From 31871ca836e6fcbea9b1c54e2ec15f49667bf093 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 23 十二月 2022 14:14:04 +0800 Subject: [PATCH] 2022-12-23 --- src/menu/components/search/main-search/index.jsx | 63 +++++++++++-------------------- 1 files changed, 23 insertions(+), 40 deletions(-) diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index d6250e4..8407229 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' @@ -50,8 +51,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', width: 24, name: card.name, subtype: card.subtype, @@ -97,25 +96,27 @@ card: _card }) - this.props.updateConfig(_card) + this.updateComponent(_card) } changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) } /** * @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) } @@ -145,9 +146,7 @@ this.setState({card: _card}) this.handleSearch(newcell) } else { - this.setState({card: _card}, ()=> { - this.props.updateConfig(_card) - }) + this.updateComponent(_card) } } @@ -208,7 +207,6 @@ this.searchFormRef.handleConfirm().then(res => { let fieldrepet = false // 瀛楁閲嶅 - let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 card.search = card.search.map(item => { // 鏁版嵁鏇存柊鍙婇噸澶嶆娴� if (item.uuid !== res.uuid && res.field && item.field) { @@ -234,8 +232,6 @@ if (setFields.length < itemFields.length + resFields.length && (res.type !== 'date' || item.type !== 'date')) { fieldrepet = true - } else if (item.label === res.label) { - labelrepet = true } } @@ -250,13 +246,6 @@ notification.warning({ top: 92, message: '瀛楁宸插瓨鍦�!', - duration: 5 - }) - return - } else if (labelrepet) { - notification.warning({ - top: 92, - message: '鍚嶇О宸插瓨鍦�!', duration: 5 }) return @@ -275,6 +264,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) + param.LText = param.LText.replace(/\n/g, ' ') param.LText = Utils.formatOptions(param.LText) param.secretkey = Utils.encrypt('', param.timestamp) @@ -286,11 +276,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}) @@ -302,10 +291,9 @@ }) } else { this.setState({ - card: card, visible: false }, ()=> { - this.props.updateConfig(card) + this.updateComponent(card) }) } }) @@ -323,11 +311,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() {} }) @@ -369,18 +353,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) } } @@ -397,7 +375,12 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.updateComponent(_card) + }) } } -- Gitblit v1.8.0