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.
 
 
 

133 lines
2.5 KiB

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 EquipmentManufacturerRules = reactive({
number: [required],
name: [required],
concurrencyStamp: [required]
})
export const EquipmentManufacturer = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '设备厂商编号',
field: 'number',
sort: 'custom',
isSearch: true,
fixed: 'left',
isForm: false,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true
},
{
label: '简称',
field: 'shortName',
sort: 'custom',
isSearch: true
},
{
label: '地址',
field: 'address',
sort: 'custom',
isSearch: true
},
{
label: '国家',
field: 'country',
sort: 'custom',
isSearch: true
},
{
label: '城市',
field: 'city',
sort: 'custom',
isSearch: true
},
{
label: '电话',
field: 'phone',
sort: 'custom',
isSearch: true
},
{
label: '传真',
field: 'fax',
sort: 'custom',
isSearch: true
},
{
label: '邮编',
field: 'postId',
sort: 'custom',
isSearch: true
},
{
label: '联系人',
field: 'contacts',
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: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: false,
isTableForm: false,
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))