From 7a5502884c004b829bf881dc304215a16755de6c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 01 十一月 2022 14:21:04 +0800 Subject: [PATCH] 2022-11-01 --- src/menu/components/search/main-search/index.jsx | 44 ++++++++++++++++---------------------------- 1 files changed, 16 insertions(+), 28 deletions(-) diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 3595d12..6a98307 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -9,6 +9,7 @@ import Utils from '@/utils/utils.js' import { getSearchForm } from '@/templates/zshare/formconfig' import { resetStyle } from '@/utils/utils-custom.js' +import { getTables } from '@/utils/utils-custom.js' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' import DragElement from './dragsearch' @@ -95,7 +96,7 @@ card: _card }) - this.props.updateConfig(_card) + this.updateComponent(_card) } changeStyle = () => { @@ -108,12 +109,14 @@ * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 */ updateComponent = (component) => { - this.setState({ - card: component - }) + component.$tables = getTables(component) component.width = component.wrap.width component.name = component.wrap.name + + this.setState({ + card: component + }) this.props.updateConfig(component) } @@ -143,9 +146,7 @@ this.setState({card: _card}) this.handleSearch(newcell) } else { - this.setState({card: _card}, ()=> { - this.props.updateConfig(_card) - }) + this.updateComponent(_card) } } @@ -284,11 +285,10 @@ Api.genericInterface(param).then(result => { if (result.status) { this.setState({ - card: card, sqlVerifing: false, visible: false }, ()=> { - this.props.updateConfig(card) + this.updateComponent(card) }) } else { this.setState({sqlVerifing: false}) @@ -300,10 +300,9 @@ }) } else { this.setState({ - card: card, visible: false }, ()=> { - this.props.updateConfig(card) + this.updateComponent(card) }) } }) @@ -321,11 +320,7 @@ let _card = fromJS(_this.state.card).toJS() _card.search = _card.search.filter(item => item.uuid !== cell.uuid) - _this.setState({ - card: _card - }, () => { - _this.props.updateConfig(_card) - }) + _this.updateComponent(_card) }, onCancel() {} }) @@ -367,18 +362,12 @@ if (type === 'simple') { _card.search.push(item) - this.setState({ - card: _card, - }, () => { - this.props.updateConfig(_card) - }) + + this.updateComponent(_card) } else if (type === 'multil') { _card.search.push(...item) - this.setState({ - card: _card, - }, () => { - this.props.updateConfig(_card) - }) + + this.updateComponent(_card) } } @@ -399,8 +388,7 @@ let _card = {...this.state.card} _card.style = {..._card.style, ...style} - this.setState({ card: _card }) - this.props.updateConfig(_card) + this.updateComponent(_card) }) } } -- Gitblit v1.8.0