| | |
| | | loading: false, |
| | | colLoading: false, |
| | | searchKey: '', |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | usefulfields: '', |
| | | defaultsql: '', // 默认Sql |
| | | defaultsql: '', |
| | | systemScripts: [], |
| | | median: {}, |
| | | visible: false, |
| | |
| | | pvisible: false, |
| | | reload: false, |
| | | script: null, |
| | | oriConfig: null, |
| | | scriptValue: '', |
| | | cols: null, |
| | | colColumns: [ |
| | |
| | | median: _setting, |
| | | searches: formatSearch(search), |
| | | searchKey: '', |
| | | debugId: _setting.debugId || '' |
| | | debugId: _setting.debugId || '', |
| | | oriConfig: fromJS({ |
| | | scripts, |
| | | columns: columns, |
| | | subColumns: subColumns, |
| | | setting: _setting |
| | | }).toJS() |
| | | }) |
| | | |
| | | this.getsysScript() |
| | |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | closeDataSource = (callback) => { |
| | | const { setting, columns, subColumns, scripts, oriConfig } = this.state |
| | | |
| | | let line = scripts.map(item => item.sql).join('') |
| | | line += columns.map(item => item.field + item.datatype).join('') |
| | | line += subColumns.map(item => item.field + item.datatype).join('') |
| | | line += setting.interType + (setting.dataresource || '') + (setting.order || '') + (setting.primaryKey || '') |
| | | |
| | | let _line = oriConfig.scripts.map(item => item.sql).join('') |
| | | _line += oriConfig.columns.map(item => item.field + item.datatype).join('') |
| | | _line += oriConfig.subColumns.map(item => item.field + item.datatype).join('') |
| | | _line += oriConfig.setting.interType + (oriConfig.setting.dataresource || '') + (oriConfig.setting.order || '') + (oriConfig.setting.primaryKey || '') |
| | | |
| | | if (line !== _line) { |
| | | confirm({ |
| | | content: '数据源已修改,确定取消吗?', |
| | | onOk() { |
| | | callback() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | |
| | | sqlverify = (resolve, reject, type, testScripts) => { |
| | |
| | | setting={setting} |
| | | searches={searches} |
| | | defaultsql={defaultsql} |
| | | initsql={this.state.initsql} |
| | | customScripts={scripts} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |