diff --git a/src/views/system/devtools/template/template.data.ts b/src/views/system/devtools/template/template.data.ts index f775f11..eccacf4 100644 --- a/src/views/system/devtools/template/template.data.ts +++ b/src/views/system/devtools/template/template.data.ts @@ -1,40 +1,62 @@ 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: 'label', - width: 100 + title: '模板名称', + dataIndex: 'name', }, { - title: '值', - dataIndex: 'value', - width: 100 + 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: 'sort', - width: 130 + 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: 'label', - label: '标签', + field: 'name', + label: '模板名称', component: 'Input', componentProps: { - placeholder: '请输入标签', + placeholder: '请输入模板名称', }, colProps: { span: 6 } }, { - field: 'value', - label: '值', - component: 'Input', + field: 'type', + label: '模版分类', + component: 'Select', componentProps: { - placeholder: '请输入值', + options: [ + { label: '单表',value: '1' }, + { label: '主附表',value: '2' } + ] }, colProps: { span: 6 } } @@ -48,25 +70,36 @@ export const formSchema: FormSchema[] = [ show: false }, { - field: 'label', - label: '标签', + field: 'name', + label: '模板名称', component: 'Input', - required: true + required: true, + colProps: { span: 12 }, }, { - field: 'value', - label: '值', - component: 'Input', - required: true + field: 'type', + label: '模板分类', + component: 'Select', + required: true, + componentProps: { + options: [ + { label: '单表',value: '1' }, + { label: '主附表',value: '2' } + ] + }, + colProps: { span: 12 }, }, { - field: 'sort', - label: '排序', - component: 'InputNumber', + field: 'isSystem', + label: '是否系统模板', + component: 'Select', + required: true, componentProps: { - style: { width:'100%' }, - min: 0 + options: [ + { label: '系统内置',value: '1' }, + { label: '非系统内置',value: '0' } + ] }, - required: true - } + colProps: { span: 12 }, + }, ];