king
2024-06-01 4cc738e535d1a20701d206e12cf9de8cc5a01170
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'},
@@ -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
        }
      }
    },
@@ -287,11 +260,9 @@
      required: false,
      linkField: 'datatype',
      options: [
        {ParentID: 'static', value: 'static', label: '静态值'},
        {ParentID: 'dynamic', value: 'static', label: '静态值'},
        {ParentID: '', value: 'static', label: '静态值'},
        {ParentID: 'dynamic', value: 'dynamic', label: '动态值'},
        {ParentID: 'dynamic', value: 'joint', label: '拼接值'},
        {ParentID: 'public', value: 'static', label: '静态值'},
        {ParentID: 'public', value: 'dynamic', label: '动态值'},
        {ParentID: 'public', value: 'joint', label: '拼接值'},
      ],
@@ -427,6 +398,7 @@
      label: '语音播报',
      initval: wrap.broadcast || '',
      tooltip: '语音播报在移动端有效。注:在H5中请使用音频链接,添加定时器时,可循环播报',
      timestamp: new Date().getTime(),
      required: false,
      options: columns,
      forbid: !columns || appType !== 'mob' || subtype !== 'propcard'
@@ -525,6 +497,7 @@
      label: '控制字段',
      initval: wrap.jumpField || '',
      tooltip: '当字段值为true时触发跳转。',
      timestamp: new Date().getTime(),
      required: true,
      options: columns,
      forbid: subtype !== 'propcard' || appType !== 'mob'
@@ -544,6 +517,7 @@
      label: '链接字段',
      initval: wrap.link || '',
      tooltip: '跳转链接为查询数据的返回值。',
      timestamp: new Date().getTime(),
      required: true,
      options: columns,
      forbid: subtype !== 'propcard' || appType !== 'mob'