From d340a56429b12c3c893762730638631e147e047c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 27 八月 2023 13:46:34 +0800 Subject: [PATCH] 2023-08-27 --- src/menu/datasource/index.jsx | 46 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index dfa48d8..4076942 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -1,10 +1,11 @@ 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 { @@ -19,7 +20,8 @@ mainSearch: [], visible: false, loading: false, - setting: null + setting: null, + record: {} } UNSAFE_componentWillMount () { @@ -134,7 +136,8 @@ this.setState({ visible: true, - mainSearch: search + mainSearch: search, + record: {...config.setting} }) } @@ -224,9 +227,34 @@ }) } + 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"> @@ -238,14 +266,18 @@ 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> -- Gitblit v1.8.0