From 66e943c91e133eec5a0822ea22fd92cbc04bc9f3 Mon Sep 17 00:00:00 2001
From: zhuguifei <312353457@qq.com>
Date: 星期三, 12 三月 2025 16:04:14 +0800
Subject: [PATCH] 保养工单汇总
---
eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue | 79 +++++++++++++++++++++++++++++++++++----
1 files changed, 71 insertions(+), 8 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 52487f2..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,21 +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 { 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: {
@@ -40,13 +58,21 @@
// 鐐瑰嚮琛岄�変腑
// 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,
@@ -68,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;
+ }
}
});
@@ -81,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();
}
@@ -115,6 +166,11 @@
fieldMappingTime: formOptions.fieldMappingTime
});
}
+
+/**
+ * 娲惧伐
+ */
+function handleSendWork() {}
onMounted(async () => {
await setupDeptSelect();
@@ -186,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>
@@ -225,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