From 74448f9a9f1f8cb779023db3ea9eda762fc6ad0a Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期五, 28 二月 2025 14:29:42 +0800 Subject: [PATCH] 维修工接单、维修 --- eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue | 84 ++++++++++++++++++++++++++++++++++++----- 1 files changed, 73 insertions(+), 11 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 d248376..b686dd0 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 @@ -1,22 +1,39 @@ <script setup lang="ts"> import type { Recordable } from '@vben/types'; -import { onMounted } from 'vue'; +import { onMounted, ref } from 'vue'; 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 { useRoleBaseFilters } from '#/views/eims/repair-req/use-role-base-filters'; import { columns, querySchema } from './data'; import repairReqDrawer from './repair-req-drawer.vue'; +import sendWorkDrawer from './send-work-drawer.vue'; +import RepairRecord from '#/views/eims/repair-record/index.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: { @@ -41,18 +58,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() + ...formValues + // ...useRoleBaseFilters() }); } } @@ -69,12 +94,16 @@ }, id: 'eims-repair-req-index' }; - +const reqId = ref<string>(); const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions, gridEvents: { - sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), + cellClick: (e: any) => { + const { row } = e; + reqId.value = row.id; + } } }); @@ -82,8 +111,29 @@ 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.DAIJIEDAN); + 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(); } @@ -116,6 +166,11 @@ fieldMappingTime: formOptions.fieldMappingTime }); } + +/** + * 娲惧伐 + */ +function handleSendWork() {} onMounted(async () => { await setupDeptSelect(); @@ -187,14 +242,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="璁惧鐩樼偣鍒楄〃"> + <div class="flex h-full gap-[8px] flex-col"> + <BasicTable class="h-2/3" 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,7 +286,9 @@ </Space> </template> </BasicTable> + <RepairRecord :req-id="reqId" class="h-1/3" table-title="缁翠慨璁板綍" /> </div> <RepairReqDrawer @reload="tableApi.query()" /> + <SendWorkDrawer @reload="tableApi.query()" /> </Page> </template> -- Gitblit v1.9.3