| | |
| | | <Loading :loading="compState.loading" :tip="compState.tip" /> |
| | | <WoDrawer @register="registerDrawer" @success="handleSuccess" /> |
| | | <WoModal @register="registerWo" @success="handleSuccess" :title="title" :mtitle="mtitle" /> |
| | | <!-- 自定义模态框,可以自定义多表单 --> |
| | | <CustModal |
| | | @register="registerCust" |
| | | @success="handleSuccess" |
| | | @success="custSuccess" |
| | | :type="cType" |
| | | :detailSlots="dtlSlots" |
| | | > |
| | | <!-- 用插槽自定义多表单 --> |
| | | <template #[item.name] v-for="item in dtlSlots" :key="item.name"> |
| | | <BasicForm |
| | | :schemas="formSchema" |
| | | :ref="item.name" |
| | | :labelWidth="100" |
| | | :showActionButtonGroup="false" |
| | | > |
| | | <template #[sitem]="{ field }" v-for="sitem in item.slots" :key="sitem"> |
| | | <BasicForm @register="useFormData[item.name][0]"> |
| | | <!-- 用插槽自定义弹出选择框 --> |
| | | <template #[name]="{ field }" v-for="name in item.slots" :key="name"> |
| | | <a-button |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="handleCustClick(field)" |
| | | :preIcon="item.preIcons[sitem]" |
| | | :preIcon="item.preIcons[name]" |
| | | /> |
| | | <NormalModal |
| | | @register="useModalData[name][0]" |
| | | @success="(d, u) => handleEntSuccess(d, u, item.name)" |
| | | /> |
| | | </template> |
| | | </BasicForm> |
| | | <NormalModal |
| | | @register="registerEntity" |
| | | @success="(d, u) => handleEntSuccess(d, u, item.name)" |
| | | /> |
| | | </template> |
| | | </CustModal> |
| | | <RouteViewModal @register="registerRv" @success="RvItemSuccess" /> |
| | |
| | | <script lang="ts" setup> |
| | | import { reactive, unref, h, onMounted, ref, nextTick } from 'vue'; |
| | | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| | | import { BasicForm, FormSchema, FormActionType, FormProps } from '/@/components/Form/index'; |
| | | import { BasicForm, FormSchema, FormActionType, useForm } from '/@/components/Form/index'; |
| | | import WoDrawer from './WoDrawer.vue'; |
| | | import WoModal from './WoModal.vue'; |
| | | import NormalModal from '/@/views/components/NormalModal.vue'; |
| | |
| | | const { t } = useI18n(); |
| | | const cType = ref(''); |
| | | const title = ref('工单导入'); |
| | | const ctitle = ref('工单下发配置'); |
| | | const mtitle = ref('工单列表'); |
| | | const dtlSlots = ref([] as any[]); |
| | | const selectVals = ref({}); |
| | |
| | | loading: false, |
| | | tip: '加载中...', |
| | | }); |
| | | const [registerEntity, { openModal: openEntModal }] = useModal(); |
| | | const [registerRv, { openModal: openRvModal }] = useModal(); |
| | | const [registerWo, { openModal: openWoModal }] = useModal(); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | |
| | | showIndexColumn: false, |
| | | }); |
| | | const formSchema = ref([] as FormSchema[]); |
| | | const woinfo = ref<Nullable<FormActionType>>(null); |
| | | const forminfo = ref<Nullable<FormActionType>>(null); |
| | | const prodinfo = ref<Nullable<FormActionType>>(null); |
| | | const woSchema = ref([] as FormSchema[]); |
| | | const prodSchema = ref([] as FormSchema[]); |
| | | const xxSchema = ref([] as FormSchema[]); |
| | | //表单中插槽渲染按钮打开模态框useModal方法 |
| | | const useModalData = ref({ |
| | | add: useModal(), |
| | | set: useModal(), |
| | | addRot: useModal(), |
| | | setRot: useModal(), |
| | | }); |
| | | //自定义多表单实例 |
| | | 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(() => {}); |
| | | |
| | |
| | | cType.value = 'BIZ_MES_WO_Config'; |
| | | dtlSlots.value = [ |
| | | { name: 'woinfo', slots: [], preIcons: {}, title: '工单信息' }, |
| | | { name: 'prodinfo', slots: [], preIcons: {}, title: '产品信息' }, |
| | | { |
| | | name: 'prodinfo', |
| | | slots: ['addRot', 'setRot'], |
| | | preIcons: { addRot: 'search|svg', setRot: 'config|svg' }, |
| | | title: '产品信息', |
| | | }, |
| | | { name: 'xxinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: 'XXX' }, |
| | | ]; |
| | | formSchema.value = getFormSchema(cType.value); |
| | | 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: '', |
| | | formEl: { woinfo: woinfo.value, prodinfo: prodinfo.value }, //如果是多个表单,增加多个插槽 |
| | | // preIcons: { add: 'search|svg', set: 'config|svg' }, |
| | | // slots: ['add', 'set'], //给弹出框增加插槽标签数组 |
| | | ...record, |
| | | }); |
| | | } |
| | |
| | | { |
| | | name: 'forminfo', |
| | | slots: ['add', 'set'], |
| | | preIcons: { add: 'search|svg', set: 'config|svg' }, |
| | | preIcons: { add: 'search|svg', set: 'config|svg' }, //如果是多个表单,增加多个插槽。slots是弹出框按钮的插槽,preIcons是插槽对应的按钮图标 |
| | | title: '下发配置', |
| | | }, |
| | | ]; //如果是多个表单,增加多个插槽。slots是弹出框按钮的插槽,preIcons是插槽对应的按钮图标 |
| | | ]; |
| | | formSchema.value = getFormSchema(cType.value); |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | openCustModal(true, { |
| | | isUpdate: true, //是否更新操作 |
| | | ctype: cType, //是哪个页面 |
| | | title: '工单下发', //标题 |
| | | width: '900px', //弹出框宽度 |
| | | formEl: { forminfo: forminfo.value }, |
| | | formElName: 'forminfo', |
| | | RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //插槽的弹出框选择的code |
| | | ...record, |
| | | }); |
| | | }, 100); |
| | | closeModal(); |
| | | openCustModal(true, {}); |
| | | openCustModal(true, { |
| | | isUpdate: true, //是否更新操作 |
| | | ctype: cType, //是哪个页面 |
| | | title: '工单下发', //标题 |
| | | width: '900px', //弹出框宽度 |
| | | formEl: useFormData.value, |
| | | formElName: ['forminfo'], |
| | | RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //插槽的弹出框选择的code |
| | | ...record, |
| | | }); |
| | | } |
| | | function custSuccess(d) { |
| | | reload(); |
| | | } |
| | | //取消下发 |
| | | function handleUnRelease(record: Recordable) {} |
| | |
| | | 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') { |
| | | forminfo.value.setFieldsValue(_val); |
| | | } |
| | | if (item == 'prodinfo') { |
| | | prodinfo.value.setFieldsValue(_val); |
| | | } |
| | | if (item == 'woinfo') { |
| | | woinfo.value.setFieldsValue(_val); |
| | | } |
| | | useFormData.value[item][1].setFieldsValue(_val); |
| | | } |
| | | |
| | | /* 弹出选择框 */ |
| | | function handleCustClick(item) { |
| | | // openRvModal(true, {}); |
| | | OpenSelectItem(openEntModal, cType.value, item, [openRvModal], selectVals.value['ID']); |
| | | //打开自定义模态框 |
| | | OpenSelectItem( |
| | | useModalData.value[item][1].openModal, //带入openModal方法 |
| | | cType.value, |
| | | item, |
| | | [openRvModal], |
| | | selectVals.value['ID'], |
| | | ); //[openRvModal], selectVals.value['ID']这是自定义参数,按实际需求 |
| | | } |
| | | function RvItemSuccess(d, u) {} |
| | | </script> |