king
2024-05-23 9a11e62adeb8d435b52a361eb62d5b59e1deef2a
src/templates/zshare/formconfig.jsx
@@ -261,6 +261,7 @@
      label: '数据源',
      initVal: card.dataSource || '',
      tooltip: '数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'',
      placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。',
      required: true
    },
    {
@@ -730,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) {
@@ -771,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) => {
@@ -1794,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',