king
2021-05-08 6afdec0062dacbded57e166230eb22cc55ced0c1
src/templates/zshare/formconfig.jsx
@@ -2,7 +2,7 @@
import enUS from '@/locales/en-US/model.js'
import { formRule } from '@/utils/option.js'
const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
/**
 * @description 获取树形页面设置表单配置信息
@@ -667,7 +667,11 @@
  }
  let refresh = []
  if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签
    if (card.focus) {
      card.popClose = 'maingrid'
    }
    refresh.push({
      value: 'maingrid',
      text: Formdict['header.form.refresh.maingrid']
@@ -726,14 +730,6 @@
      options: []
    },
    {
      type: 'text',
      key: 'label',
      label: '按钮名称',
      initVal: card.label,
      required: true,
      readonly: false
    },
    {
      type: 'radio',
      key: 'procMode',
      label: '参数处理',
@@ -754,6 +750,14 @@
      initVal: card.sqlType || '',
      required: true,
      options: []
    },
    {
      type: 'text',
      key: 'label',
      label: '按钮名称',
      initVal: card.label,
      required: true,
      readonly: false
    },
    {
      type: 'text',
@@ -826,7 +830,7 @@
    {
      type: 'text',
      key: 'url',
      label: Formdict['model.form.newpage.url'],
      label: Formdict['model.pageUrl'],
      initVal: card.url || '',
      required: true
    },
@@ -855,7 +859,7 @@
    {
      type: 'textarea',
      key: 'interface',
      label: Formdict['header.form.interface'],
      label: '测试地址',
      initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''),
      required: true,
      readonly: card.sysInterface === 'true'
@@ -884,17 +888,32 @@
    },
    {
      type: 'radio',
      key: 'cross',
      label: '跨域请求',
      initVal: card.cross || 'true',
      tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。',
      required: false,
      options: [{
        value: 'true',
        text: '支持'
      }, {
        value: 'false',
        text: '不支持'
      }]
    },
    {
      type: 'radio',
      key: 'callbackType',
      label: '回调方式',
      initVal: card.callbackType || 'script',
      tooltip: '使用默认方式执行时,需要配合计划任务。',
      tooltip: '使用后台脚本执行时,需要配合计划任务。',
      required: true,
      options: [{
        value: 'default',
        text: '默认脚本'
      }, {
        value: 'script',
        text: '自定义脚本'
      }, {
        value: 'default',
        text: '后台脚本'
      }]
    },
    {
@@ -1116,7 +1135,7 @@
 * @param {object} card       // 搜索条件对象
 * @param {Array}  menulist   // 菜单列表-用于字段透视
 */
export function getColumnForm (card, menulist = []) {
export function getColumnForm (card, menulist = [], fields = []) {
  let roleList = sessionStorage.getItem('sysRoles')
  if (roleList) {
    try {
@@ -1126,6 +1145,10 @@
    }
  } else {
    roleList = []
  }
  if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) {
    card.perspective = ''
  }
  return [
@@ -1165,6 +1188,9 @@
      }, {
        value: 'textarea',
        text: Formdict['model.form.textarea']
      }, {
        value: 'index',
        text: '序号'
      }]
    },
    {
@@ -1375,8 +1401,11 @@
      type: 'radio',
      key: 'perspective',
      label: '字段透视',
      initVal: card.perspective || 'linkmenu',
      initVal: card.perspective || '',
      options: [{
        value: '',
        text: '无'
      }, {
        value: 'linkmenu',
        text: '菜单'
      }, {
@@ -1389,15 +1418,23 @@
      key: 'linkmenu',
      label: Formdict['model.menu'],
      initVal: card.linkmenu || [],
      required: false,
      required: true,
      options: menulist
    },
    {
      type: 'text',
      type: 'textarea',
      key: 'linkurl',
      label: '链接地址',
      initVal: card.linkurl || '',
      required: false
      required: true
    },
    {
      type: 'multiselect',
      key: 'linkfields',
      label: '关联字段',
      initVal: card.linkfields || [],
      required: false,
      options: fields
    },
    {
      type: 'multiselect',
@@ -1900,8 +1937,10 @@
    })
  }
  if (['textarea', 'fileupload', 'multiselect', 'checkbox', 'brafteditor'].includes(card.type)) {
  if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) {
    _fieldlength = 512
  } else if (['textarea', 'brafteditor'].includes(card.type)) {
    _fieldlength = 8000
  }
  return [
@@ -1970,9 +2009,6 @@
        value: 'textarea',
        text: Formdict['model.form.textarea']
      }, {
        value: 'hint',
        text: '提示'
      }, {
        value: 'color',
        text: Formdict['model.form.color']
      }, {
@@ -1981,6 +2017,12 @@
      }, {
        value: 'funcvar',
        text: Formdict['header.form.funcvar']
      }, {
        value: 'hint',
        text: '提示'
      }, {
        value: 'split',
        text: '分隔线'
      },
      ..._openType]
    },
