king
2024-02-03 06a670976e2145a10ea05207041d3cf3164cd380
src/menu/components/chart/antv-dashboard/chartcompile/formconfig.jsx
@@ -20,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,
@@ -46,43 +46,42 @@
    },
    {
      type: 'styleInput',
      key: 'height',
      field: 'height',
      label: '图表高度',
      initVal: card.height,
      initval: card.height,
      tooltip: '图表绘图区域的高度,不包括标题及内外边距。',
      required: true,
      options: ['px', 'vh', 'vw']
    },
    {
      type: 'radio',
      key: 'permission',
      field: 'permission',
      label: '权限验证',
      initVal: card.permission || 'false',
      initval: card.permission || 'false',
      required: false,
      options: [
        {value: 'true', text: '启用'},
        {value: 'false', text: '禁用'},
        {value: 'true', label: '启用'},
        {value: 'false', label: '禁用'},
      ],
      forbid: !appType || ispop || isprint
    },
    {
      type: 'radio',
      key: 'cacheLocal',
      field: 'cacheLocal',
      label: '本地缓存',
      initVal: card.cacheLocal || 'true',
      initval: card.cacheLocal || 'true',
      required: false,
      options: [
        {value: 'true', text: '继承菜单'},
        {value: 'false', text: '禁用'},
        {value: 'true', label: '继承菜单'},
        {value: 'false', label: '禁用'},
      ],
      forbid: ispop || isprint
    },
    {
      type: 'select',
      key: 'blacklist',
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initVal: card.blacklist || [],
      multi: true,
      initval: card.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType || isprint
@@ -95,30 +94,30 @@
 * @param {Array}  columns    // 显示列
 */
export function getOptionForm (card, columns) {
  let appType = sessionStorage.getItem('appType')
  // let appType = sessionStorage.getItem('appType')
  let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype))
  return [
    {
      type: 'text',
      key: 'label',
      field: 'label',
      label: '指标名称',
      initVal: card.label || '',
      initval: card.label || '',
      required: false
    },
    {
      type: 'select',
      key: 'valueField',
      field: 'valueField',
      label: '显示值',
      initVal: card.valueField || '',
      initval: card.valueField || '',
      required: true,
      options: yfields
    },
    {
      type: 'number',
      key: 'maxValue',
      field: 'maxValue',
      label: '最大值',
      initVal: card.maxValue || 100,
      initval: card.maxValue || 100,
      tooltip: '仪表盘最大刻度值',
      min: 0,
      max: 999999,
@@ -127,9 +126,9 @@
    },
    {
      type: 'number',
      key: 'tickInterval',
      field: 'tickInterval',
      label: '间隔',
      initVal: card.tickInterval || 10,
      initval: card.tickInterval || 10,
      tooltip: '仪表盘刻度间隔值。',
      min: 0,
      max: 999999,
@@ -138,56 +137,58 @@
    },
    {
      type: 'radio',
      key: 'percent',
      field: 'percent',
      label: '百分率',
      initVal: card.percent || 'true',
      initval: card.percent || 'true',
      required: false,
      options: [{
        value: 'true',
        text: '使用'
        label: '使用'
      }, {
        value: 'false',
        text: '不使用'
        label: '不使用'
      }]
    }, {
      type: 'radio',
      key: 'download',
      label: '导出图片',
      initVal: card.download || 'forbid',
      required: false,
      forbid: appType === 'mob',
      options: [{
        value: 'forbid',
        text: '禁用'
      }, {
        value: 'enable',
        text: '启用'
      }]
    // }, {
    //   type: 'radio',
    //   field: 'download',
    //   label: '导出图片',
    //   initval: card.download || 'forbid',
    //   required: false,
    //   forbid: appType === 'mob',
    //   options: [{
    //     value: 'forbid',
    //     label: '禁用'
    //   }, {
    //     value: 'enable',
    //     label: '启用'
    //   }]
    },
    // {
    //   type: 'radio',
    //   key: 'empty',
    //   field: 'empty',
    //   label: '空值隐藏',
    //   initVal: card.empty || 'show',
    //   initval: card.empty || 'show',
    //   tooltip: '当查询数据为空时,隐藏该组件。',
    //   required: false,
    //   options: [
    //     {value: 'show', text: '否'},
    //     {value: 'hidden', text: '是'},
    //     {value: 'show', label: '否'},
    //     {value: 'hidden', label: '是'},
    //   ],
    // },
    {
      type: 'color',
      key: 'tickColor',
      field: 'tickColor',
      label: '刻度线',
      initVal: card.tickColor || '#CBCBCB',
      initval: card.tickColor || '',
      allowClear: true,
      required: false
    },
    {
      type: 'color',
      key: 'labelColor',
      field: 'labelColor',
      label: '指标颜色',
      initVal: card.labelColor || '#545454',
      initval: card.labelColor || '',
      allowClear: true,
      required: false
    }
  ]
