king
2023-06-28 f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd
src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx
@@ -1,3 +1,6 @@
import MenuUtils from '@/utils/utils-custom.js'
/**
 * @description 获取图表视图配置表单
 * @param {object} card       // 图表对象
@@ -106,7 +109,7 @@
      tooltip: '点击节点时触发的事件。',
      required: false,
      options: [
        {value: '', label: '数据切换'},
        {value: '', label: '无'},
        {value: 'menu', label: '菜单'},
        {value: 'menus', label: '菜单组'}
      ],
@@ -197,136 +200,71 @@
 * @param {object} card       // 图表对象
 * @param {Array}  columns    // 显示列
 */
export function getOptionForm (card, columns) {
export function getOptionForm (card, uuid) {
  let menu = window.GLOB.customMenu
  let modules = MenuUtils.getSupModules(menu.components, uuid, menu.interfaces)
  return [
    {
      type: 'select',
      field: 'subtype',
      label: '类型',
      initval: card.subtype || 'mindmap',
      label: '图表类型',
      initval: card.subtype || 'xflow',
      required: true,
      options: [{
        value: 'mindmap',
        label: '思维导图'
        value: 'xflow',
        label: '流程图'
      }, {
        value: 'indentTree',
        label: '缩进文件树'
      }, {
        value: 'kapmap',
        label: '知识图谱树'
        value: 'lane',
        label: '泳道图'
      }],
      controlFields: [
        {field: 'dirField', values: ['mindmap']},
        {field: 'nodeColor', values: ['mindmap']},
        // {field: 'collapsed', values: ['indentTree', 'kapmap']},
      ]
        {field: 'gridType', values: ['xflow']},
        {field: 'backgroundColor', values: ['xflow']}
      ],
    },
    {
      type: 'radio',
      field: 'rootType',
      label: '根节点取值',
      initval: card.rootType || 'fixed',
      tooltip: '选择上级时,请填写根节点的文本和值的字段名',
      field: 'function',
      label: '功能',
      initval: card.function || 'show',
      required: true,
      options: [{
        value: 'fixed',
        label: '固定值'
      }, {
        value: 'supvalue',
        label: '上级组件'
      }, {
        value: 'line',
        label: '行'
      }],
      options: [
        {value: 'edit', label: '流程编辑'},
        {value: 'show', label: '流程展示'},
      ],
      controlFields: [
        {field: 'rootLabel', values: ['fixed', 'supvalue']},
        {field: 'rootValue', values: ['fixed', 'supvalue']},
        {field: 'mark', values: ['line']},
        {field: 'empty', values: ['show']}
      ]
    },
    {
      type: 'text',
      field: 'rootValue',
      label: '根节点值',
      initval: card.rootValue || '',
      required: true
    },
    {
      type: 'text',
      field: 'rootLabel',
      label: '根节点文本',
      initval: card.rootLabel || '',
      required: true
    },
    {
      type: 'select',
      field: 'valueField',
      label: '值字段',
      initval: card.valueField || '',
      required: true,
      options: columns
    },
    {
      type: 'select',
      field: 'labelField',
      label: '文本字段',
      initval: card.labelField || '',
      required: true,
      options: columns
    },
    {
      type: 'select',
      field: 'parentField',
      label: '上级字段',
      initval: card.parentField || '',
      required: true,
      options: columns
    },
    {
      type: 'text',
      field: 'mark',
      label: '顶级标识',
      initval: card.mark || '',
      tooltip: '上级字段值与顶级标识相同时,视为根节点。',
      required: true
    },
    {
      type: 'select',
      field: 'dirField',
      label: '方向控制',
      initval: card.dirField || '',
      type: 'cascader',
      field: 'supModule',
      label: '上级组件',
      initval: card.supModule || [],
      required: false,
      options: columns,
      controlFields: [
        {field: 'dirSign', notNull: true},
        {field: 'leftColor', notNull: true},
      ]
      options: modules,
      allowClear: true
    },
    {
      type: 'text',
      field: 'dirSign',
      label: '左向标记',
      initval: card.dirSign || '',
      tooltip: '当节点值与标记相同时节点信息位于节点左侧,多个值请用逗号分隔。',
      required: false
      type: 'radio',
      field: 'gridType',
      label: '网格',
      initval: card.gridType || 'none',
      required: false,
      options: [
        {value: 'none', label: '无'},
        {value: 'dot', label: '点状网格'},
        {value: 'mesh', label: '网状网格'}
      ],
    },
    {
      type: 'color',
      field: 'nodeColor',
      label: '节点颜色',
      initval: card.nodeColor || '#1890ff',
      tooltip: '右侧节点的标记颜色。',
      colorType: 'hex',
      required: false
    },
    {
      type: 'color',
      field: 'leftColor',
      label: '左节点颜色',
      initval: card.leftColor || '#26C281',
      tooltip: '左侧节点的标记颜色。',
      colorType: 'hex',
      required: false
      field: 'backgroundColor',
      label: '背景色',
      initval: card.backgroundColor || '',
      required: false,
      allowClear: true
    },
    {
      type: 'radio',
@@ -339,18 +277,6 @@
        {value: 'show', label: '否'},
        {value: 'hidden', label: '是'},
      ],
    },
    {
      type: 'radio',
      field: 'collapsed',
      label: '节点合并',
      initval: card.collapsed || 'false',
      tooltip: '一级节点是否合并。',
      required: false,
      options: [
        {value: 'false', label: '否'},
        {value: 'true', label: '是'},
      ],
    },
    }
  ]
}