Bladeren bron

首件上报重复限制

duy 2 jaren geleden
bovenliggende
commit
4b7694da56
1 gewijzigde bestanden met toevoegingen van 71 en 58 verwijderingen
  1. 71 58
      src/views/other/first-item.vue

+ 71 - 58
src/views/other/first-item.vue

@@ -404,23 +404,29 @@ const tableRowName = (row) => {
 
 //上报首件
 const isFirstReportDrawer = ref(false)
+const isCanreport=ref(false)
 const firstReportClick = () => {
     const rows = deepClone(tableSelectionKeys.value)
     //判断是否满足条件
     const result = rows.every(({status})=> {
-        // return status === 2
-        return status === 0 || status === 3
+        return status === 2
+        // return status === 0 || status === 3
     })
+    isCanreport.value=result
     //判断状态
-    if (result) {
+    // if (result) {
+    //     isFirstReportDrawer.value = true
+    //     queryNodeStatus()
+    //     tableFileData.value = rows
+    //     getFirstExcelHtml()
+    // } else {
+    //     tableFileData.value = []
+    //     window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
+    // }
         isFirstReportDrawer.value = true
         queryNodeStatus()
         tableFileData.value = rows
         getFirstExcelHtml()
-    } else {
-        tableFileData.value = []
-        window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
-    }
 }
 const FirstReportDrawerClose = () => {
     isFirstReportDrawer.value = false
@@ -617,62 +623,69 @@ const reportTypeData = ref('')
 const reportDatas = ref([])
 const isReportModalDatas = ref(false)
 const reportModalClick = async () => {
-    const { primaryKeyId, contractIdRelation } = treeItem.value
-    let rows = [];
-    //处理获取流程的条件
-    if (tabTypeKey.value === 'mark') {
-        reportTypeData.value = tableFormId.value
-        isReportModalDatas.value = false
-        rows = tableFileData.value
-    } else {
-        isReportModalDatas.value = true
-        rows = tableSelectionKeys.value
-    }
-    if (rows.length > 0) {
-        reportLoading.value = true
-        const taskCheck = await eVisaTaskCheckApi({
-            projectId: projectId.value,
-            contractId: contractId.value
-        })
-        if (taskCheck) {
-            if (tabTypeKey.value === 'mark') {
-                reportIds.value = tableFormId.value
-                const { data } = await firstApi.queryFirstDocumentTitle({
-                    projectId: projectId.value,
-                    contractId: contractId.value,
-                    queryId: tableFormId.value
-                })
-                reportTaskName.value = isString(data) ? data ?? '' : ''
-            } else {
-                reportIds.value = rowsToId(rows)
-                //设置任务数据
-                let reportDataArr = []
-                rows.forEach(item => {
-                    reportDataArr.push({
-                        id: item?.id,
-                        name: item?.name
+    console.log(isCanreport.value,'是否可以上报');
+    if(isCanreport.value){
+        const { primaryKeyId, contractIdRelation } = treeItem.value
+        let rows = [];
+        //处理获取流程的条件
+        if (tabTypeKey.value === 'mark') {
+            reportTypeData.value = tableFormId.value
+            isReportModalDatas.value = false
+            rows = tableFileData.value
+        } else {
+            isReportModalDatas.value = true
+            rows = tableSelectionKeys.value
+        }
+        if (rows.length > 0) {
+            reportLoading.value = true
+            const taskCheck = await eVisaTaskCheckApi({
+                projectId: projectId.value,
+                contractId: contractId.value
+            })
+            if (taskCheck) {
+                if (tabTypeKey.value === 'mark') {
+                    reportIds.value = tableFormId.value
+                    const { data } = await firstApi.queryFirstDocumentTitle({
+                        projectId: projectId.value,
+                        contractId: contractId.value,
+                        queryId: tableFormId.value
                     })
-                })
-                reportDatas.value = reportDataArr
-                //其他数据
-                reportTypeData.value = rows[0]['id']
-                reportTaskName.value = rows.length > 1?`${rows[0].name}等${rows.length}个文件`:rows[0].name
-            }
-            reportLoading.value = false
-            //附加数据
-            reportAddition.value = {
-                classify: 1,
-                isFirst: 1,
-                primaryKeyId: primaryKeyId,
-                contractIdRelation: contractIdRelation ?? contractId.value,
+                    reportTaskName.value = isString(data) ? data ?? '' : ''
+                } else {
+                    reportIds.value = rowsToId(rows)
+                    //设置任务数据
+                    let reportDataArr = []
+                    rows.forEach(item => {
+                        reportDataArr.push({
+                            id: item?.id,
+                            name: item?.name
+                        })
+                    })
+                    reportDatas.value = reportDataArr
+                    //其他数据
+                    reportTypeData.value = rows[0]['id']
+                    reportTaskName.value = rows.length > 1?`${rows[0].name}等${rows.length}个文件`:rows[0].name
+                }
+                reportLoading.value = false
+                //附加数据
+                reportAddition.value = {
+                    classify: 1,
+                    isFirst: 1,
+                    primaryKeyId: primaryKeyId,
+                    contractIdRelation: contractIdRelation ?? contractId.value,
+                }
+                showReportModal.value = true
+            } else {
+                reportLoading.value = false
             }
-            showReportModal.value = true
         } else {
-            reportLoading.value = false
+            window.$message?.warning('暂无相关数据')
         }
-    } else {
-        window.$message?.warning('暂无相关数据')
+    }else{
+         window.$message?.warning('当前工序资料还未审批,待审批完成才能进行首件模板上报')
+         
     }
+    
 }
 
 //上报的审批内容移除