Ben Lin
2024-07-04 d582f081e148c5df7c1b334a94fa1df1cd2655a9
src/views/tigerprojects/system/menu/menu.data.ts
@@ -1,9 +1,12 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { h, unref } from 'vue';
import { Tag } from 'ant-design-vue';
import Icon from '@/components/Icon/Icon.vue';
import { GetEnum } from '/@/api/tigerapi/system';
import { useLocale } from '/@/locales/useLocale';
const { getLocale } = useLocale();
export const columns: BasicColumn[] = [
  {
    title: '菜单名称',
@@ -33,7 +36,7 @@
    dataIndex: 'orderNo',
    width: 100,
    customRender: ({ record }) => {
      return h("h1", null, record.orderNo); //渲染单元格数据,h是返回一个“虚拟节点 (virtual node)”
      return h('h1', null, record.orderNo); //渲染单元格数据,h是返回一个“虚拟节点 (virtual node)”
    },
  },
  {
@@ -52,6 +55,16 @@
    title: '创建时间',
    dataIndex: 'createTime',
  },
  {
    title: '按钮类型',
    dataIndex: 'btnType',
    ifShow: false,
  },
  {
    title: '执行方法',
    dataIndex: 'doMethod',
    ifShow: false,
  },
];
const isDir = (type: string) => type === '0';
@@ -65,18 +78,18 @@
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    componentProps: {
      options: [
        { label: '启用', value: '1' },
        { label: '停用', value: '0' },
      ],
    },
    colProps: { span: 8 },
  },
  // {
  //   field: 'status',
  //   label: '状态',
  //   component: 'Select',
  //   componentProps: {
  //     options: [
  //       { label: '启用', value: '1' },
  //       { label: '停用', value: '0' },
  //     ],
  //   },
  //   colProps: { span: 8 },
  // },
];
export const formSchema: FormSchema[] = [
@@ -126,7 +139,7 @@
    label: '图标',
    component: 'IconPicker',
    required: ({ values }) => isDir(values.func_type),
    ifShow: ({ values }) => !isButton(values.func_type),
    ifShow: ({ values }) => true, //!isButton(values.func_type),
  },
  {
@@ -143,10 +156,31 @@
    ifShow: ({ values }) => isMenu(values.func_type),
  },
  {
    field: 'btnType',
    label: '按钮类型',
    component: 'ApiSelect',
    defaultValue: 0,
    componentProps: {
      api: GetEnum,
      params: { name: 'SYS_MENU+BUTTON_TYPEs' },
      resultField: 'Data',
      labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
      valueField: 'Value',
      placeholder: '请选择按钮类型',
    },
    ifShow: ({ values }) => isButton(values.func_type),
  },
  {
    field: 'doMethod',
    label: '执行方法名',
    component: 'Input',
    ifShow: ({ values }) => isButton(values.func_type),
  },
  {
    field: 'func_code',
    label: '权限标识',
    component: 'Input',
    dynamicDisabled:true,
    dynamicDisabled: true,
    ifShow: ({ values }) => !isDir(values.func_type),
  },
  {