From 3497c5f377ec117fb91e7ac5d27777feb1129895 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Fri, 17 May 2024 11:23:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=85=BB=E9=A1=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/maintenanceItem/index.ts | 61 ++++ src/config/axios/config.ts | 2 +- src/views/eam/equipmentManufacturer/index.vue | 1 - src/views/eam/equipmentSupplier/index.vue | 1 - src/views/eam/inspectionItem/index.vue | 1 - .../eam/inspectionItem/inspectionItem.data.ts | 34 +-- src/views/eam/maintenanceItem/index.vue | 268 ++++++++++++++++++ .../maintenanceItem/maintenanceItem.data.ts | 106 +++++++ src/views/eam/spotCheckItem/index.vue | 1 - .../eam/spotCheckItem/spotCheckItem.data.ts | 21 +- 10 files changed, 463 insertions(+), 33 deletions(-) create mode 100644 src/api/eam/maintenanceItem/index.ts create mode 100644 src/views/eam/maintenanceItem/index.vue create mode 100644 src/views/eam/maintenanceItem/maintenanceItem.data.ts diff --git a/src/api/eam/maintenanceItem/index.ts b/src/api/eam/maintenanceItem/index.ts new file mode 100644 index 000000000..403c459dc --- /dev/null +++ b/src/api/eam/maintenanceItem/index.ts @@ -0,0 +1,61 @@ +import request from '@/config/axios' + +export interface MaintenanceItemVO { + id: number + content: string + serialNumber: number + equipmentParts: string + departmentCode: string + remark: string + siteId: string + available: string + deletionTime: Date + deleterId: byte[] + concurrencyStamp: number +} + +// 查询保养项维护列表 +export const getMaintenanceItemPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/basic/maintenance-item/senior', data }) + } else { + return await request.get({ url: `/eam/basic/maintenance-item/page`, params }) + } +} + +// 查询保养项维护详情 +export const getMaintenanceItem = async (id: number) => { + return await request.get({ url: `/eam/basic/maintenance-item/get?id=` + id }) +} + +// 新增保养项维护 +export const createMaintenanceItem = async (data: MaintenanceItemVO) => { + return await request.post({ url: `/eam/basic/maintenance-item/create`, data }) +} + +// 修改保养项维护 +export const updateMaintenanceItem = async (data: MaintenanceItemVO) => { + return await request.put({ url: `/eam/basic/maintenance-item/update`, data }) +} + +// 删除保养项维护 +export const deleteMaintenanceItem = async (id: number) => { + return await request.delete({ url: `/eam/basic/maintenance-item/delete?id=` + id }) +} + +// 导出保养项维护 Excel +export const exportMaintenanceItem = async (params) => { + if (params.isSearch) { + const data = { ...params } + return await request.downloadPost({ url: `/eam/basic/maintenance-item/export-excel-senior`, data }) + } else { + return await request.download({ url: `/eam/basic/maintenance-item/export-excel`, params }) + } +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/basic/maintenance-item/get-import-template' }) +} \ No newline at end of file diff --git a/src/config/axios/config.ts b/src/config/axios/config.ts index 811650873..7f7b94732 100644 --- a/src/config/axios/config.ts +++ b/src/config/axios/config.ts @@ -16,7 +16,7 @@ const config: { /** * 接口请求超时时间 */ - request_timeout: 30000, + request_timeout: 3000000, /** * 默认接口请求类型 diff --git a/src/views/eam/equipmentManufacturer/index.vue b/src/views/eam/equipmentManufacturer/index.vue index b30215282..9db5fb151 100644 --- a/src/views/eam/equipmentManufacturer/index.vue +++ b/src/views/eam/equipmentManufacturer/index.vue @@ -256,7 +256,6 @@ const handleEnable = (row,enable) =>{ row.available = enable EquipmentManufacturerApi.updateEquipmentManufacturer(row).then(res => { message.success(t('common.updateSuccess')) - getList() }) }) diff --git a/src/views/eam/equipmentSupplier/index.vue b/src/views/eam/equipmentSupplier/index.vue index e9ffeac07..af2a2bd16 100644 --- a/src/views/eam/equipmentSupplier/index.vue +++ b/src/views/eam/equipmentSupplier/index.vue @@ -256,7 +256,6 @@ const handleEnable = (row,enable) =>{ row.available = enable EquipmentSupplierApi.updateEquipmentSupplier(row).then(res => { message.success(t('common.updateSuccess')) - getList() }) }) } diff --git a/src/views/eam/inspectionItem/index.vue b/src/views/eam/inspectionItem/index.vue index fb132513f..8e95cb776 100644 --- a/src/views/eam/inspectionItem/index.vue +++ b/src/views/eam/inspectionItem/index.vue @@ -257,7 +257,6 @@ const handleEnable = (row,enable) =>{ row.available = enable InspectionItemApi.updateInspectionItem(row).then(res => { message.success(t('common.updateSuccess')) - getList() }) }) } diff --git a/src/views/eam/inspectionItem/inspectionItem.data.ts b/src/views/eam/inspectionItem/inspectionItem.data.ts index 1e310154e..e652e6091 100644 --- a/src/views/eam/inspectionItem/inspectionItem.data.ts +++ b/src/views/eam/inspectionItem/inspectionItem.data.ts @@ -17,6 +17,16 @@ export const InspectionItemRules = reactive({ export const InspectionItem = useCrudSchemas(reactive([ + { + label: '序号', + field: 'serialNumber', + sort: 'custom', + isSearch: true, + fixed: 'left', + form: { + component:'InputNumber' + }, + }, { label: '巡检内容', field: 'content', @@ -41,16 +51,6 @@ export const InspectionItem = useCrudSchemas(reactive([ sort: 'custom', isSearch: true }, - { - label: '序号', - field: 'serialNumber', - sort: 'custom', - isSearch: true, - fixed: 'left', - form: { - component:'InputNumber' - }, - }, { label: '来源于类型配置', field: 'type', @@ -84,13 +84,13 @@ export const InspectionItem = useCrudSchemas(reactive([ label: '是否启用', field: 'available', sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', // 默认都是字符串类型其他暂不考虑 - isTable: true, - isDetail: false, - isSearch: false, - isTableForm: false, - isForm: false, + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isTable: true, + isDetail: false, + isSearch: false, + isTableForm: false, + isForm: false, }, { label: '备注', diff --git a/src/views/eam/maintenanceItem/index.vue b/src/views/eam/maintenanceItem/index.vue new file mode 100644 index 000000000..bf32498c2 --- /dev/null +++ b/src/views/eam/maintenanceItem/index.vue @@ -0,0 +1,268 @@ + + + diff --git a/src/views/eam/maintenanceItem/maintenanceItem.data.ts b/src/views/eam/maintenanceItem/maintenanceItem.data.ts new file mode 100644 index 000000000..82f964601 --- /dev/null +++ b/src/views/eam/maintenanceItem/maintenanceItem.data.ts @@ -0,0 +1,106 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' +import { handleTreeToComponentOptions } from '@/utils/tree' +import * as DeptApi from '@/api/system/dept' +const deptList = ref([]) // 树形结构 + +// 加载部门树(默认格式) +deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList()) + +// 表单校验 +export const MaintenanceItemRules = reactive({ + content: [required], + serialNumber: [required], + concurrencyStamp: [required] +}) + +export const MaintenanceItem = useCrudSchemas(reactive([ + + { + label: '序号', + field: 'serialNumber', + sort: 'custom', + isSearch: true, + fixed: 'left', + form: { + component:'InputNumber' + }, + }, + { + label: '保养内容', + field: 'content', + sort: 'custom', + isSearch: true, + form: { + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 + } + } + }, + { + label: '保养部位', + field: 'equipmentParts', + sort: 'custom', + isSearch: true + }, + { + label: '部门', + field: 'departmentCode', + sort: 'custom', + isTable: false, + isDetail: false, + isSearch: false, + isTableForm: false, + form: { + component: 'TreeSelect', + componentProps: { // 假设deptList是部门数据列表 + data: deptList, + placeholder: "请选择部门", + filterable: true, + // multiple: true, + } + } + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: true, + form: { + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 + } + } + }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isTable: true, + isDetail: false, + isSearch: false, + isTableForm: false, + isForm: false, + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/eam/spotCheckItem/index.vue b/src/views/eam/spotCheckItem/index.vue index 6fc7ba504..997bae35f 100644 --- a/src/views/eam/spotCheckItem/index.vue +++ b/src/views/eam/spotCheckItem/index.vue @@ -256,7 +256,6 @@ const handleEnable = (row,enable) =>{ row.available = enable SpotCheckItemApi.updateSpotCheckItem(row).then(res => { message.success(t('common.updateSuccess')) - getList() }) }) } diff --git a/src/views/eam/spotCheckItem/spotCheckItem.data.ts b/src/views/eam/spotCheckItem/spotCheckItem.data.ts index 67902adfb..4d7e8db78 100644 --- a/src/views/eam/spotCheckItem/spotCheckItem.data.ts +++ b/src/views/eam/spotCheckItem/spotCheckItem.data.ts @@ -16,7 +16,16 @@ export const SpotCheckItemRules = reactive({ }) export const SpotCheckItem = useCrudSchemas(reactive([ - + { + label: '序号', + field: 'serialNumber', + sort: 'custom', + isSearch: true, + fixed: 'left', + form: { + component:'InputNumber' + }, + }, { label: '点检内容', field: 'content', @@ -35,16 +44,6 @@ export const SpotCheckItem = useCrudSchemas(reactive([ sort: 'custom', isSearch: true }, - { - label: '序号', - field: 'serialNumber', - sort: 'custom', - isSearch: true, - fixed: 'left', - form: { - component:'InputNumber' - }, - }, { label: '来源于类型配置', field: 'type',