king
2021-12-19 9ee3d1f9a09a865188baffdffb85f6ad329c7b09
src/menu/components/card/data-card/options.jsx
@@ -1,12 +1,20 @@
import { fromJS } from 'immutable'
import MenuUtils from '@/utils/utils-custom.js'
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, subtype, columns) {
export default function (wrap, subtype, columns, id) {
  let appType = sessionStorage.getItem('appType')
  let MenuType = ''
  let menu = fromJS(window.GLOB.customMenu).toJS()
  if (window.GLOB.customMenu.parentId === 'BillPrintTemp') {
  if (menu.parentId === 'BillPrintTemp') {
    MenuType = 'billPrint'
  }
  let modules = []
  if (subtype === 'propcard') {
    modules = MenuUtils.getSupModules(menu.components, id) || []
  }
  let roleList = sessionStorage.getItem('sysRoles')
@@ -59,6 +67,10 @@
        {value: 'dynamic', label: '动态'},
        {value: 'static', label: '静态'},
      ],
      controlFields: [
        {field: 'goback', values: ['dynamic']},
        {field: 'supModule', values: ['static']},
      ],
      forbid: subtype !== 'propcard'
    },
    {
@@ -66,7 +78,7 @@
      field: 'pagestyle',
      label: '分页风格',
      initval: wrap.pagestyle || 'page',
      tooltip: '数据源选择分页时有效。',
      tooltip: '数据源选择分页时有效。注:滑动加载只有第一个有效',
      required: false,
      options: [
        {value: 'page', label: '页码'},
@@ -84,25 +96,70 @@
      options: [
        {value: '', label: '不可选'},
        {value: 'radio', label: '单选'},
        {value: 'checkbox', label: '多选', forbid: subtype === 'propcard'},
        {value: 'checkbox', label: '多选', disabled: subtype === 'propcard'},
      ],
      controlFields: [
        {field: 'checkAll', values: ['checkbox']}
        {field: 'checkAll', values: ['checkbox']},
        {field: 'selected', values: ['radio', 'checkbox']},
        {field: 'selStyle', values: ['radio', 'checkbox']},
      ],
      forbid: subtype === 'tablecard'
    },
    {
      type: 'radio',
      field: 'checkAll',
      label: '全选',
      initval: wrap.checkAll || 'hidden',
      field: 'selected',
      label: '首行选中',
      initval: wrap.selected || 'false',
      required: false,
      options: [
        {value: 'hidden', label: '隐藏'},
        {value: 'show', label: '显示'},
      ],
      forbid: subtype !== 'datacard' || appType !== 'mob'
        {value: 'false', label: '无'},
        {value: 'init', label: '初始化'},
        {value: 'always', label: '数据加载', disabled: subtype === 'propcard'},
      ]
    },
    {
      type: 'radio',
      field: 'supType',
      label: '上级类型',
      initval: wrap.supType || 'single',
      tooltip: '上级组件为单一组件或多个组件。',
      required: false,
      forbid: subtype !== 'datacard' || appType === 'mob',
      options: [
        {value: 'single', label: '单组件'},
        {value: 'multi', label: '多组件'},
      ]
    },
    {
      type: subtype === 'propcard' ? 'select' : 'radio',
      field: 'selStyle',
      label: '选中风格',
      initval: wrap.selStyle || 'active',
      tooltip: '存在边框时,边框会使用系统色。',
      required: false,
      options: subtype === 'propcard' ? [
        {value: 'none', label: '无'},
        {value: 'active', label: '外阴影'},
        {value: 'backFont', label: '背景+文字'},
        {value: 'font', label: '文字'},
      ] : [
        {value: 'none', label: '无'},
        {value: 'active', label: '外阴影'},
      ]
      // forbid: subtype !== 'propcard'
    },
    // {
    //   type: 'radio',
    //   field: 'checkAll',
    //   label: '全选',
    //   initval: wrap.checkAll || 'hidden',
    //   required: false,
    //   options: [
    //     {value: 'hidden', label: '隐藏'},
    //     {value: 'show', label: '显示'},
    //   ],
    //   forbid: subtype !== 'datacard' || appType !== 'mob'
    // },
    {
      type: 'radio',
      field: 'cardFloat',
@@ -154,6 +211,29 @@
      forbid: !columns || appType !== 'mob'
    },
    {
      type: 'radio',
      field: 'goback',
      label: '空值返回',
      initval: wrap.goback || 'false',
      tooltip: '当查询数据为空时,返回上一界面。',
      required: false,
      options: [
        {value: 'true', label: '是'},
        {value: 'false', label: '否'},
      ],
      forbid: subtype !== 'propcard' || appType !== 'mob'
    },
    {
      type: 'cascader',
      field: 'supModule',
      label: '上级组件',
      initval: wrap.supModule || [],
      required: false,
      options: modules,
      allowClear: true,
      forbid: subtype !== 'propcard'
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
@@ -165,7 +245,7 @@
  ]
  return cardWrapForm.map(item => {
    if (['pagestyle', 'cardType'].includes(item.field)) {
    if (['pagestyle'].includes(item.field)) {
      item.options = item.options.filter(option => !option.forbid)
    }