You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
1.9 KiB
94 lines
1.9 KiB
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { TableColumn } from '@/types/table'
|
|
import * as GxApi from '@/api/basedata/progx'
|
|
|
|
const gxList = await GxApi.getAllGxs()
|
|
|
|
|
|
// 表单校验
|
|
export const DeviceRules = reactive({
|
|
deviceNo: [required],
|
|
deviceName: [required],
|
|
gxId: [required]
|
|
})
|
|
|
|
export const Device = useCrudSchemas(reactive<CrudSchema[]>([
|
|
// {
|
|
// label: '主键、自增',
|
|
// field: 'id',
|
|
// sort: 'custom',
|
|
// isForm: false,
|
|
// },
|
|
{
|
|
label: '设备编号',
|
|
field: 'deviceNo',
|
|
sort: 'custom',
|
|
isSearch: true,
|
|
},
|
|
{
|
|
label: '设备名称',
|
|
field: 'deviceName',
|
|
sort: 'custom',
|
|
isSearch: true,
|
|
},
|
|
{
|
|
label: '设备描述',
|
|
field: 'deviceDesc',
|
|
sort: 'custom',
|
|
isSearch: false,
|
|
},
|
|
{
|
|
label: '所属工序',
|
|
field: 'gxId',
|
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
|
|
return gxList.find((obj) => obj.id === cellValue)?.gxName
|
|
},
|
|
search: {
|
|
show: true,
|
|
component: 'Select',
|
|
api: () => gxList,
|
|
componentProps: {
|
|
optionsAlias: {
|
|
labelField: 'gxName',
|
|
valueField: 'id'
|
|
}
|
|
}
|
|
},
|
|
form: {
|
|
component: 'Select',
|
|
api: () => gxList,
|
|
componentProps: {
|
|
optionsAlias: {
|
|
labelField: 'gxName',
|
|
valueField: 'id'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
label: '创建时间',
|
|
field: 'createTime',
|
|
sort: 'custom',
|
|
formatter: dateFormatter,
|
|
isSearch: false,
|
|
search: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
type: 'daterange',
|
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
|
|
}
|
|
},
|
|
isForm: false,
|
|
},
|
|
{
|
|
label: '操作',
|
|
field: 'action',
|
|
isForm: false,
|
|
table: {
|
|
width: 150,
|
|
fixed: 'right'
|
|
}
|
|
}
|
|
]))
|
|
|