From e1c347c5c1e9f0b85a0c8bf091a4152dc56377f7 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Mon, 5 Feb 2024 13:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .../device/deviceInspectionDetail/index.ts | 58 ++++++ src/utils/dict.ts | 2 +- .../deviceInspectionMain.data.ts | 181 +++++++++++++++++- .../eam/device/deviceInspectionMain/index.vue | 124 ++++++++++-- 5 files changed, 353 insertions(+), 14 deletions(-) create mode 100644 src/api/eam/device/deviceInspectionDetail/index.ts diff --git a/.env.development b/.env.development index 6c6c5c2..5c1f646 100644 --- a/.env.development +++ b/.env.development @@ -4,8 +4,8 @@ NODE_ENV=development VITE_DEV=false # 请求路径 -# VITE_BASE_URL='http://localhost:12080' VITE_BASE_URL='http://localhost:12080' +# VITE_BASE_URL='http://192.168.0.165:12080' # 上传路径 VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload' diff --git a/src/api/eam/device/deviceInspectionDetail/index.ts b/src/api/eam/device/deviceInspectionDetail/index.ts new file mode 100644 index 0000000..3260996 --- /dev/null +++ b/src/api/eam/device/deviceInspectionDetail/index.ts @@ -0,0 +1,58 @@ +import request from '@/config/axios' + +export interface DeviceInspectionDetailVO { + id: number + number: string + siteId: string + available: string + concurrencyStamp: number + name: string + peoples: string + estimatedMinutes: number + actualMinutes: number + chargePeoples: string + completionTime: Date + engineer: string + uncompleted: string +} + +// 查询检修工单子列表 +export const getDeviceInspectionDetailPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/device-inspection-detail/senior', data }) + } else { + return await request.get({ url: `/eam/device-inspection-detail/page`, params }) + } +} + +// 查询检修工单子详情 +export const getDeviceInspectionDetail = async (id: number) => { + return await request.get({ url: `/eam/device-inspection-detail/get?id=` + id }) +} + +// 新增检修工单子 +export const createDeviceInspectionDetail = async (data: DeviceInspectionDetailVO) => { + return await request.post({ url: `/eam/device-inspection-detail/create`, data }) +} + +// 修改检修工单子 +export const updateDeviceInspectionDetail = async (data: DeviceInspectionDetailVO) => { + return await request.put({ url: `/eam/device-inspection-detail/update`, data }) +} + +// 删除检修工单子 +export const deleteDeviceInspectionDetail = async (id: number) => { + return await request.delete({ url: `/eam/device-inspection-detail/delete?id=` + id }) +} + +// 导出检修工单子 Excel +export const exportDeviceInspectionDetail = async (params) => { + return await request.download({ url: `/eam/device-inspection-detail/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/device-inspection-detail/get-import-template' }) +} \ No newline at end of file diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 03d73bd..8072cb1 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -290,7 +290,7 @@ export enum DICT_TYPE { GET_ORDER_STATUS = 'get_order_status', //模具保养周期 IS_OPEN = 'is_open', //是否打开 ITEM_APPLY_STATUS = 'item_apply_status',//备件申领状态 - + JX_DETAILS_STATUS = 'jx_details_status', //检修明细状态 } diff --git a/src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts b/src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts index 75eff32..81e7e29 100644 --- a/src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts +++ b/src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts @@ -4,10 +4,13 @@ import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import { useUserStore } from '@/store/modules/user' import { selecUserByType } from '@/api/system/dept' import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' +import { dateFormatter } from '@/utils/formatTime' const userStore = useUserStore() const factoryList = await selectAllFactoryArea() const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }) +const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined }) +const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 2}) const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE') // 表单校验 export const DeviceInspectionMainRules = reactive({ @@ -167,7 +170,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ labelField: 'name', valueField: 'id' }, - placeholder: "请选择设备" + placeholder: "请选择维修人" }, } }, @@ -263,3 +266,179 @@ export const DeviceInspectionMain = useCrudSchemas(reactive([ } } ])) + + +// 表单校验 +export const DeviceInspectionDetailRules = reactive({ + number: [required], + estimatedMinutes: [required], + maintenance: [required], +}) + +export const DeviceInspectionDetail = useCrudSchemas(reactive([ + { + label: '检修编号', + field: 'number', + sort: 'custom', + table: { + width: '150', + }, + isSearch: false, + isForm: false, + }, + { + label: '责任人', + field: 'maintenance', + sort: 'custom', + table: { + width: '150', + }, + api: () => dutyUserList, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return dutyUserList.find((account) => account.id == cellValue)?.name + }, + form: { + component: 'Select', + api: () => dutyUserList, + componentProps: { + disabled: false, + optionsAlias: { + labelField: 'name', + valueField: 'id' + }, + placeholder: "请选择责任人" + }, + } + }, + { + label: '预计分钟', + field: 'estimatedMinutes', + sort: 'custom', + formatter: dateFormatter, + table: { + width: '150', + }, + isSearch: false, + isTable: true, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '人数', + field: 'peoples', + sort: 'custom', + table: { + width: '150', + }, + isSearch: false, + isForm: true, + isTable: true, + }, + + { + label: '实际分钟', + field: 'actualMinutes', + sort: 'custom', + formatter: dateFormatter, + table: { + width: '150', + }, + isSearch: false, + isTable: true, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + + { + label: '完成时间', + field: 'completionTime', + sort: 'custom', + formatter: dateFormatter, + table: { + width: '150', + }, + isSearch: false, + isTable: true, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '工程师确认', + field: 'engineer', + sort: 'custom', + isSearch: false, + table: { + width: '150', + }, + api: () => engineerList, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return engineerList.find((account) => account.id == cellValue)?.name + }, + form: { + component: 'Select', + api: () => engineerList, + componentProps: { + disabled: false, + optionsAlias: { + labelField: 'name', + valueField: 'id' + }, + placeholder: "请选择工程师" + }, + } + }, + { + label: '是否完成', + field: 'status', + sort: 'custom', + table: { + width: '150', + }, + isSearch: false, + isTable: true, + dictType: DICT_TYPE.JX_DETAILS_STATUS, + dictClass: 'string', + form: { + component: 'Select', + componentProps: { + disabled: false, + } + }, + }, + { + label: '未完成原因', + field: 'uncompleted', + sort: 'custom', + table: { + width: '150', + }, + isSearch: false, + isForm: true, + isTable: true, + }, + + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/eam/device/deviceInspectionMain/index.vue b/src/views/eam/device/deviceInspectionMain/index.vue index 884246d..d500c1d 100644 --- a/src/views/eam/device/deviceInspectionMain/index.vue +++ b/src/views/eam/device/deviceInspectionMain/index.vue @@ -11,13 +11,20 @@ - -