king
2023-10-19 072227ec43346c50c93cda3bf21c346f463eb551
src/menu/components/table/base-table/columns/editColumn/formconfig.jsx
@@ -33,8 +33,17 @@
    value: 'number',
    text: '数字'
  }, {
    value: 'custom',
    text: '自定义列'
  }, {
    value: 'formula',
    text: '公式'
  }, {
    value: 'picture',
    text: '图片'
  }, {
    value: 'video',
    text: '视频'
  }, {
    value: 'link',
    text: '链接'
@@ -42,24 +51,16 @@
    value: 'textarea',
    text: '多行文本'
  }, {
    value: 'custom',
    text: '自定义列'
  }, {
    value: 'colspan',
    text: '合并列'
  }, {
    value: 'formula',
    text: '公式'
  }, {
    value: 'index',
    text: '序号'
  }]
  if (!card.isSub) {
    options.push({
      value: 'action',
      text: '操作'
    })
  let decimal = card.decimal === undefined ? 0 : card.decimal
  if (card.type === 'formula' && typeof(card.decimal) !== 'number') {
    decimal = ''
  }
  return [
@@ -68,7 +69,11 @@
      key: 'label',
      label: '列头文字',
      initVal: card.label,
      required: true
      required: true,
      rules: [{
        max: 100,
        message: '最多100个字符。'
      }]
    },
    {
      type: 'select',
@@ -84,14 +89,25 @@
      label: '字段',
      initVal: card.field,
      required: true,
      options: card.isSub ? fields : []
      options: card.isSub ? fields : [],
      rules: [{
        pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
        message: '字段名只允许包含数字、字母、汉字以及_'
      }, {
        max: 100,
        message: '最多100个字符。'
      }]
    },
    {
      type: 'text',
      key: 'nameField',
      label: '名称字段',
      initVal: card.nameField || '',
      required: false
      required: false,
      rules: [{
        max: 100,
        message: '最多100个字符。'
      }]
    },
    {
      type: 'number',
@@ -135,7 +151,7 @@
      type: 'radio',
      key: 'IsSort',
      label: '排序',
      initVal: card.IsSort || (card.isSub ? 'false' : 'true'),
      initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'),
      required: true,
      options: [{
        value: 'true',
@@ -143,6 +159,32 @@
      }, {
        value: '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: '函数'
      }]
    },
    {
@@ -161,6 +203,26 @@
        value: 'right',
        text: '右对齐'
      }]
    },
    {
      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',
@@ -190,14 +252,16 @@
      }, {
        value: 'false',
        text: '否'
      }]
      }],
      forbid: card.isSub || card.sum !== 'true'
    },
    {
      type: 'number',
      key: 'fieldlength',
      label: '字段长度',
      initVal: card.fieldlength || 50,
      required: true
      required: true,
      forbid: card.isSub
    },
    {
      type: 'number',
@@ -206,8 +270,8 @@
      max: 18,
      decimal: 0,
      label: '小数位',
      initVal: card.decimal || 0,
      required: true
      initVal: decimal,
      required: !card.isSub
    },
    {
      type: 'select',
@@ -255,7 +319,11 @@
      label: '前缀',
      initVal: card.prefix || '',
      required: false,
      readonly: false
      readonly: false,
      rules: [{
        max: 100,
        message: '最多100个字符。'
      }]
    },
    {
      type: 'text',
@@ -263,7 +331,11 @@
      label: '后缀',
      initVal: card.postfix || '',
      required: false,
      readonly: false
      readonly: false,
      rules: [{
        max: 100,
        message: '最多100个字符。'
      }]
    },
    {
      type: 'number',
@@ -299,6 +371,18 @@
        { value: '3:4', text: '3:4' },
        { value: '2:3', text: '2:3' },
        { value: '9:16', text: '9:16' },
      ]
    },
    {
      type: 'radio',
      key: 'backgroundSize',
      label: '图像大小',
      initVal: card.backgroundSize || 'cover',
      required: false,
      options: [
        { value: 'cover', text: '覆盖' },
        { value: 'contain', text: '包含' },
        { value: 'auto', text: '自适应' },
      ]
    },
    {
@@ -353,18 +437,6 @@
      initVal: card.linkfields || [],
      required: false,
      options: fields,
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析',
      initVal: card.eval || 'true',
      tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。',
      required: false,
      options: [
        { value: 'true', text: '是' },
        { value: 'false', text: '否' }
      ]
    },
    {
      type: 'textarea',