king
2025-01-27 66551ce2db74ccd54226fb78a640d07f04519917
src/menu/components/card/balcony/options.jsx
@@ -1,29 +1,20 @@
import React from 'react'
import MenuUtils from '@/utils/utils-custom.js'
import MenuUtils, { getLinkModules, getInterfaces } from '@/utils/utils-custom.js'
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, buttons, columns) {
  let menu = window.GLOB.customMenu
  let MenuType = menu.parentId === 'BillPrintTemp' ? 'billPrint' : ''
  let isprint = sessionStorage.getItem('MenuType') === 'billPrint'
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
  let modules = MenuUtils.getLinkModules(menu.components) || []
  let modules = 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
        })
      }
    })
  }
  let interfaces = getInterfaces()
  if (roleList) {
    try {
@@ -60,7 +51,7 @@
      field: 'datatype',
      label: '数据来源',
      initval: wrap.datatype || 'static',
      tooltip: '选择静态值,无需配置数据源。',
      tooltip: '选择静态时,无需配置数据源,可展示上级组件或url参数字段。',
      required: false,
      options: [
        {value: 'dynamic', label: '动态'},
@@ -81,23 +72,15 @@
      required: true,
      options: interfaces,
      reset_source: true,
      callback: (map, record) => {
      callback: (record) => {
        if (!record.publicId) return
        let interfaces = window.GLOB.customMenu.interfaces || []
        let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0]
        let d = interfaces.filter(m => m.value === record.publicId)[0]
        if (!d || !d.columns) return
        let columns = JSON.parse(JSON.stringify(d.columns))
        let _bgField = map.get('bgField')
        if (_bgField && !_bgField.forbid) {
          _bgField.options = columns
          _bgField.oriOptions = columns
          map.set('bgField', _bgField)
        return {
          bgField: d.columns
        }
      }
    },
@@ -107,14 +90,13 @@
      label: '受控类型',
      initval: wrap.linkType || 'static',
      tooltip: <div>
        <div>组件与其他组件之间的控制类型: </div>
        <div>1、独立表示与其他组件没有关联。</div>
        <div>2、同步类型中公式、按钮以及全选元素比较特殊,操作数据为其同步组件的数据。</div>
        <div>3、上级类型需添加当前组件的上级组件,并可设置当前组件为始终显示,还是只有在上级组件选行后才显示。</div>
        <div>同步类型:此类型时公式、按钮以及全选元素比较特殊,操作数据为其同步组件选中的数据。</div>
        <div>上级类型:可设置当前组件的显示条件(始终显示或上级选行时显示),与静态数据源配合也可用于展示上级组件选中的信息。</div>
      </div>,
      toolWidth: 400,
      required: false,
      options: [
        {value: 'static', label: '独立'},
        {value: 'static', label: '无'},
        {value: 'sync', label: '同步'},
        {value: 'sup', label: '上级'},
      ],
@@ -124,16 +106,17 @@
        {field: 'syncModule', values: ['sync']},
        {field: 'checkAll', values: ['sync']},
      ],
      forbid: MenuType === 'billPrint'
      forbid: isprint
    },
    {
      type: 'cascader',
      field: 'supModule',
      label: '上级组件',
      initval: wrap.supModule || [],
      // tooltip: '当上级组件不存在或没有权限时,当前组件不显示。',
      required: true,
      options: supmodules
      allowClear: true,
      options: supmodules,
      forbid: isprint
    },
    {
      type: 'radio',
@@ -145,7 +128,8 @@
      options: [
        {value: 'hidden', label: '选行'},
        {value: 'show', label: '始终'},
      ]
      ],
      forbid: isprint
    },
    {
      type: 'cascader',
@@ -154,7 +138,18 @@
      initval: wrap.syncModule || '',
      tooltip: '当同步组件不存在或没有权限时,当前组件不显示。',
      required: true,
      options: modules
      options: modules,
      forbid: isprint
    },
    {
      type: 'cascader',
      field: 'syncModule',
      label: '同步组件',
      initval: wrap.syncModule || '',
      tooltip: '当同步组件不存在或没有权限时,当前组件不显示。',
      required: true,
      options: modules,
      forbid: isprint
    },
    {
      type: 'radio',
@@ -166,7 +161,8 @@
      options: [
        {value: 'hidden', label: '隐藏'},
        {value: 'show', label: '显示'},
      ]
      ],
      forbid: isprint
    },
    {
      type: 'radio',
@@ -175,7 +171,6 @@
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      skip: true,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
@@ -187,6 +182,7 @@
      label: '背景图',
      initval: wrap.bgField || '',
      tooltip: '动态背景,背景图片由字段值控制。请注意调整背景样式。',
      timestamp: new Date().getTime(),
      required: false,
      options: columns
    },
@@ -201,7 +197,7 @@
        {value: 'content', label: '浮动卡'},
        {value: 'headerOrfooter', label: '页眉/页脚'},
      ],
      forbid: MenuType !== 'billPrint'
      forbid: !isprint
    },
    {
      type: 'radio',
@@ -210,10 +206,22 @@
      initval: wrap.permission || (!appType ? 'true' : 'false'),
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'true', label: !appType ? '继承菜单' : '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: sessionStorage.getItem('editMenuType') === 'popview'
      forbid: ispop || isprint
    },
    {
      type: 'radio',
      field: 'cacheLocal',
      label: '本地缓存',
      initval: wrap.cacheLocal || 'true',
      required: false,
      options: [
        {value: 'true', label: '继承菜单'},
        {value: 'false', label: '禁用'},
      ],
      forbid: ispop || isprint
    },
    {
      type: 'select',
@@ -222,7 +230,7 @@
      initval: wrap.linkbtn || '',
      required: false,
      options: buttons,
      forbid: MenuType === 'billPrint'
      forbid: isprint
    },
    {
      type: 'multiselect',
@@ -231,7 +239,7 @@
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
      forbid: !!appType || isprint
    },
  ]