king
2023-10-04 ae46c8e640ed64abd7605b289554377e0cdc0cb7
src/tabviews/zshare/mutilform/index.jsx
@@ -486,47 +486,42 @@
      let item = fieldMap.get(cell.field)
      // 下级表单控制-字段写入
      if ((['select', 'radio', 'link'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true') || (item.type === 'cascader' && item.resourceType !== '2')) && item.linkSubField) {
        item.subFields = []
        item.linkSubField.forEach(m => {
          let n = fieldMap.get(m)
          if (n && ['text', 'number', 'textarea'].includes(n.type)) {
            item.subFields.push({
              uuid: n.uuid,
              field: m
            })
          }
        })
        if (item.subFields.length === 0) {
          item.subFields = null
        } else if (item.oriOptions.length > 0) {
          item.oriOptions = item.oriOptions.map(cell => {
            item.subFields.forEach(m => {
              cell[m.field] = cell[m.field] === undefined ? '' : cell[m.field]
            })
            return cell
      if (item.linkSubField && item.linkSubField.length > 0) {
        if ((['select', 'radio', 'link'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true') || (item.type === 'cascader' && item.resourceType !== '2'))) {
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
              })
            }
          })
          item.options = fromJS(item.oriOptions).toJS()
        }
        item.linkSubField = null
      } else if (item.type === 'switch' && item.linkSubField) {
        item.options = []
        item.subFields = []
        item.linkSubField.forEach(m => {
          let n = fieldMap.get(m)
          if (n && ['text', 'number', 'textarea'].includes(n.type)) {
            item.subFields.push({
              uuid: n.uuid,
              field: m
          if (item.oriOptions.length > 0) {
            item.oriOptions = item.oriOptions.map(cell => {
              item.subFields.forEach(m => {
                cell[m.field] = cell[m.field] === undefined ? '' : cell[m.field]
              })
              return cell
            })
            item.options = fromJS(item.oriOptions).toJS()
          }
        })
        if (item.subFields.length === 0) {
          item.subFields = null
        } else {
        } else if (item.type === 'switch') {
          item.options = []
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
              })
            }
          })
          reFieldsVal = reFieldsVal || {}
          let val = item.initval === item.openVal ? item.openText : item.closeText
@@ -534,7 +529,20 @@
          item.subFields.forEach(n => {
            reFieldsVal[n.field] = val || ''
          })
        } else if (item.type === 'fileupload') {
          item.options = []
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
              })
            }
          })
        }
        item.linkSubField = null
      }
@@ -751,15 +759,11 @@
      mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp)
      if (window.GLOB.mainSystemApi) {
        mainparam.rduri = window.GLOB.mainSystemApi
      }
      if (window.GLOB.mkHS) { // 云端数据验证
        mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp)
        if (window.GLOB.cloudServiceApi) {
          mainparam.rduri = window.GLOB.cloudServiceApi
          mainparam.userid = sessionStorage.getItem('CloudUserID') || ''
          mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
        }
      } else if (window.GLOB.mainSystemApi) {
        mainparam.rduri = window.GLOB.mainSystemApi
      }
      deffers.push(
@@ -822,6 +826,9 @@
      if (form.database === 'sso' && window.GLOB.mainSystemApi) {
        param.rduri = window.GLOB.mainSystemApi
      }
      if (window.GLOB.mkHS) { // 云端数据验证
        param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
      }
  
      return (
@@ -1137,7 +1144,7 @@
        } else if (item.type === 'fileupload') {
          className = item.readonly ? 'readonly' : ''
          className += item.fileType === 'picture-card' ? ' file-upload' : ''
          content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
          content = (<MKFileUpload config={item} onChange={(val, other = {}) => this.recordChange({[item.field]: val, ...other})} />)
        } else if (item.type === 'textarea') {
          content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>)
        } else if (item.type === 'rate') {
@@ -1211,7 +1218,19 @@
            _item.value = _item.value.replace(/\t+|\v+/g, '')       // 去除制表符
    
            if (item.interception !== 'false') {                    // 去除首尾空格
              _item.value = _item.value.replace(/(^\s*|\s*$)/g, '')
              if (item.interception === 'func') {
                try {
                  // eslint-disable-next-line
                  let func = new Function('value', 'data', item.func)
                  _item.value = func(_item.value, record)
                  _item.value = _item.value !== undefined ? _item.value : ''
                } catch (e) {
                  console.warn(e)
                  _item.value = ''
                }
              } else {
                _item.value = _item.value.replace(/(^\s*|\s*$)/g, '')
              }
            }
            if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换
              _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || ''))