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') {
@@ -159,7 +153,7 @@
      field: 'datatype',
      label: '数据来源',
      initval: wrap.datatype || 'dynamic',
      tooltip: '选择静态值,无需配置数据源。',
      tooltip: '选择静态时,无需配置数据源,可展示上级组件或url参数字段。',
      required: false,
      options: [
        {value: 'dynamic', label: '动态', priKeyType: 'static'},
@@ -167,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']},
@@ -175,7 +169,7 @@
        {field: 'supModule', values: ['static']},
        {field: 'publicId', values: ['public']},
        {field: 'emptyExec', values: ['dynamic', 'public']},
      ],
      ] : null,
      forbid: subtype !== 'propcard'
    },
    {
@@ -187,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
        }
      }
    },
@@ -236,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',
@@ -287,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'
@@ -330,7 +314,7 @@
      type: 'select',
      field: 'selStyle',
      label: '选中风格',
      initval: wrap.selStyle || 'active',
      initval: wrap.selStyle || 'none',
      tooltip: '存在边框时,边框会使用系统色。',
      required: false,
      options: [
@@ -427,6 +411,7 @@
      label: '语音播报',
      initval: wrap.broadcast || '',
      tooltip: '语音播报在移动端有效。注:在H5中请使用音频链接,添加定时器时,可循环播报',
      timestamp: new Date().getTime(),
      required: false,
      options: columns,
      forbid: !columns || appType !== 'mob' || subtype !== 'propcard'
@@ -455,9 +440,9 @@
        {value: 'normal', label: '正常显示'},
        {value: 'hidden', label: '不可见'},
      ],
      controlFields: [
      controlFields: subtype === 'propcard' ? [
        {field: 'empty', values: ['normal']},
      ],
      ] : null,
      forbid: subtype !== 'propcard'
    },
    {
@@ -467,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',
@@ -484,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',
@@ -525,6 +535,7 @@
      label: '控制字段',
      initval: wrap.jumpField || '',
      tooltip: '当字段值为true时触发跳转。',
      timestamp: new Date().getTime(),
      required: true,
      options: columns,
      forbid: subtype !== 'propcard' || appType !== 'mob'
@@ -544,6 +555,7 @@
      label: '链接字段',
      initval: wrap.link || '',
      tooltip: '跳转链接为查询数据的返回值。',
      timestamp: new Date().getTime(),
      required: true,
      options: columns,
      forbid: subtype !== 'propcard' || appType !== 'mob'
@@ -591,6 +603,7 @@
      tooltip: '用于控制行数据是否可选择。',
      required: false,
      allowClear: true,
      joint: true,
      options: columns,
      controlFields: [
        {field: 'controlVal', notNull: true},
@@ -657,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',