| | |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | menu: PropTypes.object, // 菜单信息 |
| | | config: PropTypes.object, // 页面配置信息 |
| | | inputSubmit: PropTypes.any // 回车提交事件 |
| | |
| | | } else if (type === 'scripts' && _scripts.length === 0) { |
| | | _resolve() |
| | | } else { // type 为 submit 、 verify ,以及其他需要验证的场景 |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: SettingUtils.getDebugSql(setting, _scripts) |
| | | LText: SettingUtils.getDebugSql(setting, _scripts, timestamp) |
| | | } |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.timestamp = timestamp |
| | | param.secretkey = Utils.encrypt('', timestamp) |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | _resolve() |
| | | } else { |
| | |
| | | if (_loading) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '存在未保存脚本,请点击确定保存,或点击取消放弃修改!', |
| | | message: '存在未保存脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | this.setState({loading: true}) |
| | | this.sqlverify(() => { // 验证成功 |
| | |
| | | const { activeKey, setting, loading, scripts } = this.state |
| | | |
| | | return ( |
| | | <div className="model-tree-setting-form-box" id="model-setting-form-body"> |
| | | <div className="model-tree-setting-form-box"> |
| | | {loading && <Spin size="large" />} |
| | | <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}> |
| | | <Tabs activeKey={activeKey} onChange={this.changeTab}> |
| | | <TabPane tab="数据源" key="setting"> |
| | | <DataSource |
| | | menu={menu} |
| | | dict={this.props.dict} |
| | | setting={setting} |
| | | inputSubmit={this.props.inputSubmit} |
| | | wrappedComponentRef={(inst) => this.settingForm = inst} |
| | |
| | | 自定义脚本 |
| | | {scripts.length ? <span className="count-tip">{scripts.length}</span> : null} |
| | | </span> |
| | | } key="scripts"> |
| | | } key="scripts" id="mk-setting-scripts"> |
| | | <CustomScript |
| | | dict={this.props.dict} |
| | | setting={setting} |
| | | scripts={scripts} |
| | | defaultSql={this.state.defaultsql} |