king
2020-05-09 aaaf56d7ca060f7c681d6b8a67aac46aa89a4dbc
src/tabviews/commontable/index.jsx
@@ -567,12 +567,15 @@
  async loadmaindata () {
    const { setting, BIDs, search } = this.state
    let param = ''
    let requireFields = search.filter(item => item.required && !item.value)
    let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
    if (requireFields.length > 0) {
      let labels = requireFields.map(item => item.label)
      labels = Array.from(new Set(labels))
      notification.warning({
        top: 92,
        message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('、') + ' !',
        message: this.state.dict['form.required.input'] + labels.join('、') + ' !',
        duration: 3
      })
      return
@@ -690,20 +693,22 @@
      _dataresource = '(' + _dataresource + ') tb'
    }
    if (setting.queryType === 'statistics') { // 统计数据源,内容替换
    let regoptions = null
    if (setting.queryType === 'statistics' || param.custom_script) {
      let allSearch = Utils.getAllSearchOptions(search)
      let options = allSearch.map(item => {
      regoptions = allSearch.map(item => {
        return {
          reg: new RegExp('@' + item.key + '@', 'ig'),
          value: item.value
          value: `'${item.value}'`
        }
      })
    }
      options.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
    if (setting.queryType === 'statistics') { // 统计数据源,内容替换
      regoptions.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, item.value)
      })
      _search = ''
    }
@@ -715,7 +720,28 @@
      DateCount = ''
    }
    param.custom_script = Utils.formatOptions(param.custom_script)
    if (param.custom_script) {
      regoptions.push({
        reg: new RegExp('@orderBy@', 'ig'),
        value: _orderBy
      })
      if (setting.laypage !== 'false') {
        regoptions.push({
          reg: new RegExp('@pageSize@', 'ig'),
          value: pageSize
        }, {
          reg: new RegExp('@pageIndex@', 'ig'),
          value: pageIndex
        })
      }
      regoptions.forEach(item => {
        param.custom_script = param.custom_script.replace(item.reg, item.value)
      })
      param.custom_script = Utils.formatOptions(param.custom_script)
    }
    param.LText = Utils.formatOptions(LText)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)