iZaiZaiA 2 gadi atpakaļ
vecāks
revīzija
935237745f

+ 24 - 0
src/api/modules/ledger/query.js

@@ -97,4 +97,28 @@ export default {
             params: form
         }, msg);
     },
+    //获取当前资料的任务状态
+    async checkTheLogTaskStatus(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/contractLog/checkTheLogTaskStatus',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //预览、打印
+    async theLogPreviewAndPrint(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/contractLog/theLogPreviewAndPrint',
+            method: 'post',
+            data: form
+        }, msg);
+    },
+    //废除
+    async theLogOneAbolish(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/contractLog/oneAbolish',
+            method: 'get',
+            params: form
+        }, msg);
+    },
 }

+ 62 - 5
src/views/ledger/components/table-form.vue

@@ -38,13 +38,13 @@
         </div>
         <div class="hc-footer-box">
             <HcTooltip keys="ledger_query_save_form">
-                <el-button type="primary" hc-btn :disabled="!isTableForm" :loading="tableFormSaveLoading" @click="tableFormSaveClick">
+                <el-button type="primary" hc-btn :disabled="!isTableForm || taskStatus === 3 || taskStatus === 4" :loading="tableFormSaveLoading" @click="tableFormSaveClick">
                     <HcIcon name="save"/>
                     <span>保存</span>
                 </el-button>
             </HcTooltip>
             <HcTooltip keys="ledger_query_report_form">
-                <el-button hc-btn :disabled="!isTableForm" @click="reportModalClick">
+                <el-button hc-btn :disabled="!isTableForm || taskStatus === 3 || taskStatus === 4" @click="reportModalClick">
                     <HcIcon name="send-plane-2"/>
                     <span>上报</span>
                 </el-button>
@@ -56,23 +56,27 @@
                 </el-button>
             </HcTooltip>
             <HcTooltip keys="ledger_query_copy_form">
-                <el-button hc-btn :disabled="!isTableForm" @click="copyTableFormClick">
+                <el-button hc-btn :disabled="!isTableForm || taskStatus === 3 || taskStatus === 4" @click="copyTableFormClick">
                     <HcIcon name="file-copy-2"/>
                     <span>复制当前表格及内容</span>
                 </el-button>
             </HcTooltip>
             <HcTooltip keys="ledger_query_time_form">
-                <el-button hc-btn :disabled="!isTableForm" @click="copyTimeLogModal">
+                <el-button hc-btn :disabled="!isTableForm || taskStatus === 3 || taskStatus === 4" @click="copyTimeLogModal">
                     <HcIcon name="file-copy-2"/>
                     <span>复制任意时间</span>
                 </el-button>
             </HcTooltip>
             <HcTooltip keys="ledger_query_add_form">
-                <el-button hc-btn :disabled="!isTableForm" @click="addTableFormClick">
+                <el-button hc-btn :disabled="!isTableForm || taskStatus === 3 || taskStatus === 4" @click="addTableFormClick">
                     <HcIcon name="add-circle"/>
                     <span>新增表格</span>
                 </el-button>
             </HcTooltip>
+            <el-button hc-btn :disabled="!isTableForm || taskStatus === 1 || taskStatus === 2" @click="abolishTableFormClick">
+                <HcIcon name="delete-bin-3"/>
+                <span>废除</span>
+            </el-button>
         </div>
 
         <!--关联工序-->
@@ -157,6 +161,7 @@ const dateCalendarChoice = ({date, choices}) => {
     getExcelHtml(excelIdVal.value)
     getTheLogBusinessData(excelIdVal.value, choices)
     getSubmitLogDateList(date,primaryKeyId)
+    checkTheLogTaskStatus(choices,primaryKeyId)
 }
 
 //获取模板标签数据
@@ -268,6 +273,30 @@ const getSubmitLogDateList = async ({year},pid) => {
     }
 }
 
+//获取当前资料的任务状态
+const taskStatus = ref(1)
+const checkTheLogTaskStatus = async (choices,primaryKeyId) => {
+    if (primaryKeyId > 0) {
+        const { error, code, data } = await queryApi.checkTheLogTaskStatus({
+            projectId: projectId.value,
+            contractId: contractId.value,
+            nodePrimaryKeyId: primaryKeyId,
+            recordTime: choices
+        }, false)
+        //处理数据
+        const res = isString(data) ? data || '' : ''
+        if (!error && code === 200 && res) {
+            //1和2的时候所有按钮皆可操作,废除 除外
+            //3和4时, 除了预览和废除 都不行
+            taskStatus.value = data
+        } else {
+            taskStatus.value = 1
+        }
+    } else {
+        taskStatus.value = 1
+    }
+}
+
 //关联工序
 const processNodeModal = ref(false)
 const showProcessModal = () => {
@@ -538,6 +567,34 @@ const showReportFinish = () => {
     window?.location?.reload()  //刷新页面
 }
 
+//废除
+const abolishTableFormClick = () => {
+    window?.$messageBox?.alert('是否废除已上报的文件?', '废除文件', {
+        showCancelButton: true,
+        confirmButtonText: '确定废除',
+        cancelButtonText: '取消',
+        callback: (action) => {
+            if (action === 'confirm') {
+                theLogOneAbolish()
+            }
+        }
+    })
+}
+//确认废除
+const theLogOneAbolish = async () => {
+    const {primaryKeyId} = menuItem.value
+    const { error, code } = await queryApi.theLogOneAbolish({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        nodePrimaryKeyId: primaryKeyId,
+        recordTime: recordTime.value
+    })
+    //处理数据
+    if (!error && code === 200) {
+        window.$message?.success('废除成功')
+        window?.location?.reload()  //刷新页面
+    }
+}
 </script>
 
 <style lang="scss" scoped>

+ 21 - 2
src/views/ledger/components/table-list.vue

@@ -31,7 +31,7 @@
                     </el-button>
                 </HcTooltip>
                 <HcTooltip keys="ledger_query_print">
-                    <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
+                    <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="previewPrintLoading" @click="previewAndPrintClick">
                         <HcIcon name="printer"/>
                         <span>预览/打印</span>
                     </el-button>
@@ -52,7 +52,7 @@
 <script setup>
 import {ref, watch, nextTick} from "vue";
 import queryApi from '~api/ledger/query';
-import {getArrValue,getObjValue} from "vue-utils-plus"
+import {getArrValue, getObjValue, isString} from "vue-utils-plus"
 
 //参数
 const props = defineProps({
@@ -238,6 +238,25 @@ const batchAbolishSave = async (ids) => {
     }
 }
 
+//预览、打印
+const previewPrintLoading = ref(false)
+const previewAndPrintClick = async () => {
+    previewPrintLoading.value = true
+    const rows = tableCheckedKeys.value;
+    const rowsIds = rowsToId(rows)
+    const ids = rowsIds.split(',')
+    const { error, code, data } = await queryApi.theLogPreviewAndPrint({
+        ids: ids
+    })
+    //处理数据
+    previewPrintLoading.value = false
+    const res = isString(data) ? data || '' : ''
+    if (!error && code === 200 && res) {
+        window.open(res,'_blank')
+    }
+}
+
+
 //拼接ID
 const rowsToId = (rows) => {
     return rows.map((obj) => {