From 45a3c06adfa25476b91acdce7bb1b73c05e675c6 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 15 六月 2024 21:28:24 +0800
Subject: [PATCH] 工艺路线,工序行为更新

---
 src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue |  255 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 159 insertions(+), 96 deletions(-)

diff --git a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
index 618f998..c22111e 100644
--- a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
+++ b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
@@ -1,120 +1,183 @@
 <!--
+ * @Description: file content
+ * @Author: your name
+ * @version: 
+ * @Date: 2024-05-01 17:18:49
+ * @LastEditors: your name
+ * @LastEditTime: 2024-06-15 21:24:19
+-->
+<!--
  * @Description: 琛ㄥ崟椤瑰睘鎬э紝鎺т欢灞炴�ч潰鏉�
 -->
 <template>
   <div class="properties-content">
     <Form class="properties-body" label-align="left" layout="vertical">
       <FormItem label="宸ヨ壓璺嚎缂栫爜" name="宸ヨ壓璺嚎缂栫爜">
-        <Input
-          :style="{ width: '100%' }"
-          v-model:value="mesRoute.ROT_CODE"
-          :min="0"
-          :step="1"
-          :readonly="true"
-        />
+        <Input :style="{ width: '100%' }" v-model:value="mesRoute.ROT_CODE" :min="0" :step="1" :readonly="true" />
       </FormItem>
       <FormItem label="鑺傜偣ID" name="鑺傜偣ID">
-        <Input
-          :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentAct.NODE_ID"
-          :min="0"
-          :step="1"
-          :readonly="true"
-        />
+        <Input :style="{ width: '100%' }" v-model:value="routeConfig.currentAct.NODE_ID" :min="0" :step="1"
+          :readonly="true" />
+      </FormItem>
+      <FormItem label="琛屼负鍚嶇О" name="琛屼负鍚嶇О">
+        <Input :style="{ width: '100%' }" v-model:value="routeConfig.currentAct.ACT_NAME" :min="0" :step="1" />
       </FormItem>
       <FormItem label="琛屼负绫诲瀷" name="琛屼负绫诲瀷">
-        <ApiSelect
-          :api="GetEnum"
-          :params="{ name: 'MES_ROUTE_NODE_ACT+ACT_TYPEs' }"
-          v-model:value="routeConfig.currentAct.ACT_TYPE"
-          resultField="Data"
-          :label-field="actTypeLable"
-          valueField="Value"
-          placeholder="璇烽�夋嫨琛屼负绫诲瀷"
-        />
-      </FormItem>
-      <FormItem label="鑷畾涔夋柟娉曠被鍨�" name="鑷畾涔夋柟娉曠被鍨�">
-        <ApiSelect
-          :api="GetEnum"
-          :params="{ name: 'MES_ROUTE_NODE_ACT+DO_TYPEs' }"
-          v-model:value="routeConfig.currentAct.DO_TYPE"
-          resultField="Data"
-          :label-field="actTypeLable"
-          valueField="Value"
-          placeholder="璇烽�夋嫨琛屼负绫诲瀷"
-        />
+        <ApiSelect :api="GetEnum" :params="{ name: 'MES_ROUTE_NODE_ACT+ACT_TYPEs' }"
+          v-model:value="routeConfig.currentAct.ACT_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"
-        />
+        <Input :style="{ width: '85%' }" v-model:value="routeConfig.currentAct.ACT_CODE" :min="0" :step="1" />
+        <a-button class="mt-1 ml-1" size="small" @click="handleSelectItem(item)" preIcon="search|svg" />
+        <NormalModal @register="registerItemAdd" @success="handleItemSuccess" />
       </FormItem>
-      <FormItem label="閫氳繃鏃舵墽琛�(璋冪敤鏂规硶鐨勫叏鍚�)" name="閫氳繃鏃舵墽琛�">
-        <Input
-          :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentAct.DO_IF_PASS"
-          :min="0"
-          :step="1"
-        />
-      </FormItem>
-      <FormItem label="澶辫触鏃舵墽琛�(璋冪敤鏂规硶鐨勫叏鍚�)" name="澶辫触鏃舵墽琛�">
-        <Input
-          :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentAct.DO_IF_FAIL"
-          :min="0"
-          :step="1"
-        />
+      <FormItem label="鏄惁璁剧疆鎵嶈兘涓嬪彂鐢熶骇(Y/N)" name="鏄惁璁剧疆鎵嶈兘涓嬪彂鐢熶骇(Y/N)">
+        <Select ref="select" v-model:value="routeConfig.currentAct.NEED_SETUP" style="width: 150px"
+          :options="needSetupOptions" />
       </FormItem>
       <FormItem label="鏄惁鍚敤" name="鏄惁鍚敤">
-        <Select
-          ref="select"
-          v-model:value="routeConfig.currentAct.IS_ACTIVE"
-          style="width: 120px"
-          :options="options1"
-        />
+        <Select ref="select" v-model:value="routeConfig.currentAct.IS_ACTIVE" style="width: 150px"
+          :options="options1" />
       </FormItem>
     </Form>
   </div>
 </template>
 <script lang="ts" setup>
