| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal } from 'antd' |
| | | import { Modal, Button } from 'antd' |
| | | import { SettingOutlined } from '@ant-design/icons' |
| | | |
| | | import VerifyCard from './verifycard' |
| | | import CreateFunc from '@/templates/zshare/createfunc' |
| | | import './index.scss' |
| | | |
| | | class DataSource extends Component { |
| | |
| | | mainSearch: [], |
| | | visible: false, |
| | | loading: false, |
| | | setting: null |
| | | setting: null, |
| | | record: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | mainSearch: search |
| | | mainSearch: search, |
| | | record: {...config.setting} |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | creatFunc = () => { |
| | | const { config } = this.props |
| | | const { mainSearch } = this.state |
| | | const menu = window.GLOB.customMenu |
| | | |
| | | return new Promise((resolve) => { |
| | | this.verifyRef.submitDataSource().then(res => { |
| | | let _config = fromJS(config).toJS() |
| | | _config.MenuName = menu.MenuName + '-' + _config.name |
| | | _config.menuNo = menu.MenuNo |
| | | _config.MenuID = menu.MenuID |
| | | _config.setting = res.setting |
| | | _config.columns = res.columns |
| | | _config.func = res.setting.innerFunc |
| | | _config.$type = 'table' |
| | | |
| | | if (res.setting.useMSearch === 'true') { // 使用主搜索条件 |
| | | _config.search = [..._config.search, ...mainSearch] |
| | | } |
| | | |
| | | resolve(_config) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const { config } = this.props |
| | | const { visible, loading, mainSearch } = this.state |
| | | const { visible, loading, mainSearch, record } = this.state |
| | | |
| | | return ( |
| | | <div className="model-datasource"> |
| | |
| | | width={'75vw'} |
| | | maskClosable={false} |
| | | okText="提交" |
| | | onOk={this.verifySubmit} |
| | | confirmLoading={loading} |
| | | onCancel={() => {this.setState({ visible: false }) }} |
| | | onCancel={() => {this.setState({ visible: false, loading: false }) }} |
| | | footer={[ |
| | | config.subtype !== 'dualdatacard' && record.interType === 'inner' ? <CreateFunc key="create" getMsg={this.creatFunc}/> : null, |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>取消</Button>, |
| | | <Button key="confirm" type="primary" loading={loading} onClick={this.verifySubmit}>确定</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <VerifyCard |
| | | mainSearch={mainSearch} |
| | | config={config} |
| | | updRecord={(record) => this.setState({record: record})} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> |
| | | </Modal> |