king
2020-05-22 523cec6c87d88b43954a4409a8dfde6aade095a1
src/templates/sharecomponent/settingcomponent/settingform/customscript/index.jsx
@@ -11,6 +11,7 @@
class CustomForm extends Component {
  static propTpyes = {
    type: PropTypes.string,         // 菜单类型
    dict: PropTypes.object,         // 字典项
    setting: PropTypes.object,      // 设置
    searches: PropTypes.array,      // 搜索条件
@@ -27,15 +28,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 +60,15 @@
    this.props.form.setFieldsValue({
      sql: record.sql,
      initsql: record.initsql || 'false'
    })
  }
  handleCancel = () => {
    this.setState({
      editItem: null
    })
    this.props.form.setFieldsValue({
      sql: ''
    })
  }
@@ -123,6 +140,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)
@@ -200,7 +219,7 @@
  }
  render() {
    const { systemScripts, setting } = this.props
    const { systemScripts, setting, type } = this.props
    const { getFieldDecorator } = this.props.form
    const { usefulFields } = this.state
    const formItemLayout = {
@@ -224,12 +243,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, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''}
              id, bid, loginuid, sessionuid, userid, appkey, {type === 'main' ? 'out_id, ' : '' }time_id, orderBy{setting.laypage !== 'false' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''}
            </Form.Item>
          </Col>
          <Col span={8} style={{whiteSpace: 'nowrap'}}>
@@ -257,10 +276,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'}>