From 935e5ea21e9d2a56f704810910f38fca453b06fd Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Thu, 9 May 2024 08:52:50 +0800 Subject: [PATCH] =?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