king
2022-07-06 be22457344d6d3fc079de2a4f0a1e06e4c0f85c3
src/templates/zshare/formconfig.jsx
@@ -13,6 +13,17 @@
export function getTreeSettingForm (setting, usefulFields = [], MenuID) {
  let str = '^(' + usefulFields.join('|') + ')'
  let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
  let rules = [{
    max: formRule.func.max,
    message: formRule.func.maxMessage
  }]
  if (usefulFields.length > 0) {
    rules.push({
      pattern: _patten,
      message: formRule.func.innerMessage
    })
  }
  return [
    {
@@ -103,19 +114,11 @@
      key: 'innerFunc',
      label: Formdict['header.form.innerFunc'],
      initVal: setting.innerFunc || '',
      tooltip: '开头可用字符:' + usefulFields.join(', '),
      tooltip: usefulFields.length ? '开头可用字符:' + usefulFields.join(', ') : '',
      placement: 'bottomLeft',
      required: false,
      readonly: false,
      rules: [
        {
          pattern: _patten,
          message: formRule.func.innerMessage
        }, {
          max: formRule.func.max,
          message: formRule.func.maxMessage
        }
      ]
      rules: rules
    },
    {
      type: 'datasource',
@@ -286,7 +289,7 @@
 * @param {object} card           // 搜索条件对象
 * @param {Array}  linkableFields // 可关联字段
 */
export function getSearchForm (card, linkableFields) {
export function getSearchForm (card, linkableFields, columns) {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
  if (roleList) {
@@ -396,7 +399,8 @@
      key: 'field',
      label: Formdict['model.form.field'],
      initVal: card.field || '',
      required: true
      required: true,
      options: columns
    },
    {
      type: 'select',
@@ -460,6 +464,9 @@
      }, {
        value: 'picture',
        text: '图片'
      }, {
        value: 'color',
        text: '色块'
      }]
    },
    {
@@ -826,19 +833,29 @@
      }]
    },
    {
      type: 'radio',
      key: 'selectStyle',
      label: '选中效果',
      tooltip: '背景及文字变化时会使用系统色。',
      initVal: card.selectStyle || (card.backgroundColor ? 'custom' : 'background'),
      options: [{
        value: 'background',
        text: '背景变化'
      }, {
        value: 'font',
        text: '文字变化'
      }, {
        value: 'custom',
        text: '自定义'
      }]
    },
    {
      type: 'color',
      key: 'backgroundColor',
      label: '背景色',
      initVal: card.backgroundColor || '',
      tooltip: '设置背景色后,选中效果由背景颜色控制。',
      required: false
    },
    {
      type: 'color',
      key: 'borderColor',
      label: '边框颜色',
      initVal: card.borderColor || '',
      required: false
      required: true
    },
    {
      type: 'multiselect',
@@ -861,6 +878,7 @@
 */
export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) {
  let columns = (config.columns || []).filter(col => col.field)
  usefulFields = []
  let opentypes = [
    {
@@ -957,6 +975,9 @@
      }, {
        value: 'megvii',
        text: '旷视面板机'
      }, {
        value: 'filezip',
        text: '文件压缩包'
      }]
    },
    { // 旷视面板机接口 待扩展
@@ -1036,9 +1057,18 @@
      key: 'innerFunc',
      label: Formdict['header.form.innerFunc'],
      initVal: card.innerFunc || '',
      tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始。`,
      tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始。` : '',
      fields: usefulFields,
      required: card.intertype === 'inner',
      readonly: false
    },
    {
      type: 'text',
      key: 'urlkey',
      label: '地址字段',
      initVal: card.urlkey || '',
      tooltip: '图片(文件)链接的字段名。',
      required: false,
      readonly: false
    },
    {
@@ -1323,7 +1353,7 @@
      type: 'text',
      key: 'output',
      label: '返回值',
      tooltip: '执行成功后的返回值。例如:@id',
      tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,如@id);自定义函数可指定返回字段(如id)。',
      initVal: card.output || '',
      required: false
    },
@@ -1448,7 +1478,7 @@
      key: 'preFunc',
      label: '前置函数',
      initVal: card.preFunc || '',
      tooltip: `函数名称需以${usefulFields.join(', ')}等字符开始;前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。`,
      tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始;前置函数执行完成后,结果会传入内部函数中,此时内部函数会异步执行;当前置函数返回中ErrCode等于-1时,将不再执行内部函数。` : '',
      fields: usefulFields,
      required: false,
      readonly: false
@@ -2386,6 +2416,9 @@
  }, {
    value: 'linkMain',
    text: '关联主表'
  }, {
    value: 'formula',
    text: '公式'
  }]
  let _fieldlength = 50
@@ -2445,6 +2478,9 @@
    }, {
      value: 'linkMain',
      text: '关联主表'
    }, {
      value: 'formula',
      text: '公式'
    }]
  }
@@ -2572,6 +2608,9 @@
      }, {
        value: 'picture',
        text: '图片'
      }, {
        value: 'color',
        text: '色块'
      }]
    },
    {
@@ -2603,9 +2642,9 @@
    },
    {
      type: 'radio',
      key: 'ratio',
      key: 'picratio',
      label: '图片比例',
      initVal: card.ratio || '1:1',
      initVal: card.picratio || card.ratio || '1:1',
      required: true,
      options: [{
        value: '1:1',
@@ -2900,16 +2939,16 @@
      initVal: card.regular || '',
      options: [{
        value: '',
        text: Formdict['model.empty']
        text: '空'
      }, {
        value: 'number',
        text: Formdict['model.form.number']
        text: '数字'
      }, {
        value: 'letter',
        text: Formdict['header.form.letter']
        text: '字母'
      }, {
        value: 'letter&number',
        text: '字母+数字'
        text: '数字、字母以及_@_.'
      }, {
        value: 'phone',
        text: '手机号'
@@ -3135,19 +3174,29 @@
      }]
    },
    {
      type: 'radio',
      key: 'selectStyle',
      label: '选中效果',
      tooltip: '背景及文字变化时会使用系统色。',
      initVal: card.selectStyle || (card.backgroundColor ? 'custom' : 'background'),
      options: [{
        value: 'background',
        text: '背景变化'
      }, {
        value: 'font',
        text: '文字变化'
      }, {
        value: 'custom',
        text: '自定义'
      }]
    },
    {
      type: 'color',
      key: 'backgroundColor',
      label: '背景色',
      initVal: card.backgroundColor || '',
      tooltip: '设置背景色后,选中效果由背景颜色控制。',
      required: false
    },
    {
      type: 'color',
      key: 'borderColor',
      label: '边框颜色',
      initVal: card.borderColor || '',
      required: false
      required: true
    },
    {
      type: 'radio',
@@ -3205,6 +3254,37 @@
      }]
    },
    {
      type: 'textarea',
      key: 'formula',
      label: '公式',
      initVal: card.formula || '',
      tooltip: '动态替换相应的字段,展示获得的结果。可使用JS的一些语法,如:三元表达式 @field1@ > @field2@ ? 0 : 1;Math对象,取绝对值 Math.abs(@field@)、四舍五入 Math.round(@field@)等',
      rows: 2,
      required: true
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析',
      initVal: card.eval || 'true',
      tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。',
      required: false,
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'text',
      key: 'postfix',
      label: '后缀',
      initVal: card.postfix || '',
      required: false
    },
    {
      type: 'radio',
      key: 'splitline',
      label: '分割线',