diff --git a/src/api/eam/equipmentMaintenanceMain/index.ts b/src/api/eam/equipmentMaintenanceMain/index.ts index 6509d8dc0..a3ba8d8db 100644 --- a/src/api/eam/equipmentMaintenanceMain/index.ts +++ b/src/api/eam/equipmentMaintenanceMain/index.ts @@ -78,3 +78,8 @@ export const importTemplate = () => { export const updateEnableCode = async (data: EquipmentMainPartVO) => { return await request.post({ url: `/eam/equipment-maintenance-main/ables` , data }) } + +// 执行保养工单 +export const executeMaintenanceOrder = async (data: EquipmentMainPartVO) => { + return await request.post({ url: `/eam/equipment-maintenance-main/execute`, data }) +} diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index 38e469d75..b32418e0a 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -325,6 +325,19 @@ export function mainListReceiveBtn(option:any) { }) } +// 主列表-执行按钮 +export function mainListExecuteBtn(option:any) { + return __defaultBtnOption(option,{ + label: t(`ts.执行`).replace('ts.', ''), + name: 'execute', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 主列表-完成按钮 export function mainListFinishBtn(option:any) { return __defaultBtnOption(option,{ diff --git a/src/views/eam/equipmentMaintenanceMain/index.vue b/src/views/eam/equipmentMaintenanceMain/index.vue index 52f6474ef..7317de2b2 100644 --- a/src/views/eam/equipmentMaintenanceMain/index.vue +++ b/src/views/eam/equipmentMaintenanceMain/index.vue @@ -79,6 +79,8 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data"; import * as ToolItemApi from "@/api/eam/toolAccounts"; +import * as ReworkBatchApi from "@/api/mes/reworkBatch"; +import {mainListExecuteBtn} from "@/utils/disposition/defaultButtons"; defineOptions({ name: 'EquipmentMaintenanceMain' }) @@ -153,11 +155,21 @@ const isShowMainButton = (row,val) => { } } +const isShowStatusButton = (row,val) => { + if (val.indexOf(row.status) > -1) { + return false + } else { + return true + } +} + // 列表-操作按钮 const butttondata = (row) => { return [ defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceMain:update'}), // 编辑 //defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceMain:delete'}), // 删除 + defaultButtons.mainListReceiveBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:maintenance:update'}), // 领取 + defaultButtons.mainListExecuteBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:maintenance:update'}), // 执行 defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}), defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}), ] @@ -169,6 +181,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + } else if (val == 'receive') { // 领取 + handleReceive(row.id) + } else if (val == 'execute') { // 执行 + handleExecute(row.id) } } @@ -235,6 +251,44 @@ const handleDelete = async (id: number) => { } catch {} } +/** 领取按钮操作 */ +const handleReceive = async (id: number) => { + try { + // 中止的二次确认 + await message.delConfirm('是否领取所选中任务?'); + const params = ref({ + id: '', + status:'', + }) + params.value.id = id + params.value.status = '4' + // 发起删除 + await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) + message.success(t('领取成功')) + // 刷新列表 + await getList() + } catch {} +} + +/** 执行按钮操作 */ +const handleExecute = 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 handleEnable = async (id: number) => { try {