king
2021-09-06 84a746468a3f7e5b39a3ed53090a19a8dec8cb10
src/mob/components/tabs/antv-tabs/options.jsx
@@ -1,7 +1,7 @@
/**
 * @description Wrap表单配置信息
 */
export default function (tab, setting) {
export function getTabForm(tab, setting) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
@@ -60,4 +60,96 @@
  ]
  return tabForm
}
}
/**
 * @description tabs表单配置信息
 */
export function getTabsSetForm(setting) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
  const tabForm = [
    {
      type: 'text',
      field: 'name',
      label: '组件名称',
      initval: setting.name || '',
      tooltip: '用于组件间的区分。',
      required: true
    },
    {
      type: 'number',
      field: 'width',
      label: '宽度',
      initval: setting.width || 24,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
      precision: 0,
      required: true
    },
    {
      type: 'select',
      field: 'position',
      label: '标签位置',
      initval: setting.position || 'top',
      required: true,
      options: [
        {value: 'top', label: 'top'},
        {value: 'bottom', label: 'bottom'},
        {value: 'left', label: 'left'},
        {value: 'right', label: 'right'},
      ],
      controlFields: [
        {field: 'display', values: ['top', 'bottom']},
      ]
    },
    {
      type: 'radio',
      field: 'tabStyle',
      label: '页签样式',
      initval: setting.tabStyle || 'line',
      tooltip: '标签位置为top时有效,默认值为line。',
      required: true,
      options: [
        {value: 'line', label: 'line'},
        {value: 'card', label: 'card'},
      ],
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      field: 'display',
      label: '标签显示',
      initval: setting.display || 'flex',
      required: false,
      options: [
        {value: 'flex', label: '弹性布局'},
        {value: 'inline-block', label: '定宽'},
      ],
      forbid: appType !== 'mob'
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: setting.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
    },
  ]
  return tabForm
}