king
2020-05-18 ff4295358a99b2d35265a5fed445e4407cf6ed9a
src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx
@@ -27,15 +27,22 @@
  UNSAFE_componentWillMount() {
    const { searches } = this.props
    let _usefulFields = searches.map(item => {
    let _usefulFields = []
    searches.forEach(item => {
      if (item.type === 'group') {
        if (item.transfer === 'true') {
          return item.field + ', ' + item.datefield
        } else {
          return item.datefield
          _usefulFields.push(item.field)
        }
        _usefulFields.push(item.datefield)
        _usefulFields.push(item.datefield + '1')
      } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) {
        _usefulFields.push(item.field)
        _usefulFields.push(item.field + '1')
      } else if (_usefulFields.includes(item.field)) {
        _usefulFields.push(item.field + '1')
      } else {
        return item.field
        _usefulFields.push(item.field)
      }
    })
@@ -52,6 +59,15 @@
    this.props.form.setFieldsValue({
      sql: record.sql,
      initsql: record.initsql || 'false'
    })
  }
  handleCancel = () => {
    this.setState({
      editItem: null
    })
    this.props.form.setFieldsValue({
      sql: ''
    })
  }
@@ -123,6 +139,8 @@
          func: 's_debug_sql',
          LText: _initsql + values.sql + tail
        }
        param.LText = param.LText.replace(/@\$|\$@/ig, '')
        let allSearch = Utils.initMainSearch(searches)
        allSearch = Utils.getAllSearchOptions(allSearch)
@@ -224,12 +242,12 @@
          </Col> : null}
          <Col span={16}>
            <Form.Item label={'报错字段'} style={{margin: 0}}>
              errorCode, errmsg
              ErrorCode, retmsg
            </Form.Item>
          </Col>
          <Col span={24} className="sqlfield">
            <Form.Item label={'可用字段'}>
              id, bid, loginuid, sessionuid, userid, appkey{usefulFields ? ', ' + usefulFields : ''}
              id, bid, loginuid, sessionuid, userid, appkey, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''}
            </Form.Item>
          </Col>
          <Col span={8} style={{whiteSpace: 'nowrap'}}>
@@ -257,10 +275,13 @@
              </Select>
            </Form.Item>
          </Col>
          <Col span={4} className="add">
            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}>
          <Col span={6} className="add">
            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginTop: 5, marginBottom: 15, marginLeft: 30}}>
              保存
            </Button>
            <Button onClick={this.handleCancel} style={{marginTop: 5, marginBottom: 15, marginLeft: 10}}>
              取消
            </Button>
          </Col>
          <Col span={24} className="sql">
            <Form.Item label={'sql'}>