123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import { h } from 'vue';
- import { Tag } from 'ant-design-vue';
- import { BasicColumn } from '/@/components/Table';
- import { FormSchema } from '/@/components/Form/index';
- import { adapt } from '/@/utils/adapt';
- const adaptWidth = adapt();
- export const columns: BasicColumn[] = [
- {
- title: 'ID',
- dataIndex: 'id',
- align: 'left',
- editComponentProps: {
- prefix: '$',
- },
- width: 150,
- },
- {
- title: '父级',
- dataIndex: 'pid',
- width: 160,
- },
- {
- title: '名称',
- dataIndex: 'name',
- width: 160,
- },
- {
- title: '状态',
- dataIndex: 'status',
- width: 80,
- customRender: ({ record }) => {
- const status = record.status;
- const enable = status === 'normal';
- const color = enable ? 'green' : 'red';
- const text = enable ? '启用' : '停用';
- return h(Tag, { color: color }, () => text);
- },
- },
- ];
- // popup =====================================================
- export const schemas: FormSchema[] = [
- {
- field: 'pid',
- label: '父级',
- component: 'TreeSelect',
- componentProps: {
- replaceFields: {
- title: 'name',
- key: 'id',
- value: 'id',
- },
- getPopupContainer: () => document.body,
- },
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- },
- {
- field: 'name',
- component: 'Input',
- label: '名称',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- },
- // {
- // field: 'rules',
- // component: 'Input',
- // label: '规则',
- // labelWidth: adaptWidth.labelWidth,
- // colProps: {
- // span: adaptWidth.elContainer,
- // },
- // },
- {
- field: 'status',
- label: '状态',
- component: 'RadioButtonGroup',
- defaultValue: 'normal',
- componentProps: {
- options: [
- { label: '启用', value: 'normal' },
- { label: '停用', value: 'locked' },
- ],
- },
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- },
- ];
|