From 3ba5f2f55ee9fe90677d0f2d313f64d1ecfde0fa Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Fri, 23 Feb 2024 14:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B0=E8=B4=A6=E6=B7=BB=E5=8A=A0=E5=8A=9F?= =?UTF-8?q?=E7=8E=87=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/dict.ts | 1 + .../deviceAccounts/deviceAccounts.data.ts | 104 ++++++++++++++++-- 2 files changed, 95 insertions(+), 10 deletions(-) diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 8a7e292..f6e71e5 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -295,6 +295,7 @@ export enum DICT_TYPE { CLASSIFICATION = 'classification', //检修明细状态 DEPT_BUSI_TYPE = 'dept_busi_type', //部门类型 DEPT_GROUP = 'dept_group', //部门分组 + POWER_RANGE = 'power_range', //功率范围 } diff --git a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts index b87bb8c..9063836 100644 --- a/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts +++ b/src/views/eam/device/deviceAccounts/deviceAccounts.data.ts @@ -1,7 +1,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea } from '@/api/system/dept' - +const factoryList = await selectAllFactoryArea() // 表单校验 export const DeviceAccountsRules = reactive({ // number: [required], @@ -21,41 +21,107 @@ export const DeviceAccounts = useCrudSchemas(reactive([ sort: 'custom', isSearch: true, isForm: false, + table: { + width: '150', + }, }, { label: '名称', field: 'name', sort: 'custom', - isSearch: true + isSearch: true, + table: { + width: '150', + }, }, { label: '规格型号', field: 'specification', - sort: 'custom' + sort: 'custom', + table: { + width: '150', + }, + }, + { + label: '设备功率(kw)', + field: 'power', + sort: 'custom', + isSearch: false, + table: { + width: '200', + }, + }, + { + label: '设备功率范围', + field: 'powerRange', + sort: 'custom', + dictType: DICT_TYPE.POWER_RANGE, + dictClass: 'string', + isSearch: true, + search: { + show: true, + component: 'Select', + }, + isTable: false, + isForm: false, + isTableForm: true, + isDetail: true, }, { label: '设备类型', field: 'type', sort: 'custom', - isSearch: true, + table: { + width: '150', + }, + isSearch: false, + isForm: true, + dictType: DICT_TYPE.DEVICE_MOLD_TYPE, + dictClass: 'string', form: { - component: 'Select' + value: 'DEVICE', + component: 'Select', + componentProps: { + disabled: true, + } + }, + search: { + value: 'DEVICE' } }, { label: '所属厂区', field: 'factoryAreaNumber', sort: 'custom', + isSearch: false, + table: { + width: '150', + }, + api: () => factoryList, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return factoryList.find((account) => account.id == cellValue)?.name + }, + search: { + show: true, + component: 'Select', + api: () => factoryList, + componentProps: { + optionsAlias: { + labelField: 'name', + valueField: 'id' + } + } + }, form: { component: 'Select', - api: () => selectAllFactoryArea(), + api: () => factoryList, componentProps: { disabled: false, optionsAlias: { labelField: 'name', valueField: 'id' }, - placeholder: "请选择所属厂区", + placeholder: "请选择设备" }, } }, @@ -64,6 +130,9 @@ export const DeviceAccounts = useCrudSchemas(reactive([ field: 'purchaseTime', sort: 'custom', formatter: dateFormatter, + table: { + width: '150', + }, form: { component: 'DatePicker', componentProps: { @@ -82,6 +151,9 @@ export const DeviceAccounts = useCrudSchemas(reactive([ isSearch: false, isForm: true, isTable: true, + table: { + width: '150', + }, form: { component: 'Input', } @@ -92,18 +164,27 @@ export const DeviceAccounts = useCrudSchemas(reactive([ sort: 'custom', form: { component: 'Input', - } + }, + table: { + width: '150', + }, }, { label: '供应商编号', field: 'supplierNumber', - sort: 'custom' + sort: 'custom', + table: { + width: '150', + }, }, { label: '出厂日期', field: 'productionDate', sort: 'custom', formatter: dateFormatter, + table: { + width: '150', + }, form: { component: 'DatePicker', componentProps: { @@ -115,7 +196,10 @@ export const DeviceAccounts = useCrudSchemas(reactive([ { label: '价格', field: 'purchasePrice', - sort: 'custom' + sort: 'custom', + table: { + width: '150', + }, }, { label: '创建时间',