From cca7adfe0b76ed7c2fbdbc9978533de147695184 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期六, 08 六月 2024 23:02:07 +0800 Subject: [PATCH] 工单管理更新 --- src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue | 221 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 196 insertions(+), 25 deletions(-) diff --git a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue index 65a84db..55c2500 100644 --- a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue +++ b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue @@ -15,7 +15,7 @@ @click="handleSelectItem" preIcon="search|svg" /> - <ItemModal @register="registerItemAdd" @success="handleItemSuccess" /> + <NormalModal @register="registerItemAdd" @success="handleItemSuccess" /> </template> <template #action="{ record }"> <TableAction @@ -36,45 +36,83 @@ }, }, { + icon: 'config|svg', + tooltip: '閰嶇疆宸ヨ壓', + onClick: handleConfig.bind(null, record), + }, + { icon: 'release|svg', tooltip: '涓嬪彂', - onClick: handleBao.bind(null, record), + onClick: handleRelease.bind(null, record), }, { icon: 'unrelease|svg', tooltip: '鍙栨秷涓嬪彂', - onClick: handleBao.bind(null, record), + onClick: handleUnRelease.bind(null, record), }, { icon: 'suspend-blue|svg', tooltip: '鏆傚仠', - onClick: handleBao.bind(null, record), + onClick: handlePause.bind(null, record), }, ]" /> </template> </BasicTable> <Loading :loading="compState.loading" :tip="compState.tip" /> - <!-- <WmsItemDrawer @register="registerDrawer" @success="handleSuccess" /> --> <WoDrawer @register="registerDrawer" @success="handleSuccess" /> - <WoModal @register="registerWo" @success="handleSuccess" /> + <WoModal @register="registerWo" @success="handleSuccess" :title="title" :mtitle="mtitle" /> + <CustModal + @register="registerCust" + @success="custSuccess" + :type="cType" + :detailSlots="dtlSlots" + > + <template #[item.name] v-for="item in dtlSlots" :key="item.name"> + <BasicForm @register="useFormData[item.name][0]"> + <template #[sitem]="{ field }" v-for="sitem in item.slots" :key="sitem"> + <a-button + class="mt-1 ml-1" + size="small" + @click="handleCustClick(field)" + :preIcon="item.preIcons[sitem]" + /> + </template> + </BasicForm> + <NormalModal + @register="registerEntity" + @success="(d, u) => handleEntSuccess(d, u, item.name)" + /> + </template> + </CustModal> + <RouteViewModal @register="registerRv" @success="RvItemSuccess" /> </div> </template> <script lang="ts" setup> - import { reactive, unref, h } from 'vue'; + import { reactive, unref, h, onMounted, ref, nextTick } from 'vue'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; + import { BasicForm, FormSchema, FormActionType, useForm } from '/@/components/Form/index'; import WoDrawer from './WoDrawer.vue'; import WoModal from './WoModal.vue'; - import ItemModal from '/@/views/components/ItemModal.vue'; + import NormalModal from '/@/views/components/NormalModal.vue'; + import RouteViewModal from '/@/views/components/RouteViewModal.vue'; + import CustModal from '/@/views/components/CustModal.vue'; import { useDrawer } from '/@/components/Drawer'; import { columns, searchFormSchema } from './biz_mes_wo.data'; - import { DeleteMesWo, getWoListByPage } from '/@/api/tigerapi/mes/wo'; + import { DeleteMesWo } from '/@/api/tigerapi/mes/wo'; import { Loading } from '/@/components/Loading'; import { useMessage } from '/@/hooks/web/useMessage'; import { useI18n } from '/@/hooks/web/useI18n'; import { useModal } from '/@/components/Modal'; + import { getListByPage } from '/@/api/tigerapi/system'; + import { GetSelectSuccess, OpenSelectItem, getFormSchema } from '/@/views/components/data'; const { t } = useI18n(); + const cType = ref(''); + const title = ref('宸ュ崟瀵煎叆'); + const mtitle = ref('宸ュ崟鍒楄〃'); + const dtlSlots = ref([] as any[]); + const selectVals = ref({}); const { createMessage } = useMessage(); const [registerDrawer, { openDrawer }] = useDrawer(); const compState = reactive({ @@ -82,11 +120,14 @@ loading: false, tip: '鍔犺浇涓�...', }); + const [registerEntity, { openModal: openEntModal }] = useModal(); + const [registerRv, { openModal: openRvModal }] = useModal(); const [registerWo, { openModal: openWoModal }] = useModal(); const [registerItemAdd, { openModal: openItemModal }] = useModal(); + const [registerCust, { openModal: openCustModal, closeModal }] = useModal(); const [registerTable, { getForm, reload }] = useTable({ title: '宸ュ崟淇℃伅', - api: getWoListByPage, + api: getListByPage, columns, formConfig: { labelWidth: 120, @@ -105,6 +146,46 @@ bordered: true, showIndexColumn: false, }); + const formSchema = ref([] as FormSchema[]); + const woSchema = ref([] as FormSchema[]); + const prodSchema = ref([] as FormSchema[]); + const xxSchema = ref([] as FormSchema[]); + const useFormData = ref({ + forminfo: useForm({ + labelWidth: 120, + schemas: formSchema, + actionColOptions: { + span: 24, + }, + showActionButtonGroup: false, + }), + woinfo: useForm({ + labelWidth: 120, + schemas: woSchema, + actionColOptions: { + span: 24, + }, + showActionButtonGroup: false, + }), + prodinfo: useForm({ + labelWidth: 120, + schemas: prodSchema, + actionColOptions: { + span: 24, + }, + showActionButtonGroup: false, + }), + xxinfo: useForm({ + labelWidth: 120, + schemas: xxSchema, + actionColOptions: { + span: 24, + }, + showActionButtonGroup: false, + }), + }); + + onMounted(() => {}); //鏂板 function addWo() { @@ -129,20 +210,60 @@ info: 'Info', }); } - //鎶ュ簾 - function handleBao(record: any) { - // const apiAction = SaveTool(record, unref(true), true); - // apiAction.then((action) => { - // if (action.IsSuccessed) { - // createMessage.success(t('宸叉姤搴�')); - // reload(); - // } else { - // createMessage.success(t('鎶ュ簾鎿嶄綔澶辫触')); - // } - // }); + //閰嶇疆宸ヨ壓 + function handleConfig(record: Recordable) { + cType.value = 'BIZ_MES_WO_Config'; + dtlSlots.value = [ + { name: 'woinfo', slots: [], preIcons: {}, title: '宸ュ崟淇℃伅' }, + { name: 'prodinfo', slots: [], preIcons: {}, title: '浜у搧淇℃伅' }, + { name: 'xxinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: 'XXX' }, + ]; + woSchema.value = getFormSchema('woinfo'); + prodSchema.value = getFormSchema('prodinfo'); + xxSchema.value = getFormSchema('xxinfo'); + openCustModal(true, { + isUpdate: true, + ctype: cType, + title: '宸ヨ壓閰嶇疆', + width: '1000px', + formEl: useFormData.value, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы + formElName: ['woinfo', 'prodinfo', 'xxinfo'], + RowKey: '', + ...record, + }); } + //涓嬪彂 + function handleRelease(record: Recordable) { + cType.value = 'BIZ_MES_WO'; + dtlSlots.value = [ + { + name: 'forminfo', + slots: ['add', 'set'], + preIcons: { add: 'search|svg', set: 'config|svg' }, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы銆俿lots鏄脊鍑烘鎸夐挳鐨勬彃妲斤紝preIcons鏄彃妲藉搴旂殑鎸夐挳鍥炬爣 + title: '涓嬪彂閰嶇疆', + }, + ]; + formSchema.value = getFormSchema(cType.value); + openCustModal(true, { + isUpdate: true, //鏄惁鏇存柊鎿嶄綔 + ctype: cType, //鏄摢涓〉闈� + title: '宸ュ崟涓嬪彂', //鏍囬 + width: '900px', //寮瑰嚭妗嗗搴� + formEl: useFormData.value, + formElName: ['forminfo'], + RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //鎻掓Ы鐨勫脊鍑烘閫夋嫨鐨刢ode + ...record, + }); + } + function custSuccess(d) { + reload(); + } + //鍙栨秷涓嬪彂 + function handleUnRelease(record: Recordable) {} + //鏆傚仠 + function handlePause(record: Recordable) {} //鍒犻櫎 - function handleDelete(record: any) { + function handleDelete(record: Recordable) { const apiAction = DeleteMesWo(record.ID); apiAction.then((action) => { if (action.IsSuccessed) { @@ -156,14 +277,64 @@ //鐐瑰嚮鎵撳紑鐗╂枡鍒楄〃妗� function handleSelectItem() { openItemModal(true, { - data: 'content', - info: 'Info', + title: '鐗╂枡鍒楄〃', + schemas: [ + { + field: 'ITEM_CODE', + component: 'Input', + label: '鐗╂枡缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('鐗╂枡缂栫爜'), + dataIndex: 'ITEM_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('鐗╂枡鍚嶇О'), + dataIndex: 'ITEM_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'BAS_ITEM', + rowKey: 'ITEM_CODE', }); } function handleItemSuccess(d, u) { getForm().setFieldsValue({ - ITEM_CODE: d.values.values, + ITEM_CODE: d.values['val'], }); } + /* 寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庝簨浠� */ + function handleEntSuccess(d, u, item) { + var values = GetSelectSuccess(d, u, cType.value); + selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋� + let _val = {}; + _val[d.returnFieldName] = values[d.returnFieldName]; + if (item == 'forminfo') { + useFormData.value['forminfo'][1].setFieldsValue(_val); + } + if (item == 'prodinfo') { + useFormData.value['prodinfo'][1].setFieldsValue(_val); + } + if (item == 'woinfo') { + useFormData.value['woinfo'][1].setFieldsValue(_val); + } + } + + /* 寮瑰嚭閫夋嫨妗� */ + function handleCustClick(item) { + // openRvModal(true, {}); + OpenSelectItem(openEntModal, cType.value, item, [openRvModal], selectVals.value['ID']); + } + function RvItemSuccess(d, u) {} </script> -- Gitblit v1.9.3