king
2023-09-06 d2fd67a1bcec35db7870f55a83a25c043ae854f8
src/tabviews/zshare/topSearch/index.jsx
@@ -114,22 +114,11 @@
      if (item.advanced && !forbid) {
        _setting.showAdv = true
        if (!['group', 'check', 'switch'].includes(item.type)) {
          item.signValue = true
        }
      } else {
        item.advanced = false
      }
      if (item.advanced && item.initval) {
        let val = item.initval
        if (item.precision === 'hour') {
          if (/,/ig.test(val)) {
            val = val.split(',').map(m => m + ':00').join(',')
          } else {
            val = val + ':00'
          }
        }
        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
        }
      }
      if (item.type === 'group') {
@@ -179,6 +168,29 @@
        if (item.type === 'checkcard' && item.multiple === 'dropdown' && item.resourceType === '0') {
          this.resetCheckcard(item)
        }
      }
      if (item.signValue && item.initval) {
        let val = item.initval
        if (item.precision === 'hour') {
          if (/,/ig.test(val)) {
            val = val.split(',').map(m => m + ':00').join(',')
          } else {
            val = val + ':00'
          }
        }
        let text = val
        if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
          item.oriOptions.forEach(cell => {
            if (cell.Value === val) {
              text = cell.Text
            }
          })
        }
        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
      }
      fieldMap.set(item.field, item)
@@ -319,15 +331,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(
@@ -621,7 +629,7 @@
      if (visible) {
        let advanceValues = []
        this.state.searchlist.forEach(item => {
          if (!item.advanced) return
          if (!item.signValue) return
    
          let val = this.record[item.field]
          if (val || val === 0) {
@@ -632,9 +640,18 @@
                val = val + ':00'
              }
            }
            if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
              advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
            let text = val
            if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
              item.oriOptions.forEach(cell => {
                if (cell.Value === val) {
                  text = cell.Text
                }
              })
            }
            advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
          }
        })
        this.setState({advanceValues})
@@ -652,6 +669,8 @@
  }
  handleSubmit = () => {
    const { config } = this.props
    this.setState({}, () => {
      this.props.form.validateFields((err, values) => {
        if (err) return
@@ -689,11 +708,20 @@
          this.sign = ''
        }, 2000)
        
        if (config.wrap && config.wrap.cacheSearch === 'true') {
          let _values = {}
          searches.forEach(item => {
            _values[item.key] = item.value
          })
          window.GLOB.SearchBox.set(config.$searchId + 'cache', _values)
        }
        if (this.props.refreshdata) {
          this.props.refreshdata(searches)
        } else {
          window.GLOB.SearchBox.set(this.props.config.$searchId, searches)
          MKEmitter.emit('searchRefresh', this.props.config.$searchId)
          window.GLOB.SearchBox.set(config.$searchId, searches)
          MKEmitter.emit('searchRefresh', config.$searchId)
        }
      })
    })
@@ -720,7 +748,7 @@
      } else {
        record[item.field] = item.initval
      }
      if (item.advanced && item.initval) {
      if (item.signValue && item.initval) {
        let val = item.initval
        if (item.precision === 'hour') {
          if (/,/ig.test(val)) {
@@ -729,9 +757,18 @@
            val = val + ':00'
          }
        }
        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
        let text = val
        if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
          item.oriOptions.forEach(cell => {
            if (cell.Value === val) {
              text = cell.Text
            }
          })
        }
        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
      }
      return item
@@ -835,7 +872,7 @@
    let advanceValues = []
    this.state.searchlist.forEach(item => {
      if (!item.advanced) return
      if (!item.signValue) return
      let val = this.record[item.field]
      if (val || val === 0) {
@@ -846,9 +883,18 @@
            val = val + ':00'
          }
        }
        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
        let text = val
        if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
          item.oriOptions.forEach(cell => {
            if (cell.Value === val) {
              text = cell.Text
            }
          })
        }
        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
      }
    })
@@ -886,7 +932,7 @@
                return (
                  <div key={index}>
                    <span>{item.label}: </span>
                    <span className="advance-value">{item.value}</span>
                    <span className="advance-value">{item.text}</span>
                    <CloseOutlined onClick={() => this.closeAdvanceForm(item)} />
                  </div>)
              })}