From 2fc928c582961b78e215b145a4edf98d3cdca2f4 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期一, 06 五月 2024 21:00:46 +0800
Subject: [PATCH] 工艺路线更新

---
 src/api/tigerapi/model/router.ts                                     |    1 
 src/api/tigerapi/mes/router.ts                                       |   27 ++++++
 src/views/tigerprojects/mes/eng/route/components/FormItemProps.vue   |    5 +
 src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue |   71 +++++++++++++++--
 src/views/tigerprojects/mes/eng/route/index.vue                      |  130 +++++++++++++++++++++----------
 5 files changed, 179 insertions(+), 55 deletions(-)

diff --git a/src/api/tigerapi/mes/router.ts b/src/api/tigerapi/mes/router.ts
index af197ed..b815637 100644
--- a/src/api/tigerapi/mes/router.ts
+++ b/src/api/tigerapi/mes/router.ts
@@ -116,3 +116,30 @@
       isTransformResponse: false,
     },
   );
+
+/*
+ *琛屼负鐩稿叧
+ */
+export const ActTypeStatus = async () => {
+  const usParams = genAction('MES_ROUTE_NODE_ACT+ACT_TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      //apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
+
+export const DoTypeStatus = async () => {
+  const usParams = genAction('MES_ROUTE_NODE_ACT+DO_TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      //apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
diff --git a/src/api/tigerapi/model/router.ts b/src/api/tigerapi/model/router.ts
index fd41598..b93a9d5 100644
--- a/src/api/tigerapi/model/router.ts
+++ b/src/api/tigerapi/model/router.ts
@@ -105,6 +105,7 @@
   DO_METHOD: string;
   DO_IF_PASS: string;
   DO_IF_FAIL: string;
+  IS_ACTIVE: string;
   // RULE_CODE: string;
   // ITEM_CODE: string;
   // PROD_CODE: string;
diff --git a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
index 0fa8b4a..1a4642d 100644
--- a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
+++ b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
@@ -7,32 +7,61 @@
       <FormItem label="宸ヨ壓璺嚎缂栫爜" name="宸ヨ壓璺嚎缂栫爜">
         <Input
           :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentItem.ROT_CODE"
+          v-model:value="mesRoute.ROT_CODE"
           :min="0"
           :step="1"
           :readonly="true"
         />
       </FormItem>
-      <FormItem label="鑺傜偣缂栫爜" name="鑺傜偣缂栫爜">
+      <FormItem label="鑺傜偣ID" name="鑺傜偣ID">
         <Input
           :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentItem.NODE_CODE"
+          v-model:value="routeConfig.currentAct.NODE_ID"
+          :min="0"
+          :step="1"
+          :readonly="true"
+        />
+      </FormItem>
+      <FormItem label="琛屼负绫诲瀷" name="琛屼负绫诲瀷">
+        <ApiSelect
+          :api="ActTypeStatus"
+          v-model:value="routeConfig.currentAct.ACT_TYPE"
+          resultField="Data"
+          :label-field="actTypeLable"
+          valueField="Value"
+          placeholder="璇烽�夋嫨琛屼负绫诲瀷"
+        />
+      </FormItem>
+      <FormItem label="鑷畾涔夋柟娉曠被鍨�" name="鑷畾涔夋柟娉曠被鍨�">
+        <ApiSelect
+          :api="DoTypeStatus"
+          v-model:value="routeConfig.currentAct.DO_TYPE"
+          resultField="Data"
+          :label-field="actTypeLable"
+          valueField="Value"
+          placeholder="璇烽�夋嫨琛屼负绫诲瀷"
+        />
+      </FormItem>
+      <FormItem label="鑷畾涔夋柟娉�(璋冪敤鏂规硶鐨勫叏鍚�)" name="鑷畾涔夋柟娉�">
+        <Input
+          :style="{ width: '100%' }"
+          v-model:value="routeConfig.currentAct.DO_METHOD"
           :min="0"
           :step="1"
         />
       </FormItem>
-      <FormItem label="鑺傜偣鍚嶇О" name="鑺傜偣鍚嶇О">
+      <FormItem label="閫氳繃鏃舵墽琛�(璋冪敤鏂规硶鐨勫叏鍚�)" name="閫氳繃鏃舵墽琛�">
         <Input
           :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentItem.NODE_NAME"
+          v-model:value="routeConfig.currentAct.DO_IF_PASS"
           :min="0"
           :step="1"
         />
       </FormItem>
-      <FormItem label="宸ュ簭缂栫爜" name="宸ュ簭缂栫爜">
+      <FormItem label="澶辫触鏃舵墽琛�(璋冪敤鏂规硶鐨勫叏鍚�)" name="澶辫触鏃舵墽琛�">
         <Input
           :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentItem.OPER_CODE"
+          v-model:value="routeConfig.currentAct.DO_IF_FAIL"
           :min="0"
           :step="1"
         />
@@ -40,10 +69,9 @@
       <FormItem label="鏄惁鍚敤" name="鏄惁鍚敤">
         <Select
           ref="select"
-          v-model:value="routeConfig.currentItem.IS_ACTIVE"
+          v-model:value="routeConfig.currentAct.IS_ACTIVE"
           style="width: 120px"
           :options="options1"
-          :readonly="true"
         />
       </FormItem>
     </Form>
@@ -53,9 +81,13 @@
   import { Select, Input, Form, FormItem } from 'ant-design-vue';
   import { useRouteDesignState } from '../hooks/useRouteDesignState';
   import { SelectTypes } from 'ant-design-vue/es/select';
-  import { ref } from 'vue';
+  import { ApiSelect } from '/@/components/Form/index';
+  import { ref, unref, watch } from 'vue';
+  import { useLocale } from '/@/locales/useLocale';
+  import { ActTypeStatus, DoTypeStatus } from '/@/api/tigerapi/mes/router';
 
-  const { routeConfig } = useRouteDesignState();
+  const { getLocale } = useLocale();
+  const { routeConfig, mesRoute } = useRouteDesignState();
   const options1 = ref<SelectTypes['options']>([
     {
       value: 'Y',
@@ -66,4 +98,21 @@
       label: '涓嶅惎鐢�',
     },
   ]);
+  const actTypeLable = unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name';
+  watch(
+    () => routeConfig.currentAct,
+    (newVal, oldVal) => {
+      routeConfig.routeData.acts.forEach((r) => {
+        if (r.ID == routeConfig.currentAct.ID) {
+          r.IS_ACTIVE = newVal.IS_ACTIVE;
+          r.ACT_TYPE = newVal.ACT_TYPE;
+          r.DO_TYPE = newVal.DO_TYPE;
+          r.DO_METHOD = newVal.DO_METHOD;
+          r.DO_IF_PASS = newVal.DO_IF_PASS;
+          r.DO_IF_FAIL = newVal.DO_IF_FAIL;
+        }
+      });
+    },
+    { deep: true, immediate: true },
+  );
 </script>
diff --git a/src/views/tigerprojects/mes/eng/route/components/FormItemProps.vue b/src/views/tigerprojects/mes/eng/route/components/FormItemProps.vue
index 7bc5eb0..7fa2445 100644
--- a/src/views/tigerprojects/mes/eng/route/components/FormItemProps.vue
+++ b/src/views/tigerprojects/mes/eng/route/components/FormItemProps.vue
@@ -22,7 +22,7 @@
           :readonly="true"
         />
       </FormItem>
-      <FormItem label="宸ユ" name="鑺傜偣鍚嶇О">
+      <FormItem label="宸ユ" name="宸ユ">
         <Input
           :style="{ width: '100%' }"
           v-model:value="routeConfig.currentItem.SEGMENT"
@@ -87,6 +87,7 @@
       () => routeConfig.canSkip,
       () => routeConfig.isInput,
       () => routeConfig.isOutput,
+      () => routeConfig.currentItem,
     ],
     (newVal, oldVal) => {
       routeConfig.routeData.nodes.forEach((r) => {
@@ -103,6 +104,8 @@
           if (oldVal[3] != newVal[3] && !isNullOrUnDef(oldVal[3])) {
             r.IS_OUTPUT = newVal[3] ? 'Y' : 'N';
           }
+          r.IS_ACTIVE = newVal[4].IS_ACTIVE;
+          r.SEGMENT = newVal[4].SEGMENT;
         }
       });
     },
diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue
index ae4e723..f0c3508 100644
--- a/src/views/tigerprojects/mes/eng/route/index.vue
+++ b/src/views/tigerprojects/mes/eng/route/index.vue
@@ -152,50 +152,58 @@
     const diffnodes = routeConfig.routeData.nodes.filter((itemA) =>
       _nodes.some((itemB) => itemB.id === itemA.ID),
     );
-    routeConfig.routeData.acts = [];
+    const diffacts = routeConfig.routeData.acts.filter((itemA) =>
+      _nodes.some((itemB) => itemB.id === itemA.ID),
+    );
     _nodes.forEach((n) => {
       if (n.properties.operType && n.properties.operType == 'Action') {
-        var act: MES_ROUTE_NODE_ACT = {
-          ID: n.id,
-          CREATE_TIME: routeConfig.routeData.route.CREATE_TIME,
-          CREATE_USER: useUserStore().getUserInfo.userId as string,
-          UPDATE_TIME: routeConfig.routeData.route.UPDATE_TIME,
-          UPDATE_USER: useUserStore().getUserInfo.userId as string,
-          GHOST_ROW: false,
-          ROT_ID: routeConfig.routeData.route.ID,
-          GPH_TYPE: n.type,
-          GPH_X: n.x,
-          GPH_Y: n.y,
-          GPH_PROP: JSON.stringify(n.properties),
-          GPH_TEXT: n.text.value,
-          REMARK: '',
-          AUTH_ORG: '',
-          AUTH_PROD: '',
-          AUTH_WH: '',
-          OPTION_1: '',
-          OPTION_2: '',
-          OPTION_3: '',
-          OPTION_4: '',
-          OPTION_5: '',
-          ACT_NAME: `${routeConfig.routeData.route.ROT_CODE}_${n.text.value}_${_num}`,
-          NODE_ID: '',
-          ACT_TYPE: 0,
-          DO_TYPE: 0,
-          DO_METHOD: '',
-          DO_IF_PASS: '',
-          DO_IF_FAIL: '',
-          node: {} as node,
-        };
-        var pnode = [n];
-        while (pnode[0].properties.operType == 'Action') {
-          pnode = unref(lf).getNodeIncomingNode(pnode[0].id);
-          if (pnode[0].properties.operType != 'Action') {
-            act.NODE_ID = pnode[0].id;
-            break;
+        var _diffacts = diffacts.length > 0 ? diffacts : routeConfig.routeData.acts;
+        _diffacts.forEach((a) => {
+          if (a.ID == n.id) {
+            var act: MES_ROUTE_NODE_ACT = {
+              ID: n.id,
+              CREATE_TIME: routeConfig.routeData.route.CREATE_TIME,
+              CREATE_USER: useUserStore().getUserInfo.userId as string,
+              UPDATE_TIME: routeConfig.routeData.route.UPDATE_TIME,
+              UPDATE_USER: useUserStore().getUserInfo.userId as string,
+              GHOST_ROW: false,
+              ROT_ID: routeConfig.routeData.route.ID,
+              GPH_TYPE: n.type,
+              GPH_X: n.x,
+              GPH_Y: n.y,
+              GPH_PROP: JSON.stringify(n.properties),
+              GPH_TEXT: n.text.value,
+              REMARK: a.REMARK,
+              AUTH_ORG: '',
+              AUTH_PROD: '',
+              AUTH_WH: '',
+              OPTION_1: '',
+              OPTION_2: '',
+              OPTION_3: '',
+              OPTION_4: '',
+              OPTION_5: '',
+              ACT_NAME: `${routeConfig.routeData.route.ROT_CODE}_${n.text.value}_${_num}`,
+              NODE_ID: a.NODE_ID,
+              ACT_TYPE: a.ACT_TYPE,
+              DO_TYPE: a.DO_TYPE,
+              DO_METHOD: a.DO_METHOD,
+              DO_IF_PASS: a.DO_IF_PASS,
+              DO_IF_FAIL: a.DO_IF_FAIL,
+              node: {} as node,
+              IS_ACTIVE: a.IS_ACTIVE,
+            };
+            var pnode = [n];
+            while (pnode[0].properties.operType == 'Action') {
+              pnode = unref(lf).getNodeIncomingNode(pnode[0].id);
+              if (pnode[0].properties.operType != 'Action') {
+                act.NODE_ID = pnode[0].id;
+                break;
+              }
+            }
+            currRotData.acts.push(act);
           }
-        }
-        currRotData.acts.push(act);
-        routeConfig.routeData.acts.push(act);
+        });
+        routeConfig.routeData.acts = _diffacts;
       } else {
         var _diffnodes = diffnodes.length > 0 ? diffnodes : routeConfig.routeData.nodes;
         _diffnodes.forEach((nd) => {
@@ -209,8 +217,8 @@
               GHOST_ROW: false,
               NODE_NAME: `${currRotData.route.ROT_CODE}_${n.text.value}_${_num}`,
               ROT_ID: currRotData.route.ID,
-              SEGMENT: '',
-              OPER_CODE: '',
+              SEGMENT: nd.SEGMENT,
+              OPER_CODE: nd.OPER_CODE,
               GPH_TYPE: n.type,
               GPH_X: n.x,
               GPH_Y: n.y,
@@ -359,6 +367,7 @@
       //鍐嶈繑鍥炲叿浣撴暟鎹�
       routeConfig.routeData = GetRotData(lf);
     }
+
     var _node = routeConfig.routeData.nodes.filter((x) => x.ID == selectnode.value.id)[0];
     if (isNullOrUnDef(_node)) {
       _node = {
@@ -396,9 +405,44 @@
       };
       routeConfig.routeData.nodes.push(_node);
     }
+    //鏄涓�
     if (selectnode.value.properties.operType && selectnode.value.properties.operType == 'Action') {
+      var _act = routeConfig.routeData.acts.filter((x) => x.ID == selectnode.value.id)[0];
       routeConfig.activeKey = 3;
+      routeConfig.currentAct = {
+        ID: selectnode.value.id,
+        CREATE_TIME: currRoute.value.CREATE_TIME,
+        CREATE_USER: useUserStore().getUserInfo.userId as string,
+        UPDATE_TIME: currRoute.value.UPDATE_TIME,
+        UPDATE_USER: useUserStore().getUserInfo.userId as string,
+        GHOST_ROW: false,
+        AUTH_ORG: '',
+        AUTH_PROD: '',
+        AUTH_WH: '',
+        ACT_NAME: _act.ACT_NAME,
+        ROT_ID: currRoute.value.ID,
+        NODE_ID: _act.NODE_ID,
+        ACT_TYPE: _act.ACT_TYPE,
+        GPH_TYPE: selectnode.value.type,
+        GPH_X: selectnode.value.x,
+        GPH_Y: selectnode.value.y,
+        GPH_PROP: JSON.stringify(selectnode.value.properties),
+        GPH_TEXT: selectnode.value.text.value,
+        DO_TYPE: _act.DO_TYPE,
+        DO_METHOD: _act.DO_METHOD,
+        DO_IF_PASS: _act.DO_IF_PASS,
+        DO_IF_FAIL: _act.DO_IF_FAIL,
+        IS_ACTIVE: _act.IS_ACTIVE,
+        OPTION_1: '',
+        OPTION_2: '',
+        OPTION_3: '',
+        OPTION_4: '',
+        OPTION_5: '',
+        REMARK: '',
+        node: {} as node,
+      };
     } else {
+      //鏄伐搴�
       routeConfig.currentItem = {
         ID: selectnode.value.id,
         CREATE_TIME: currRoute.value.CREATE_TIME,

--
Gitblit v1.9.3