king
2025-05-13 1a176e4bdba485301385caac1a29102e598d25cc
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,
@@ -69,6 +74,17 @@
      ],
      controlFields: [
        {field: 'selected', values: ['radio', 'checkbox']},
      ]
    },
    {
      type: 'radio',
      field: 'parity',
      label: '奇偶异色',
      initval: wrap.parity || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ]
    },
    {
@@ -145,6 +161,19 @@
    },
    {
      type: 'radio',
      field: 'searchSize',
      label: '搜索样式',
      initval: wrap.searchSize === 'middle' ? '' : wrap.searchSize || '',
      required: false,
      options: [
        {value: '', label: '默认'},
        {value: 'small', label: '小间距'},
        {value: 'updown', label: '上下排列'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'mode',
      label: '模式',
      initval: wrap.mode || 'default',
@@ -153,20 +182,6 @@
        {value: 'default', label: '常规'},
        {value: 'ghost', label: '透明'},
      ]
    },
    {
      type: 'select',
      field: 'selected',
      label: '数据选中',
      initval: wrap.selected || 'false',
      tooltip: '初始化:数据加载时选中首行数据,仅执行一次。数据加载:每次数据加载时均选中首行(当按钮执行完成并返回主键值时,默认选中主键值对应行)。选中标记:返回数据中存在 selected 字段,且值为 true 的数据被选中。',
      required: false,
      options: [
        {value: 'false', label: '无'},
        {value: 'init', label: '初始化'},
        {value: 'always', label: '数据加载'},
        {value: 'sign', label: '选中标记'}
      ],
    },
    {
      type: 'color',
@@ -190,16 +205,19 @@
      ]
    },
    {
      type: 'number',
      field: 'btnlimit',
      label: '按钮限制',
      initval: wrap.btnlimit || '',
      tooltip: '按钮数量限制,超出的按钮会在更多中下拉显示,注:更多中的按钮不要绑定双击事件。',
      min: 3,
      max: 3000,
      precision: 0,
      type: 'select',
      field: 'selected',
      label: '数据选中',
      initval: wrap.selected || 'false',
      tooltip: '初始化:数据加载时选中首行数据,仅执行一次。数据加载:每次数据加载时均选中首行(当按钮执行完成并返回主键值时,默认选中主键值对应行)。选中标记:返回数据中存在 selected 字段,且值为 true 的数据被选中。本地记录:数据刷新时上次被选中的行将自动选中。',
      required: false,
      forbid: appType !== '' || isprint
      options: [
        {value: 'false', label: '无'},
        {value: 'init', label: '初始化'},
        {value: 'always', label: '数据加载'},
        {value: 'sign', label: '选中标记'},
        {value: 'local', label: '本地记录'},
      ],
    },
    {
      type: 'select',
@@ -229,6 +247,7 @@
      tooltip: '鼠标悬浮于行上方时的提示信息。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns
    },
    {
@@ -239,6 +258,7 @@
      tooltip: '用于控制行数据是否可选择。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns,
      controlFields: [
        {field: 'controlVal', notNull: true},
@@ -253,6 +273,30 @@
      required: false
    },
    {
      type: 'number',
      field: 'btnlimit',
      label: '按钮限制',
      initval: wrap.btnlimit || '',
      tooltip: '按钮数量限制,超出的按钮会在更多中下拉显示,注:更多中的按钮不要绑定双击事件。',
      min: 3,
      max: 3000,
      precision: 0,
      required: false,
      forbid: appType !== '' || isprint
    },
    {
      type: 'number',
      field: 'maxPageSize',
      label: '每页最大数',
      initval: wrap.maxPageSize || '',
      tooltip: '分页时每页可显示的最大数量。',
      min: 10,
      max: 500,
      precision: 0,
      required: false,
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
@@ -262,6 +306,21 @@
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
      controlFields: [
        {field: 'empSign', values: ['show']},
      ]
    },
    {
      type: 'radio',
      field: 'empSign',
      label: '空值图标',
      initval: wrap.empSign || 'show',
      tooltip: '当查询数据为空时,是否显示空值提示图标。',
      required: false,
      options: [
        {value: 'show', label: '显示'},
        {value: 'hidden', label: '隐藏'},
      ],
    },
    {
@@ -276,6 +335,22 @@
        {value: 'false', label: '忽略'},
      ],
      forbid: isprint
    },
    {
      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',
@@ -315,6 +390,67 @@
      forbid: !!appType || isprint
    },
    {
      type: 'radio',
      field: 'tree',
      label: '结构树',
      initval: wrap.tree || 'false',
      tooltip: '使用结构树时,显示列首列请使用文本类型。',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      controlFields: [
        {field: 'valueField', values: ['true']},
        {field: 'parentField', values: ['true']},
        {field: 'mark', values: ['true']},
        {field: 'defOpen', values: ['true']},
      ],
      forbid: appType === 'mob' || isprint
    },
    {
      type: 'select',
      field: 'valueField',
      label: '值字段',
      initval: wrap.valueField || '',
      tooltip: '数据值字段,结构树中节点ID值,与上级字段配合组织数据的上下级关系。',
      required: true,
      options: columns,
      forbid: appType === 'mob' || isprint
    },
    {
      type: 'select',
      field: 'parentField',
      label: '上级字段',
      initval: wrap.parentField || '',
      tooltip: '上级字段,用于组织数据的上下级关系。',
      required: true,
      options: columns,
      forbid: appType === 'mob' || isprint
    },
    {
      type: 'text',
      field: 'mark',
      label: '顶级标识',
      initval: wrap.mark || '',
      tooltip: '上级字段值与顶级标识相同时,视为顶级节点。',
      required: false,
      forbid: appType === 'mob' || isprint
    },
    {
      type: 'radio',
      field: 'defOpen',
      label: '默认展开',
      initval: wrap.defOpen || '',
      required: false,
      options: [
        {value: '', label: '无'},
        {value: 'topline', label: '首行'},
        {value: 'all', label: '全部'},
      ],
      forbid: appType === 'mob' || isprint
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
@@ -323,6 +459,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