From e34d8f9133f196f17667d8051a6a9d080b0385fb Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期六, 06 七月 2024 22:25:10 +0800 Subject: [PATCH] 优化提示 --- src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue | 336 +++++++++++++++++++++++++++++++------------------------ 1 files changed, 188 insertions(+), 148 deletions(-) diff --git a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue index 371c07a..1f55e0a 100644 --- a/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue +++ b/src/views/tigerprojects/mes/eng/route/components/ActionItemProps.vue @@ -13,172 +13,212 @@ <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" /> + <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="璇烽�夋嫨琛屼负绫诲瀷" /> + <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: '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" /> + <FormItem label="琛屼负瀹氫箟" name="琛屼负瀹氫箟"> + <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" + /> <GeneralModal @register="registerItemAdd" @success="handleItemSuccess" /> </FormItem> <FormItem label="鏄惁璁剧疆鎵嶈兘涓嬪彂鐢熶骇(Y/N)" name="鏄惁璁剧疆鎵嶈兘涓嬪彂鐢熶骇(Y/N)"> - <Select ref="select" v-model:value="routeConfig.currentAct.NEED_SETUP" style="width: 150px" - :options="needSetupOptions" /> + <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: 150px" - :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, 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 { 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'; + 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 { 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 { 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 }); - } - 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 = '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; + 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 }); } - 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} - }); -} + 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 handleItemSuccess(d, u) { - routeConfig.currentAct.ACT_CODE = d.values['val'] -} + 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