From ec4d16c8a630960a4671a60f4d1957fd3de9def3 Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期四, 27 二月 2025 16:53:59 +0800 Subject: [PATCH] 完成维修工单查看维修记录子表 --- eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue | 65 ++++++++++++++++++++++++++++++-- 1 files changed, 61 insertions(+), 4 deletions(-) diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue b/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue index 14bf3ea..3dff59f 100644 --- a/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue +++ b/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue @@ -5,17 +5,34 @@ import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; import { $t } from '@vben/locales'; +import { useUserStore } from '@vben/stores'; import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; -import { Modal, Popconfirm, Space } from 'ant-design-vue'; +import { message, Modal, Popconfirm, Space } from 'ant-design-vue'; import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; import { delRepairReq, listRepairReq, repairReqExport } from '#/api/eims/repair-req'; import { getDeptTree, userList } from '#/api/system/user'; +import { REPAIR_REQ_STATUS } from '#/constants/dict'; import { commonDownloadExcel } from '#/utils/file/download'; import { columns, querySchema } from './data'; import repairReqDrawer from './repair-req-drawer.vue'; +import sendWorkDrawer from './send-work-drawer.vue'; + +interface Props { + filterFlag?: boolean; + status?: string; +} +const props = withDefaults(defineProps<Props>(), { filterFlag: false, status: undefined }); + +const userStore = useUserStore(); +const userId = userStore.userInfo?.userId; +const deptId = userStore.userInfo?.deptId; + +defineExpose({ + tableSelect +}); const formOptions: VbenFormProps = { commonConfig: { @@ -40,17 +57,26 @@ // 鐐瑰嚮琛岄�変腑 // trigger: 'row' }, - columns, + columns: columns?.filter((item) => (props.filterFlag ? item.field !== 'action' : item.field !== '-1')), height: 'auto', keepSource: true, pagerConfig: {}, + toolbarConfig: { + enabled: !props.filterFlag + }, proxyConfig: { ajax: { query: async ({ page }, formValues = {}) => { + // 濡傛灉浼犲叆浜唀quId鍒欏彧鏌ヨ褰撳墠id鏁版嵁 + if (props.filterFlag && props.status) { + const params = { status: props.status }; + Object.assign(formValues, params); + } return await listRepairReq({ pageNum: page.currentPage, pageSize: page.pageSize, ...formValues + // ...useRoleBaseFilters() }); } } @@ -80,8 +106,28 @@ connectedComponent: repairReqDrawer }); +const [SendWorkDrawer, drawerApi] = useVbenDrawer({ + connectedComponent: sendWorkDrawer, + title: '娲惧伐' +}); + +function openSendWork() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id).join(','); + const filterData = rows.filter((item) => item.status === REPAIR_REQ_STATUS.WEIXIU || item.status === REPAIR_REQ_STATUS.WANCHENG); + if (rows.length === 0) { + message.warn('璇烽�夋嫨鎶ヤ慨鍗曞悗娲惧伐锛�'); + return; + } else if (filterData.length > 0) { + message.warn('璇烽�夋嫨鏈帴鍗曟姤淇崟鍚庢淳宸ワ紒'); + return; + } + drawerApi.setData({ batchReqIds: ids }); + drawerApi.open(); +} + function handleAdd() { - repairReqDrawerApi.setData({}); + repairReqDrawerApi.setData({ reqUser: userId, reqDept: deptId }); repairReqDrawerApi.open(); } @@ -114,6 +160,11 @@ fieldMappingTime: formOptions.fieldMappingTime }); } + +/** + * 娲惧伐 + */ +function handleSendWork() {} onMounted(async () => { await setupDeptSelect(); @@ -185,14 +236,19 @@ } ]); } +// 閫変腑鏁版嵁 +function tableSelect() { + return tableApi.grid.getCheckboxRecords(); +} </script> <template> <Page :auto-content-height="true"> <div class="flex h-full gap-[8px]"> - <BasicTable class="flex-1 overflow-hidden" table-title="璁惧鐩樼偣鍒楄〃"> + <BasicTable class="flex-1 overflow-hidden" table-title="鏁呴殰鎶ヤ慨鍒楄〃"> <template #toolbar-tools> <Space> + <a-button v-access:code="['eims:repairReq:send']" @click="openSendWork"> 娲惧伐 </a-button> <a-button v-access:code="['eims:repairReq:export']" @click="handleDownloadExcel"> {{ $t('pages.common.export') }} </a-button> @@ -226,5 +282,6 @@ </BasicTable> </div> <RepairReqDrawer @reload="tableApi.query()" /> + <SendWorkDrawer @reload="tableApi.query()" /> </Page> </template> -- Gitblit v1.9.3