| | |
| | | import { Modal } from 'antd' |
| | | import { SettingOutlined } from '@ant-design/icons' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import VerifyCard from './verifycard' |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | appType: sessionStorage.getItem('appType'), |
| | | sourcelist: [], |
| | | mainSearch: [], |
| | |
| | | editDataSource = () => { |
| | | const { config } = this.props |
| | | const { appType } = this.state |
| | | |
| | | if (config.type === 'interface') { // 公共数据源不使用搜索 |
| | | this.setState({visible: true}) |
| | | return |
| | | } |
| | | |
| | | let search = [] |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | res.columns.reverse() |
| | | } |
| | | |
| | | let maxScript = 0 |
| | |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | res.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | } |
| | | |
| | | res.setting.maxScript = maxScript |
| | | |
| | | if (config.subtype !== 'dualdatacard') { |
| | | delete res.subColumns |
| | | } else { |
| | | res.subColumns.reverse() |
| | | } |
| | | |
| | | if (this.verifyRef.state.debugId) { |
| | | res.setting.debugId = this.verifyRef.state.debugId |
| | | } else { |
| | | delete res.setting.debugId |
| | | } |
| | | |
| | | this.setState({loading: false, visible: false}) |
| | | this.props.updateConfig({...config, ...res}) |
| | |
| | | |
| | | render () { |
| | | const { config } = this.props |
| | | const { visible, dict, loading, mainSearch } = this.state |
| | | const { visible, loading, mainSearch } = this.state |
| | | |
| | | return ( |
| | | <div className="model-datasource"> |
| | | <SettingOutlined title="数据源" onClick={() => this.editDataSource()} /> |
| | | <Modal |
| | | wrapClassName="popview-modal" |
| | | title={'数据源配置'} |
| | | wrapClassName="mk-pop-modal" |
| | | title="" |
| | | visible={visible} |
| | | width={'75vw'} |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | okText="提交" |
| | | onOk={this.verifySubmit} |
| | | confirmLoading={loading} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | onCancel={() => {this.setState({ visible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | <VerifyCard |
| | | dict={dict} |
| | | mainSearch={mainSearch} |
| | | config={config} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |