import { BasicColumn } from '/@/components/Table' import { FormSchema } from '/@/components/Table' import { getCropCate } from '/@/api/sys/user' export const columns: BasicColumn[] = [ { title: '名称', dataIndex: 'name', }, { title: '单位', dataIndex: 'unit', }, { title: '是否是结点', dataIndex: 'is_end', customRender: ({ text }) => { return text == 1 ? '是' : '否' }, }, { width: 180, title: '操作', dataIndex: 'action', align: 'center', fixed: undefined, }, ] export const searchFormSchema: FormSchema[] = [] export const accountFormSchema: FormSchema[] = [ { field: 'id', label: 'ID', required: false, dynamicDisabled: true, component: 'Input', ifShow: ({ values }) => { return !!values.id }, }, { field: 'category_id', label: '产业', required: true, component: 'ApiSelect', componentProps: { api: async () => { const res = await getCropCate() return res }, labelField: 'name', valueField: 'id', }, }, { field: 'name', label: '名称', required: true, component: 'Input', }, { field: 'parent_id', label: '上级', component: 'TreeSelect', slot: 'parent', }, { field: 'unit', label: '单位', required: true, component: 'Input', }, // { // field: 'sort', // label: '排序', // required: true, // component: 'Input', // }, { field: 'is_end', label: '是否是结点', required: false, component: 'Switch', }, { field: 'extends', label: '', required: false, component: 'Input', slot: 'extends', ifShow: ({ values }) => { return values.is_end === true }, }, ]