king
2023-08-29 3e168c2a5149f1a56e41cacf4eda95d10b497210
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)
@@ -621,7 +633,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 +644,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})
@@ -720,7 +741,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 +750,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 +865,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 +876,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 +925,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>)
              })}