| | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addRepairRes, getRepairRes, updateRepairRes } from '#/api/eims/repair-res'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { REPAIR_RES_STATUS } from '#/constants/dict'; |
| | | import reqModal from '#/views/eims/components/repair-req-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | |
| | | |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | const { action } = drawerApi.getData() as { action?: string }; |
| | | const { resUser } = drawerApi.getData() as { resUser?: number | string }; |
| | | const { resDept } = drawerApi.getData() as { resDept?: number | string }; |
| | | isUpdate.value = !!id; |
| | |
| | | await setupUserOptions(record.resDept); |
| | | } |
| | | } |
| | | showAllColumns(); |
| | | // 根据action 显示隐藏列 |
| | | if (action && action === REPAIR_RES_STATUS.WEIXIU) { |
| | | await formApi.setValues({ 'status': REPAIR_RES_STATUS.WEIXIU }); |
| | | showWeixiuColumns(); |
| | | } else if (action && action === REPAIR_RES_STATUS.WANCHENG) { |
| | | await formApi.setValues({ 'status': REPAIR_RES_STATUS.WANCHENG }); |
| | | showWanchengColumns(); |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | function showAllColumns() { |
| | | const show = true; |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resReason' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resHandle' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resPrevent' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'endTime' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resDept' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resUser' |
| | | } |
| | | ]); |
| | | } |
| | | function showWeixiuColumns() { |
| | | const show = false; |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resReason' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resHandle' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resPrevent' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'endTime' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resDept' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'resUser' |
| | | } |
| | | ]); |
| | | } |
| | | function showWanchengColumns() { |
| | | const show = false; |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => show, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'status' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | const [ReqModal, reqModalApi] = useVbenModal({ |
| | | connectedComponent: reqModal, |
| | | draggable: true, |