康来智慧冷链-后端
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.
 
 
 
 
 
 

108 lines
2.1 KiB

import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
export const columns: BasicColumn[] = [
{
title: '部门名称',
dataIndex: 'name',
width: 160,
align: 'left',
},
{
title: '排序',
dataIndex: 'sort',
width: 50,
},
{
title: '状态',
dataIndex: 'status',
width: 80,
customRender: ({ record }) => {
const status = record.status;
const enable = ~~status === 0;
const color = enable ? 'green' : 'red';
const text = enable ? '启用' : '停用';
return h(Tag, { color: color }, () => text);
},
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
},
];
export const searchFormSchema: FormSchema[] = [
{
field: 'keyword',
label: '关键字',
component: 'Input',
componentProps: {
placeholder: '请输入名称/编码',
},
colProps: { span: 8 },
},
{
field: 'startDate',
label: '起始时间',
component: 'DatePicker',
colProps: { span: 8 },
},
{
field: 'endDate',
label: '截止时间',
component: 'DatePicker',
colProps: { span: 8 },
},
];
export const formSchema: FormSchema[] = [
{
field: 'id',
label: 'ID',
component: 'Input',
show: false,
},
{
field: 'name',
label: '部门名称',
component: 'Input',
required: true,
},
{
field: 'parentId',
label: '上级部门',
component: 'TreeSelect',
componentProps: {
replaceFields: {
title: 'name',
key: 'id',
value: 'id',
},
getPopupContainer: () => document.body,
},
required: true,
},
{
field: 'sort',
label: '排序',
component: 'InputNumber',
required: true,
},
{
field: 'status',
label: '状态',
component: 'RadioButtonGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '启用', value: '0' },
{ label: '停用', value: '1' },
],
},
required: true,
},
];