king
2025-04-03 d4d2b680baff18f950da5e77463c1f0e26dbd567
src/menu/components/card/data-card/options.jsx
@@ -1,4 +1,4 @@
import MenuUtils from '@/utils/utils-custom.js'
import MenuUtils, { getInterfaces } from '@/utils/utils-custom.js'
/**
 * @description Wrap表单配置信息
@@ -9,16 +9,10 @@
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
  let menu = window.GLOB.customMenu
  let laypage = setting && setting.laypage !== 'false'
  let interfaces = []
  if (subtype === 'propcard' && menu.interfaces) {
    menu.interfaces.forEach(item => {
      if (item.status === 'true') {
        interfaces.push({
          value: item.uuid,
          label: item.name
        })
      }
    })
  if (subtype === 'propcard') {
    interfaces = getInterfaces()
  }
  let modules = []
  if (subtype === 'propcard' || subtype === 'datacard') {
@@ -59,6 +53,74 @@
    }
  }
  let interaction = []
  let interOptions = []
  if (wrap.scale === 'true') {
    interaction.push('scale')
  }
  if (wrap.parity === 'true') {
    interaction.push('parity')
  }
  if (wrap.hover === 'true') {
    interaction.push('hover')
  }
  if (subtype === 'datacard') {
    interOptions = [
      {value: 'parity', label: '奇偶异色'},
    ]
    if (appType !== 'mob') {
      interOptions.push(
        {value: 'hover', label: '悬浮变色'},
        {value: 'scale', label: '悬浮放大'}
      )
    }
  } else if (subtype === 'propcard' && appType !== 'mob') {
    interOptions = [
      {value: 'scale', label: '悬浮放大'}
    ]
  } else if (subtype === 'tablecard') {
    interOptions = [
      {value: 'parity', label: '奇偶异色'},
    ]
    if (appType !== 'mob') {
      interOptions.push(
        {value: 'hover', label: '悬浮变色'}
      )
    }
  }
  if (interaction.length && interOptions.length) {
    interaction = interaction.filter(m => interOptions.findIndex(cell => cell.value === m) > -1)
  }
  // let interItem = null
  // if (interOptions.length === 1) {
  //   interItem = {
  //     type: 'radio',
  //     field: interOptions[0].value,
  //     label: interOptions[0].label,
  //     initval: interaction.length === 1 ? 'true' : 'false',
  //     required: false,
  //     options: [
  //       {value: 'true', label: '启用'},
  //       {value: 'false', label: '禁用'}
  //     ]
  //   }
  // } else {
  //   interItem = {
  //     type: 'checkbox',
  //     field: 'interaction',
  //     label: '交互效果',
  //     initval: interaction,
  //     required: false,
  //     options: interOptions,
  //     forbid: interOptions.length === 0
  //   }
  // }
  const cardWrapForm = [
    {
      type: 'text',
@@ -91,7 +153,7 @@
      field: 'datatype',
      label: '数据来源',
      initval: wrap.datatype || 'dynamic',
      tooltip: '选择静态值,无需配置数据源。',
      tooltip: '选择静态时,无需配置数据源,可展示上级组件或url参数字段。',
      required: false,
      options: [
        {value: 'dynamic', label: '动态', priKeyType: 'static'},
@@ -99,7 +161,7 @@
        {value: 'public', label: '公共数据源', priKeyType: 'static'},
      ],
      linkFields: ['priKeyType'],
      controlFields: [
      controlFields: subtype === 'propcard' ? [
        {field: 'goback', values: ['dynamic', 'public']},
        {field: 'empty', values: ['dynamic', 'public']},
        {field: 'jump', values: ['dynamic', 'public']},
@@ -107,7 +169,7 @@
        {field: 'supModule', values: ['static']},
        {field: 'publicId', values: ['public']},
        {field: 'emptyExec', values: ['dynamic', 'public']},
      ],
      ] : null,
      forbid: subtype !== 'propcard'
    },
    {
@@ -119,38 +181,17 @@
      options: interfaces,
      reset_source: true,
      forbid: subtype !== 'propcard',
      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 _broadcast = map.get('broadcast')
        if (_broadcast && !_broadcast.forbid) {
          _broadcast.options = columns
          _broadcast.oriOptions = columns
          map.set('broadcast', _broadcast)
        }
        let _jumpField = map.get('jumpField')
        if (_jumpField && !_jumpField.forbid) {
          _jumpField.options = columns
          _jumpField.oriOptions = columns
          map.set('jumpField', _jumpField)
        }
        let _link = map.get('link')
        if (_link && !_link.forbid) {
          _link.options = columns
          _link.oriOptions = columns
          map.set('link', _link)
        return {
          broadcast: d.columns,
          jumpField: d.columns,
          link: d.columns
        }
      }
    },
@@ -168,8 +209,21 @@
      controlFields: subtype !== 'propcard' ? [
        {field: 'printHeight', values: ['flex']},
        {field: 'cardFloat', values: ['grid']},
        {field: 'zHeight', values: ['grid']},
      ] : [{field: 'cardFloat', values: ['grid']}],
      forbid: subtype === 'tablecard'
    },
    {
      type: 'number',
      field: 'zHeight',
      label: '最大高度',
      initval: wrap.zHeight || '',
      tooltip: '卡片内容区的最大高度(不包含标题、翻页等元素),添加高度后组件中第一个属性卡将固定于头部。注:小于等于100大于0时为高度的百分比,小于0时为窗口高度减去此值。',
      min: -1000,
      max: 3000,
      precision: 0,
      required: false,
      forbid: subtype !== 'datacard' || appType === 'mob'
    },
    {
      type: 'radio',
@@ -219,12 +273,10 @@
      required: false,
      linkField: 'datatype',
      options: [
        {ParentID: 'static', value: 'static', label: '静态值'},
        {ParentID: 'dynamic', value: 'static', label: '静态值'},
        {ParentID: 'dynamic', value: 'dynamic', label: '动态值'},
        {ParentID: 'dynamic', value: 'joint', label: '拼接值'},
        {ParentID: 'public', value: 'static', label: '静态值'},
        {ParentID: 'public', value: 'dynamic', label: '动态值'},
        {ParentID: '', value: 'static', label: '静态值'},
        {ParentID: 'dynamic', value: 'joint', label: '拼接值'},
        {ParentID: 'public', value: 'joint', label: '拼接值'},
      ],
      forbid: subtype !== 'propcard'
@@ -262,7 +314,7 @@
      type: 'select',
      field: 'selStyle',
      label: '选中风格',
      initval: wrap.selStyle || 'active',
      initval: wrap.selStyle || 'none',
      tooltip: '存在边框时,边框会使用系统色。',
      required: false,
      options: [
@@ -306,31 +358,27 @@
      ],
      forbid: subtype !== 'datacard' || appType === 'mob'
    },
    // {
    //   type: 'radio',
    //   field: 'scale',
    //   label: '放大效果',
    //   initval: wrap.scale || 'false',
    //   tooltip: '鼠标悬浮于卡片上方时,卡片放大1.05倍。',
    //   required: false,
    //   options: [
    //     {value: 'false', label: '无'},
    //     {value: 'true', label: '有'},
    //   ],
    //   forbid: subtype === 'tablecard' || appType === 'mob'
    // },
    {
      type: 'radio',
      field: 'scale',
      label: '放大效果',
      initval: wrap.scale || 'false',
      tooltip: '鼠标悬浮于卡片上方时,卡片放大1.05倍。',
      type: 'checkbox',
      field: 'interaction',
      label: '交互效果',
      initval: interaction,
      required: false,
      options: [
        {value: 'false', label: '无'},
        {value: 'true', label: '有'},
      ],
      forbid: subtype === 'tablecard' || appType === 'mob'
    },
    {
      type: 'radio',
      field: 'parity',
      label: '奇偶背景',
      initval: wrap.parity || 'false',
      tooltip: '偶数行会添加背景色。',
      required: false,
      options: [
        {value: 'false', label: '无'},
        {value: 'true', label: '有'},
      ],
      forbid: subtype === 'propcard'
      options: interOptions,
      forbid: interOptions.length === 0
    },
    {
      type: 'radio',
@@ -363,6 +411,7 @@
      label: '语音播报',
      initval: wrap.broadcast || '',
      tooltip: '语音播报在移动端有效。注:在H5中请使用音频链接,添加定时器时,可循环播报',
      timestamp: new Date().getTime(),
      required: false,
      options: columns,
      forbid: !columns || appType !== 'mob' || subtype !== 'propcard'
@@ -391,9 +440,9 @@
        {value: 'normal', label: '正常显示'},
        {value: 'hidden', label: '不可见'},
      ],
      controlFields: [
      controlFields: subtype === 'propcard' ? [
        {field: 'empty', values: ['normal']},
      ],
      ] : null,
      forbid: subtype !== 'propcard'
    },
    {
@@ -403,11 +452,26 @@
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      skip: true,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
      controlFields: [
        {field: 'empSign', values: ['show']},
      ]
    },
    {
      type: 'radio',
      field: 'empSign',
      label: '空值图标',
      initval: wrap.empSign || 'show',
      tooltip: '当查询数据为空时,是否显示空值提示图标。',
      required: false,
      options: [
        {value: 'show', label: '显示'},
        {value: 'hidden', label: '隐藏'},
      ],
      forbid: subtype === 'propcard'
    },
    {
      type: 'select',
@@ -420,7 +484,17 @@
      forbid: subtype !== 'propcard' && subtype !== 'datacard',
      controlFields: [
        {field: 'emptyExec', notNull: true},
        {field: 'execDelay', notNull: true},
      ]
    },
    {
      type: 'number',
      field: 'execDelay',
      label: '执行延时',
      initval: wrap.execDelay,
      tooltip: '自动执行按钮的延时执行时间,单位毫秒。',
      required: false,
      forbid: subtype !== 'propcard'
    },
    {
      type: 'radio',
@@ -449,7 +523,6 @@
      ],
      controlFields: [
        {field: 'jumpField', values: ['menu', 'link']},
        {field: 'joint', values: ['menu', 'link']},
        {field: 'open', values: ['menu', 'link']},
        {field: 'menu', values: ['menu']},
        {field: 'link', values: ['link']},
@@ -462,6 +535,7 @@
      label: '控制字段',
      initval: wrap.jumpField || '',
      tooltip: '当字段值为true时触发跳转。',
      timestamp: new Date().getTime(),
      required: true,
      options: columns,
      forbid: subtype !== 'propcard' || appType !== 'mob'
@@ -481,20 +555,9 @@
      label: '链接字段',
      initval: wrap.link || '',
      tooltip: '跳转链接为查询数据的返回值。',
      timestamp: new Date().getTime(),
      required: true,
      options: columns,
      forbid: subtype !== 'propcard' || appType !== 'mob'
    },
    {
      type: 'radio',
      field: 'joint',
      label: '参数拼接',
      initval: wrap.joint || 'true',
      required: false,
      options: [
        {value: 'true', label: '是'},
        {value: 'false', label: '否'},
      ],
      forbid: subtype !== 'propcard' || appType !== 'mob'
    },
    {
@@ -540,6 +603,7 @@
      tooltip: '用于控制行数据是否可选择。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns,
      controlFields: [
        {field: 'controlVal', notNull: true},
@@ -606,20 +670,19 @@
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !!appType || isprint
      forbid: !!appType || subtype === 'propcard' || isprint
    },
    {
      type: 'radio',
      field: 'searchBtn',
      label: '搜索按钮',
      initval: wrap.searchBtn || 'hidden',
      // tooltip: '启用搜索条件缓存后,在菜单刷新时搜索条件不变。',
      required: false,
      options: [
        {value: 'hidden', label: '隐藏'},
        {value: 'show', label: '显示'},
      ],
      forbid: appType === 'mob' || isprint,
      forbid: appType === 'mob' || subtype === 'propcard' || isprint,
    },
    {
      type: 'radio',
@@ -682,7 +745,7 @@
          width: '20%'
        },
        {
          title: '菜单',
          title: '组件',
          dataIndex: 'nodes',
          inputType: 'cascader',
          editable: true,