king
2025-04-21 f3d4db769ba9b51b799d981511a710fd443d0e08
src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx
@@ -3,11 +3,14 @@
 * @param {object} card       // 图表对象
 */
export function getBaseForm (card) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  let isprint = sessionStorage.getItem('MenuType') === 'billPrint'
  let ispop = sessionStorage.getItem('editMenuType') === 'popview'
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch {
    } catch (e) {
      roleList = []
    }
  } else {
@@ -17,24 +20,24 @@
  return [
    {
      type: 'text',
      key: 'title',
      field: 'title',
      label: '标题',
      initVal: card.title,
      initval: card.title,
      required: false
    },
    {
      type: 'text',
      key: 'name',
      field: 'name',
      label: '组件名称',
      initVal: card.name,
      initval: card.name,
      tooltip: '用于组件间的区分。',
      required: true
    },
    {
      type: 'number',
      key: 'width',
      field: 'width',
      label: '宽度',
      initVal: card.width,
      initval: card.width,
      tooltip: '栅格布局,每行等分为24列。',
      min: 1,
      max: 24,
@@ -42,23 +45,46 @@
      required: true
    },
    {
      type: 'number',
      key: 'height',
      label: '高度',
      initVal: card.height,
      min: 100,
      max: 1000,
      decimal: 0,
      required: true
      type: 'styleInput',
      field: 'height',
      label: '图表高度',
      initval: card.height,
      tooltip: '图表绘图区域的高度,不包括标题及内外边距。',
      required: true,
      options: ['px', 'vh', 'vw']
    },
    {
      type: 'select',
      key: 'blacklist',
      label: '黑名单',
      initVal: card.blacklist || [],
      multi: true,
      type: 'radio',
      field: 'permission',
      label: '权限验证',
      initval: card.permission || 'false',
      required: false,
      options: roleList
      options: [
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType || ispop || isprint
    },
    {
      type: 'radio',
      field: 'cacheLocal',
      label: '本地缓存',
      initval: card.cacheLocal || 'true',
      required: false,
      options: [
        {value: 'true', label: '继承菜单'},
        {value: 'false', label: '禁用'},
      ],
      forbid: ispop || isprint
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: card.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType || isprint
    }
  ]
}
@@ -69,68 +95,96 @@
 * @param {Array}  columns    // 显示列
 */
export function getOptionForm (card, columns) {
  // let appType = sessionStorage.getItem('appType')
  let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype))
  let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype))
  return [
    {
      type: 'select',
      key: 'gender',
      field: 'gender',
      label: '类型',
      initVal: card.gender || '',
      initval: card.gender || '',
      required: true,
      options: xfields
    },
    {
      type: 'select',
      key: 'Xaxis',
      field: 'Xaxis',
      label: 'X-轴',
      initVal: card.Xaxis || '',
      initval: card.Xaxis || '',
      required: true,
      options: columns
    },
    {
      type: 'select',
      key: 'Yaxis',
      field: 'Yaxis',
      label: 'Y-轴',
      initVal: card.Yaxis || '',
      initval: card.Yaxis || '',
      required: true,
      options: yfields
    },
    {
      type: 'radio',
      key: 'shape',
      field: 'shape',
      label: '形状',
      initVal: card.shape || 'circle',
      initval: card.shape || 'circle',
      required: false,
      options: [{
        value: 'circle',
        text: 'circle'
        label: '圆形'
      }, {
        value: 'square',
        text: 'square'
        label: '方形'
      }]
    },
    {
      type: 'radio',
      field: 'tooltip',
      label: '悬浮提示',
      initval: card.tooltip || 'true',
      required: false,
      options: [{
        value: 'true',
        label: '显示'
      }, {
        value: 'false',
        label: '隐藏'
      }]
    },
    {
      type: 'radio',
      field: 'empty',
      label: '空值隐藏',
      initval: card.empty || 'show',
      tooltip: '当查询数据为空时,隐藏该组件。',
      required: false,
      options: [
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'text',
      key: 'Xunit',
      field: 'Xunit',
      label: 'X轴单位',
      initVal: card.Xunit || '',
      initval: card.Xunit || '',
      required: false
    },
    {
      type: 'text',
      key: 'Yunit',
      field: 'Yunit',
      label: 'Y轴单位',
      initVal: card.Yunit || '',
      initval: card.Yunit || '',
      required: false
    },
    {
      type: 'color',
      key: 'color',
      label: '色系',
      initVal: card.color || 'rgba(0, 0, 0, 0.65)',
      tooltip: '坐标轴提示文字及示例的颜色。',
      field: 'lineColor',
      label: '坐标轴颜色',
      initval: card.lineColor || '',
      tooltip: '坐标轴线的颜色。',
      allowClear: true,
      required: false
    }
  ]