@@ -119,7 +119,7 @@ import DrillPath from '@/views/chart/view/DrillPath'
119
119
import { areaMapping } from ' @/api/map/map'
120
120
import ChartComponentG2 from ' @/views/chart/components/ChartComponentG2'
121
121
import EditBarView from ' @/components/canvas/components/Editor/EditBarView'
122
- import { customAttrTrans , customStyleTrans , recursionTransObj } from ' @/components/canvas/utils/style'
122
+ import { adaptCurTheme , customAttrTrans , customStyleTrans , recursionTransObj } from ' @/components/canvas/utils/style'
123
123
import ChartComponentS2 from ' @/views/chart/components/ChartComponentS2'
124
124
import PluginCom from ' @/views/system/plugin/PluginCom'
125
125
import LabelNormalText from ' @/views/chart/components/normal/LabelNormalText'
@@ -354,7 +354,7 @@ export default {
354
354
// deep监听panel 如果改变 提交到 store
355
355
canvasStyleData: {
356
356
handler (newVal , oldVla ) {
357
- this .mergeStyle ()
357
+ // this.mergeStyle()
358
358
// 如果视图结果模式模式 或者 视图结果获取数量改变 刷新视图
359
359
if (! this .preCanvasPanel || this .preCanvasPanel .resultCount !== newVal .panel .resultCount || this .preCanvasPanel .resultMode !== newVal .panel .resultMode ) {
360
360
this .getData (this .element .propValue .viewId , false )
@@ -421,30 +421,44 @@ export default {
421
421
},
422
422
batchOptChange (param ) {
423
423
if (this .curBatchOptComponents .includes (this .element .propValue .viewId )) {
424
- this .$store .state .styleChangeTimes ++
425
- // stylePriority change to 'view'
426
- const updateParams = { ' id' : this .chart .id , ' stylePriority' : ' view' }
427
- if (param .custom === ' customAttr' ) {
428
- const sourceCustomAttr = JSON .parse (this .sourceCustomAttrStr )
429
- sourceCustomAttr[param .property ][param .value .modifyName ] = param .value [param .value .modifyName ]
430
- this .sourceCustomAttrStr = JSON .stringify (sourceCustomAttr)
431
- this .chart .customAttr = this .sourceCustomAttrStr
432
- updateParams[' customAttr' ] = this .sourceCustomAttrStr
433
- } else if (param .custom === ' customStyle' ) {
434
- const sourceCustomStyle = JSON .parse (this .sourceCustomStyleStr )
435
- // view's title use history
436
- // if (param.property === 'text') {
437
- // param.value.title = sourceCustomStyle.text.title
438
- // }
439
- sourceCustomStyle[param .property ][param .value .modifyName ] = param .value [param .value .modifyName ]
440
- this .sourceCustomStyleStr = JSON .stringify (sourceCustomStyle)
441
- this .chart .customStyle = this .sourceCustomStyleStr
442
- updateParams[' customStyle' ] = this .sourceCustomStyleStr
443
- }
444
- viewPropsSave (this .panelInfo .id , updateParams)
445
- this .$store .commit (' recordViewEdit' , { viewId: this .chart .id , hasEdit: true })
446
- this .mergeScale ()
424
+ this .optFromBatchSingleProp (param)
425
+ }
426
+ },
427
+ optFromBatchSingleProp (param ) {
428
+ this .$store .state .styleChangeTimes ++
429
+ const updateParams = { }
430
+ if (param .custom === ' customAttr' ) {
431
+ const sourceCustomAttr = JSON .parse (this .sourceCustomAttrStr )
432
+ sourceCustomAttr[param .property ][param .value .modifyName ] = param .value [param .value .modifyName ]
433
+ this .sourceCustomAttrStr = JSON .stringify (sourceCustomAttr)
434
+ this .chart .customAttr = this .sourceCustomAttrStr
435
+ updateParams[' customAttr' ] = this .sourceCustomAttrStr
436
+ } else if (param .custom === ' customStyle' ) {
437
+ const sourceCustomStyle = JSON .parse (this .sourceCustomStyleStr )
438
+ sourceCustomStyle[param .property ][param .value .modifyName ] = param .value [param .value .modifyName ]
439
+ this .sourceCustomStyleStr = JSON .stringify (sourceCustomStyle)
440
+ this .chart .customStyle = this .sourceCustomStyleStr
441
+ updateParams[' customStyle' ] = this .sourceCustomStyleStr
447
442
}
443
+ viewPropsSave (this .panelInfo .id , updateParams)
444
+ this .$store .commit (' recordViewEdit' , { viewId: this .chart .id , hasEdit: true })
445
+ this .mergeScale ()
446
+ },
447
+ optFromBatchThemeChange () {
448
+ const updateParams = { }
449
+ const sourceCustomAttr = JSON .parse (this .sourceCustomAttrStr )
450
+ const sourceCustomStyle = JSON .parse (this .sourceCustomStyleStr )
451
+ adaptCurTheme (sourceCustomStyle, sourceCustomAttr)
452
+ this .sourceCustomAttrStr = JSON .stringify (sourceCustomAttr)
453
+ this .chart .customAttr = this .sourceCustomAttrStr
454
+ updateParams[' customAttr' ] = this .sourceCustomAttrStr
455
+
456
+ this .sourceCustomStyleStr = JSON .stringify (sourceCustomStyle)
457
+ this .chart .customStyle = this .sourceCustomStyleStr
458
+ updateParams[' customStyle' ] = this .sourceCustomStyleStr
459
+ viewPropsSave (this .panelInfo .id , updateParams)
460
+ this .$store .commit (' recordViewEdit' , { viewId: this .chart .id , hasEdit: true })
461
+ this .mergeScale ()
448
462
},
449
463
resizeChart () {
450
464
if (this .chart .type === ' map' ) {
@@ -473,6 +487,15 @@ export default {
473
487
bus .$on (' batch-opt-change' , param => {
474
488
this .batchOptChange (param)
475
489
})
490
+ bus .$on (' onSubjectChange' , () => {
491
+ this .optFromBatchThemeChange ()
492
+ })
493
+ bus .$on (' onThemeColorChange' , () => {
494
+ this .optFromBatchThemeChange ()
495
+ })
496
+ bus .$on (' onThemeAttrChange' , (param ) => {
497
+ this .optFromBatchSingleProp (param)
498
+ })
476
499
},
477
500
478
501
addViewTrackFilter (linkageParam ) {
@@ -485,7 +508,6 @@ export default {
485
508
const customStyleChart = JSON .parse (this .sourceCustomStyleStr )
486
509
recursionTransObj (customAttrTrans, customAttrChart, this .scale , this .scaleCoefficientType )
487
510
recursionTransObj (customStyleTrans, customStyleChart, this .scale , this .scaleCoefficientType )
488
-
489
511
// 移动端地图标签不显示
490
512
if (this .chart .type === ' map' && this .scaleCoefficientType === ' mobile' ) {
491
513
customAttrChart .label .show = false
@@ -495,32 +517,6 @@ export default {
495
517
customAttr: JSON .stringify (customAttrChart),
496
518
customStyle: JSON .stringify (customStyleChart)
497
519
}
498
- this .mergeStyle ()
499
- },
500
- mergeStyle () {
501
- if ((this .requestStatus === ' success' || this .requestStatus === ' merging' ) && this .chart .stylePriority === ' panel' && this .canvasStyleData .chart ) {
502
- const customAttrChart = JSON .parse (this .chart .customAttr )
503
- const customStyleChart = JSON .parse (this .chart .customStyle )
504
- const customAttrPanel = JSON .parse (this .canvasStyleData .chart .customAttr )
505
- const customStylePanel = JSON .parse (this .canvasStyleData .chart .customStyle )
506
- if (customStyleChart .background ) {
507
- // 组件样式-背景设置
508
- customStyleChart .background = customStylePanel .background
509
- }
510
- // 图形属性-颜色设置
511
- if (this .chart .type .includes (' table' )) {
512
- customAttrChart .color = customAttrPanel .tableColor
513
- } else {
514
- customAttrChart .color [' value' ] = customAttrPanel .color [' value' ]
515
- customAttrChart .color [' colors' ] = customAttrPanel .color [' colors' ]
516
- customAttrChart .color [' alpha' ] = customAttrPanel .color [' alpha' ]
517
- }
518
- this .chart = {
519
- ... this .chart ,
520
- customAttr: JSON .stringify (customAttrChart),
521
- customStyle: JSON .stringify (customStyleChart)
522
- }
523
- }
524
520
},
525
521
getData (id , cache = true , dataBroadcast = false ) {
526
522
if (id) {
0 commit comments