king
2024-05-16 b69b5f6329ca5f87932436b7a6c1ddfc3377e10f
src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx
@@ -1,8 +1,3 @@
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
/**
 * @description 获取显示列表单配置信息
 * @param {object} card       // 搜索条件对象
@@ -40,40 +35,43 @@
  let options = [{
    value: 'text',
    text: Formdict['model.form.text']
    text: '文本'
  }, {
    value: 'number',
    text: Formdict['model.form.number']
  }, {
    value: 'picture',
    text: Formdict['model.form.picture']
  }, {
    value: 'link',
    text: Formdict['model.form.href']
  }, {
    value: 'textarea',
    text: Formdict['model.form.textarea']
    text: '数字'
  }, {
    value: 'custom',
    text: '自定义列'
  }, {
    value: 'formula',
    text: '公式'
  }, {
    value: 'picture',
    text: '图片'
  }, {
    value: 'video',
    text: '视频'
  }, {
    value: 'link',
    text: '链接'
  }, {
    value: 'textarea',
    text: '多行文本'
  }, {
    value: 'colspan',
    text: '合并列'
  }, {
    value: 'formula',
    text: '公式'
    value: 'extend',
    text: '扩展列'
  }, {
    value: 'index',
    text: '序号'
  }]
  if (!card.isSub) {
    options.push({
      value: 'action',
      text: '操作'
    })
  if (appType === 'mob') {
    options = options.filter(item => item.value !== 'extend')
  }
  if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) {
    card.perspective = ''
  }
@@ -89,7 +87,7 @@
    {
      type: 'select',
      key: 'type',
      label: Formdict['model.form.type'],
      label: '类型',
      initVal: card.type,
      required: true,
      options: options
@@ -97,7 +95,7 @@
    {
      type: 'select',
      key: 'field',
      label: Formdict['model.form.field'],
      label: '字段',
      initVal: card.field,
      required: true,
      options: fields
@@ -105,8 +103,10 @@
    {
      type: 'select',
      key: 'nameField',
      label: Formdict['model.name'] + Formdict['model.form.field'],
      label: '名称字段',
      initVal: card.nameField || '',
      tooltip: '名称字段为链接在界面中显示的内容,在链接中以@***@形式拼接的字段(字段来源于字段集中,此外 id、appkey、userid、LoginUID 为系统字段),跳转时将替换为对应值,例如:http://sso.mk9h.cn/doc/index.html?appkey=@appkey@&LoginUID=@LoginUID@,其中appkey与LoginUID将被替换。',
      toolWidth: 350,
      required: false,
      options: [{uuid: 'empty', field: '', label: '空'}, ...fields]
    },
@@ -116,68 +116,189 @@
      min: 20,
      max: 1000,
      decimal: 0,
      label: Formdict['model.form.columnWidth'],
      label: '列宽',
      initVal: card.Width || 120,
      required: true
    },
    {
      type: 'radio',
      key: 'joint',
      label: Formdict['model.form.paramJoint'],
      initVal: card.joint || 'true',
      required: true,
      options: [{
        value: 'true',
        text: Formdict['model.true']
      }, {
        value: 'false',
        text: Formdict['model.false']
      }]
    },
    {
      type: 'radio',
      key: 'Hide',
      label: Formdict['model.hidden'],
      label: '隐藏',
      initVal: card.Hide || 'false',
      required: true,
      options: [{
        value: 'true',
        text: Formdict['model.true']
        text: '是'
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'IsSort',
      label: Formdict['model.sort'],
      initVal: card.IsSort || (card.isSub ? 'false' : 'true'),
      label: '排序',
      initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'),
      required: true,
      options: [{
        value: 'true',
        text: Formdict['model.true']
        text: '是'
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '否'
      }]
    },
    {
      type: 'select',
      key: 'sortField',
      label: '排序字段',
      initVal: card.sortField || '',
      required: true,
      options: fields
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析方式',
      initVal: card.eval || 'false',
      tooltip: '当公式内容涉及计算时请选择“计算”,当公式内容为字段拼接时请选择“字段替换”,使用函数时入参为data(数组)。',
      required: false,
      options: [{
        value: 'false',
        text: '字段替换'
      }, {
        value: 'true',
        text: '计算'
      }, {
        value: 'func',
        text: '函数'
      }]
    },
    {
      type: 'radio',
      key: 'Align',
      label: Formdict['model.form.align'],
      label: '对齐方式',
      initVal: card.Align || 'left',
      required: true,
      options: [{
        value: 'left',
        text: Formdict['model.form.alignLeft']
        text: '左对齐'
      }, {
        value: 'center',
        text: Formdict['model.form.alignCenter']
        text: '居中'
      }, {
        value: 'right',
        text: Formdict['model.form.alignRight']
        text: '右对齐'
      }]
    },
    {
      type: 'radio',
      key: 'colUnit',
      label: '单位',
      initVal: card.colUnit || 'day',
      required: true,
      options: [{
        value: 'day',
        text: '天'
      }, {
        value: 'hour',
        text: '小时'
      }]
    },
    {
      type: 'number',
      key: 'shift',
      label: '偏移量',
      initVal: card.shift || 0,
      min: -1000,
      max: 1000,
      decimal: 0,
      required: true
    },
    {
      type: 'number',
      key: 'quota',
      label: '指标数',
      initVal: card.quota || 7,
      min: 1,
      max: 1000,
      decimal: 0,
      required: true
    },
    {
      type: 'select',
      key: 'dayFormat',
      label: '格式化',
      initVal: card.dayFormat || 'M/DD',
      required: true,
      options: [{
        value: 'M/DD',
        label: 'M/DD(4/29)'
      }, {
        value: 'M-DD',
        label: 'M-DD(4-29)'
      }, {
        value: 'M月DD日',
        label: 'M月DD日(4月29日)'
      }, {
        value: 'M/DD week',
        label: 'M/DD week(4/29 星期一)'
      }, {
        value: 'M-DD week',
        label: 'M-DD week(4-29 星期一)'
      }, {
        value: 'M月DD日 week',
        label: 'M月DD日 week(4月29日 星期一)'
      }]
    },
    {
      type: 'select',
      key: 'hourFormat',
      label: '格式化',
      initVal: card.hourFormat || 'H:00',
      required: true,
      options: [{
        value: 'H:00',
        label: 'H:00(15:00)'
      }, {
        value: 'H point',
        label: 'H(15点)'
      }, {
        value: 'h:00',
        label: 'h:00(3:00 pm)'
      }]
    },
    {
      type: 'text',
      key: 'supField',
      label: '上级字段',
      initVal: card.supField || '',
      tooltip: '来源于上级组件的字段集(上级组件为空时从url参数中选取),该字段值(用逗号分隔)可控制扩展列的列名。',
      required: false,
      rules: [{
        pattern: /^[0-9a-zA-Z_]*$/ig,
        message: '字段名只允许包含数字、字母以及_'
      }]
    },
    {
      type: 'number',
      key: 'startTime',
      precision: 0,
      label: '开始时间',
      initVal: card.startTime || 0,
      tooltip: '视频开始播放的时间,用于调整视频初始化展示的界面。',
      required: false
    },
    {
      type: 'select',
      key: 'aspectRatio',
      label: '长宽比',
      initVal: card.aspectRatio || '16:9',
      required: true,
      options: [
        { value: '4:3', text: '4:3' },
        { value: '16:9', text: '16:9' }
      ]
    },
    {
      type: 'radio',
@@ -188,25 +309,10 @@
      required: false,
      options: [{
        value: 'true',
        text: Formdict['model.true']
        text: '是'
      }, {
        value: 'false',
        text: Formdict['model.false']
      }]
    },
    {
      type: 'radio',
      key: 'sum',
      label: '显示合计',
      initVal: card.sum || 'false',
      tooltip: '合计信息只在使用系统数据源时有效。',
      required: false,
      options: [{
        value: 'true',
        text: Formdict['model.true']
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '否'
      }]
    },
    {
@@ -215,14 +321,14 @@
      min: 0,
      max: 18,
      decimal: 0,
      label: Formdict['header.form.decimal'],
      initVal: card.decimal || 0,
      label: '小数位',
      initVal: card.decimal,
      required: false
    },
    {
      type: 'select',
      key: 'format',
      label: Formdict['header.form.format'],
      label: '格式化',
      initVal: card.format || 'none',
      options: [{
        value: 'none',
@@ -242,7 +348,7 @@
    {
      type: 'select',
      key: 'textFormat',
      label: Formdict['header.form.format'],
      label: '格式化',
      initVal: card.textFormat || 'none',
      options: [{
        value: 'none',
@@ -262,7 +368,7 @@
    {
      type: 'text',
      key: 'prefix',
      label: Formdict['header.form.prefix'],
      label: '前缀',
      initVal: card.prefix || '',
      required: false,
      readonly: false
@@ -270,7 +376,7 @@
    {
      type: 'text',
      key: 'postfix',
      label: Formdict['header.form.postfix'],
      label: '后缀',
      initVal: card.postfix || '',
      required: false,
      readonly: false
@@ -313,17 +419,41 @@
    },
    {
      type: 'radio',
      key: 'backgroundSize',
      label: '图像大小',
      initVal: card.backgroundSize || 'cover',
      required: false,
      options: [
        { value: 'cover', text: '覆盖' },
        { value: 'contain', text: '包含' },
        { value: 'auto', text: '自适应' },
      ]
    },
    {
      type: 'radio',
      key: 'scale',
      label: '点击缩放',
      initVal: card.scale || 'true',
      required: false,
      options: [{
        value: 'true',
        text: Formdict['model.true']
        text: '是'
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'lostTip',
      label: '图片缺失',
      initVal: card.lostTip || 'true',
      tooltip: '图片地址不存在时,是否提示图片丢失。',
      required: false,
      options: [
        { value: 'true', text: '提示' },
        { value: 'false', text: '不提示' }
      ]
    },
    {
      type: 'radio',
@@ -340,33 +470,26 @@
        value: 'linkurl',
        text: '链接'
      }],
      forbidden: appType === 'mob'
      forbid: appType === 'mob'
    },
    {
      type: appType === 'pc' ? 'select' : 'cascader',
      key: 'linkmenu',
      label: Formdict['model.menu'],
      label: '菜单',
      initVal: card.linkmenu || (appType === 'pc' ? '' : []),
      required: true,
      options: menulist,
      forbidden: appType === 'mob'
      forbid: appType === 'mob'
    },
    {
      type: 'textarea',
      key: 'linkurl',
      label: '链接地址',
      initVal: card.linkurl || '',
      tooltip: '在链接中以@***@形式拼接的字段(字段来源于字段集中,此外 id、appkey、userid、LoginUID 为系统字段),跳转时将替换为对应值,例如:http://sso.mk9h.cn/doc/index.html?appkey=@appkey@&LoginUID=@LoginUID@,其中appkey与LoginUID将被替换。',
      toolWidth: 350,
      required: true,
      forbidden: appType === 'mob'
    },
    {
      type: 'multiselect',
      key: 'linkfields',
      label: '关联字段',
      initVal: card.linkfields || [],
      required: false,
      options: fields,
      forbidden: appType === 'mob'
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
@@ -381,18 +504,6 @@
      ]
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析',
      initVal: card.eval || 'true',
      tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。',
      required: false,
      options: [
        { value: 'true', text: '是' },
        { value: 'false', text: '否' }
      ]
    },
    {
      type: 'textarea',
      key: 'formula',
      label: '公式',
@@ -402,13 +513,28 @@
      required: true
    },
    {
      type: 'radio',
      key: 'noValue',
      label: '空值',
      initVal: card.noValue || 'show',
      tooltip: '数值为 0 或时间小于 1949-10-02 时,是否显示',
      required: false,
      options: [{
        value: 'show',
        text: '显示'
      }, {
        value: 'hide',
        text: '隐藏'
      }]
    },
    {
      type: 'multiselect',
      key: 'blacklist',
      label: Formdict['header.form.blacklist'],
      label: '黑名单',
      initVal: card.blacklist || [],
      required: false,
      options: roleList,
      forbidden: appType === 'mob'
      forbid: appType === 'mob'
    }
  ]
}