diff --git a/src/api/eam/equipmentMaintenanceMain/index.ts b/src/api/eam/equipmentMaintenanceMain/index.ts index 5bc59771d..4037defac 100644 --- a/src/api/eam/equipmentMaintenanceMain/index.ts +++ b/src/api/eam/equipmentMaintenanceMain/index.ts @@ -3,27 +3,32 @@ import {EquipmentMainPartVO} from "@/api/eam/equipmentMainPart"; export interface EquipmentMaintenanceMainVO { id: number - number: string describing: string + number: string + sources: string equipmentCode: string type: string - classes: string - planNumber: string faultType: string - cycle: string - times: string + planNumber: string + planStartTime: Date + planEndTime: Date + startTime: Date + endTime: Date + classType: string verifyer: number verifyContent: string verifyTime: Date maintenancer: number maintenancePhone: string - completeResult: string completionTime: Date maintenanceTime: Date status: string + autoOrder: string + autoPerform: string + autoVerify: string + directCreateRecord: string factoryAreaCode: string workshopCode: string - workshopSectionCode: string departmentCode: string remark: string siteId: string @@ -49,6 +54,12 @@ export const getEquipmentMaintenanceMain = async (id: number) => { return await request.get({ url: `/eam/equipment-maintenance-main/get?id=` + id }) } + + +export const getMaintenanceOrderConfig = async () => { + return await request.get({ url: `/eam/equipment-maintenance-main/get-order-config`}) +} + // 新增设备保养工单主 export const createEquipmentMaintenanceMain = async (data: EquipmentMaintenanceMainVO) => { return await request.post({ url: `/eam/equipment-maintenance-main/create`, data }) diff --git a/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts b/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts index d2f92e2ed..717f499ca 100644 --- a/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts +++ b/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts @@ -7,15 +7,16 @@ import * as WorkshopApi from "@/api/wms/workshop"; import {RelationMaintenancePlanItem} from "@/views/eam/maintenance/maintenance.data"; import * as ItemApi from "@/api/eam/relationMaintenancePlanItem"; import {validateroundNumber} from "@/utils/validator"; -import {getRelationMaintenancePlanItemPage} from "@/api/eam/relationMaintenancePlanItem"; // 表单校验 export const EquipmentMaintenanceMainRules = reactive({ number: [required], + sources: [required], equipmentCode: [required], - planNumber: [required], + type: [required], + planStartTime: [required], + planEndTime: [required], status: [required], - factoryAreaCode: [required], }) export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ @@ -29,23 +30,23 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ isDetail:false, }, { - label: '保养工单编号', - field: 'number', + label: '描述', + field: 'describing', sort: 'custom', + isSearch: false, + isTable: false, isForm: false, - isSearch: true, + isDetail:false, }, { - label: '描述', - field: 'describing', + label: '保养工单编号', + field: 'number', sort: 'custom', isSearch: true, }, { - label: '设备类别', - field: 'type', - dictType: DICT_TYPE.DEVICE_TYPE, - dictClass: 'string', + label: '来源字典', + field: 'sources', sort: 'custom', isSearch: true, }, @@ -75,8 +76,16 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ } }, { - label: '班次枚举', - field: 'classes', + label: '设备类别', + field: 'type', + dictType: DICT_TYPE.DEVICE_TYPE, + dictClass: 'string', + sort: 'custom', + isSearch: true, + }, + { + label: '故障类型枚举', + field: 'faultType', sort: 'custom', isSearch: true, }, @@ -87,26 +96,98 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ isSearch: true, }, { - label: '故障类型枚举', - field: 'faultType', + label: '计划开始时间', + field: 'planStartTime', sort: 'custom', + formatter: dateFormatter, isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, }, { - label: '保养周期', - field: 'cycle', + label: '计划结束时间', + field: 'planEndTime', sort: 'custom', + formatter: dateFormatter, isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, }, { - label: '保养次数', - field: 'times', + label: '保养开始时间', + field: 'startTime', sort: 'custom', + formatter: dateFormatter, isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, form: { - component: 'InputNumber', - value: 0 + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '保养结束时间', + field: 'endTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '保养班组', + field: 'classType', + sort: 'custom', + isSearch: true, }, { label: '验证人', @@ -119,6 +200,13 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ field: 'verifyContent', sort: 'custom', isSearch: true, + form: { + component: 'Editor', + componentProps: { + valueHtml: '', + height: 200 + } + }, }, { label: '验证时间', @@ -154,12 +242,6 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ sort: 'custom', isSearch: true, }, - { - label: '结果枚举临时措施、完成', - field: 'completeResult', - sort: 'custom', - isSearch: true, - }, { label: '完成时间', field: 'completionTime', @@ -212,14 +294,35 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ dictType: DICT_TYPE.EAM_ORDER_STATUS, dictClass: 'string', }, + // { + // label: '自动接单', + // field: 'autoOrder', + // sort: 'custom', + // isSearch: true, + // }, + // { + // label: '自动执行', + // field: 'autoPerform', + // sort: 'custom', + // isSearch: true, + // }, + // { + // label: '自动验证', + // field: 'autoVerify', + // sort: 'custom', + // isSearch: true, + // }, + { + label: '直接生成记录', + field: 'directCreateRecord', + sort: 'custom', + isSearch: true, + }, { label: '所属厂区编号', field: 'factoryAreaCode', sort: 'custom', - isSearch: false, - isTable: false, - isForm: false, - isDetail:false, + isSearch: true, }, { label: '车间编号', @@ -288,9 +391,10 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ label: '是否可用默认TRUE', field: 'available', sort: 'custom', - isSearch: true, - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, }, { label: '删除时间', @@ -351,6 +455,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ ])) + export const EquipmentMaintenanceDetailRules = reactive({ number: [required], masterId: [required], diff --git a/src/views/eam/equipmentMaintenanceMain/finishForm.vue b/src/views/eam/equipmentMaintenanceMain/finishForm.vue new file mode 100644 index 000000000..3834f8f70 --- /dev/null +++ b/src/views/eam/equipmentMaintenanceMain/finishForm.vue @@ -0,0 +1,232 @@ + + + + diff --git a/src/views/eam/equipmentMaintenanceMain/index.vue b/src/views/eam/equipmentMaintenanceMain/index.vue index 4e0295cb2..fb244e15a 100644 --- a/src/views/eam/equipmentMaintenanceMain/index.vue +++ b/src/views/eam/equipmentMaintenanceMain/index.vue @@ -51,6 +51,20 @@ @onChange="onChange" /> + + + + { } else if (val == 'execute') { // 执行 handleExecute(row.id) } else if (val == 'finish') { // 完成 - handleFinish(row.id) + handleFinish(row) } else if (val == 'validate') { // 验证 handleValidate(row.id) } @@ -330,22 +345,38 @@ const handleExecute = async (id: number) => { } /** 完成按钮操作 */ -const handleFinish = async (id: number) => { - try { - // 中止的二次确认 - await message.delConfirm('是否完成所选中工单?'); - const params = ref({ - id: '', - status:'', - }) - params.value.id = id - params.value.status = '5' - // 发起 - await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) - message.success(t('工单已完成')) - // 刷新列表 - await getList() - } catch {} +const finishFormRef = ref() +const handleFinish = async (row) => { + let res = await EquipmentMaintenanceMainApi.getMaintenanceOrderConfig(); + //系统配置需要验证 + if(res.remark === 'TRUE'){ + try { + // 中止的二次确认 + await message.delConfirm('是否完成所选中工单?'); + const params = ref({ + id: '', + status:'', + }) + params.value.id = row.id + params.value.status = '5' + // 发起 + await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) + message.success(t('工单已完成')) + // 刷新列表 + await getList() + } catch {} + } + //系统配置不需要验证 + if(res.remark === 'FALSE'){ + try { + // 中止的二次确认 + await message.delConfirm('是否完成所选中工单?'); + + //打开提交表单 + finishFormRef.value.open('update', row); + + } catch {} + } } /** 验证按钮操作 */ @@ -498,6 +529,30 @@ const searchFormClick = (searchData) => { getList() // 刷新当前列表 } +const getClosed=(val)=> { + //console.log('orderday-publishClosed-200',val) + nextTick?.(() => { + console.log(val) + getList() + }) +} + +const getData=(val)=> { + nextTick?.(async () => { + console.log(val) + const params = ref({ + id: '', + status: '', + }) + params.value.id = val + params.value.status = '5' + // 发起 + await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) + message.success(t('工单已完成')) + // 刷新列表 + await getList()}) +} + /** 初始化 **/ onMounted(async () => { getList()