vben
2023-04-05 8e5a6b7ce547ba8edb1d767bb4d820f3b66ff95a
src/views/demo/system/dept/dept.data.ts
@@ -1,5 +1,4 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
@@ -7,22 +6,23 @@
  {
    title: '部门名称',
    dataIndex: 'deptName',
    width: 300,
    width: 160,
    align: 'left',
  },
  {
    title: '排序',
    dataIndex: 'orderNo',
    width: 80,
    width: 50,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 120,
    width: 80,
    customRender: ({ record }) => {
      const status = record.status;
      const enable = ~~status === 0;
      const color = enable ? 'green' : 'red';
      const text = enable ? '正常' : '停用';
      const text = enable ? '启用' : '停用';
      return h(Tag, { color: color }, () => text);
    },
  },
@@ -69,9 +69,10 @@
    field: 'parentDept',
    label: '上级部门',
    component: 'TreeSelect',
    componentProps: {
      replaceFields: {
        title: 'deptName',
      fieldNames: {
        label: 'deptName',
        key: 'id',
        value: 'id',
      },
@@ -89,10 +90,11 @@
    field: 'status',
    label: '状态',
    component: 'RadioButtonGroup',
    defaultValue: '0',
    componentProps: {
      options: [
        { label: '正常', value: '0' },
        { label: '禁用', value: '1' },
        { label: '启用', value: '0' },
        { label: '停用', value: '1' },
      ],
    },
    required: true,