Prechádzať zdrojové kódy

首件上报提示信息修改

duy 2 rokov pred
rodič
commit
3d2483d0e9
1 zmenil súbory, kde vykonal 78 pridanie a 67 odobranie
  1. 78 67
      src/views/other/first-item.vue

+ 78 - 67
src/views/other/first-item.vue

@@ -632,15 +632,82 @@ const reportTypeData = ref('')
 const reportDatas = ref([])
 const isReportModalDatas = ref(false)
 const iscanReport=ref(false)
+//上报方法封装
+const toreportModalClick = async (type) => {
+    if(type){
+            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
+                            })
+                        })
+                        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
+                }
+            } else {
+                window.$message?.warning('暂无相关数据')
+            }
+        }else{
+             window.$message?.warning('当前工序资料还未审批,待审批完成才能进行首件模板上报')
+            
+        }
+}
 const reportModalClick = async (type) => {
     if(type===2){
          console.log('上报')
-        iscanReport.value=isCanreport.value
-    }else{
-     
+        iscanReport.value=isCanreport.value;
+        toreportModalClick(iscanReport.value)
+
+    }
+    
+    else{
          const rows = deepClone(tableSelectionKeys.value)
          let result=false
-            console.log('上报',rows)
+            console.log('上报审批',rows)
         //判断自身是否满足条件
          const result1 = rows.every(({taskStatusStr})=> {
             return taskStatusStr === '未上报'||taskStatusStr === '已废除'
@@ -650,73 +717,17 @@ const reportModalClick = async (type) => {
              result = rows.every(({isApprove})=> {
                 return isApprove === true
             })
+             iscanReport.value=result
+              toreportModalClick(iscanReport.value)
+        }else{
+              window.$message?.warning('已上报的数据不能重复上报')
+               iscanReport.value=false
         }
        
-         iscanReport.value=result
-         
-    }
-    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
-                    })
-                    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
-            }
-        } else {
-            window.$message?.warning('暂无相关数据')
-        }
-    }else{
-         window.$message?.warning('当前工序资料还未审批,待审批完成才能进行首件模板上报')
+        
          
     }
-    
+   
 }
 
 //上报的审批内容移除