-  import { Select, Input, Form, FormItem } from 'ant-design-vue';
-  import { useRouteDesignState } from '../hooks/useRouteDesignState';
-  import { SelectTypes } from 'ant-design-vue/es/select';
-  import { ApiSelect } from '/@/components/Form/index';
-  import { ref, unref, watch } from 'vue';
-  import { useLocale } from '/@/locales/useLocale';
-  import { GetEnum } from '/@/api/tigerapi/system';
+import { Select, Input, Form, FormItem, Tag } from 'ant-design-vue';
+import { useRouteDesignState } from '../hooks/useRouteDesignState';
+import NormalModal from '/@/views/components/NormalModal.vue';
+import { SelectTypes } from 'ant-design-vue/es/select';
+import { ApiSelect } from '/@/components/Form/index';
+import { h, ref, unref, watch } from 'vue';
+import { useLocale } from '/@/locales/useLocale';
+import { GetEnum } from '/@/api/tigerapi/system';
+import { useModal } from '/@/components/Modal';
+import { useI18n } from '/@/hooks/web/useI18n';
 
-  const { getLocale } = useLocale();
-  const { routeConfig, mesRoute } = useRouteDesignState();
-  const options1 = ref<SelectTypes['options']>([
-    {
-      value: 'Y',
-      label: '鍚敤',
-    },
-    {
-      value: 'N',
-      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;
+const { getLocale } = useLocale();
+const { t } = useI18n();
+const emit = defineEmits(['changeName']);
+const [registerItemAdd, { openModal: openItemModal }] = useModal();
+const { routeConfig, mesRoute } = useRouteDesignState();
+const options1 = ref<SelectTypes['options']>([
+  {
+    value: 'Y',
+    label: '鍚敤',
+  },
+  {
+    value: 'N',
+    label: '涓嶅惎鐢�',
+  },
+]);
+const needSetupOptions = ref<SelectTypes['options']>([
+  {
+    value: 'Y',
+    label: '蹇呴渶璁剧疆鍙笅鍙�',
+  },
+  {
+    value: 'N',
+    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) {
+        if (r.ACT_NAME != newVal.ACT_NAME) {
+          r.ACT_NAME = newVal.ACT_NAME;
+          console.log(r.ACT_NAME, newVal.ACT_NAME);
+          emit('changeName', { id: r.ID, val: r.ACT_NAME });
         }
-      });
-    },
-    { deep: true, immediate: true },
-  );
+        r.IS_ACTIVE = newVal.IS_ACTIVE;
+        r.ACT_TYPE = newVal.ACT_TYPE;
+        r.ACT_CODE = newVal.ACT_CODE;
+        r.NEED_SETUP = newVal.NEED_SETUP;
+        // 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 },
+);
+
+function handleSelectItem(item) {
+  openItemModal(true, {
+    title: '宸ュ簭琛屼负瀹氫箟',
+    schemas: [
+      {
+        field: 'ACT_CODE',
+        component: 'Input',
+        label: '琛屼负缂栫爜',
+        colProps: {
+          span: 12,
+        },
+      },
+    ],
+    ItemColumns: [
+      {
+        title: t('琛屼负缂栫爜'),
+        dataIndex: 'ACT_CODE',
+        resizable: true,
+        sorter: true,
+        width: 100,
+      },
+      {
+        title: t('琛屼负鍚嶇О'),
+        dataIndex: 'ACT_NAME',
+        resizable: true,
+        sorter: true,
+        width: 100,
+      },
+      {
+        title: t('琛屼负绫诲瀷'),
+        dataIndex: 'ACT_TYPE',
+        resizable: true,
+        sorter: true,
+        width: 100,
+        customRender: ({ record }) => {
+          const type = record.ACT_TYPE;
+          var text = '';
+          var color = 'green';
+          switch (type) {
+            case 0:
+              text = '榛樿琛屼负';
+              break;
+            case 1:
+              color = 'blue';
+              text = '鎵爜楠岃瘉';
+              break;
+            case 2:
+              color = 'orange';
+              text = '缁勮涓婃枡';
+              break;
+            case 3:
+              color = '#707070';
+              text = '浜у搧娴嬭瘯';
+              break;
+            case 4:
+              color = '#5927be';
+              text = '浜у搧鎶芥';
+              break;
+            case 5:
+              color = '#27beae';
+              text = '鏍囩鎵撳嵃';
+              break;
+          }
+          return h(Tag, { color: color }, () => text);
+        },
+      },
+    ],
+    tableName: 'MES_CUSTOM_ACT',
+    rowKey: 'ACT_CODE',
+  });
+}
+
+function handleItemSuccess(d, u) {
+  routeConfig.currentAct.ACT_CODE = d.values['val']
+}
 </script>

--
Gitblit v1.9.3