@@ -199,32 +200,32 @@
 * @param {Array}  columns    // 显示列
 */
export function getRadioOptionForm (card, columns) {
  let appType = sessionStorage.getItem('appType')
  // 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: 'labelField',
      field: 'labelField',
      label: '指标',
      initVal: card.labelField || '',
      initval: card.labelField || '',
      required: true,
      options: xfields
    },
    {
      type: 'select',
      key: 'valueField',
      field: 'valueField',
      label: '值',
      initVal: card.valueField || '',
      initval: card.valueField || '',
      required: true,
      options: yfields
    },
    {
      type: 'number',
      key: 'maxValue',
      field: 'maxValue',
      label: '最大值',
      initVal: card.maxValue || 100,
      initval: card.maxValue || 100,
      min: 0,
      max: 999999,
      decimal: 1,
@@ -232,9 +233,9 @@
    },
    {
      type: 'number',
      key: 'radius',
      field: 'radius',
      label: '外环',
      initVal: card.radius || 75,
      initval: card.radius || 75,
      tooltip: '图形所占区域的百分率。',
      min: 30,
      max: 100,
@@ -243,9 +244,9 @@
    },
    {
      type: 'number',
      key: 'fontSize',
      field: 'fontSize',
      label: '字体大小',
      initVal: card.fontSize || 28,
      initval: card.fontSize || 28,
      min: 12,
      max: 300,
      decimal: 0,
@@ -253,44 +254,46 @@
    },
    {
      type: 'radio',
      key: 'percent',
      field: 'percent',
      label: '百分率',
      initVal: card.percent || 'true',
      initval: card.percent || 'true',
      required: false,
      options: [{
        value: 'true',
        text: '使用'
        label: '使用'
      }, {
        value: 'false',
        text: '不使用'
        label: '不使用'
      }]
    }, {
      type: 'radio',
      key: 'download',
      label: '导出图片',
      initVal: card.download || 'forbid',
      required: false,
      forbid: appType === 'mob',
      options: [{
        value: 'forbid',
        text: '禁用'
      }, {
        value: 'enable',
        text: '启用'
      }]
    // }, {
    //   type: 'radio',
    //   field: 'download',
    //   label: '导出图片',
    //   initval: card.download || 'forbid',
    //   required: false,
    //   forbid: appType === 'mob',
    //   options: [{
    //     value: 'forbid',
    //     label: '禁用'
    //   }, {
    //     value: 'enable',
    //     label: '启用'
    //   }]
    },
    {
      type: 'color',
      key: 'backColor',
      field: 'backColor',
      label: '背景色',
      initVal: card.backColor || '#ebedf0',
      initval: card.backColor || '',
      allowClear: true,
      required: false
    },
    {
      type: 'color',
      key: 'labelColor',
      field: 'labelColor',
      label: '字体颜色',
      initVal: card.labelColor || '#8c8c8c',
      initval: card.labelColor || '',
      allowClear: true,
      required: false
    }
  ]