From 3e0f519c396ac8a72e7bbd426e4f38fa6cc403dc Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期五, 14 三月 2025 16:50:34 +0800 Subject: [PATCH] 点检模块 --- eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue | 131 ++++++++++++++++++++++++++----------------- 1 files changed, 78 insertions(+), 53 deletions(-) diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue b/eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue similarity index 61% copy from eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue copy to eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue index 716379d..6f7549b 100644 --- a/eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue +++ b/eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue @@ -1,23 +1,21 @@ <script setup lang="ts"> +import type { Recordable } from '@vben/types'; + import { onMounted, ref } from 'vue'; import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; +import { $t } from '@vben/locales'; import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; -import { Popconfirm, Space } from 'ant-design-vue'; +import { Modal, Popconfirm, Space } from 'ant-design-vue'; -import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; -import { listMaintOrderGroupDetail } from '#/api/eims/maint-order'; -import { delMaintOrderSt, listMaintOrderSt } from '#/api/eims/maint-order-st'; +import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { delInspRecord, inspRecordExport, listInspRecord } from '#/api/eims/insp-record'; import { getDeptTree, userList } from '#/api/system/user'; -import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; -import { columns as orderCol } from '#/views/eims/maint-order/data'; +import { commonDownloadExcel } from '#/utils/file/download'; import { columns, querySchema } from './data'; -import maintOrderStDrawer from './maint-order-st-drawer.vue'; -import type { Recordable } from '@vben/types'; -import { MAINT_ORDER_STATUS } from '#/constants/dict'; -import { $t } from '@vben/locales'; +import inspRecordDrawer from './insp-record-drawer.vue'; defineExpose({ tableSelect @@ -32,9 +30,7 @@ }, collapsed: true, schema: querySchema(), - wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', - // 鏃ユ湡閫夋嫨鏍煎紡鍖� - fieldMappingTime: [['planTime', ['params[beginPlanTime]', 'params[endPlanTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]] + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' }; const gridOptions: VxeGridProps = { @@ -53,7 +49,7 @@ proxyConfig: { ajax: { query: async ({ page }, formValues = {}) => { - return await listMaintOrderSt({ + return await listInspRecord({ pageNum: page.currentPage, pageSize: page.pageSize, ...formValues @@ -71,7 +67,7 @@ // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 multiple: true }, - id: 'maint-order-group-index' + id: 'insp-record-index' }; const orderId = ref<string>(); const [BasicTable, tableApi] = useVbenVxeGrid({ @@ -81,10 +77,49 @@ sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), cellClick: (e: any) => { const { row } = e; - orderId.value = `${row.equId}_${row.planTime}`; + orderId.value = row.id; } } }); + +const [InspRecordDrawer, inspRecordDrawerApi] = useVbenDrawer({ + connectedComponent: inspRecordDrawer +}); + +function handleAdd() { + inspRecordDrawerApi.setData({}); + inspRecordDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + inspRecordDrawerApi.setData({ id: record.id }); + inspRecordDrawerApi.open(); +} + +async function handleDelete(row: Recordable<any>) { + await delInspRecord(row.id); + await tableApi.query(); +} + +function handleMultiDelete() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id); + Modal.confirm({ + title: '鎻愮ず', + okType: 'danger', + content: `纭鍒犻櫎閫変腑鐨�${ids.length}鏉¤褰曞悧锛焋, + onOk: async () => { + await delInspRecord(ids); + await tableApi.query(); + } + }); +} + +function handleDownloadExcel() { + commonDownloadExcel(inspRecordExport, '鐐规璁板綍', tableApi.formApi.form.values, { + fieldMappingTime: formOptions.fieldMappingTime + }); +} /** * 鍒濆鍖栭儴闂ㄩ�夋嫨 @@ -108,7 +143,7 @@ /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ await setupUserOptions(deptId); /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ - formModel.maintUser = undefined; + formModel.inspUser = undefined; }, placeholder: '璇烽�夋嫨', showSearch: true, @@ -120,7 +155,7 @@ // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� treeNodeLabelProp: 'fullName' }), - fieldName: 'maintDept' + fieldName: 'inspDept' } ]); } @@ -148,28 +183,10 @@ tableApi.formApi.updateSchema([ { componentProps: { options, placeholder, filterOption }, - fieldName: 'maintUser' + fieldName: 'inspUser' } ]); } -const [MaintOrderStDrawer, maintOrderStDrawerApi] = useVbenDrawer({ - connectedComponent: maintOrderStDrawer -}); - -function handleAdd() { - maintOrderStDrawerApi.setData({}); - maintOrderStDrawerApi.open(); -} - -async function handleEdit(record: Recordable<any>) { - maintOrderStDrawerApi.setData({ id: record.id }); - maintOrderStDrawerApi.open(); -} -async function handleDelete(row: Recordable<any>) { - await delMaintOrderSt(row.id); - await tableApi.query(); -} - onMounted(async () => { await setupDeptSelect(); @@ -184,9 +201,25 @@ <template> <Page :auto-content-height="true"> <div class="flex h-full gap-[8px] flex-col"> - <BasicTable class="h-3/5" table-title="淇濆吇宸ュ崟鍒楄〃"> + <BasicTable table-title="鐐规璁板綍鍒楄〃"> <template #toolbar-tools> - <Space /> + <Space> + <a-button v-access:code="['eims:inspectRecord:export']" @click="handleDownloadExcel"> + {{ $t('pages.common.export') }} + </a-button> + <a-button + :disabled="!vxeCheckboxChecked(tableApi)" + danger + type="primary" + v-access:code="['eims:inspectRecord:remove']" + @click="handleMultiDelete" + > + {{ $t('pages.common.delete') }} + </a-button> + <!-- <a-button type="primary" v-access:code="['eims:inspectRecord:add']" @click="handleAdd"> + {{ $t('pages.common.add') }} + </a-button>--> + </Space> </template> <template #equName="{ row }"> @@ -194,30 +227,22 @@ <span>{{ row.equName }}</span> </Space> </template> + <template #action="{ row }"> <Space> - <ghost-button v-access:code="['eims:maintOrderSt:edit']" @click.stop="handleEdit(row)"> + <ghost-button v-access:code="['eims:inspectRecord:edit']" @click.stop="handleEdit(row)"> {{ $t('pages.common.edit') }} </ghost-button> - <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" - @confirm="handleDelete(row)"> - <ghost-button danger v-access:code="['eims:maintOrderSt:remove']" @click.stop=""> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> + <ghost-button danger v-access:code="['eims:inspectRecord:remove']" @click.stop=""> {{ $t('pages.common.delete') }} </ghost-button> </Popconfirm> </Space> </template> - </BasicTable> - <BasisSubTable - :columns="orderCol" - :list-api="listMaintOrderGroupDetail" - :req-value="orderId" - class="h-2/5" - req-key="maintCode" - title="淇濆吇瀹炴柦椤圭洰" - /> + <!--<BasisSubTable :columns="maintStandCol" :list-api="listMaintStand" :req-value="equId" class="h-1/3" req-key="equId" title="淇濆吇瀹炴柦椤圭洰" />--> </div> - <MaintOrderStDrawer @reload="tableApi.query()" /> + <InspRecordDrawer @reload="tableApi.query()" /> </Page> </template> -- Gitblit v1.9.3