From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/mob/components/search/single-search/index.jsx | 36 ++++++++++++------------------------ 1 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/mob/components/search/single-search/index.jsx b/src/mob/components/search/single-search/index.jsx index ec9400c..43debf2 100644 --- a/src/mob/components/search/single-search/index.jsx +++ b/src/mob/components/search/single-search/index.jsx @@ -4,8 +4,6 @@ import { Popover, Input, Button } from 'antd' import { ToolOutlined, ScanOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, SearchOutlined } from '@ant-design/icons' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import { resetStyle } from '@/utils/utils-custom.js' import asyncIconComponent from '@/utils/asyncIconComponent' import getWrapForm from './options' @@ -21,13 +19,7 @@ deletecomponent: PropTypes.func } - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - sqlVerifing: false, // sql楠岃瘉涓� - visible: false, // 妯℃�佹鎺у埗 - showField: false, - editcard: null // 缂栬緫涓厓绱� - } + state = {} /** * @description 鎼滅储鏉′欢鍒濆鍖� @@ -39,8 +31,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', width: 24, name: card.name, subtype: card.subtype, @@ -61,10 +51,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -72,19 +58,14 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.setState({ card: _card @@ -96,7 +77,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) } /** @@ -126,7 +107,13 @@ 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.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } @@ -152,6 +139,7 @@ } trigger="hover"> <ToolOutlined /> </Popover> + <div className="component-name"><div className="center">{card.name}</div></div> </div> ) } -- Gitblit v1.8.0