lambo-design-bi 0.0.184 → 0.0.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
1
  <template>
2
- <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1" :widget="widget"
3
- :is-drill="isDrill" @on-drill="onDrill" :sub-num2="subNum2" :trend2="trend2" :polar1="polar1" :polar2="polar2" :eva-level="evaLevel">
2
+ <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1"
3
+ :widget="widget" :is-drill="isDrill" @on-drill="onDrill" :sub-num2="subNum2" :trend2="trend2" :polar1="polar1"
4
+ :polar2="polar2" :eva-level="evaLevel" :tab-clickable="tabClickable" @on-tab-click="onTabClick">
4
5
  </LamboNumberInfoBi>
5
6
  </template>
6
7
  <script>
7
8
  import { getListMapData } from "../api/data"
8
9
  import LamboNumberInfoBi from "../../../pub/number-info/index"
9
- import { pageDrill } from '../util/router-util';
10
+ import { pageDrill } from '../util/router-util'
11
+ import { EVENT_TYPES, EventBus } from '../util/event-bus'
10
12
 
11
13
  export default {
12
14
  name: "BiNumIndex",
@@ -41,8 +43,10 @@ export default {
41
43
  drillK2: null,
42
44
  drillV2: null,
43
45
  drillK3: null,
44
- dirllV3: null,
45
- evaLevel: null
46
+ drillV3: null,
47
+ evaLevel: null,
48
+ tabClickable: false,
49
+ defaultTabActive: false
46
50
  }
47
51
  },
48
52
  methods: {
@@ -54,6 +58,12 @@ export default {
54
58
  if (this.toPageId && this.toRouteName) {
55
59
  this.isDrill = true
56
60
  }
61
+ if (this.widget.options["tabClickable"] === '1') {
62
+ this.tabClickable = true
63
+ }
64
+ if (this.widget.options["defaultTabActive"] === '1') {
65
+ this.defaultTabActive = true
66
+ }
57
67
  },
58
68
  doSearch() {
59
69
  if (!this.apiId) {
@@ -126,7 +136,25 @@ export default {
126
136
  console.error('num 跳转失败:', error.msg)
127
137
  this.$message.error(error.msg)
128
138
  }
129
- }
139
+ },
140
+ onTabClick() {
141
+ console.log("num onTabClick 卡片点击触发父组件事件,当前实例:", this.widget.id + "_" + this.widget.name)
142
+ this.emitNumIdxTabClicked()
143
+ },
144
+ emitNumIdxTabClicked() {
145
+ if (this.tabClickable) {
146
+ // 发布卡片激活事件
147
+ EventBus.$emit(EVENT_TYPES.NUM_IDX_ACTIVATED, {
148
+ rootId: this.widget.rootId,
149
+ widgetId: this.widget.id,
150
+ widgetName: this.widget.name,
151
+ options: this.widget.options,
152
+ idxBizCode: this.widget.options.idxBizCode || null,
153
+ instance: this
154
+ })
155
+ }
156
+ },
157
+
130
158
  },
131
159
  created() {
132
160
  console.log("num-idx widget:", this.widget)
@@ -143,7 +171,10 @@ export default {
143
171
  this.doSearch()
144
172
  },
145
173
  deep: true
146
- },
174
+ }
175
+ },
176
+ beforeDestroy() {
177
+
147
178
  }
148
179
  }
149
180
  </script>
@@ -106,7 +106,7 @@ export default {
106
106
  handleNumIdxActivated(eventData) {
107
107
  console.log('BiPage handleNumIdxActivated eventData:', eventData)
108
108
  // 处理数值指标激活事件的逻辑
109
-
109
+ this.$set(this.params, 'idxBizCode', eventData["idxBizCode"]);
110
110
  }
111
111
  },
112
112
  created() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.184",
