From c180306a3985173e42e2c65b188054ea02b101de Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 8 May 2024 17:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basic/fixedAssets/index.ts | 5 +- src/api/eam/mold/moldInspectionMain/index.ts | 8 ++- .../eam/basic/fixedAssets/fixedAssets.data.ts | 16 ++++- src/views/eam/basic/moldMaintenance/index.vue | 3 +- .../deviceMaintenanceMain.data.ts | 2 +- .../eam/device/devicemaintenancejob/index.vue | 60 +++++++------------ .../eam/mold/moldinspectionjob/index.vue | 4 +- 7 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/api/eam/basic/fixedAssets/index.ts b/src/api/eam/basic/fixedAssets/index.ts index 6911147..042214b 100644 --- a/src/api/eam/basic/fixedAssets/index.ts +++ b/src/api/eam/basic/fixedAssets/index.ts @@ -1,7 +1,7 @@ import request from '@/config/axios' import { getStrDictOptions } from '@/utils/dict' import { useUserStore } from '@/store/modules/user' - +import { checkPermi } from '@/utils/permission' export interface FixedAssetsVO { number: string name: string @@ -31,13 +31,12 @@ export const getFixedAssetsPage = async (params) => { ); const admin = userStore.roles.find(role => { - if (role == 'gdzc_admin') { + if(checkPermi(['gdzc_admin'])){ return true; } else { return false; } }); - // 如果找到了匹配的角色,将它作为manageDept的值加入到params中 if (matchingRole) { params.manageDept = matchingRole; // 这里只添加第一个匹配的角色 diff --git a/src/api/eam/mold/moldInspectionMain/index.ts b/src/api/eam/mold/moldInspectionMain/index.ts index 10190c7..59f633f 100644 --- a/src/api/eam/mold/moldInspectionMain/index.ts +++ b/src/api/eam/mold/moldInspectionMain/index.ts @@ -58,6 +58,12 @@ export const importTemplate = () => { } +// 检修完成 +export const finishInspection = (id: number) => { + return request.get({ url: `/eam/mold-inspection-job-main/orderClickFinish?id=` + id }) +} + + // 查询检修工单主列表 export const getMoldInspectionMainNoPage = async (params) => { return await request.get({ url: `/eam/mold-inspection-job-main/noPage`, params }) @@ -66,5 +72,5 @@ export const getMoldInspectionMainNoPage = async (params) => { //验证 export const verifyOrder = async (id: number,verifyContent: string) => { - return await request.get({ url: `/eam/mold-inspection-job-main/onVerify?id=`+id+`&verifyContent=` + verifyContent }) + return await request.get({ url: `/eam/mold-inspection-job-main/orderClickVerify?id=`+id+`&verifyContent=` + verifyContent }) } diff --git a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts index fe6876c..61a7044 100644 --- a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts +++ b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts @@ -3,9 +3,23 @@ import { dateFormatter } from '@/utils/formatTime' import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator' import * as LocationApi from '@/api/eam/basic/location' import * as SupplierApi from '@/api/eam/basic/supplier' +import { useUserStore } from '@/store/modules/user' +import { checkPermi } from '@/utils/permission' const localtionList = await LocationApi.getLocationNoPage() const supplierList = await SupplierApi.getSupplierNoPage() +const userStore = useUserStore() // 用户信息 +const admin = userStore.roles.find(role => { + if(checkPermi(['gdzc_admin'])){ + return true; + } else { + return false; + } +}); +const isAdmin = ref(false); +if (admin) { + isAdmin.value = true; +} // 表单校验 export const FixedAssetsRules = reactive({ @@ -151,7 +165,7 @@ export const FixedAssets = useCrudSchemas(reactive([ label: '管理部门', field: 'manageDept', sort: 'custom', - isForm: false, + isForm: isAdmin.value, dictType: DICT_TYPE.SPECIAL_DEPT_ROLE, dictClass: 'string', table: { diff --git a/src/views/eam/basic/moldMaintenance/index.vue b/src/views/eam/basic/moldMaintenance/index.vue index e82ade8..9258146 100644 --- a/src/views/eam/basic/moldMaintenance/index.vue +++ b/src/views/eam/basic/moldMaintenance/index.vue @@ -239,14 +239,12 @@ const formsSuccess = async (formType,data) => { openDataNew.value = data if(judgeSame()){ basicFormRef.value.dialogVisible = false - getList() }else{ updateData.value = data dialogVisible.value = true } } basicFormRef.value.dialogVisible = false - getList() } /** 详情操作 */ @@ -309,6 +307,7 @@ const onSubmit = async () => { message.success(t('common.delSuccess')) dialogVisible.value = false; } + getList() } catch (error) { console.error(error); // 假设这里是操作失败,不关闭basicFormRef窗口 diff --git a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts index 6c56755..abd9202 100644 --- a/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts +++ b/src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts @@ -235,7 +235,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([ labelField: 'label', valueField: 'value' }, - disabled: true, + // disabled: true, filterable: true, placeholder: "请选择设备" } diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index 9831cfb..5aa405c 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -361,38 +361,18 @@ const judgeIsTheClass = (row) => { } } -const judgeIsTheFactory = (row) => { - return userStore.userSelfInfo.deptId == row.factoryAreaNumber -} - - -const judgeIsTheClassEngineer = (row) => { - 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 != undefined && rolesOk != null) { - return true - } else { - return false - } -} - const judgeIsTheClassEngineerAndApply = (row,type) => { // 根据不同的状态进行判断 - // if (row.status === 'COMPLETED' && type == 'CONFIRM') { - if (row.status === 'COMPLETED') { + if (row.status === 'COMPLETED' && type == 'CONFIRM') { // COMPLETED状态下,需要额外判断requestNumber和declarer if(row.requestNumber != null && row.requestNumber !== '' && row.declarer === userStore.getUser.id){ return true }else{ return false } + }else if(row.status === 'APPLYPASS' && type == 'VERIFY'){ + return true } - // 如果不是COMPLETED或APPLYPASS状态,或者COMPLETED状态下条件不满足,则默认返回false return false; } @@ -452,7 +432,7 @@ const butttondata = (row) => { defaultButtons.acceptOrderBtn({ hasPermi:'eam:device-maintenance-job-main:orderClick', hide: !( - row.status == 'PENDING' && judgeIsTheFactory(row) + row.status == 'PENDING' ) }), // 接单 defaultButtons.turnOrderBtn({ @@ -466,7 +446,7 @@ const butttondata = (row) => { defaultButtons.verifyOrderBtn({ hasPermi:'eam:device-maintenance-job-main:orderClickVerify', hide: !( - judgeIsTheClassEngineerAndApply(row,'VERIFY') && judgeIsTheFactory(row) + judgeIsTheClassEngineerAndApply(row,'VERIFY') ) }), // 验证 defaultButtons.finishOrderBtn({ @@ -491,11 +471,11 @@ const onChange = (field, cur, item) => { // console.log(item) // console.log(item.componentProps.options) formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id) - if (judgeIfDeviceRole()) { - formRef.value.formRef.formModel.type = 'DEVICE' - } else { - formRef.value.formRef.formModel.type = 'TECH' - } + // if (judgeIfDeviceRole()) { + // formRef.value.formRef.formModel.type = 'DEVICE' + // } else { + // formRef.value.formRef.formModel.type = 'TECH' + // } } } @@ -1186,16 +1166,16 @@ const getActorClass = () => { } -const judgeIfDeviceRole = () => { - const rolesOk = userStore.roles.find(item => { - return item == 'device_class_worker_role' || item == 'device_class_Engineer_role' - }) - if (rolesOk != undefined && rolesOk != null) { - return true - } else { - return false - } -} +// const judgeIfDeviceRole = () => { +// const rolesOk = userStore.roles.find(item => { +// return item == 'device_class_worker_role' || item == 'device_class_Engineer_role' +// }) +// if (rolesOk != undefined && rolesOk != null) { +// return true +// } else { +// return false +// } +// } const validateRow = (row) => { let flag = true; diff --git a/src/views/eam/mold/moldinspectionjob/index.vue b/src/views/eam/mold/moldinspectionjob/index.vue index deef944..883c47d 100644 --- a/src/views/eam/mold/moldinspectionjob/index.vue +++ b/src/views/eam/mold/moldinspectionjob/index.vue @@ -404,7 +404,7 @@ function handleFinishOrder(row) { let param = { masterId : row.id } - DeviceInspectionDetailApi.getDeviceInspectionDetailPage(param + MoldInspectionDetailApi.getMoldInspectionDetailPage(param ).then(response => { if (response != null) { if (response.list.length == 0) { @@ -417,7 +417,7 @@ function handleFinishOrder(row) { // message.error(t('请先完成各检修明细内容!')) // return // } else { - DeviceInspectionMainApi.finishInspection(row.id).then(res => { + MoldInspectionMainApi.finishInspection(row.id).then(res => { message.success(t('common.finishSuccess')) getList() })