From a82003f4cf9ae6b69f70212374b3a71090f1770f Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 27 七月 2024 13:24:37 +0800
Subject: [PATCH] 打印模板更新为高级页面

---
 src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue |  210 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 192 insertions(+), 18 deletions(-)

diff --git a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
index 0fa8b4a..7f6c6f1 100644
--- a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
+++ b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue
@@ -1,4 +1,12 @@
 <!--
+ * @Description: file content
+ * @Author: your name
+ * @version: 
+ * @Date: 2024-05-01 17:18:49
+ * @LastEditors: Ben Lin
+ * @LastEditTime: 2024-07-19 15:58:20
+-->
+<!--
  * @Description: 琛ㄥ崟椤瑰睘鎬э紝鎺т欢灞炴�ч潰鏉�
 -->
 <template>
@@ -7,55 +15,99 @@
       <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="琛屼负鍚嶇О">
+        <Input
+          :style="{ width: '100%' }"
+          v-model:value="routeConfig.currentAct.ACT_NAME"
           :min="0"
           :step="1"
         />
       </FormItem>
-      <FormItem label="鑺傜偣鍚嶇О" name="鑺傜偣鍚嶇О">
+      <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="琛屼负瀹氫箟">
         <Input
-          :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentItem.NODE_NAME"
+          :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"
+        />
+        <GeneralModal @register="registerItemAdd" @success="handleItemSuccess" />
       </FormItem>
-      <FormItem label="宸ュ簭缂栫爜" name="宸ュ簭缂栫爜">
-        <Input
-          :style="{ width: '100%' }"
-          v-model:value="routeConfig.currentItem.OPER_CODE"
-          :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="鎵ц鍑洪敊鏃讹紝鏄惁閲嶇疆鏁翠釜宸ュ簭鐨勬搷浣�(Y/N)" name="鎵ц鍑洪敊鏃讹紝鏄惁閲嶇疆鏁翠釜宸ュ簭鐨勬搷浣�(Y/N)">
+        <Select
+          ref="select"
+          v-model:value="routeConfig.currentAct.NEED_RESET"
+          style="width: 150px"
+          :options="needResetOptions"
         />
       </FormItem>
       <FormItem label="鏄惁鍚敤" name="鏄惁鍚敤">
         <Select
           ref="select"
-          v-model:value="routeConfig.currentItem.IS_ACTIVE"
-          style="width: 120px"
+          v-model:value="routeConfig.currentAct.IS_ACTIVE"
+          style="width: 150px"
           :options="options1"
-          :readonly="true"
         />
       </FormItem>
     </Form>
   </div>
 </template>
 <script lang="ts" setup>
-  import { Select, Input, Form, FormItem } from 'ant-design-vue';
+  import { Select, Input, Form, FormItem, Tag } from 'ant-design-vue';
   import { useRouteDesignState } from '../hooks/useRouteDesignState';
+  import GeneralModal from '/@/views/components/GeneralModal.vue';
   import { SelectTypes } from 'ant-design-vue/es/select';
-  import { ref } from 'vue';
+  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 { routeConfig } = useRouteDesignState();
+  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',
@@ -66,4 +118,126 @@
       label: '涓嶅惎鐢�',
     },
   ]);
+  const needSetupOptions = ref<SelectTypes['options']>([
+    {
+      value: 'Y',
+      label: '蹇呴渶璁剧疆',
+    },
+    {
+      value: 'N',
+      label: '鏃犻渶璁剧疆',
+    },
+  ]);
+  const needResetOptions = 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 });
+          }
+          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.NEED_RESET = newVal.NEED_RESET;
+          // 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 = 'orange';
+                text = '鎵爜楠岃瘉';
+                break;
+              case 2:
+                color = 'blue';
+                text = '缁勮涓婃枡';
+                break;
+              case 3:
+                color = '#24c7cf';
+                text = '浜у搧娴嬭瘯';
+                break;
+              case 4:
+                color = '#550689';
+                text = '浜у搧鎶芥';
+                break;
+              case 5:
+                color = '#bfbfbf';
+                text = '鏍囩鎵撳嵃';
+                break;
+            }
+            return h(Tag, { color: color }, () => text);
+          },
+        },
+      ],
+      tableName: 'MES_CUSTOM_ACT',
+      rowKey: 'ACT_CODE',
+      searchInfo: { TABLE_NAME: 'MES_CUSTOM_ACT', ACT_TYPE: routeConfig.currentAct.ACT_TYPE },
+    });
+  }
+
+  function handleItemSuccess(d, u) {
+    routeConfig.currentAct.ACT_CODE = d.values['val'];
+  }
 </script>

--
Gitblit v1.9.3