king
2023-08-24 0c1a33a33b45fc3265cb7fef20beb48407cd6c98
src/tabviews/zshare/mutilform/index.jsx
@@ -610,8 +610,9 @@
    }
    this.record = record
    let ID = this.props.data ? this.props.data.$$uuid || '' : ''
    this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => {
    this.setState({ formlist, ID }, () => {
      if (unload) return
      
      if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) {
@@ -629,13 +630,29 @@
      }
      if (deForms.length > 0) {
        if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') {
          this.improveSimpleActionForm(deForms)
        if (action.$cache && action.setting.cache !== 'false') {
          Api.getLCacheConfig(action.uuid, action.$time, this.props.BID, ID).then(res => {
            if (!res.valid) {
              this.getFormData(deForms)
            } else {
              this.resetFormList(res.data, true)
            }
          })
        } else {
          this.improveActionForm(deForms)
          this.getFormData(deForms)
        }
      }
    })
  }
  getFormData = (deForms) => {
    if (deForms.length === 1) {
      this.improveSimpleActionForm(deForms)
    } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') {
      this.improveSimpleActionForm(deForms)
    } else {
      this.improveActionForm(deForms)
    }
  }
  /**
@@ -647,8 +664,8 @@
    let deffers = []
    let mainItems = []  // 云端或单点数据
    let localItems = [] // 本地数据
    let cache = action.setting.cache !== 'false'
    let debug = window.GLOB.debugger === true
    let cache = action.setting.cache !== 'false' && !action.$cache
    let skip = false
    let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
    let _sso = _sql
@@ -661,7 +678,7 @@
        sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`)
        sql = sql.replace(/@BID@/ig, `'${BID}'`)
        if (debug) {
        if (window.GLOB.debugger === true) {
          console.info(sql)
        }
@@ -675,7 +692,7 @@
        sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`)
        sql = sql.replace(/@BID@/ig, `'${BID}'`)
        if (debug) {
        if (window.GLOB.debugger === true) {
          console.info(sql)
        }
@@ -712,6 +729,7 @@
                message: res.message,
                duration: 5
              })
              skip = true
            }
            resolve(res)
          })
@@ -753,6 +771,7 @@
                message: res.message,
                duration: 5
              })
              skip = true
            }
            resolve(res)
          })
@@ -768,7 +787,7 @@
      delete result.message
      delete result.status
      this.resetFormList(result)
      this.resetFormList(result, skip)
    })
  }
@@ -776,8 +795,11 @@
   * @description 测试系统获取下拉表单选项信息
   */
  improveSimpleActionForm = (deForms) => {
    let cache = this.props.action.setting.cache !== 'false'
    const { action } = this.props
    let cache = this.props.action.setting.cache !== 'false' && !action.$cache
    let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
    let skip = false
    let deffers = deForms.map((form, index) => {
      let param = {
@@ -812,6 +834,7 @@
                  message: res.message,
                  duration: 5
                })
                skip = true
              }
              resolve(res)
            })
@@ -822,6 +845,7 @@
    Promise.all(deffers).then(response => {
      let result = {}
      response.forEach(res => {
        result = {...result, ...res}
      })
@@ -831,11 +855,17 @@
      delete result.message
      delete result.status
      this.resetFormList(result)
      this.resetFormList(result, skip)
    })
  }
  resetFormList = (result) => {
  resetFormList = (result, skip) => {
    const { BID, action } = this.props
    if (action.$cache && action.setting.cache !== 'false' && !skip) {
      Api.writeCacheConfig(action.uuid, fromJS(result).toJS(), BID, this.state.ID)
    }
    let reFieldsVal = null
    let _formlist = fromJS(this.state.formlist).toJS().map(item => {
      if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) {