king
2025-04-21 f3d4db769ba9b51b799d981511a710fd443d0e08
src/menu/components/editor/braft-editor/options.jsx
@@ -4,6 +4,22 @@
export default function (wrap, columns) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  let isprint = sessionStorage.getItem('MenuType') === 'billPrint'
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
  let menu = window.GLOB.customMenu
  let interfaces = []
  if (menu.interfaces) {
    menu.interfaces.forEach(item => {
      if (item.status === 'true') {
        interfaces.push({
          value: item.uuid,
          label: item.name,
          columns: JSON.parse(JSON.stringify(item.columns))
        })
      }
    })
  }
  if (roleList) {
    try {
@@ -15,7 +31,28 @@
    roleList = []
  }
  let tbStyle = wrap.tbStyle ? wrap.tbStyle.split(' ') : []
  let splitLine = 'false'
  if (tbStyle.includes('deep-split')) {
    tbStyle = tbStyle.filter(n => n !== 'deep-split')
    splitLine = 'true'
  }
  let loads = []
  if (wrap.loaded === 'true') {
    loads.push('loaded')
  }
  if (wrap.preload === 'true') {
    loads.push('preload')
  }
  const cardWrapForm = [
    {
      type: 'text',
      field: 'title',
      label: '标题',
      initval: wrap.title || '',
      required: false
    },
    {
      type: 'text',
      field: 'name',
@@ -45,18 +82,41 @@
      options: [
        {value: 'dynamic', label: '动态'},
        {value: 'static', label: '静态'},
        {value: 'public', label: '公共数据源'},
      ],
      controlFields: [
        {field: 'field', values: ['dynamic']},
        {field: 'encryption', values: ['dynamic']},
        {field: 'field', values: ['dynamic', 'public']},
        {field: 'empty', values: ['dynamic', 'public']},
        {field: 'publicId', values: ['public']},
        {field: 'encryption', values: ['dynamic', 'public']},
      ]
    },
    {
      type: 'select',
      field: 'publicId',
      label: '数据源',
      initval: wrap.publicId || '',
      required: true,
      options: interfaces,
      reset_source: true,
      callback: (record) => {
        if (!record.publicId) return
        let d = interfaces.filter(m => m.value === record.publicId)[0]
        if (!d || !d.columns) return
        return {
          field: d.columns
        }
      }
    },
    {
      type: 'select',
      field: 'field',
      label: '文本字段',
      initval: wrap.field || '',
      tooltip: '选择动态值时,需设置文本字段才可生效。',
      timestamp: new Date().getTime(),
      required: false,
      options: columns
    },
@@ -73,14 +133,88 @@
      ]
    },
    {
      type: 'number',
      field: 'minHeight',
      label: '最小高度',
      initval: wrap.minHeight || '',
      min: 0,
      max: 3000,
      precision: 0,
      required: false
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: wrap.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'checkbox',
      field: 'tbStyle',
      label: '表格样式',
      initval: tbStyle,
      tooltip: '富文本中表格的样式,注:选择“边框加粗”或“边框颜色加深”时“无边框”无效。',
      required: false,
      options: [
        {value: 'th-light', label: '表头透明'},
        {value: 'tb-flex', label: '列等宽'},
        {value: 'no-border', label: '无边框'},
        {value: 'bold-border', label: '边框加粗'},
        {value: 'deep-border', label: '边框颜色加深'},
        {value: 'word-break', label: '强制换行'},
      ],
      span: 24
    },
    {
      type: 'radio',
      field: 'splitLine',
      label: '分割线加深',
      initval: splitLine,
      required: false,
      options: [
        {value: 'false', label: '否'},
        {value: 'true', label: '是'},
      ],
    },
    {
      type: 'checkbox',
      field: 'loads',
      label: '布局调整',
      initval: loads,
      required: false,
      tooltip: '预处理入参html、data,返回修改后的html;后处理入参为html,可通过页面元素的样式调整并返回处理后的html。',
      options: [
        {value: 'preload', label: '预处理'},
        {value: 'loaded', label: '后处理'},
      ],
      controlFields: [
        {field: 'prefunc', values: ['preload']},
        {field: 'loadedfunc', values: ['loaded']},
      ]
    },
    {
      type: 'codemirror',
      field: 'prefunc',
      label: '预处理脚本',
      initval: wrap.prefunc || '',
      required: true,
      span: 24
    },
    {
      type: 'codemirror',
      field: 'loadedfunc',
      label: '后处理脚本',
      initval: wrap.loadedfunc || '',
      required: true,
      span: 24
    },
    {
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: wrap.permission || 'false',
      required: false,
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType || ispop || isprint
    },
    {
      type: 'multiselect',
@@ -89,7 +223,7 @@
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
      forbid: !!appType || isprint
    },
  ]