| | |
| | | UNSAFE_componentWillMount() { |
| | | const { config } = this.props |
| | | |
| | | let _setting = fromJS(config.setting).toJS() |
| | | let _scripts = fromJS(config.scripts).toJS() |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | _scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | if (_setting.dataresource) { |
| | | _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | setting: fromJS(config.setting).toJS(), |
| | | setting: _setting, |
| | | columns: fromJS(config.columns).toJS(), |
| | | scripts: fromJS(config.scripts).toJS() |
| | | scripts: _scripts |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { columns, setting, scripts, colColumns, activeKey, loading } = this.state |
| | | |
| | | return ( |
| | |
| | | wrappedComponentRef={(inst) => this.contrastForm = inst} |
| | | /> |
| | | <FieldsComponent |
| | | config={{...this.props.config, columns}} |
| | | config={{...config, columns}} |
| | | type="fields" |
| | | updatefield={this.updatefields} |
| | | /> |
| | |
| | | dict={this.props.dict} |
| | | setting={setting} |
| | | scripts={scripts} |
| | | urlFields={config.urlFields} |
| | | defaultSql={this.state.defaultsql} |
| | | searches={this.props.searches} |
| | | scriptsChange={this.scriptsChange} |