刘洋 1 年之前
父节点
当前提交
0e1093b296
共有 2 个文件被更改,包括 43 次插入5 次删除
  1. 41 4
      src/views/sop/sop-manage/sop-step/index.vue
  2. 2 1
      src/views/user/org-struct-manage/struct-manage/index.vue

+ 41 - 4
src/views/sop/sop-manage/sop-step/index.vue

@@ -387,6 +387,18 @@ const initFill = async () => {
     });
   });
   if (res.currFlowTaskResult) {
+    res.currFlowTaskResult.formProperty =
+      res.currFlowTaskResult.formProperty.map((item) => {
+        //设备出库时间和设备入库时间,赋予默认值为当前时间
+        if (
+          ['device_out_time_4', 'device_in_time_10'].includes(item.formName) &&
+          !item.value
+        ) {
+          let now = Date.now();
+          item.value = JSON.stringify({ value: now });
+        }
+        return item;
+      });
     currFlowTaskResultSetup.value = res.currFlowTaskResult.setup;
     allSteps.value = [...res.flowTaskHistoryList, res.currFlowTaskResult];
 
@@ -394,6 +406,7 @@ const initFill = async () => {
     const stepData = allSteps.value.find(
       (item) => item.taskKey === curStep.value
     );
+
     curStepData.value = stepData;
   } else {
     allSteps.value = [...res.flowTaskHistoryList];
@@ -417,9 +430,26 @@ const initEdit = async () => {
   crmInfo.value = res.crmInfo || {};
   updateSopInfo(crmInfo.value);
   sopEditDetail.value = res;
-  allSteps.value = Object.values(res.setupMap).sort(
-    (a, b) => a.setup - b.setup
-  );
+  allSteps.value = Object.values(res.setupMap)
+    .sort((a, b) => a.setup - b.setup)
+    //2023-11-20新增需求,编辑时,第一步里,除了那3个选人的地方,其余全部改为可写状态
+    .map((item) => {
+      if (item.setup == 1) {
+        item.formProperty = item.formProperty.map((v) => {
+          if (
+            ![
+              'region_user_id_1',
+              'engineer_user_id_1',
+              'assistant_engineer_user_id_1',
+            ].includes(v.formName)
+          ) {
+            v.writable = true;
+          }
+          return v;
+        });
+      }
+      return item;
+    });
   flowApproveHistoryList.value = getFlowApproveHistoryList(
     res.flowApproveHistoryList
   );
@@ -450,9 +480,16 @@ const init = () => {
 };
 init();
 
+const maxStep = computed(() => {
+  return Math.max(...allSteps.value.map((item) => item.setup));
+});
+
 const showAction = computed(() => {
   if (
-    (IS_EDIT_MODE.value && curStepData.value.setup !== 1) ||
+    // (IS_EDIT_MODE.value && curStepData.value.setup !== 1) ||
+    (IS_EDIT_MODE.value &&
+      (curStepData.value.setup == 1 ||
+        curStepData.value.setup == maxStep.value)) ||
     IS_NEW_MODE.value
   )
     return true;

+ 2 - 1
src/views/user/org-struct-manage/struct-manage/index.vue

@@ -12,7 +12,7 @@
         ref="tableRef"
         v-model:expandedTreeNodes="expandedTreeNodes"
         row-key="id"
-        :data="orgData"
+        :data="tableData"
         :columns="columns"
         :tree="treeConfig"
         :tree-expand-and-fold-icon="treeIcon"
@@ -189,6 +189,7 @@ const handleAdd = (row = null) => {
   showAddNodeDialog.value = true;
 };
 const handleEdit = (row) => {
+  console.log('rrr', row);
   curRow.value = row;
   showAddNodeDialog.value = true;
 };