king
2024-05-23 9a11e62adeb8d435b52a361eb62d5b59e1deef2a
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
    },
    {
@@ -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)) return
    linksupFields.push({
      field: item.field,
      label: item.label
    })
    if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return
    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) => {
@@ -1782,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',
@@ -1853,6 +1932,21 @@
      }, {
        value: 'false',
        text: '否'
      }]
    },
    {
      type: 'radio',
      key: 'format',
      label: '格式化',
      tooltip: '使用千分位时,数值将以千分位格式显示,提交时为原数值。',
      initVal: card.format || '',
      forbid: appType === 'mob',
      options: [{
        value: '',
        text: '无'
      }, {
        value: 'thdSeparator',
        text: '千分位'
      }]
    },
    {
@@ -2052,6 +2146,7 @@
      key: 'inputType',
      label: '加密显示',
      initVal: card.inputType || 'text',
      tooltip: '输入框内容以 ****** 显示。',
      required: false,
      options: [{
        value: 'text',
@@ -2062,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: '自定义函数'
@@ -2331,6 +2432,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',
@@ -2459,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: '正则扩展符',
@@ -2535,7 +2669,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: '提交'