king
2022-10-28 aa41be24e83653077d85860cb70882551912af24
src/menu/components/card/balcony/options.jsx
@@ -1,18 +1,33 @@
import { fromJS } from 'immutable'
import React from 'react'
import MenuUtils from '@/utils/utils-custom.js'
/**
 * @description Wrap表单配置信息
 */
export default function (wrap) {
  let modules = MenuUtils.getLinkModules(fromJS(window.GLOB.customMenu).toJS().components) || []
  let supmodules = MenuUtils.getSupModules(fromJS(window.GLOB.customMenu).toJS().components, '') || []
  let menu = window.GLOB.customMenu
  let modules = MenuUtils.getLinkModules(menu.components) || []
  let supmodules = MenuUtils.getSupModules(menu.components, '', menu.interfaces)
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
  let interfaces = []
  if (menu.interfaces) {
    menu.interfaces.forEach(item => {
      if (item.status === 'true') {
        interfaces.push({
          value: item.uuid,
          label: item.name
        })
      }
    })
  }
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch {
    } catch (e) {
      roleList = []
    }
  } else {
@@ -49,14 +64,32 @@
      options: [
        {value: 'dynamic', label: '动态'},
        {value: 'static', label: '静态'},
        {value: 'public', label: '公共数据源'},
      ],
      controlFields: [
        {field: 'empty', values: ['dynamic']},
        {field: 'publicId', values: ['public']},
      ]
    },
    {
      type: 'select',
      field: 'publicId',
      label: '数据源',
      initval: wrap.publicId || '',
      required: true,
      options: interfaces
    },
    {
      type: 'radio',
      field: 'linkType',
      label: '受控类型',
      initval: wrap.linkType || 'static',
      tooltip: '组件与其他组件之间的控制类型,独立表示与其他没有关联。',
      tooltip: <div>
        <div>组件与其他组件之间的控制类型: </div>
        <div>1、独立表示与其他组件没有关联。</div>
        <div>2、同步类型中公式、按钮以及全选元素比较特殊,操作数据为其同步组件的数据。</div>
        <div>3、上级类型需添加当前组件的上级组件,并可设置当前组件为始终显示,还是只有在上级组件选行后才显示。</div>
      </div>,
      required: false,
      options: [
        {value: 'static', label: '独立'},
@@ -74,7 +107,7 @@
      type: 'cascader',
      field: 'supModule',
      label: '上级组件',
      initval: wrap.supModule || '',
      initval: wrap.supModule || [],
      // tooltip: '当上级组件不存在或没有权限时,当前组件不显示。',
      required: true,
      options: supmodules
@@ -117,20 +150,17 @@
      field: 'position',
      label: '位置',
      initval: wrap.position || 'relative',
      tooltip: '使用固定定位时,请在测试环境中查看定位效果。',
      tooltip: '相对定位是相对其正常位置的偏移;绝对定位是相对于原组件的偏移,原组件高度可视为0;固定定位是相对于窗口的位置,定位效果测试环境中查看。',
      required: false,
      options: [
        {value: 'relative', label: '相对定位'},
        {value: 'absolute', label: '绝对定位'},
        {value: 'fixed', label: '固定定位'},
      ],
      controlFields: [
        {field: 'quick', values: ['fixed']},
        {field: 'top', values: ['fixed']},
        {field: 'right', values: ['fixed']},
        {field: 'bottom', values: ['fixed']},
        {field: 'left', values: ['fixed']},
        {field: 'realwidth', values: ['fixed']},
        {field: 'transform', values: ['fixed']},
        {field: 'realwidth', values: ['fixed', 'absolute']},
        {field: 'transform', values: ['fixed', 'absolute']},
      ]
    },
    {
@@ -205,12 +235,38 @@
      ]
    },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      skip: true,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList
      options: roleList,
      forbid: !!appType
    },
  ]