king
2023-10-24 4de0acf2a232ae29f2b5bd7bb2ee61a238c5d2d0
src/menu/components/table/edit-table/options.jsx
@@ -1,7 +1,7 @@
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, action = []) {
export default function (wrap, columns = []) {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
@@ -32,18 +32,149 @@
      required: true
    },
    {
      type: 'number',
      field: 'width',
      label: '宽度',
      initval: wrap.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    {
      type: 'number',
      field: 'height',
      label: '高度',
      initval: wrap.height || '',
      tooltip: '表格高度,空值时高度自适应。注:小于等于100时为高度的百分比。',
      min: 10,
      max: 3000,
      precision: 0,
      required: false
    },
    // {
    //   type: 'radio',
    //   field: 'editable',
    //   label: '初始化',
    //   initval: wrap.editable || 'false',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '可编辑'},
    //     {value: 'false', label: '不可编辑'},
    //   ],
    //   controlFields: [
    //     {field: 'switchable', values: ['true']},
    //   ]
    // },
    // {
    //   type: 'radio',
    //   field: 'submittal',
    //   label: '提交后',
    //   initval: wrap.submittal || 'false',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '可编辑'},
    //     {value: 'false', label: '不可编辑'},
    //   ]
    // },
    // {
    //   type: 'radio',
    //   field: 'addable',
    //   label: '可新增',
    //   initval: wrap.addable || 'false',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '是'},
    //     {value: 'false', label: '否'},
    //   ]
    // },
    // {
    //   type: 'radio',
    //   field: 'delable',
    //   label: '可删除',
    //   initval: wrap.delable || 'false',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '是'},
    //     {value: 'false', label: '否'},
    //   ]
    // },
    {
      type: 'radio',
      field: 'commit',
      label: '数据提交',
      initval: wrap.commit || 'all',
      tooltip: '单项提交指在表单中回车或删除行时,设置为单项时如点击提交按钮,会提交修改项。失去焦点提交时会验证数据是否修改,未修改的数据不会提交。',
      required: false,
      options: [
        {value: 'all', label: '全部'},
        {value: 'change', label: '修改项'},
        {value: 'simple', label: '单项'},
        {value: 'blur', label: '失去焦点'},
      ],
      controlFields: [
        {field: 'standard', values: ['change', 'simple']},
      ]
    },
    // {
    //   type: 'radio',
    //   field: 'operType',
    //   label: '编辑按钮',
    //   initval: wrap.operType || 'btnMode',
    //   tooltip: '编辑时的添加、删除按钮显示位置,注:使用浮标时表格横向滚动失效,表格设置高度时浮标无效。',
    //   required: false,
    //   options: [
    //     {value: 'btnMode', label: '按钮式'},
    //     {value: 'buoyMode', label: '浮标式'},
    //   ]
    // },
    {
      type: 'radio',
      field: 'editType',
      label: '编辑模式',
      initval: wrap.editType || 'simple',
      tooltip: '可编辑表单是否全部放开。',
      required: false,
      options: [
        {value: 'simple', label: '单项'},
        {value: 'multi', label: '整体'},
      ]
    },
    {
      type: 'radio',
      field: 'standard',
      label: '修改标准',
      initval: wrap.standard || 'init',
      tooltip: '如何判断行信息是否应该提交。',
      required: false,
      options: [
        {value: 'init', label: '与初始值不同'},
        {value: 'change', label: '存在编辑痕迹'},
      ]
    },
    {
      type: 'radio',
      field: 'cache',
      label: '缓存',
      initval: wrap.cache || 'true',
      tooltip: '对于使用数据源的下拉菜单,下拉选项是否缓存到本地。',
      required: false,
      options: [
        {value: 'true', label: '使用'},
        {value: 'false', label: '不使用'},
      ]
    },
    {
      type: 'radio',
      field: 'tableType',
      label: '表格属性',
      initval: wrap.tableType,
      initval: wrap.tableType || '',
      required: false,
      options: [
        {value: '', label: '不可选'},
        {value: 'radio', label: '单选'},
        {value: 'checkbox', label: '多选'},
      ],
      controlFields: [
        {field: 'selected', values: ['radio', 'checkbox']},
      ]
    },
    {
@@ -79,7 +210,7 @@
        {value: 'default', label: '大'},
        {value: 'middle', label: '中'},
        {value: 'small', label: '小'},
        // {value: 'mini', label: '微'},
        {value: 'mini', label: '迷你'},
      ]
    },
    {
@@ -93,30 +224,18 @@
        {value: 'ghost', label: '透明'},
      ]
    },
    {
      type: 'radio',
      field: 'selected',
      label: '首行选中',
      initval: wrap.selected || 'false',
      required: false,
      options: [
        {value: 'false', label: '无'},
        {value: 'init', label: '初始化'},
        {value: 'always', label: '数据加载'},
      ]
    },
    {
      type: 'radio',
      field: 'show',
      label: '搜索按钮',
      initval: wrap.show || 'true',
      tooltip: '搜索条件存在时,可选择是否显示搜索按钮。',
      required: false,
      options: [
        {value: 'true', label: '显示'},
        {value: 'false', label: '隐藏'},
      ]
    },
    // {
    //   type: 'radio',
    //   field: 'show',
    //   label: '搜索按钮',
    //   initval: wrap.show || 'true',
    //   tooltip: '搜索条件存在时,可选择是否显示搜索按钮。',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '显示'},
    //     {value: 'false', label: '隐藏'},
    //   ]
    // },
    {
      type: 'color',
      field: 'borderColor',
@@ -126,68 +245,92 @@
      required: false
    },
    {
      type: 'color',
      field: 'color',
      label: '字体颜色',
      initval: wrap.color || 'rgba(0, 0, 0, 0.65)',
      tooltip: '默认值 rgba(0, 0, 0, 0.65)。',
      required: false
    },
    {
      type: 'number',
      field: 'width',
      label: '宽度',
      initval: wrap.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    {
      type: 'number',
      field: 'fontSize',
      label: '字体大小',
      initval: wrap.fontSize || 14,
      min: 12,
      max: 30,
      precision: 0,
      required: false
    },
    {
      type: 'number',
      field: 'height',
      label: '高度',
      initval: wrap.height || '',
      tooltip: '表格高度,空值时高度自适应。',
      min: 10,
      max: 3000,
      precision: 0,
      type: 'radio',
      field: 'vertical',
      label: '垂直对齐',
      initval: wrap.vertical || 'middle',
      tooltip: '单元格的垂直对齐方式。',
      required: false,
      forbid: appType === 'mob'
      options: [
        {value: 'top', label: '向上'},
        {value: 'middle', label: '居中'},
        {value: 'bottom', label: '向下'},
      ]
    },
    // {
    //   type: 'color',
    //   field: 'color',
    //   label: '字体颜色',
    //   initval: wrap.color || 'rgba(0, 0, 0, 0.65)',
    //   tooltip: '默认值 rgba(0, 0, 0, 0.65)。',
    //   required: false
    // },
    // {
    //   type: 'number',
    //   field: 'fontSize',
    //   label: '字体大小',
    //   initval: wrap.fontSize || 14,
    //   min: 12,
    //   max: 30,
    //   precision: 0,
    //   required: false
    // },
    // {
    //   type: 'number',
    //   field: 'advanceWidth',
    //   label: '高级搜索',
    //   initval: wrap.advanceWidth || 1000,
    //   tooltip: '高级搜索弹窗的宽度,注:当宽度值小于100时表示占窗口的百分比,大于100时表示宽度的绝对值。',
    //   min: 10,
    //   max: 3000,
    //   precision: 0,
    //   required: false
    // },
    {
      type: 'number',
      field: 'advanceWidth',
      label: '高级搜索',
      initval: wrap.advanceWidth || 1000,
      tooltip: '高级搜索弹窗的宽度,注:当宽度值小于100时表示占窗口的百分比,大于100时表示宽度的绝对值。',
      min: 10,
      max: 3000,
      precision: 0,
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || (!appType ? 'true' : 'false'),
      required: false,
      forbid: appType === 'mob'
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: sessionStorage.getItem('editMenuType') === 'popview'
    },
    // {
    //   type: 'radio',
    //   field: 'switchable',
    //   label: '状态切换',
    //   initval: wrap.switchable || 'true',
    //   tooltip: '是否可以在编辑和默认table状态间切换。',
    //   required: false,
    //   options: [
    //     {value: 'true', label: '启用'},
    //     {value: 'false', label: '禁用'},
    //   ]
    // },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'select',
      field: 'doubleClick',
      label: '双击事件',
      initval: wrap.doubleClick || '',
      tooltip: '双击表格中行,触发的按钮。',
      field: 'tipField',
      label: '信息提示',
      initval: wrap.tipField || '',
      tooltip: '鼠标悬浮于行上方时的提示信息。',
      required: false,
      allowClear: true,
      options: action.map(item => ({value: item.uuid, label: item.label})),
      forbid: appType === 'mob'
      options: columns
    },
    {
      type: 'multiselect',