king
2025-01-18 f9f60bb0dd17a764ba03faa8041f5b6e9e071553
src/templates/zshare/formconfig.jsx
@@ -74,6 +74,9 @@
      value: 'group',
      text: '日期(组合)'
    }, {
      value: 'range',
      text: '数值(区间)'
    }, {
      value: 'switch',
      text: '开关'
    }, {
@@ -258,6 +261,7 @@
      label: '数据源',
      initVal: card.dataSource || '',
      tooltip: '数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'',
      placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值:@BID@、@Appkey@、@UserID@、@SessionUid@、@LoginUID@、@lang@。',
      required: true
    },
    {
@@ -440,7 +444,7 @@
        text: '本地'
      }, {
        value: 'sso',
        text: '系统'
        text: '单点'
      }]
    },
    {
@@ -464,6 +468,15 @@
      initVal: card.labelwidth || 33.3,
      tooltip: '名称占据搜索条件宽度的百分比。注:存在多列搜索时,当前搜索如果想要占据整行可参照以下比例,两列(16.5)、三列(10.8)、四列(8)',
      required: true,
      forbid: appType === 'mob'
    },
    {
      type: 'text',
      key: 'dateShift',
      label: '日期偏移',
      initVal: card.dateShift || '',
      tooltip: '可以填入上级字段,用于控制初始值,例如:上级字段值为2023-12-10,初始值为本月,则初始区间为 2023-12-01 ~ 2023-12-31。',
      required: false,
      forbid: appType === 'mob'
    },
    {
@@ -718,13 +731,8 @@
/**
 * @description 获取表单配置信息
 * @param {*} card            // 表单对象
 * @param {*} inputfields     // 可写入表单
 * @param {*} tabfields       // 可切换表单
 * @param {*} linkableFields  // 可关联表单
 * @param {*} linksupFields   // 上级表单
 */
export function getModalForm (card, inputfields = [], tabfields = [], linkableFields, linksupFields, columns = []) {
export function getModalForm (card, fields, columns = []) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  if (roleList) {
@@ -759,6 +767,64 @@
    }
  } else {
    msgTemps = []
  }
  let inputfields = []
  let tabfields = []
  let linkableFields = []
  let linksupFields = []
  fields.forEach(item => {
    if (!item.field || card.field === item.field) return
    if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
      inputfields.push({
        field: item.field,
        label: item.label
      })
    }
    if (item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) {
      tabfields.push({
        field: item.field,
        label: item.label
      })
    }
    if (['switch', 'check', 'popSelect'].includes(item.type)) {
      linksupFields.push({
        field: item.field,
        label: item.label
      })
    }
    if (['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) {
      linksupFields.push({
        field: item.field,
        label: item.label
      })
    }
    if (['select', 'link', 'radio', 'popSelect'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true')) {
      linkableFields.push({
        field: item.field,
        label: item.label + '-表单'
      })
    }
  })
  let _fields = linkableFields.map(cell => cell.field)
  columns.forEach(col => {
    if (col.field && !_fields.includes(col.field)) {
      linkableFields.push({
        field: col.field,
        label: col.label + '-显示列'
      })
    }
  })
  if (card.linkSubField && card.linkSubField.length > 0) {
    let fields = inputfields.map(item => item.field)
    card.linkSubField = card.linkSubField.filter(item => fields.includes(item))
  }
  inputfields = inputfields.map((item, index) => {
@@ -946,12 +1012,20 @@
  let options = card.options || []
  if (['select', 'radio', 'link'].includes(card.type) && card.setAll === 'true') { // 兼容
    options.unshift({
    let cell = {
      key: 'empty',
      Value: '',
      Text: card.emptyText || '空',
      ParentID: ''
    })
    }
    if (card.linkSubField) {
      card.linkSubField.forEach(m => {
        cell[m] = ''
      })
    }
    options.unshift(cell)
  }
  let initval = card.initval || ''
@@ -1133,7 +1207,7 @@
      label: '数据源',
      initVal: card.dataSource || '',
      tooltip: '数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'',
      placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值:@ID@、@BID@。',
      placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。公共值:@ID@、@BID@、@Appkey@、@UserID@、@SessionUid@、@LoginUID@、@lang@。',
      required: true,
      readonly: false
    },
@@ -1782,6 +1856,19 @@
    },
    {
      type: 'radio',
      key: 'notZero',
      label: "不可为0",
      initVal: card.notZero || 'false',
      options: [{
        value: 'true',
        text: '是'
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'database',
      label: '数据库',
      initVal: card.database || 'local',
@@ -1790,7 +1877,7 @@
        text: '本地'
      }, {
        value: 'sso',
        text: '系统'
        text: '单点'
      }]
    },
    {
@@ -1828,7 +1915,7 @@
      type: 'radio',
      key: 'readin',
      label: '自动填充',
      tooltip: '将表格选中的数据自动填充到表单中。注:在批量操作时,如想要所选行(当前字段)全部修改请设为否或首行。',
      tooltip: '将表格选中的数据自动填充到表单中。注:在批量操作时,如想要所选行(当前字段)全部修改请设为否或首行;使用“缓存”时,将在本地保存与读取表单信息,选行时使用行信息填充。',
      initVal: card.readin || 'true',
      options: [{
        value: 'true',
@@ -1839,6 +1926,9 @@
      }, {
        value: 'top',
        text: '首行'
      }, {
        value: 'local',
        text: '缓存'
      }]
    },
    {
@@ -1853,6 +1943,35 @@
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'verifyVal',
      label: '空值验证',
      tooltip: '按钮提交时验证字段值是否为空(或数值为0)。',
      initVal: card.verifyVal || 'false',
      options: [{
        value: 'true',
        text: '开启'
      }, {
        value: 'false',
        text: '关闭'
      }]
    },
    {
      type: 'radio',
      key: 'format',
      label: '格式化',
      tooltip: '使用千分位时,数值将以千分位格式显示,提交时为原数值。',
      initVal: card.format || '',
      forbid: appType === 'mob',
      options: [{
        value: '',
        text: '无'
      }, {
        value: 'thdSeparator',
        text: '千分位'
      }]
    },
    {
@@ -2052,6 +2171,7 @@
      key: 'inputType',
      label: '加密显示',
      initVal: card.inputType || 'text',
      tooltip: '输入框内容以 ****** 显示。',
      required: false,
      options: [{
        value: 'text',
@@ -2062,17 +2182,23 @@
      }]
    },
    {
      type: 'radio',
      type: 'select',
      key: 'interception',
      label: '截取方式',
      label: '文本预处理',
      initVal: card.interception || 'true',
      tooltip: '提交时的文本处理方式,空白字符指开头或结尾的空白字符。',
      tooltip: '提交时的文本处理方式。注:全角转半角时会去除首尾空格',
      options: [{
        value: 'false',
        text: '无'
      }, {
        value: 'true',
        text: '空白字符'
        text: '去掉首尾空格'
      // }, {
      //   value: 'char',
      //   text: '全角转半角'
      }, {
        value: 'charTure',
        text: '全角转半角'
      }, {
        value: 'func',
        text: '自定义函数'
@@ -2331,6 +2457,23 @@
    },
    {
      type: 'radio',
      key: 'mkfocus',
      label: '聚焦时',
      initVal: card.mkfocus || 'def',
      options: [{
        value: 'def',
        text: '默认'
      }, {
        value: 'check',
        text: '全选'
      }, {
        value: 'clear',
        text: '清空'
      }],
      forbid: appType !== 'mob'
    },
    {
      type: 'radio',
      key: 'sendType',
      label: '发送方式',
      initVal: card.sendType || 'local',
@@ -2397,6 +2540,18 @@
    },
    {
      type: 'number',
      key: 'contHeidht',
      label: '高度',
      min: 1,
      max: 2000,
      precision: 1,
      initVal: card.contHeidht,
      tooltip: '富文本编辑区的高度,小于100时为窗口的百分比。',
      required: false,
      forbid: appType === 'mob'
    },
    {
      type: 'number',
      key: 'labelwidth',
      min: 1,
      max: 100,
@@ -2457,6 +2612,22 @@
      initVal: card.supvalue || '',
      required: false,
      readonly: false
    },
    {
      type: 'radio',
      key: 'opacity',
      label: '是否可见',
      initVal: card.opacity || 'true',
      tooltip: '不可见时仅用作表单分隔,不显示名称。',
      required: false,
      forbid: appType === 'mob',
      options: [{
        value: 'true',
        text: '可见'
      }, {
        value: 'false',
        text: '不可见'
      }]
    },
    {
      type: 'text',
@@ -2535,7 +2706,7 @@
      key: 'enter',
      label: '回车事件',
      initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'),
      tooltip: '点击Enter键,或文本类表单输入回车符。',
      tooltip: '1、点击Enter键或文本类表单输入回车符;2、下拉选择、时间、开关的选项切换。',
      options: [{
        value: 'sub',
        text: '提交'