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

105 lines
2.5 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',
},
{
title: '模板分类',
dataIndex: 'type',
width: 100,
customRender: ({record}) => {
const type = record.type;
// 采用二进制~~取反,只要为null或者0等等一些其他的空元素都会转为0
// 第一次取反会运算为-1,在后一次取反会运算为0
const enable = ~~type === 1;
const color = enable ? 'green' : 'warning';
const text = enable ? '单表' : '主附表';
return h(Tag, { color: color }, () => text);
}
},
{
title: '是否系统模板',
dataIndex: 'isSystem',
width: 80,
customRender: ({ record }) => {
const isSystem = record.isSystem;
// 采用二进制~~取反,只要为null或者0等等一些其他的空元素都会转为0
// 第一次取反会运算为-1,在后一次取反会运算为0
const enable = ~~isSystem === 1;
const color = enable ? 'green' : 'warning';
const text = enable ? '系统内置' : '非系统内置';
return h(Tag, { color: color }, () => text);
}
}
];
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '模板名称',
component: 'Input',
componentProps: {
placeholder: '请输入模板名称',
},
colProps: { span: 6 }
},
{
field: 'type',
label: '模版分类',
component: 'Select',
componentProps: {
options: [
{ label: '单表',value: '1' },
{ label: '主附表',value: '2' }
]
},
colProps: { span: 6 }
}
];
export const formSchema: FormSchema[] = [
{
field: 'id',
label: 'ID',
component: 'Input',
show: false
},
{
field: 'name',
label: '模板名称',
component: 'Input',
required: true,
colProps: { span: 12 },
},
{
field: 'type',
label: '模板分类',
component: 'Select',
required: true,
componentProps: {
options: [
{ label: '单表',value: '1' },
{ label: '主附表',value: '2' }
]
},
colProps: { span: 12 },
},
{
field: 'isSystem',
label: '是否系统模板',
component: 'Select',
required: true,
componentProps: {
options: [
{ label: '系统内置',value: '1' },
{ label: '非系统内置',value: '0' }
]
},
colProps: { span: 12 },
},
];