@@ -2059,6 +2101,9 @@
    {
      type: 'number',
      key: 'width',
      min: 1,
      max: 24,
      precision: 0,
      label: '卡片宽度',
      initVal: card.width || 4,
      tooltip: '栅格布局,每行等分为24列。',
@@ -2200,6 +2245,9 @@
    {
      type: 'number',
      key: 'decimal',
      min: 0,
      max: 18,
      precision: 0,
      label: Formdict['header.form.decimal'],
      initVal: card.decimal || 0,
      required: true
@@ -2221,6 +2269,9 @@
    {
      type: 'number',
      key: 'fieldlength',
      min: 1,
      max: 1000000,
      precision: 0,
      label: Formdict['model.form.field'] + Formdict['model.length'],
      tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512',
      initVal: card.fieldlength || _fieldlength,
@@ -2229,6 +2280,9 @@
    {
      type: 'number',
      key: 'maxRows',
      min: 2,
      max: 100,
      precision: 0,
      label: Formdict['header.form.maxRows'],
      initVal: card.maxRows || 6,
      required: false
@@ -2271,6 +2325,9 @@
    {
      type: 'number',
      key: 'maxfile',
      min: 1,
      max: 1000000,
      precision: 0,
      label: '最大文件数',
      initVal: card.maxfile || '',
      required: false
@@ -2370,17 +2427,39 @@
    },
    {
      type: 'radio',
      key: 'entireLine',
      label: '占据整行',
      initVal: card.entireLine || 'false',
      required: false,
      key: 'declareType',
      label: '数据类型',
      tooltip: '声明变量时的类型,时间格式datetime或文本格式nvarchar(50)。',
      initVal: card.declareType || 'datetime',
      options: [{
        value: 'true',
        text: '是'
        value: 'datetime',
        text: 'datetime'
      }, {
        value: 'false',
        text: '否'
        value: 'nvarchar(50)',
        text: 'nvarchar(50)'
      }]
    },
    {
      type: 'number',
      key: 'span',
      min: 1,
      max: 24,
      precision: 0,
      label: '表单宽度',
      initVal: card.span || (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type) ? 24 : 12),
      tooltip: '栅格布局整行24等分。',
      required: true
    },
    {
      type: 'number',
      key: 'labelwidth',
      min: 1,
      max: 100,
      precision: 1,
      label: '名称宽度',
      initVal: card.labelwidth || 33.3,
      tooltip: '名称占据表单宽度的百分比。注:存在多列表单时,当前表单如果想要占据整行可参照以下比例,两列(16.2)、三列(10.5)、四列(7.7)',
      required: true
    },
    {
      type: 'text',
@@ -2407,7 +2486,7 @@
    {
      type: 'radio',
      key: 'interception',
      label: '截取',
      label: '截取空格',
      initVal: card.interception || 'false',
      tooltip: '提交时,是否截取首尾的空白字符。',
      options: [{
@@ -2447,6 +2526,14 @@
    },
    {
      type: 'text',
      key: 'extra',
      label: '底部提示',
      tooltip: '显示于表单底部。',
      initVal: card.extra || '',
      required: false
    },
    {
      type: 'text',
      key: 'emptyText',
      label: '空值文本',
      tooltip: '空值的提示文本,选择设置空值时有效,默认值为《空》。',