218 lines
4.0 KiB
TypeScript
218 lines
4.0 KiB
TypeScript
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||
|
import {getDictOptions} from "#/utils/dict";
|
||
|
import {renderDict} from "#/utils/render";
|
||
|
|
||
|
|
||
|
export const querySchema: FormSchemaGetter = () => [
|
||
|
{
|
||
|
component: 'Input',
|
||
|
fieldName: 'machineName',
|
||
|
label: '设备名称',
|
||
|
},
|
||
|
{
|
||
|
component: 'Input',
|
||
|
fieldName: 'machineCode',
|
||
|
label: '设备编码',
|
||
|
},
|
||
|
{
|
||
|
component: 'Select',
|
||
|
componentProps:{
|
||
|
options:getDictOptions('wy_sbsyzt')
|
||
|
},
|
||
|
fieldName: 'state',
|
||
|
label: '使用状态',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const columns: VxeGridProps['columns'] = [
|
||
|
{ type: 'checkbox', width: 60 },
|
||
|
{
|
||
|
title: '设备名称',
|
||
|
field: 'machineName',
|
||
|
minWidth:180
|
||
|
},
|
||
|
{
|
||
|
title: '设备编码',
|
||
|
field: 'machineCode',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '设备品牌',
|
||
|
field: 'machineBrand',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '设备类型',
|
||
|
field: 'machineTypeId',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '位置详情',
|
||
|
field: 'locationId',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '采购价格',
|
||
|
field: 'purchasePrice',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '启用时间',
|
||
|
field: 'activationTime',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '保修截至时间',
|
||
|
field: 'deadline',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '使用年限',
|
||
|
field: 'serviceLife',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
title: '保修周期',
|
||
|
field: 'maintenanceCycle',
|
||
|
width:100,
|
||
|
slots:{
|
||
|
default: ({row})=>{
|
||
|
return renderDict(row.maintenanceCycle,'wy_sbbxzq')
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '使用状态',
|
||
|
field: 'state',
|
||
|
width:100,
|
||
|
slots:{
|
||
|
default: ({row})=>{
|
||
|
return renderDict(row.state,'wy_sbsyzt')
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '责任人',
|
||
|
field: 'personId',
|
||
|
width:100
|
||
|
},
|
||
|
{
|
||
|
field: 'action',
|
||
|
fixed: 'right',
|
||
|
slots: { default: 'action' },
|
||
|
title: '操作',
|
||
|
width: 180,
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const modalSchema: FormSchemaGetter = () => [
|
||
|
{
|
||
|
label: '主键',
|
||
|
fieldName: 'id',
|
||
|
component: 'Input',
|
||
|
dependencies: {
|
||
|
show: () => false,
|
||
|
triggerFields: [''],
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
label: '设备名称',
|
||
|
fieldName: 'machineName',
|
||
|
component: 'Input',
|
||
|
rules: 'required',
|
||
|
formItemClass: 'col-span-2',
|
||
|
},
|
||
|
{
|
||
|
label: '设备编码',
|
||
|
fieldName: 'machineCode',
|
||
|
component: 'Input',
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '设备品牌',
|
||
|
fieldName: 'machineBrand',
|
||
|
component: 'Input',
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '设备类型',
|
||
|
fieldName: 'machineTypeId',
|
||
|
component: 'TreeSelect',
|
||
|
rules: 'selectRequired',
|
||
|
formItemClass: 'col-span-2',
|
||
|
},
|
||
|
{
|
||
|
label: '位置详情',
|
||
|
fieldName: 'locationId',
|
||
|
component: 'ApiSelect',
|
||
|
rules: 'selectRequired',
|
||
|
formItemClass: 'col-span-2',
|
||
|
},
|
||
|
{
|
||
|
label: '采购价格',
|
||
|
fieldName: 'purchasePrice',
|
||
|
component: 'InputNumber',
|
||
|
componentProps:{
|
||
|
min:0,
|
||
|
precision:2
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '启用时间',
|
||
|
fieldName: 'activationTime',
|
||
|
component: 'DatePicker',
|
||
|
componentProps: {
|
||
|
format: 'YYYY-MM-DD',
|
||
|
valueFormat: 'YYYY-MM-DD',
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '保修截至时间',
|
||
|
fieldName: 'deadline',
|
||
|
component: 'DatePicker',
|
||
|
componentProps: {
|
||
|
format: 'YYYY-MM-DD',
|
||
|
valueFormat: 'YYYY-MM-DD',
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '使用年限',
|
||
|
fieldName: 'serviceLife',
|
||
|
component: 'InputNumber',
|
||
|
componentProps:{
|
||
|
min:1,
|
||
|
precision:0
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '保修周期',
|
||
|
fieldName: 'maintenanceCycle',
|
||
|
component: 'Select',
|
||
|
componentProps: {
|
||
|
options:getDictOptions('wy_sbbxzq')
|
||
|
},
|
||
|
rules: 'selectRequired',
|
||
|
},
|
||
|
{
|
||
|
label: '使用状态',
|
||
|
fieldName: 'state',
|
||
|
component: 'Select',
|
||
|
componentProps:{
|
||
|
options:getDictOptions('wy_sbsyzt')
|
||
|
},
|
||
|
rules: 'selectRequired',
|
||
|
},
|
||
|
{
|
||
|
label: '责任人',
|
||
|
fieldName: 'personId',
|
||
|
component: 'ApiSelect',
|
||
|
rules: 'selectRequired',
|
||
|
formItemClass: 'col-span-2',
|
||
|
},
|
||
|
];
|