king
2024-06-07 8040a18c4b2a848d252bf01838f06c7aec1be9f3
src/menu/components/table/normal-table/options.jsx
@@ -1,7 +1,9 @@
import MenuUtils from '@/utils/utils-custom.js'
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, action = [], columns = [], toolBtns) {
export default function (wrap, action = [], columns = [], toolBtns, supNodes, id = '') {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
  let isprint = sessionStorage.getItem('MenuType') === 'billPrint'
@@ -16,6 +18,9 @@
  } else {
    roleList = []
  }
  let menu = window.GLOB.customMenu
  let modules = MenuUtils.getSupModules(menu.components, id, menu.interfaces)
  const wrapForm = [
    {
@@ -47,10 +52,10 @@
    {
      type: 'number',
      field: 'height',
      label: '高度',
      label: '最大高度',
      initval: wrap.height || '',
      tooltip: '表格高度,空值时高度自适应。注:小于等于100时为高度的百分比。',
      min: 10,
      tooltip: '表格内容区的最大高度(不包含表头),空值时高度自适应。注:小于等于100大于0时为高度的百分比,小于0时为窗口高度减去此值。',
      min: -1000,
      max: 3000,
      precision: 0,
      required: false,
@@ -156,6 +161,19 @@
    },
    {
      type: 'radio',
      field: 'searchSize',
      label: '搜索间距',
      initval: wrap.searchSize || 'middle',
      tooltip: '搜索条件的上下间距。',
      required: false,
      options: [
        {value: 'middle', label: '默认'},
        {value: 'small', label: '小'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'mode',
      label: '模式',
      initval: wrap.mode || 'default',
@@ -228,6 +246,7 @@
      tooltip: '鼠标悬浮于行上方时的提示信息。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns
    },
    {
@@ -238,6 +257,7 @@
      tooltip: '用于控制行数据是否可选择。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns,
      controlFields: [
        {field: 'controlVal', notNull: true},
@@ -302,6 +322,22 @@
    },
    {
      type: 'radio',
      field: 'supType',
      label: '上级类型',
      initval: wrap.supType || 'single',
      tooltip: '上级组件为单一组件或多个组件。',
      required: false,
      forbid: appType === 'mob' || isprint,
      options: [
        {value: 'single', label: '单组件'},
        {value: 'multi', label: '多组件'},
      ],
      controlFields: [
        {field: 'supNodes', values: ['multi']},
      ]
    },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || (!appType ? 'true' : 'false'),
@@ -346,6 +382,36 @@
      options: roleList,
      forbid: !!appType || isprint
    },
    {
      type: 'table',
      field: 'supNodes',
      label: '上级组件',
      initval: supNodes,
      required: true,
      forbid: appType === 'mob' || isprint,
      span: 24,
      actions: ['edit', 'del', 'add', 'move'],
      columns: [
        {
          title: '序号',
          dataIndex: '$index',
          editable: false,
          required: false,
          width: '20%'
        },
        {
          title: '组件',
          dataIndex: 'nodes',
          inputType: 'cascader',
          editable: true,
          required: true,
          extends: [{key: 'label', value: 'label'}],
          width: '50%',
          render: (text, record) => record.label,
          options: modules
        }
      ]
    }
  ]
  return wrapForm