| | |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import equModal from '#/views/eims/components/equ-modal.vue'; |
| | | import fixtureModal from '#/views/eims/components/fixture-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | |
| | |
| | | ]); |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | const { reqUser } = drawerApi.getData() as { reqUser?: number | string }; |
| | | const { reqDept } = drawerApi.getData() as { reqDept?: number | string }; |
| | | isUpdate.value = !!id; |
| | | // 初始化 |
| | | await setupDeptSelect(); |
| | | await setupEquTypeSelect(); |
| | | // 新增时默认填充登录人为报修人 |
| | | if (!isUpdate.value && reqUser !== null && reqDept !== null) { |
| | | await formApi.setValues({ 'reqUser': reqUser, 'reqDept': reqDept }); |
| | | await setupUserOptions(reqDept); |
| | | } |
| | | // 更新 && 赋值 |
| | | if (isUpdate.value && id) { |
| | | const record = await getRepairReq(id); |
| | |
| | | ]); |
| | | } |
| | | |
| | | |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | |
| | | title: '选择设备' |
| | | }); |
| | | |
| | | function handleOpenModal() { |
| | | const [FixtureModal, fixtureModalApi] = useVbenModal({ |
| | | connectedComponent: fixtureModal, |
| | | draggable: true, |
| | | title: '选择工具' |
| | | }); |
| | | |
| | | function handleEquModal() { |
| | | equModalApi.setData({}); |
| | | equModalApi.open(); |
| | | } |
| | | |
| | | function handleFixtureModal() { |
| | | fixtureModalApi.setData({}); |
| | | fixtureModalApi.open(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 打开查询设备 |
| | | */ |
| | | function onSearchEqu() { |
| | | handleOpenModal(); |
| | | handleEquModal(); |
| | | } |
| | | |
| | | /** |
| | | * 打开查询工具 |
| | | */ |
| | | function onSearchFixture() { |
| | | handleFixtureModal(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | async function updateEqu(equ: any) { |
| | | await formApi.setValues({ 'equId': equ.equId, 'equName': equ.equName }); |
| | | } |
| | | /** |
| | | * 更新选择的工具 |
| | | * @param fixture |
| | | */ |
| | | async function updateFixture(fixture: any) { |
| | | await formApi.setValues({ 'fixtureId': fixture.id, 'fixtureName': fixture.fixtureName }); |
| | | } |
| | | </script> |
| | | |
| | |
| | | <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="BXD" /> |
| | | </template> |
| | | <template #equName="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="请选择设备" @search="onSearchEqu" v-bind="slotProps" |
| | | :disabled="isUpdate" /> |
| | | <InputSearch :enter-button="true" placeholder="请选择设备" @search="onSearchEqu" v-bind="slotProps" :disabled="isUpdate" /> |
| | | </template> |
| | | <template #fixtureName="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="请选择工具" @search="onSearchFixture" v-bind="slotProps" :disabled="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | <EquModal class="w-[1200px]" @update-equ="updateEqu" /> |
| | | <FixtureModal class="w-[1200px]" @update-select="updateFixture" /> |
| | | </BasicDrawer> |
| | | </template> |