duy 2 тижнів тому
батько
коміт
aa7c7be00f
1 змінених файлів з 20 додано та 78 видалено
  1. 20 78
      src/views/tasks/components/hc-data/task-review.vue

+ 20 - 78
src/views/tasks/components/hc-data/task-review.vue

@@ -1035,89 +1035,31 @@ const getTableDetail = async () => {
     isLoading.value = false;
     confirmLoading.value = false;
 };
-const setDefaultOpinion = () => {
-    if (isNullES(meterApproveOpinion1.value.chiefSupervisor)) {
-        meterApproveOpinion2.value.chiefSupervisor =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.chiefSupervisorDefault = true;
-    } else {
-        meterApproveOpinion1.value.chiefSupervisorDefault = false;
-    }
-    if (isNullES(meterApproveOpinion1.value.supervisorAudit)) {
-        meterApproveOpinion2.value.supervisorAudit =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.supervisorAuditDefault = true;
-    } else {
-        meterApproveOpinion1.value.supervisorAuditDefault = false;
-    }
-    if (isNullES(meterApproveOpinion1.value.projectBuild)) {
-        meterApproveOpinion2.value.projectBuild =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.projectBuildDefault = true;
-    } else {
-        meterApproveOpinion1.value.projectBuildDefault = false;
-    }
-    if (isNullES(meterApproveOpinion1.value.projectBuild)) {
-        meterApproveOpinion2.value.projectBuild =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.projectBuildDefault = true;
-    } else {
-        meterApproveOpinion1.value.projectBuildDefault = false;
-    }
-
-    if (isNullES(meterApproveOpinion1.value.projectBuildLeader)) {
-        meterApproveOpinion2.value.projectBuildLeader =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.projectBuildLeaderDefault = true;
-    } else {
-        meterApproveOpinion1.value.projectBuildLeaderDefault = false;
-    }
-
-    if (isNullES(meterApproveOpinion1.value.safetyManager)) {
-        meterApproveOpinion2.value.safetyManager =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.safetyManagerDefault = true;
+const setDefaultValue = (field, defaultOpinion) => {
+    if (isNullES(meterApproveOpinion1.value[field])) {
+        meterApproveOpinion2.value[field] = defaultOpinion;
+        meterApproveOpinion1.value[`${field}Default`] = true;
     } else {
-        meterApproveOpinion1.value.safetyManagerDefault = false;
+        meterApproveOpinion1.value[`${field}Default`] = false;
     }
+};
 
-    if (isNullES(meterApproveOpinion1.value.safetyManagerLeader)) {
-        meterApproveOpinion2.value.safetyManagerLeader =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.safetyManagerLeaderDefault = true;
-    } else {
-        meterApproveOpinion1.value.safetyManagerLeaderDefault = false;
-    }
-    if (isNullES(meterApproveOpinion1.value.contractDept)) {
-        meterApproveOpinion2.value.contractDept =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.contractDeptDefault = true;
-    } else {
-        meterApproveOpinion1.value.contractDeptDefault = false;
-    }
-    if (isNullES(meterApproveOpinion1.value.contractDeptLeader)) {
-        meterApproveOpinion2.value.contractDeptLeader =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.contractDeptLeaderDefault = true;
-    } else {
-        meterApproveOpinion1.value.contractDeptLeaderDefault = false;
-    }
-    if (isNullES(meterApproveOpinion1.value.generalManager)) {
-        meterApproveOpinion2.value.generalManager =
-            "拟同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.generalManagerDefault = true;
-    } else {
-        meterApproveOpinion1.value.generalManagerDefault = false;
-    }
+const setDefaultOpinion = () => {
+    const defaultOpinion = "拟同意(不填写默认为拟同意)";
+    setDefaultValue("chiefSupervisor", defaultOpinion);
+    setDefaultValue("supervisorAudit", defaultOpinion);
+    setDefaultValue("projectBuild", defaultOpinion);
+    setDefaultValue("projectBuildLeader", defaultOpinion);
+    setDefaultValue("safetyManager", defaultOpinion);
+    setDefaultValue("safetyManagerLeader", defaultOpinion);
+    setDefaultValue("contractDept", defaultOpinion);
+    setDefaultValue("contractDeptLeader", defaultOpinion);
+    setDefaultValue("generalManager", defaultOpinion);
 
-    if (isNullES(meterApproveOpinion1.value.chiefExecutive)) {
-        meterApproveOpinion2.value.chiefExecutive =
-            "同意(不填写默认为拟同意)";
-        meterApproveOpinion1.value.chiefExecutiveDefault = true;
-    } else {
-        meterApproveOpinion1.value.chiefExecutiveDefault = false;
-    }
+    // 注意:这里修改为了与其他默认意见一致
+    setDefaultValue("chiefExecutive", "同意(不填写默认为同意)");
 };
+
 //流程信息,1待审批,2已审批
 const flowList = ref([]);
 //type为1流程审批,type为2是平行审批