3
+ "version": "0.0.185",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -94,7 +94,9 @@ function getLevelOption() {
94
94
  * 40 金字塔图
95
95
  * 41 矩形树图
96
96
  * 42 桑基图
97
- * 43 仪表盘进度条) <br/>
97
+ * 43 仪表盘进度条)
98
+ * 2A:单个柱状图以及多条折线,
99
+ * 2B:单个柱状图以及左右 <br/>
98
100
  * dataX:x轴数据 <br/>
99
101
  * dataY:y轴数据 <br/>
100
102
  * dataDim:组数据 (例如柱状图、折线图多组数据) <br/>
@@ -350,6 +352,7 @@ export function getECharts(type, dataX, dataY, dataDim) {
350
352
  }
351
353
  else if (type === '20' || type === '21' || type === '22' || type === '23' || type === '24' || type === '25' || type === '26') {
352
354
  if (type === '20') {
355
+ const dynamicColors = dataDim.map((_, index) => colors[index % colors.length]);
353
356
  opt = {
354
357
  backgroundColor: '#fff',
355
358
  tooltip: {
@@ -358,6 +361,7 @@ export function getECharts(type, dataX, dataY, dataDim) {
358
361
  type: 'shadow'
359
362
  }
360
363
  },
364
+ color: dynamicColors,
361
365
  grid: {
362
366
  top: '5px', left: '0px', right: '10px', bottom: '0px', containLabel: true
363
367
  },
@@ -429,22 +433,22 @@ export function getECharts(type, dataX, dataY, dataDim) {
429
433
  normal: {
430
434
  color: function (params) {
431
435
  let colorArr =
432
- params.value > 0 ? ['#2d8cf0', 'rgb(150,204,251)'] : ['rgb(150,204,251)', '#2d8cf0'];
436
+ params.value > 0 ? ['#2d8cf0', 'rgb(150,204,251)'] : ['rgb(150,204,251)', '#2d8cf0'];
433
437
  return new echarts.graphic.LinearGradient(
434
- 0,
435
- 0,
436
- 0,
437
- 1,
438
- [{
439
- offset: 0,
440
- color: colorArr[0],
441
- },
442
- {
443
- offset: 1,
444
- color: colorArr[1],
445
- },
446
- ],
447
- false
438
+ 0,
439
+ 0,
440
+ 0,
441
+ 1,
442
+ [{
443
+ offset: 0,
444
+ color: colorArr[0],
445
+ },
446
+ {
447
+ offset: 1,
448
+ color: colorArr[1],
449
+ },
450
+ ],
451
+ false
448
452
  );
449
453
  },
450
454
  barBorderRadius: [1],
@@ -457,6 +461,15 @@ export function getECharts(type, dataX, dataY, dataDim) {
457
461
  fontSize: 10,
458
462
  },
459
463
  data: dataY[0],
464
+ markPoint: {
465
+ data: [
466
+ { type: 'max', name: 'Max' },
467
+ { type: 'min', name: 'Min' }
468
+ ]
469
+ },
470
+ markLine: {
471
+ data: [{ type: 'average', name: 'Avg' }]
472
+ }
460
473
  },
461
474
  ]
462
475
  }
@@ -1179,7 +1192,7 @@ export function getECharts(type, dataX, dataY, dataDim) {
1179
1192
 
1180
1193
  // 将 dataY 转换为带索引的排序数组
1181
1194
  let sortedIndices = dataY[0].map((_, index) => index)
1182
- .sort((a, b) => dataY[0][b] - dataY[0][a]); // 根据 dataX 的值降序排列
1195
+ .sort((a, b) => dataY[0][b] - dataY[0][a]); // 根据 dataX 的值降序排列
1183
1196
 
1184
1197
  for (let i = 0; i < sortedIndices.length; i++) {
1185
1198
  const index = sortedIndices[i];
@@ -1263,7 +1276,7 @@ export function getECharts(type, dataX, dataY, dataDim) {
1263
1276
  let radius = ['40%', '60%']; // 控制饼块粗细的半径范围
1264
1277
  let prevAngle = 0; // 初始角度
1265
1278
  let sortedIndices = dataY[0].map((_, index) => index)
1266
- .sort((a, b) => dataY[0][b] - dataY[0][a]); // 根据dataY的值进行降序排序并获取索引
1279
+ .sort((a, b) => dataY[0][b] - dataY[0][a]); // 根据dataY的值进行降序排序并获取索引
1267
1280
 
1268
1281
  for (let i = 0; i < sortedIndices.length; i++) {
1269
1282
  const index = sortedIndices[i];
@@ -1749,37 +1762,37 @@ export function getECharts(type, dataX, dataY, dataDim) {
1749
1762
  value: dataY[0][index] * dataX.length,
1750
1763
  name: name
1751
1764
  },
1752
- {
1753
- value: sum - dataY[0][index],
1754
- name: name,
1755
- itemStyle: {
1756
- normal: {
1757
- color: "rgba(0,0,0,0)"
1758
- }
1759
- },
1760
- label: {
1761
- normal: {
1762
- show: false,
1765
+ {
1766
+ value: sum - dataY[0][index],
1767
+ name: name,
1768
+ itemStyle: {
1769
+ normal: {
1770
+ color: "rgba(0,0,0,0)"
1771
+ }
1763
1772
  },
1764
- emphasis: {
1765
- show: false
1766
- }
1767
- },
1768
- labelLine: {
1769
- normal: {
1770
- show: false
1773
+ label: {
1774
+ normal: {
1775
+ show: false,
1776
+ },
1777
+ emphasis: {
1778
+ show: false
1779
+ }
1771
1780
  },
1772
- emphasis: {
1773
- show: false
1774
- }
1775
- },
1776
- tooltip: {
1777
- show: false,
1778
- formatter: function () {
1779
- return '';
1781
+ labelLine: {
1782
+ normal: {
1783
+ show: false
1784
+ },
1785
+ emphasis: {
1786
+ show: false
1787
+ }
1788
+ },
1789
+ tooltip: {
1790
+ show: false,
1791
+ formatter: function () {
1792
+ return '';
1793
+ }
1780
1794
  }
1781
1795
  }
1782
- }
1783
1796
  ]
1784
1797
  });
1785
1798
  if (showBackground === true) {
@@ -1894,37 +1907,37 @@ export function getECharts(type, dataX, dataY, dataDim) {
1894
1907
  value: dataY[0][index],
1895
1908
  name: name
1896
1909
  },
1897
- {
1898
- value: sum,
1899
- name: name,
1900
- itemStyle: {
1901
- normal: {
1902
- color: "rgba(0,0,0,0)"
1903
- }
1904
- },
1905
- label: {
1906
- normal: {
1907
- show: false,
1910
+ {
1911
+ value: sum,
1912
+ name: name,
1913
+ itemStyle: {
1914
+ normal: {
1915
+ color: "rgba(0,0,0,0)"
1916
+ }
1908
1917
  },
1909
- emphasis: {
1910
- show: false
1911
- }
1912
- },
1913
- labelLine: {
1914
- normal: {
1915
- show: false
1918
+ label: {
1919
+ normal: {
1920
+ show: false,
1921
+ },
1922
+ emphasis: {
1923
+ show: false
1924
+ }
1916
1925
  },
1917
- emphasis: {
1918
- show: false
1919
- }
1920
- },
1921
- tooltip: {
1922
- show: false,
1923
- formatter: function () {
1924
- return '';
1926
+ labelLine: {
1927
+ normal: {
1928
+ show: false
1929
+ },
1930
+ emphasis: {
1931
+ show: false
1932
+ }
1933
+ },
1934
+ tooltip: {
1935
+ show: false,
1936
+ formatter: function () {
1937
+ return '';
1938
+ }
1925
1939
  }
1926
1940
  }
1927
- }
1928
1941
  ]
1929
1942
  });
1930
1943
  if (showBackground == true) {
@@ -1949,37 +1962,37 @@ export function getECharts(type, dataX, dataY, dataDim) {
1949
1962
  color: "#E3F0FF"
1950
1963
  },
1951
1964
  },
1952
- {
1953
- value: 5,
1954
- name: name,
1955
- itemStyle: {
1956
- normal: {
1957
- color: "rgba(0,0,0,0)"
1958
- }
1959
- },
1960
- label: {
1961
- normal: {
1962
- show: false,
1965
+ {
1966
+ value: 5,
1967
+ name: name,
1968
+ itemStyle: {
1969
+ normal: {
1970
+ color: "rgba(0,0,0,0)"
1971
+ }
1963
1972
  },
1964
- emphasis: {
1965
- show: false
1966
- }
1967
- },
1968
- labelLine: {
1969
- normal: {
1970
- show: false
1973
+ label: {
1974
+ normal: {
1975
+ show: false,
1976
+ },
1977
+ emphasis: {
1978
+ show: false
1979
+ }
1971
1980
  },
1972
- emphasis: {
1973
- show: false
1974
- }
1975
- },
1976
- tooltip: {
1977
- show: false,
1978
- formatter: function () {
1979
- return '';
1981
+ labelLine: {
1982
+ normal: {
1983
+ show: false
1984
+ },
1985
+ emphasis: {
1986
+ show: false
1987
+ }
1988
+ },
1989
+ tooltip: {
1990
+ show: false,
1991
+ formatter: function () {
1992
+ return '';
1993
+ }
1980
1994
  }
1981
1995
  }
1982
- }
1983
1996
  ]
1984
1997
  });
1985
1998
  }
@@ -2310,6 +2323,262 @@ export function getECharts(type, dataX, dataY, dataDim) {
2310
2323
  };
2311
2324
  }
2312
2325
  }
2326
+ else if (type ==='2A'){
2327
+ let series = [];
2328
+ if (dataY.length > 0) {
2329
+ series.push({
2330
+ name: dataDim[0],
2331
+ type: 'bar',
2332
+ barWidth: '30px',
2333
+ itemStyle: {
2334
+ normal: {
2335
+ color: function (params) {
2336
+ const baseColor = colors[0];
2337
+ const lightColor = hexToRgba(baseColor, 0.6);
2338
+ const colorArr = params.value > 0 ? [baseColor, lightColor] : [lightColor, baseColor];
2339
+ return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
2340
+ { offset: 0, color: colorArr[0] },
2341
+ { offset: 1, color: colorArr[1] }
2342
+ ]);
2343
+ },
2344
+ barBorderRadius: [1]
2345
+ }
2346
+ },
2347
+ tooltip: { valueFormatter: value => value },
2348
+ data: dataY.map(item => item[0])
2349
+ });
2350
+ }
2351
+ for (let i = 1; i < 2; i++) {
2352
+ series.push({
2353
+ name: dataDim[i],
2354
+ type: 'line',
2355
+ smooth: true,
2356
+ showAllSymbol: true,
2357
+ symbol: 'circle',
2358
+ showSymbol: true,
2359
+ symbolSize: 5,
2360
+ lineStyle: {
2361
+ color: colors[i % colors.length],
2362
+ width: 3
2363
+ },
2364
+ label: { show: false },
2365
+ itemStyle: {
2366
+ color: colors[i % colors.length],
2367
+ borderColor: hexToRgba(colors[i % colors.length], 0.6),
2368
+ borderWidth: 3
2369
+ },
2370
+ tooltip: { valueFormatter: value => value },
2371
+ data: dataY.map(item => item[1])
2372
+ });
2373
+ }
2374
+ const dynamicColors = dataDim.map((_, index) => colors[index % colors.length]);
2375
+ opt = {
2376
+ tooltip: {
2377
+ trigger: 'axis',
2378
+ axisPointer: {
2379
+ type: 'shadow',
2380
+ lineStyle: { color: '#57617B' }
2381
+ }
2382
+ },
2383
+ legend: {
2384
+ data: dataDim,
2385
+ top: 0,
2386
+ itemWidth: 10,
2387
+ itemHeight: 6,
2388
+ selectedMode: true,
2389
+ textStyle: {
2390
+ fontSize: '10px',
2391
+ fontFamily: 'Microsoft YaHei',
2392
+ fontWeight: '400',
2393
+ color: '#666'
2394
+ },
2395
+ },
2396
+ color: dynamicColors,
2397
+ grid: {
2398
+ top: '5px', left: '0px', right: '10px', bottom: '0px', containLabel: true
2399
+ },
2400
+ xAxis: [
2401
+ {
2402
+ type: 'category',
2403
+ data: dataX,
2404
+ axisLine: {
2405
+ show: true,
2406
+ lineStyle: {
2407
+ color: '#333333'
2408
+ }
2409
+ },
2410
+ axisTick: {
2411
+ show: false
2412
+ }
2413
+ }
2414
+ ],
2415
+ yAxis: [
2416
+ {
2417
+ type: 'value',
2418
+ axisLabel: { formatter: '{value}' },
2419
+ axisLine: {
2420
+ show: false
2421
+ },
2422
+ axisTick: {
2423
+ show: false
2424
+ },
2425
+ splitLine: {
2426
+ show: true,
2427
+ lineStyle: {
2428
+ color: '#f0f0f0'
2429
+ }
2430
+ }
2431
+ }
2432
+ ],
2433
+ series: series
2434
+ };
2435
+ }
2436
+ else if (type ==='2B'){
2437
+ let series = [];
2438
+ if (dataY.length > 0) {
2439
+ series.push({
2440
+ name: dataDim[0],
2441
+ type: 'pictorialBar',
2442
+ barWidth: '30px',
2443
+ symbol: 'rect',
2444
+ symbolSize: ['100%', 4],
2445
+ symbolRepeat: true,
2446
+ symbolMargin: 0.3,
2447
+ symbolBoundingData: Math.max(...dataY.map(item => item[0])),
2448
+ itemStyle: {
2449
+ color: colors[0]
2450
+ },
2451
+ tooltip: { valueFormatter: value => value },
2452
+ data: dataY.map(item => item[0])
2453
+ });
2454
+ }
2455
+ if (dataY.length > 1) {
2456
+ series.push({
2457
+ name: dataDim[1],
2458
+ type: 'line',
2459
+ yAxisIndex: 1,
2460
+ smooth: true,
2461
+ showAllSymbol: true,
2462
+ symbol: 'circle',
2463
+ showSymbol: true,
2464
+ symbolSize: 5,
2465
+ lineStyle: {
2466
+ color: colors[1],
2467
+ width: 3
2468
+ },
2469
+ label: { show: false },
2470
+ itemStyle: {
2471
+ color: colors[1],
2472
+ borderColor: hexToRgba(colors[1], 0.6),
2473
+ borderWidth: 3
2474
+ },
2475
+ tooltip: { valueFormatter: value => value },
2476
+ data: dataY.map(item => item[1])
2477
+ });
2478
+ }
2479
+
2480
+ for (let i = 2; i < 3; i++) {
2481
+ series.push({
2482
+ name: dataDim[i],
2483
+ type: 'line',
2484
+ yAxisIndex: 0,
2485
+ smooth: true,
2486
+ showAllSymbol: true,
2487
+ symbol: 'circle',
2488
+ showSymbol: true,
2489
+ symbolSize: 5,
2490
+ lineStyle: {
2491
+ color: colors[i % colors.length],
2492
+ width: 3
2493
+ },
2494
+ label: { show: false },
2495
+ itemStyle: {
2496
+ color: colors[i % colors.length],
2497
+ borderColor: hexToRgba(colors[i % colors.length], 0.6),
2498
+ borderWidth: 3
2499
+ },
2500
+ tooltip: { valueFormatter: value => value },
2501
+ data: dataY.map(item => item[2])
2502
+ });
2503
+ }
2504
+ const dynamicColors = dataDim.map((_, index) => colors[index % colors.length]);
2505
+
2506
+ opt = {
2507
+ tooltip: {
2508
+ trigger: 'axis',
2509
+ axisPointer: {
2510
+ type: 'shadow',
2511
+ lineStyle: { color: '#57617B' }
2512
+ }
2513
+ },
2514
+ legend: {
2515
+ data: dataDim,
2516
+ top: 0,
2517
+ itemWidth: 10,
2518
+ itemHeight: 6,
2519
+ selectedMode: true,
2520
+ textStyle: {
2521
+ fontSize: '10px',
2522
+ fontFamily: 'Microsoft YaHei',
2523
+ fontWeight: '400',
2524
+ color: '#666'
2525
+ },
2526
+ },
2527
+ color: dynamicColors,
2528
+ grid: {
2529
+ top: '5px', left: '0px', right: '10px', bottom: '0px', containLabel: true
2530
+ },
2531
+ xAxis: [
2532
+ {
2533
+ type: 'category',
2534
+ data: dataX,
2535
+ axisLine: {
2536
+ show: true,
2537
+ lineStyle: {
2538
+ color: '#333333'
2539
+ }
2540
+ },
2541
+ axisTick: {
2542
+ show: false
2543
+ }
2544
+ }
2545
+ ],
2546
+ yAxis: [
2547
+ {
2548
+ type: 'value',
2549
+ name: '',
2550
+ axisLabel: { formatter: '{value}' },
2551
+ axisLine: {
2552
+ show: false
2553
+ },
2554
+ axisTick: {
2555
+ show: false
2556
+ },
2557
+ splitLine: {
2558
+ show: true,
2559
+ lineStyle: {
2560
+ color: '#f0f0f0'
2561
+ }
2562
+ }
2563
+ },
2564
+ {
2565
+ type: 'value',
2566
+ name: '',
2567
+ axisLabel: { formatter: '{value}' },
2568
+ axisLine: {
2569
+ show: false
2570
+ },
2571
+ axisTick: {
2572
+ show: false
2573
+ },
2574
+ splitLine: {
2575
+ show: false
2576
+ }
2577
+ }
2578
+ ],
2579
+ series: series
2580
+ };
2581
+ }
2313
2582
  return opt
2314
2583
  }
2315
2584
 
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="ivu-number-info" :class="{ 'card-active': isActive, 'card-clickable': clickable }"
3
- @click="handleCardClick">
2
+ <div class="ivu-number-info" :class="{ 'card-active': isActive, 'card-tabClickable': tabClickable }"
3
+ @click="handleTabClick">
4
4
  <div class="ivu-number-info-title-lambo title-div" :class="{ 'isDrill': isDrill }" v-if="title" @click="drill">
5
5
  <slot name="title">{{ title }}</slot>
6
6
  <div class="cd-right-top">
@@ -56,16 +56,14 @@
56
56
  </slot>
57
57
  </span>
58
58
  </div>
59
-
60
59
  <div class="card-bottom-line" :class="{ 'active': isActive }"></div>
61
60
  </div>
62
61
  </template>
63
62
  <script>
64
63
  import { oneOf } from 'view-ui-plus/src/utils/assist'
65
64
  import Trend from 'view-ui-plus/src/components/trend'
66
- import { EVENT_TYPES, EventBus } from '../../bi/widget/util/event-bus';
67
65
  import 'view-ui-plus/dist/styles/viewuiplus.css'
68
-
66
+ import { EVENT_TYPES, EventBus } from '../../bi/widget/util/event-bus'
69
67
 
70
68
  export default {
71
69
  name: 'LamboNumberInfoBi',
@@ -123,11 +121,11 @@ export default {
123
121
  type: String,
124
122
  default: ''
125
123
  },
126
- clickable: {
124
+ tabClickable: {
127
125
  type: Boolean,
128
126
  default: true
129
127
  },
130
- active: {
128
+ defaultTabActive: {
131
129
  type: Boolean,
132
130
  default: false
133
131
  },
@@ -145,12 +143,7 @@ export default {
145
143
  },
146
144
  data() {
147
145
  return {
148
- isActive: this.active
149
- }
150
- },
151
- watch: {
152
- active(newVal) {
153
- this.isActive = newVal
146
+ isActive: false
154
147
  }
155
148
  },
156
149
  methods: {
@@ -160,43 +153,49 @@ export default {
160
153
  this.$emit('on-drill', {})
161
154
  }
162
155
  },
163
- handleCardClick() {
164
- if (this.clickable) {
156
+ handleTabClick() {
157
+ if (this.tabClickable) {
165
158
  if (!this.isActive) {
166
- this.activateCard()
159
+ this.isActive = true
160
+ this.$emit('on-tab-click', {})
167
161
  }
168
- console.log("num-info handleCardClick 卡片被点击,当前实例:", this.widget.id + "_" + this.widget.name)
162
+ console.log("num-info handleTabClick 卡片被点击,当前实例:", this.widget.id + "_" + this.widget.name)
169
163
  }
170
164
  },
171
- // 激活卡片
172
- activateCard() {
173
- this.isActive = true
174
-
175
- // 发布卡片激活事件
176
- EventBus.$emit(EVENT_TYPES.NUM_IDX_ACTIVATED, {
177
- widgetId: this.widget.id,
178
- widgetName: this.widget.name,
179
- options: this.widget.options,
180
- instance: this
181
- })
182
- },
183
- // 处理其他卡片激活事件
184
- handleOtherCardActivated(eventData) {
185
- // 如果是同一组且不是当前卡片,则取消激活
186
- if (this.isActive === true && eventData.widgetId !== this.widget.id) {
165
+ handleOtherNumIdxTabClicked(eventData) {
166
+ // 处理其他卡片激活事件:如果是同一个页面,且不是当前卡片,则取消激活
167
+ if (eventData && this.widget && this.tabClickable === true && this.isActive === true
168
+ && eventData.rootId === this.widget.rootId && eventData.widgetId !== this.widget.id) {
187
169
  this.isActive = false
188
170
  console.log(`num-info handleOtherCardActivated 卡片 ${this.widget.id}_${this.widget.name} 因 ${eventData.widgetId}_${eventData.widgetName} 激活而取消激活`)
189
171
  }
172
+ },
173
+ eventBusOn() {
174
+ if (this.tabClickable) {
175
+ EventBus.$on(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherNumIdxTabClicked)
176
+ }
177
+ },
178
+ eventBusOff() {
179
+ if (this.tabClickable) {
180
+ EventBus.$off(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherNumIdxTabClicked)
181
+ }
182
+ },
183
+ initDefTabClickActiveStatus() {
184
+ if(this.tabClickable === true && this.defaultTabActive === true ){
185
+ if (!this.isActive) {
186
+ this.isActive = true
187
+ this.$emit('on-tab-click', {})
188
+ }
189
+ console.log("num-info handleCardClick 卡片初始设置为激活状态触发点击,当前实例:", this.widget.id + "_" + this.widget.name)
190
+ }
190
191
  }
191
192
  },
192
- mounted() {
193
- // 监听卡片激活事件
194
- EventBus.$on(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherCardActivated)
193
+ created() {
194
+ this.eventBusOn()
195
+ this.initDefTabClickActiveStatus()
195
196
  },
196
-
197
197
  beforeDestroy() {
198
- // 组件销毁前移除事件监听
199
- EventBus.$off(EVENT_TYPES.NUM_IDX_ACTIVATED, this.handleOtherCardActivated)
198
+ this.eventBusOff()
200
199
  }
201
200
  };
202
201
  </script>
@@ -254,7 +253,7 @@ export default {
254
253
  cursor: default;
255
254
 
256
255
  // 新增:可点击状态
257
- &.card-clickable {
256
+ &.card-tabClickable {
258
257
  cursor: pointer;
259
258
 
260
259
  &:hover {