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.
107 lines
2.2 KiB
107 lines
2.2 KiB
11 months ago
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||
|
import { dateFormatter } from '@/utils/formatTime'
|
||
|
import { handleTreeToComponentOptions } from '@/utils/tree'
|
||
|
import * as DeptApi from '@/api/system/dept'
|
||
|
const deptList = ref<Tree[]>([]) // 树形结构
|
||
|
|
||
|
// 加载部门树(默认格式)
|
||
|
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
|
||
|
|
||
|
// 表单校验
|
||
|
export const MaintenanceItemRules = reactive({
|
||
|
content: [required],
|
||
|
serialNumber: [required],
|
||
|
concurrencyStamp: [required]
|
||
|
})
|
||
|
|
||
|
export const MaintenanceItem = useCrudSchemas(reactive<CrudSchema[]>([
|
||
|
|
||
|
{
|
||
|
label: '序号',
|
||
|
field: 'serialNumber',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
fixed: 'left',
|
||
|
form: {
|
||
|
component:'InputNumber'
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
label: '保养内容',
|
||
|
field: 'content',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Input',
|
||
|
componentProps: {
|
||
|
type: 'textarea',
|
||
|
rows: 4
|
||
|
},
|
||
|
colProps: {
|
||
|
span: 24
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '保养部位',
|
||
|
field: 'equipmentParts',
|
||
|
sort: 'custom',
|
||
|
isSearch: true
|
||
|
},
|
||
|
{
|
||
|
label: '部门',
|
||
|
field: 'departmentCode',
|
||
|
sort: 'custom',
|
||
|
isTable: false,
|
||
|
isDetail: false,
|
||
|
isSearch: false,
|
||
|
isTableForm: false,
|
||
|
form: {
|
||
|
component: 'TreeSelect',
|
||
|
componentProps: { // 假设deptList是部门数据列表
|
||
|
data: deptList,
|
||
|
placeholder: "请选择部门",
|
||
|
filterable: true,
|
||
|
// multiple: true,
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '备注',
|
||
|
field: 'remark',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Input',
|
||
|
componentProps: {
|
||
|
type: 'textarea',
|
||
|
rows: 4
|
||
|
},
|
||
|
colProps: {
|
||
|
span: 24
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '是否可用',
|
||
|
field: 'available',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.TRUE_FALSE,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isTable: true,
|
||
|
isDetail: false,
|
||
|
isSearch: false,
|
||
|
isTableForm: false,
|
||
|
isForm: false,
|
||
|
},
|
||
|
{
|
||
|
label: '操作',
|
||
|
field: 'action',
|
||
|
isForm: false,
|
||
|
table: {
|
||
|
width: 150,
|
||
|
fixed: 'right'
|
||
|
}
|
||
|
}
|
||
|
]))
|