From c180306a3985173e42e2c65b188054ea02b101de Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 8 May 2024 17:13:35 +0800 Subject: [PATCH 01/14] =?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() }) From 935e5ea21e9d2a56f704810910f38fca453b06fd Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Thu, 9 May 2024 08:52:50 +0800 Subject: [PATCH 02/14] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basic/fixedAssets/index.ts | 8 +------- .../eam/basic/classType/classType.data.ts | 18 ++++++++++++++++-- .../eam/basic/fixedAssets/fixedAssets.data.ts | 14 ++------------ .../eam/device/devicemaintenancejob/index.vue | 2 +- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/api/eam/basic/fixedAssets/index.ts b/src/api/eam/basic/fixedAssets/index.ts index 042214b..aaa2a02 100644 --- a/src/api/eam/basic/fixedAssets/index.ts +++ b/src/api/eam/basic/fixedAssets/index.ts @@ -30,13 +30,7 @@ export const getFixedAssetsPage = async (params) => { deviceMoldTypeList.some(deviceMold => deviceMold.value === role) ); - const admin = userStore.roles.find(role => { - if(checkPermi(['gdzc_admin'])){ - return true; - } else { - return false; - } - }); + const admin = checkPermi(['gdzc_admin']); // 如果找到了匹配的角色,将它作为manageDept的值加入到params中 if (matchingRole) { params.manageDept = matchingRole; // 这里只添加第一个匹配的角色 diff --git a/src/views/eam/basic/classType/classType.data.ts b/src/views/eam/basic/classType/classType.data.ts index 605c18b..d2ed066 100644 --- a/src/views/eam/basic/classType/classType.data.ts +++ b/src/views/eam/basic/classType/classType.data.ts @@ -3,6 +3,7 @@ import { dateFormatter } from '@/utils/formatTime' import * as deptApi from '@/api/system/dept' import * as roleApi from '@/api/system/role' import { Role } from '@/views/system/role/role.data' +import { selectAllFactoryArea } from '@/api/system/dept' // 表单校验 export const ClassTypeRules = reactive({ workerRoleId: [required], @@ -12,6 +13,7 @@ export const ClassTypeRules = reactive({ }) const FactoryAreaNoPage = await deptApi.getDeptPage({'deptGroup':'factory'}) const roleList = await roleApi.getSimpleRoleList({}) +const factoryList = await selectAllFactoryArea() console.log('FactoryAreaNoPage',FactoryAreaNoPage); console.log('roleList',roleList); @@ -51,7 +53,7 @@ console.log('roleList',roleList); ])) export const ClassType = useCrudSchemas(reactive([ { - label: '维修工角色id', + label: '维修工角色', field: 'workerRoleId', sort: 'custom', form: { @@ -77,7 +79,7 @@ export const ClassType = useCrudSchemas(reactive([ }, }, { - label: '工程师角色id', + label: '工程师角色', field: 'engineerRoleId', sort: 'custom', form: { @@ -123,6 +125,18 @@ export const ClassType = useCrudSchemas(reactive([ field: 'factoryAreaNumber', isSearch: true, sort: 'custom', + search: { + show: true, + component: 'Select', + api: () => factoryList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'id' + }, + filterable: true, + } + }, form: { // labelMessage: '信息提示说明!!!', componentProps: { diff --git a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts index 61a7044..8179ccf 100644 --- a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts +++ b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts @@ -9,17 +9,7 @@ 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; -} +const admin = checkPermi(['gdzc_admin']); // 表单校验 export const FixedAssetsRules = reactive({ @@ -165,7 +155,7 @@ export const FixedAssets = useCrudSchemas(reactive([ label: '管理部门', field: 'manageDept', sort: 'custom', - isForm: isAdmin.value, + isForm: admin, dictType: DICT_TYPE.SPECIAL_DEPT_ROLE, dictClass: 'string', table: { diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index 5aa405c..cc41ca6 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -600,7 +600,7 @@ const onChangeSec = (field, cur, item,formRefSec) => { setV['factoryAreaNumber'] = newRow.value.factoryAreaNumber setV['maintenance'] = newRow.value.maintenance formRefSec.setValues(setV) - DeviceMaintenanceMainSecRules.maintenance = [{ required: true }] + DeviceMaintenanceMainSecRules.maintenance = [{ required: true,message:'请选择维修人' }] DeviceMaintenanceMainSec.allSchemas.formSchema.find(item => { return item.field == 'type' }).componentProps.disabled = true From ae92c93326d5420a0c61e2f813f3f86b87e8602c Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Thu, 9 May 2024 10:12:10 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=92=8C=E9=87=8C=E7=A8=8B=E7=A2=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basic/inspection/index.ts | 1 - src/components/Detail/src/DetailDeviceLedger.vue | 15 ++------------- src/views/eam/basic/fixedAssets/index.vue | 9 +++++++-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/api/eam/basic/inspection/index.ts b/src/api/eam/basic/inspection/index.ts index 4931600..a422e70 100644 --- a/src/api/eam/basic/inspection/index.ts +++ b/src/api/eam/basic/inspection/index.ts @@ -55,7 +55,6 @@ export const createDeviceMoldItems = async (data: DeviceMoldItemsVO) => { } //新增模具 export const creatMoldItems = async (data: DeviceMoldItemsVO) => { - debugger data.type="MOLD" data.status="INSPECTION" return await request.post({ url: `/eam/device-mold-items/create`, data }) diff --git a/src/components/Detail/src/DetailDeviceLedger.vue b/src/components/Detail/src/DetailDeviceLedger.vue index c2cc3a7..9420508 100644 --- a/src/components/Detail/src/DetailDeviceLedger.vue +++ b/src/components/Detail/src/DetailDeviceLedger.vue @@ -912,8 +912,8 @@ const setBeiJian = () => { // 列表-操作按钮 const butttondata = (row) => { return [ - defaultButtons.mainListEditBtn({ hide: !hasmMilestoneRight(row)}), // 编辑 - defaultButtons.uploadFileBtn({ hide: !hasmMilestoneRight(row)}),//上传 + defaultButtons.mainListEditBtn({ hasPermi: 'eam:mold-milestone:edit'}), // 编辑 + defaultButtons.uploadFileBtn({ hasPermi: 'eam:mold-milestone:upload'}),//上传 ] } @@ -996,17 +996,6 @@ function dialogUploadFile() { }) } -const hasmMilestoneRight = (row) => { - const rolesOk = userStore.roles.find(item => { - return item == 'mold_Engineer_role' - }) - if (rolesOk != undefined && rolesOk != null) { - return true - } else { - return false - } -} -