king
2022-06-18 fe21d23b147ed5cec22b4f76a88840b05495d4ad
src/templates/zshare/formconfig.jsx
@@ -286,7 +286,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) {
@@ -302,6 +302,14 @@
  let typeOptions = []
  if (appType === 'mob') {
    // let adapters = sessionStorage.getItem('adapter')
    // if (adapters) {
    //   adapters = adapters.split(',')
    // } else {
    //   adapters = []
    // }
    // (adapters.includes('wxmini') ? '(小程序暂不支持)' : '')
    typeOptions = [{
      value: 'range',
      text: '数值(区间)'
@@ -318,6 +326,7 @@
    //   value: 'daterange',
    //   text: Formdict['model.form.daterange']
    }]
  } else {
    typeOptions = [{
      value: 'text',
@@ -387,7 +396,8 @@
      key: 'field',
      label: Formdict['model.form.field'],
      initVal: card.field || '',
      required: true
      required: true,
      options: columns
    },
    {
      type: 'select',
@@ -506,7 +516,7 @@
      required: true
    },
    {
      type: 'textarea',
      type: 'codemirror',
      key: 'dataSource',
      label: Formdict['header.form.datasource'],
      initVal: card.dataSource || '',
@@ -650,6 +660,37 @@
      required: false
    },
    {
      type: 'number',
      key: 'labelwidth',
      min: 1,
      max: 100,
      precision: 1,
      label: '名称宽度',
      initVal: card.labelwidth || 33.3,
      tooltip: '名称占据搜索条件宽度的百分比。注:存在多列搜索时,当前搜索如果想要占据整行可参照以下比例,两列(16.5)、三列(10.8)、四列(8)',
      required: true,
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      key: 'precision',
      label: '精确度',
      initVal: card.precision || 'day',
      options: [{
        value: 'day',
        text: '天'
      }, {
        value: 'hour',
        text: '小时'
      }, {
        value: 'minute',
        text: '分钟'
      }, {
        value: 'second',
        text: '秒'
      }]
    },
    {
      type: 'radio',
      key: 'required',
      label: Formdict['model.required'],
@@ -746,6 +787,7 @@
      key: 'advanced',
      label: '高级搜索',
      initVal: card.advanced || 'false',
      tooltip: '在隐藏搜索按钮时,高级搜索无效。',
      forbid: appType === 'mob',
      options: [{
        value: 'true',
@@ -805,7 +847,8 @@
      label: Formdict['header.form.blacklist'],
      initVal: card.blacklist || [],
      required: false,
      options: roleList || []
      options: roleList || [],
      forbid: appType === 'mob'
    }
  ]
}
@@ -912,7 +955,20 @@
      }, {
        value: 'closetab',
        text: '标签关闭'
      }, {
        value: 'megvii',
        text: '旷视面板机'
      }]
    },
    { // 旷视面板机接口 待扩展
      type: 'radio',
      key: 'subFunc',
      label: '接口名称',
      initVal: card.subFunc || 'addUser',
      required: true,
      options: [
        { value: 'addUser', text: '添加用户' },
      ]
    },
    {
      type: 'select',
@@ -1184,11 +1240,11 @@
        value: 'never',
        text: '不刷新'
      }, {
        value: 'grid',
        text: '刷新表格'
      }, {
        value: 'line',
        text: '刷新行'
      }, {
        value: 'grid',
        text: '刷新表格'
      },
      ...refresh]
    },
@@ -1203,11 +1259,11 @@
        value: 'never',
        text: '不刷新'
      }, {
        value: 'grid',
        text: '刷新表格'
      }, {
        value: 'line',
        text: '刷新行'
      }, {
        value: 'grid',
        text: '刷新表格'
      },
      ...refresh]
    },
@@ -1268,8 +1324,16 @@
      type: 'text',
      key: 'output',
      label: '返回值',
      tooltip: '执行成功后的返回值。',
      tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,如@id);自定义函数可指定返回字段(如id)。',
      initVal: card.output || '',
      required: false
    },
    {
      type: 'text',
      key: 'tipTitle',
      label: '确认提示',
      initVal: card.tipTitle || '',
      tooltip: '注:弹窗(表单)在显示为是否框时有效。',
      required: false
    },
    {
@@ -1343,7 +1407,7 @@
      precision: 0,
      label: '比例',
      initVal: card.ratio || 85,
      tooltip: '小于100为宽度(或高度)百分比,大于100为像素值。',
      tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。',
      required: true
    },
    {
@@ -1424,6 +1488,42 @@
      initVal: card.controlVal || '',
      required: false
    },
    {
      type: 'text',
      key: 'reason',
      label: '禁用原因',
      initVal: card.reason || '',
      required: false
    },
    {
      type: 'radio',
      key: 'hidden',
      label: '隐藏',
      initVal: card.hidden || 'false',
      tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。',
      required: false,
      options: [{
        value: 'false',
        text: '否'
      }, {
        value: 'true',
        text: '是'
      }]
    },
    {
      type: 'radio',
      key: 'progress',
      label: '进度提示',
      initVal: card.progress || 'number',
      required: false,
      options: [{
        value: 'number',
        text: '剩余数'
      }, {
        value: 'progressbar',
        text: '进度条'
      }]
    }
  ]
}
@@ -2260,9 +2360,9 @@
  }, {
    value: 'datemonth',
    text: Formdict['model.form.datemonth']
  }, {
    value: 'datetime',
    text: Formdict['model.form.datetime']
  // }, {
  //   value: 'datetime',
  //   text: '日期(分/秒)'
  }, {
    value: 'textarea',
    text: Formdict['model.form.textarea']
@@ -2325,9 +2425,9 @@
    }, {
      value: 'datemonth',
      text: Formdict['model.form.datemonth']
    }, {
      value: 'datetime',
      text: Formdict['model.form.datetime']
    // }, {
    //   value: 'datetime',
    //   text: '日期(分/秒)'
    }, {
      value: 'textarea',
      text: Formdict['model.form.textarea']
@@ -2353,6 +2453,9 @@
    _fieldlength = 512
  } else if (['textarea', 'brafteditor'].includes(card.type)) {
    _fieldlength = 8000
  } else if (card.type === 'datetime') {
    card.type = 'date'
    card.precision = 'second'
  }
  let options = card.options || []
