diff --git a/src/views/eam/basic/deviceMoldItemsHistory/deviceMoldItemsHistory.data.ts b/src/views/eam/basic/deviceMoldItemsHistory/deviceMoldItemsHistory.data.ts index aef48ae..a4f903d 100644 --- a/src/views/eam/basic/deviceMoldItemsHistory/deviceMoldItemsHistory.data.ts +++ b/src/views/eam/basic/deviceMoldItemsHistory/deviceMoldItemsHistory.data.ts @@ -1,6 +1,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' +import * as UserApi from '@/api/system/user' +const userListAll = await UserApi.getSimpleUserList() const operatTypeList = getStrDictOptions(DICT_TYPE.SYSTEM_OPERATE_TYPE).filter(item => { return (item.value == '2' || item.value == '3' || item.value == '4') }) @@ -127,6 +129,28 @@ export const DeviceMoldItemsHistory = useCrudSchemas(reactive([ } } }, + { + label: '操作人', + field: 'creator', + sort: 'custom', + isForm: false, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return userListAll.find((account) => account.id == cellValue)?.nickname + }, + table: { + width: 170 + }, + }, + { + label: '操作时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isForm: false, + table: { + width: 170 + }, + }, { label: '操作类型', field: 'operatType', @@ -149,6 +173,7 @@ export const DeviceMoldItemsHistory = useCrudSchemas(reactive([ }, } }, + { label: '操作备注', field: 'remark', diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index 909b6f8..1a599dd 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -354,6 +354,10 @@ const judgeIsTheClass = (row) => { } } +const judgeIsTheFactory = (row) => { + return userStore.userSelfInfo.deptId == row.factoryAreaNumber +} + const judgeIsTheClassEngineer = (row) => { const rolesOk = userStore.roles.find(item => { @@ -371,16 +375,6 @@ const judgeIsTheClassEngineer = (row) => { } const judgeIsTheClassEngineerAndApply = (row,type) => { - // 先判断角色是否满足条件 - const rolesOk = userStore.roles.some(item => { - if (row.type == 'DEVICE') { - return item === 'device_class_Engineer_role'; - } else if (row.type == 'TECH') { - return item === 'tech_class_Engineer_role'; - } - }); - // 如果角色不满足条件,直接返回false - if (!rolesOk) return false; // 根据不同的状态进行判断 if (row.status === 'COMPLETED' && type == 'CONFIRM') { // COMPLETED状态下,需要额外判断requestNumber和declarer @@ -389,10 +383,28 @@ const judgeIsTheClassEngineerAndApply = (row,type) => { }else{ return false } + }else if(row.status === 'COMPLETED' && type == 'VERIFY'){ + if(row.requestNumber == null || row.requestNumber == ''){ + // 先判断角色是否满足条件 + const rolesOk = userStore.roles.find(item => { + if (row.type == 'DEVICE') { + return item == 'device_class_Engineer_role' + }else if (row.type == 'TECH') { + return item == 'tech_class_Engineer_role' + } + }) + if(rolesOk) return true + } } else if (row.status === 'APPLYPASS' && type == 'VERIFY') { - // APPLYPASS状态下,可能有其他逻辑,这里直接返回true作为示例 - // 根据实际情况,这里可能需要添加额外的逻辑判断 - return true; + // 先判断角色是否满足条件 + const rolesOk = userStore.roles.find(item => { + if (row.type == 'DEVICE') { + return item == 'device_class_Engineer_role' + }else if (row.type == 'TECH') { + return item == 'tech_class_Engineer_role' + } + }) + if(rolesOk) return true } // 如果不是COMPLETED或APPLYPASS状态,或者COMPLETED状态下条件不满足,则默认返回false @@ -417,6 +429,7 @@ const judgeIsTheClassWorker = (row) => { } + // 列表头部按钮 const HeadButttondata = [ defaultButtons.defaultAddBtn({ hide: !(judgeHasAddFunc()) }), // 新增 @@ -469,7 +482,7 @@ const butttondata = (row) => { defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED' && row.status != 'APPLYPASS' && isReceiver(row.maintenance) )}), // 编辑 defaultButtons.acceptOrderBtn({ hide: !( - row.status == 'PENDING' && judgeIsTheClass(row) + row.status == 'PENDING' && judgeIsTheClass(row) && judgeIsTheFactory(row) ) }), // 接单 defaultButtons.turnOrderBtn({ @@ -480,7 +493,7 @@ const butttondata = (row) => { }), // 维修 defaultButtons.verifyOrderBtn({ hide: !( - judgeIsTheClassEngineerAndApply(row,'VERIFY') + judgeIsTheClassEngineerAndApply(row,'VERIFY') && judgeIsTheFactory(row) ) }), // 验证 defaultButtons.finishOrderBtn({ diff --git a/src/views/eam/mold/moldmaintenancejob/index.vue b/src/views/eam/mold/moldmaintenancejob/index.vue index da9bcf4..363d10a 100644 --- a/src/views/eam/mold/moldmaintenancejob/index.vue +++ b/src/views/eam/mold/moldmaintenancejob/index.vue @@ -351,6 +351,10 @@ const judgeIsTheClass = (row) => { } } +const judgeIsTheFactory = (row) => { + return userStore.userSelfInfo.deptId == row.factoryAreaNumber +} + const judgeIsTheClassEngineer = (row) => { const rolesOk = userStore.roles.find(item => { if (row.type == 'MOLD') { @@ -436,7 +440,7 @@ const butttondata = (row) => { defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED' && row.status != 'APPLYPASS' && isReceiver(row.maintenance) )}), // 编辑 defaultButtons.acceptOrderBtn({ hide: !( - row.status == 'PENDING' && judgeIsTheClass(row) + row.status == 'PENDING' && judgeIsTheClass(row) && judgeIsTheFactory(row) ) }), // 接单 defaultButtons.turnOrderBtn({ @@ -447,11 +451,11 @@ const butttondata = (row) => { }), // 维修 defaultButtons.verifyOrderBtn({ hide: !( - judgeIsTheClassEngineerAndApply(row,'VERIFY') + judgeIsTheClassEngineerAndApply(row,'VERIFY') && judgeIsTheFactory(row) ) }), // 验证 defaultButtons.finishOrderBtn({ - hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id && row.hasDetails) + hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id && row.hasDetails) }), // 完成 defaultButtons.confirmOrderBtn({ hide: !( @@ -1138,14 +1142,6 @@ const validateRow = (row) => { const judgeIsTheClassEngineerAndApply = (row,type) => { - // 先判断角色是否满足条件 - const rolesOk = userStore.roles.some(item => { - if (row.type == 'MOLD') { - return item === 'mold_class_Engineer_role'; - } - }); - // 如果角色不满足条件,直接返回false - if (!rolesOk) return false; // 根据不同的状态进行判断 if (row.status === 'COMPLETED' && type == 'CONFIRM') { // COMPLETED状态下,需要额外判断requestNumber和declarer @@ -1154,10 +1150,24 @@ const judgeIsTheClassEngineerAndApply = (row,type) => { }else{ return false } - } else if (row.status === 'APPLYPASS' && type == 'VERIFY') { - // APPLYPASS状态下,可能有其他逻辑,这里直接返回true作为示例 - // 根据实际情况,这里可能需要添加额外的逻辑判断 - return true; + }else if(row.status === 'COMPLETED' && type == 'VERIFY') { + if(row.requestNumber == null || row.requestNumber == ''){ + // 先判断角色是否满足条件 + const rolesOk = userStore.roles.some(item => { + if (row.type == 'MOLD') { + return item === 'mold_class_Engineer_role'; + } + }); + if(rolesOk) return true + } + }else if (row.status === 'APPLYPASS' && type == 'VERIFY') { + // 先判断角色是否满足条件 + const rolesOk = userStore.roles.some(item => { + if (row.type == 'MOLD') { + return item === 'mold_class_Engineer_role'; + } + }); + if(rolesOk) return true } // 如果不是COMPLETED或APPLYPASS状态,或者COMPLETED状态下条件不满足,则默认返回false