From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 17 十月 2022 17:57:34 +0800
Subject: [PATCH] 2022-10-17

---
 src/menu/components/chart/chart-custom/index.jsx |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/menu/components/chart/chart-custom/index.jsx b/src/menu/components/chart/chart-custom/index.jsx
index d82d9bf..4a1590c 100644
--- a/src/menu/components/chart/chart-custom/index.jsx
+++ b/src/menu/components/chart/chart-custom/index.jsx
@@ -10,10 +10,8 @@
 import MKEmitter from '@/utils/events.js'
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
-import { resetStyle } from '@/utils/utils-custom.js'
+import { resetStyle, getTables } from '@/utils/utils-custom.js'
 import Utils from '@/utils/utils.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 import './index.scss'
 
 const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
@@ -30,7 +28,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,
     appType: sessionStorage.getItem('appType'),
   }
@@ -55,7 +52,6 @@
         format: 'array',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,   // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
-        dataName: card.dataName || '',
         width: _plot.width,
         name: _plot.name,
         subtype: card.subtype,
@@ -70,7 +66,6 @@
         search: [],
         action: [],
         plot: _plot,
-        btnlog: [],
       }
 
       if (card.config) {
@@ -100,7 +95,6 @@
   }
 
   componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('tabsChange', this.handleTabsChange)
     setTimeout(() => {
       this.viewrender()
@@ -118,7 +112,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('tabsChange', this.handleTabsChange)
   }
 
@@ -207,6 +200,10 @@
     } else if (!card.setting.supModule) {
       card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'})
     }
+
+    if (card.errors.length === 0) {
+      card.$tables = getTables(card)
+    }
     
     this.setState({
       card: card
@@ -236,15 +233,11 @@
   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'], card.style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { card } = this.state
-
-    if (comIds[0] !== card.uuid || comIds.length > 1) return
-
-    let _card = {...card, style}
+  getStyle = (style) => {
+    let _card = {...this.state.card, style}
 
     this.updateComponent(_card)
   }
@@ -265,7 +258,7 @@
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
             {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/> : null}
-            <ChartCompileForm config={card} dict={this.state.dict} plotchange={this.updateComponent}/>
+            <ChartCompileForm config={card} plotchange={this.updateComponent}/>
             <CopyComponent type="line" card={card}/>
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
             <ClockComponent config={card} updateConfig={this.updateComponent}/>

--
Gitblit v1.8.0