@@ -2370,6 +2473,10 @@
    initval = card.initval === true
  } else if (card.type === 'number') {
    initval = card.initval || 0
  }
  if (appType === 'mob' && ![24, 12, 8, 6].includes(card.span)) {
    card.span = 24
  }
  return [
@@ -2747,6 +2854,25 @@
      }]
    },
    {
      type: 'radio',
      key: 'precision',
      label: '精确度',
      initVal: card.precision || 'day',
      options: [{
        value: 'day',
        text: '天'
      }, {
        value: 'hour',
        text: '小时'
      }, {
        value: 'minute',
        text: '分钟'
      }, {
        value: 'second',
        text: '秒'
      }]
    },
    {
      type: 'number',
      key: 'fieldlength',
      min: 1,
@@ -2755,7 +2881,7 @@
      label: Formdict['model.form.field'] + Formdict['model.length'],
      // tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512',
      initVal: card.fieldlength || _fieldlength,
      required: false
      required: true
    },
    {
      type: 'number',
@@ -2775,19 +2901,22 @@
      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: '手机号'
      }, {
        value: 'email',
        text: '邮箱'
      }]
    },
    {
@@ -3123,15 +3252,18 @@
    {
      type: 'radio',
      key: 'compress',
      label: '压缩',
      label: '文件处理',
      initVal: card.compress || 'false',
      tooltip: '文件压缩必须为图片,图片格式为jpg、png、gif 或 jpeg',
      tooltip: '文件压缩或base64必须为图片,图片格式为jpg、png、gif 或 jpeg。注:base64只可上传一张图片。',
      options: [{
        value: 'true',
        text: Formdict['model.true']
      }, {
        value: 'false',
        text: Formdict['model.false']
        text: '无'
      }, {
        value: 'true',
        text: '压缩'
      }, {
        value: 'base64',
        text: 'base64'
      }]
    },
    {
@@ -3156,6 +3288,46 @@
      tooltip: '栅格布局整行24等分。',
      required: true,
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      key: 'span',
      label: '表单宽度',
      initVal: card.span || 24,
      tooltip: '栅格布局整行24等分。',
      required: true,
      forbid: appType !== 'mob',
      options: [{
        value: 24,
        text: 24
      }, {
        value: 12,
        text: 12
      }, {
        value: 8,
        text: 8
      }, {
        value: 6,
        text: 6
      }]
    },
    {
      type: 'radio',
      key: 'lenControl',
      label: '长度控制',
      initVal: card.lenControl || 'limit',
      tooltip: '在设置字段长度后,对长度的控制方式。',
      required: false,
      options: [{
        value: 'limit',
        text: '限制输入'
      }, {
        value: 'left',
        text: '左截'
      }, {
        value: 'right',
        text: '右截'
      }]
    },
    {
      type: 'number',
@@ -3213,6 +3385,7 @@
    {
      type: 'text',
      key: 'supvalue',
      max: 512,
      label: '显示值',
      tooltip: '请填写显示值,只有上级表单值与显示值相同时,该表单才会显示,注:1、多个值用逗号分隔;2、上级表单初始值为$first时暂未处理。',
      initVal: card.supvalue || '',
@@ -3236,6 +3409,22 @@
      initVal: card.extra || '',
      required: false,
      forbid: appType === 'mob'
    },
    {
      type: 'radio',
      key: 'enterReplace',
      label: '回车符替换',
      tooltip: '回车符会替换为英文逗号。',
      initVal: card.enterReplace || 'false',
      required: false,
      forbid: appType !== 'mob',
      options: [{
        value: 'false',
        text: '否'
      }, {
        value: 'true',
        text: '是'
      }]
    },
    {
      type: 'text',
@@ -3286,35 +3475,36 @@
      initVal: card.linkSubField || [],
      options: inputfields
    },
    {
      type: 'number',
      key: 'marginTop',
      label: '上边距(px)',
      initVal: card.marginTop || 0,
      min: 0,
      max: 1000,
      precision: 0,
      required: false,
      forbid: appType !== 'mob'
    },
    {
      type: 'number',
      key: 'marginBottom',
      label: '下边距(px)',
      initVal: card.marginBottom || 0,
      min: 0,
      max: 1000,
      precision: 0,
      required: false,
      forbid: appType !== 'mob'
    },
    // {
    //   type: 'number',
    //   key: 'marginTop',
    //   label: '上边距(px)',
    //   initVal: card.marginTop || 0,
    //   min: -100,
    //   max: 1000,
    //   precision: 0,
    //   required: false,
    //   forbid: appType !== 'mob'
    // },
    // {
    //   type: 'number',
    //   key: 'marginBottom',
    //   label: '下边距(px)',
    //   initVal: card.marginBottom || 0,
    //   min: -100,
    //   max: 1000,
    //   precision: 0,
    //   required: false,
    //   forbid: appType !== 'mob'
    // },
    {
      type: 'multiselect',
      key: 'blacklist',
      label: Formdict['header.form.blacklist'],
      initVal: card.blacklist || [],
      required: false,
      options: roleList
      options: roleList,
      forbid: appType === 'mob'
    }
  ]
}