From 35ff383c08c35841102cb723733b8c19705298cd Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Tue, 23 Apr 2024 07:48:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E8=B5=84=E4=BA=A7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basic/fixedAssets/index.ts | 16 +++++- src/utils/dict.ts | 3 +- .../eam/basic/fixedAssets/fixedAssets.data.ts | 50 ++++++++++++------- src/views/eam/basic/fixedAssets/index.vue | 21 ++++++-- 4 files changed, 66 insertions(+), 24 deletions(-) diff --git a/src/api/eam/basic/fixedAssets/index.ts b/src/api/eam/basic/fixedAssets/index.ts index a8d4261..84de679 100644 --- a/src/api/eam/basic/fixedAssets/index.ts +++ b/src/api/eam/basic/fixedAssets/index.ts @@ -1,4 +1,6 @@ import request from '@/config/axios' +import { getStrDictOptions } from '@/utils/dict' +import { useUserStore } from '@/store/modules/user' export interface FixedAssetsVO { number: string @@ -19,8 +21,20 @@ export interface FixedAssetsVO { concurrencyStamp: number } -// 查询固定资产列表 export const getFixedAssetsPage = async (params) => { + const userStore = useUserStore() // 用户信息 + const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.SPECIAL_DEPT_ROLE) + + // 查找第一个同时存在于userStore.roles和deviceMoldTypeList中的值 + const matchingRole = userStore.roles.find(role => + deviceMoldTypeList.some(deviceMold => deviceMold.value === role) + ); + + // 如果找到了匹配的角色,将它作为manageDept的值加入到params中 + if (matchingRole) { + params.manageDept = matchingRole; // 这里只添加第一个匹配的角色 + } + if (params.isSearch) { delete params.isSearch const data = {...params} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 5d2524b..840575e 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -305,6 +305,7 @@ export enum DICT_TYPE { TURN_TYPE = 'turn_type', //转移类型 ORDER_COMPLETE_RESULT = 'order_complete_result', //维修工单完成结果 FACTORY_TYPE = 'factory_type',//厂区类别 - EQUIPMENT_INDEX_NAME = 'equipment_index_name'//设备年度目标指标名称分类字段 + EQUIPMENT_INDEX_NAME = 'equipment_index_name',//设备年度目标指标名称分类字段 + SPECIAL_DEPT_ROLE = 'special_dept_role' } diff --git a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts index cd6af17..59191ff 100644 --- a/src/views/eam/basic/fixedAssets/fixedAssets.data.ts +++ b/src/views/eam/basic/fixedAssets/fixedAssets.data.ts @@ -38,6 +38,7 @@ export const FixedAssetsRules = reactive({ { validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'} ], manageDept: [ + required, { max: 20, message: '不得超过20个字符', trigger: 'blur' }, ], unit: [ @@ -108,8 +109,8 @@ export const FixedAssets = useCrudSchemas(reactive([ } }, { - label: '购买时间', - field: 'purchaseDate', + label: '投入使用时间', + field: 'beginUseDate', sort: 'custom', table: { width: '150', @@ -123,14 +124,6 @@ export const FixedAssets = useCrudSchemas(reactive([ } } }, - { - label: '采购部门', - field: 'purchaseDept', - sort: 'custom', - table: { - width: '150', - }, - }, { label: '供应商', field: 'supplierNumber', @@ -170,33 +163,54 @@ export const FixedAssets = useCrudSchemas(reactive([ } } }, + // { + // label: '管理部门', + // field: 'manageDept', + // sort: 'custom', + // table: { + // width: '150', + // }, + // form: { + // componentProps: { + // disabled: true + // } + // } + // }, { - label: '购买价格', - field: 'purchasePrice', + label: '单位', + field: 'unit', sort: 'custom', table: { width: '150', }, }, { - label: '管理部门', - field: 'manageDept', + label: '数量', + field: 'qty', sort: 'custom', table: { width: '150', }, }, { - label: '单位', - field: 'unit', + label: '期间费用科目描述', + field: 'costSubjectDesc', sort: 'custom', table: { width: '150', }, }, { - label: '数量', - field: 'qty', + label: '使用人', + field: 'user', + sort: 'custom', + table: { + width: '150', + }, + }, + { + label: '状态', + field: 'status', sort: 'custom', table: { width: '150', diff --git a/src/views/eam/basic/fixedAssets/index.vue b/src/views/eam/basic/fixedAssets/index.vue index 3c28e15..6562244 100644 --- a/src/views/eam/basic/fixedAssets/index.vue +++ b/src/views/eam/basic/fixedAssets/index.vue @@ -58,14 +58,15 @@