From ed7d889f7d9dfca77fd7f055ad8d6ec6ad85ae91 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 20 七月 2022 18:28:13 +0800 Subject: [PATCH] 2022-07-20 --- src/templates/sharecomponent/searchcomponent/index.jsx | 62 ++++++++++++++++++++++-------- 1 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index c90b728..3429ae2 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -12,8 +12,9 @@ import { getSearchForm } from '@/templates/zshare/formconfig' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' -import SearchForm from './searchform' import DragElement from './dragsearch' +import SearchForm from './searchform' +import SettingForm from './settingform' import './index.scss' const { confirm } = Modal @@ -28,11 +29,12 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - searchlist: null, // 鎼滅储鏉′欢闆� - sqlVerifing: false, // sql楠岃瘉涓� - visible: false, // 妯℃�佹鎺у埗 + searchlist: null, + sqlVerifing: false, + visible: false, showField: false, - card: null // 缂栬緫涓厓绱� + setVisible: false, + card: null } /** @@ -316,6 +318,22 @@ }) } + handleSetting = () => { + this.setState({ + setVisible: true + }) + } + + settingSubmit = () => { + const { config } = this.props + + this.settingFormRef.handleConfirm().then(res => { + this.setState({ + setVisible: false + }) + this.props.updatesearch({...config, setting: {...config.setting, ...res}}) + }) + } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 @@ -332,35 +350,30 @@ if (!is(fromJS(this.state), fromJS(nextState))) { return true } else if (this.props.config.wrap) { - return this.props.config.wrap.show !== nextProps.config.wrap.show + return !is(fromJS(nextProps.config.wrap), fromJS(this.props.config.wrap)) } else { - return this.props.config.setting.show !== nextProps.config.setting.show + return !is(fromJS(nextProps.config.setting), fromJS(this.props.config.setting)) } } render() { const { config } = this.props - const { dict, searchlist, visible, sqlVerifing, card, showField } = this.state - - let show = config.setting.show - if (config.wrap) { - show = config.wrap.show - } + const { dict, searchlist, visible, sqlVerifing, card, showField, setVisible } = this.state return ( - <div className={'model-table-search-list length' + searchlist.length}> + <div className={'model-table-search-list length' + searchlist.length + (showField ? ' show-field' : '')}> <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> <QuestionCircleOutlined style={{color: '#c49f47', position: 'relative', left: '-15px', top: '5px'}} /> </Tooltip> <FieldsComponent config={{uuid: config.uuid, search: searchlist}} type="search" /> - <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} /> + <Switch className="switch-field-show" checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} /> <DragElement list={searchlist} - show={show} - showField={showField} + setting={config.wrap || config.setting} handleList={this.handleList} handleMenu={this.handleSearch} deleteMenu={this.deleteElement} + handleSetting={this.handleSetting} /> {/* 缂栬緫鎼滅储鏉′欢 */} <Modal @@ -381,6 +394,21 @@ wrappedComponentRef={(inst) => this.searchFormRef = inst} /> </Modal> + <Modal + title={'鎼滅储璁剧疆'} + visible={setVisible} + width={800} + maskClosable={false} + onOk={this.settingSubmit} + onCancel={() => this.setState({setVisible: false})} + destroyOnClose + > + <SettingForm + setting={config.wrap || config.setting} + inputSubmit={this.settingSubmit} + wrappedComponentRef={(inst) => this.settingFormRef = inst} + /> + </Modal> </div> ) } -- Gitblit v1.8.0