king
2024-05-25 10f5efae1624c89d9a8f04ac331e07c895ea282a
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。',
      required: true
    },
    {
@@ -727,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) {
@@ -768,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) => {
@@ -1791,6 +1848,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',
@@ -1862,6 +1932,21 @@
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'format',
      label: '格式化',
      tooltip: '使用千分位时,数值将以千分位格式显示,提交时为原数值。',
      initVal: card.format || '',
      forbid: appType === 'mob',
      options: [{
        value: '',
        text: '无'
      }, {
        value: 'thdSeparator',
        text: '千分位'
      }]
    },
    {
@@ -2061,6 +2146,7 @@
      key: 'inputType',
      label: '加密显示',
      initVal: card.inputType || 'text',
      tooltip: '输入框内容以 ****** 显示。',
      required: false,
      options: [{
        value: 'text',
@@ -2071,17 +2157,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: '自定义函数'
@@ -2485,6 +2577,22 @@
      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',
      key: 'regularExtra',
      label: '正则扩展符',
@@ -2561,7 +2669,7 @@
      key: 'enter',
      label: '回车事件',
      initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'),
      tooltip: '1、点击Enter键或文本类表单输入回车符;2、下拉选择或开关的选项切换。',
      tooltip: '1、点击Enter键或文本类表单输入回车符;2、下拉选择、时间、开关的选项切换。',
      options: [{
        value: 'sub',
        text: '提交'