npmapps 1.1.3 → 1.1.5

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.
Files changed (114) hide show
  1. package/app/wujie-vue2-child/.eslintrc.js +19 -0
  2. package/app/wujie-vue2-child/README.md +24 -0
  3. package/app/wujie-vue2-child/babel.config.js +5 -0
  4. package/app/wujie-vue2-child/docs/superpowers/plans/2026-05-29-quill-editor.md +836 -0
  5. package/app/wujie-vue2-child/docs/superpowers/specs/2026-05-29-quill-editor-design.md +210 -0
  6. package/app/wujie-vue2-child/jsconfig.json +19 -0
  7. package/app/wujie-vue2-child/package-lock.json +21333 -0
  8. package/app/wujie-vue2-child/package.json +63 -0
  9. package/app/wujie-vue2-child/postcss.config.js +10 -0
  10. package/app/wujie-vue2-child/public/favicon.ico +0 -0
  11. package/app/wujie-vue2-child/public/index.html +17 -0
  12. package/app/wujie-vue2-child/public/rili.jpg +0 -0
  13. package/app/wujie-vue2-child/public//344/270/200/351/224/256/351/273/221/346/232/227.html +136 -0
  14. package/app/wujie-vue2-child/src/App.vue +110 -0
  15. package/app/wujie-vue2-child/src/assets/bpmn-camunda.jpg +0 -0
  16. package/app/wujie-vue2-child/src/assets/css/diagram.less +17 -0
  17. package/app/wujie-vue2-child/src/assets/icon/Icon.less +31 -0
  18. package/app/wujie-vue2-child/src/assets/icon/font/app-codes.css +26 -0
  19. package/app/wujie-vue2-child/src/assets/icon/font/app.eot +0 -0
  20. package/app/wujie-vue2-child/src/assets/icon/font/app.svg +60 -0
  21. package/app/wujie-vue2-child/src/assets/icon/font/app.ttf +0 -0
  22. package/app/wujie-vue2-child/src/assets/icon/font/app.woff +0 -0
  23. package/app/wujie-vue2-child/src/assets/icon/font/app.woff2 +0 -0
  24. package/app/wujie-vue2-child/src/assets/icon/font/config.json +248 -0
  25. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-bottom-tool.svg +30 -0
  26. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-horizontal-center-tool.svg +85 -0
  27. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-left-tool.svg +84 -0
  28. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-right-tool.svg +80 -0
  29. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-top-tool.svg +84 -0
  30. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-vertical-center-tool.svg +89 -0
  31. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/distribute-horizontally-tool.svg +95 -0
  32. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/distribute-vertically-tool.svg +99 -0
  33. package/app/wujie-vue2-child/src/assets/icon/font/source/raw/set-color-tool.svg +111 -0
  34. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-bottom-tool.svg +30 -0
  35. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-horizontal-center-tool.svg +30 -0
  36. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-left-tool.svg +30 -0
  37. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-right-tool.svg +30 -0
  38. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-top-tool.svg +30 -0
  39. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-vertical-center-tool.svg +30 -0
  40. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/distribute-horizontally-tool.svg +30 -0
  41. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/distribute-vertically-tool.svg +30 -0
  42. package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/set-color-tool.svg +63 -0
  43. package/app/wujie-vue2-child/src/assets/logo.png +0 -0
  44. package/app/wujie-vue2-child/src/components/EllTable/README.md +70 -0
  45. package/app/wujie-vue2-child/src/components/EllTable/article.md +184 -0
  46. package/app/wujie-vue2-child/src/components/EllTable/index.js +213 -0
  47. package/app/wujie-vue2-child/src/components/EventCalendar/CalendarSkeleton.vue +147 -0
  48. package/app/wujie-vue2-child/src/components/EventCalendar/CodeBlock.vue +199 -0
  49. package/app/wujie-vue2-child/src/components/EventCalendar/MonthSelect.vue +376 -0
  50. package/app/wujie-vue2-child/src/components/EventCalendar/README.md +368 -0
  51. package/app/wujie-vue2-child/src/components/EventCalendar/example.vue +1551 -0
  52. package/app/wujie-vue2-child/src/components/EventCalendar/index.vue +1646 -0
  53. package/app/wujie-vue2-child/src/components/EventCalendar/mockData.js +349 -0
  54. package/app/wujie-vue2-child/src/components/EventCalendar/utils.js +201 -0
  55. package/app/wujie-vue2-child/src/components/FormulaEditor/FunctionSelector.vue +123 -0
  56. package/app/wujie-vue2-child/src/components/FormulaEditor/OperatorSelector.vue +184 -0
  57. package/app/wujie-vue2-child/src/components/FormulaEditor/ParameterSelector.vue +123 -0
  58. package/app/wujie-vue2-child/src/components/FormulaEditor/api.js +69 -0
  59. package/app/wujie-vue2-child/src/components/FormulaEditor/index.vue +435 -0
  60. package/app/wujie-vue2-child/src/components/HelloWorld.vue +58 -0
  61. package/app/wujie-vue2-child/src/components/PageHeader/index.vue +158 -0
  62. package/app/wujie-vue2-child/src/components/Splitter/README.md +144 -0
  63. package/app/wujie-vue2-child/src/components/Splitter/example.vue +84 -0
  64. package/app/wujie-vue2-child/src/components/Splitter/index.vue +203 -0
  65. package/app/wujie-vue2-child/src/components/diagram/ToolBar.vue +357 -0
  66. package/app/wujie-vue2-child/src/components/diagram/customTranslate/customTranslate.js +12 -0
  67. package/app/wujie-vue2-child/src/components/diagram/customTranslate/translationsGerman.js +241 -0
  68. package/app/wujie-vue2-child/src/components/diagram/index.vue +261 -0
  69. package/app/wujie-vue2-child/src/components/diagram/xmlData.js +29 -0
  70. package/app/wujie-vue2-child/src/directives/filldown.js +155 -0
  71. package/app/wujie-vue2-child/src/directives/filldownTable.js +291 -0
  72. package/app/wujie-vue2-child/src/main.js +40 -0
  73. package/app/wujie-vue2-child/src/router/index.js +72 -0
  74. package/app/wujie-vue2-child/src/store/index.js +23 -0
  75. package/app/wujie-vue2-child/src/utils/winBox.js +23 -0
  76. package/app/wujie-vue2-child/src/views/Extend/A.vue +12 -0
  77. package/app/wujie-vue2-child/src/views/Extend/B.vue +10 -0
  78. package/app/wujie-vue2-child/src/views/Extend/MagicalComponentsForELFormItem.vue +78 -0
  79. package/app/wujie-vue2-child/src/views/Extend/index.vue +59 -0
  80. package/app/wujie-vue2-child/src/views/Extend/tableMouseHorizontalWheel.vue +184 -0
  81. package/app/wujie-vue2-child/src/views/Home.vue +27 -0
  82. package/app/wujie-vue2-child/src/views/RouterJump.vue +145 -0
  83. package/app/wujie-vue2-child/src/views/calendar/index.vue +19 -0
  84. package/app/wujie-vue2-child/src/views/css.vue +57 -0
  85. package/app/wujie-vue2-child/src/views/cssComponents/EllipsisText.vue +73 -0
  86. package/app/wujie-vue2-child/src/views/cssComponents/HoverCard.vue +69 -0
  87. package/app/wujie-vue2-child/src/views/cssComponents/TableHover.vue +130 -0
  88. package/app/wujie-vue2-child/src/views/cssComponents/inputSlo.vue +42 -0
  89. package/app/wujie-vue2-child/src/views/cssComponents/tableFixed.vue +148 -0
  90. package/app/wujie-vue2-child/src/views/echarts/echart-dome.vue +73 -0
  91. package/app/wujie-vue2-child/src/views/echarts/index.vue +118 -0
  92. package/app/wujie-vue2-child/src/views/echarts/pei3d.vue +658 -0
  93. package/app/wujie-vue2-child/src/views/element/bpmn/index.vue +15 -0
  94. package/app/wujie-vue2-child/src/views/element/components/attendanceCycle/index.vue +131 -0
  95. package/app/wujie-vue2-child/src/views/element/components/attendanceGroup/index.vue +147 -0
  96. package/app/wujie-vue2-child/src/views/element/components/attendancePersonnel/index.vue +158 -0
  97. package/app/wujie-vue2-child/src/views/element/components/companyCalendar/index.vue +147 -0
  98. package/app/wujie-vue2-child/src/views/element/components/shift/index.vue +147 -0
  99. package/app/wujie-vue2-child/src/views/element/components/shiftRotationSystem/index.vue +147 -0
  100. package/app/wujie-vue2-child/src/views/element/elTableJsx/columnManagement.vue +340 -0
  101. package/app/wujie-vue2-child/src/views/element/elTableJsx/dialogInput.vue +71 -0
  102. package/app/wujie-vue2-child/src/views/element/elTableJsx/elTableJsx.vue +1826 -0
  103. package/app/wujie-vue2-child/src/views/element/elTableJsx/formTable.vue +595 -0
  104. package/app/wujie-vue2-child/src/views/element/elTableJsx/index.vue +29 -0
  105. package/app/wujie-vue2-child/src/views/element/elTableJsx/simpleTable.vue +189 -0
  106. package/app/wujie-vue2-child/src/views/element/elTableJsx.zip +0 -0
  107. package/app/wujie-vue2-child/src/views/element/index.vue +39 -0
  108. package/app/wujie-vue2-child/src/views/element/quillEditor/README.md +163 -0
  109. package/app/wujie-vue2-child/src/views/element/quillEditor/example.vue +307 -0
  110. package/app/wujie-vue2-child/src/views/element/quillEditor/index.vue +409 -0
  111. package/app/wujie-vue2-child/src/views/element/quillEditor/toolbar.js +122 -0
  112. package/app/wujie-vue2-child/vue.config.js +15 -0
  113. package/package.json +1 -1
  114. package/app/html-note(1).zip +0 -0
@@ -0,0 +1,658 @@
1
+ <template>
2
+ <!-- 3D饼图容器组件 -->
3
+ <div class="pei3d-page">
4
+ <div class="mff-main" style="position: relative;">
5
+ <div style="display: flex;
6
+ justify-content: center;
7
+ position: absolute;
8
+ z-index: 1;
9
+ left: 50%;
10
+ transform: translateX(-50%);
11
+ " v-if="isShowBtn">
12
+ <el-button
13
+ type="text"
14
+ size="small"
15
+ @click="toggleEqualHeight">{{ isEqualHeight ? "不等高" : "等高" }}</el-button>
16
+ <el-button
17
+ type="text"
18
+ size="small"
19
+ @click="toggleRotate">{{ isRotate ? '停止旋转' : '开始旋转' }}</el-button>
20
+ </div>
21
+ <!-- echarts图表容器 -->
22
+ <div style=" height: 100%;position: relative;">
23
+ <div class="mff-charts" :id="`mff-charts-${id}`"></div>
24
+ <div class="mff-charts" :id="`mff-charts-copy-${id}`" style="position: absolute;top: 0;height: 100%; width: 100%;"></div>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </template>
29
+ <script>
30
+ // 引入echarts核心库
31
+ import * as echarts from "echarts";
32
+ // 引入echarts-gl插件以支持3D图表
33
+ import "echarts-gl";
34
+ import _ from "lodash";
35
+ /**
36
+ * @description 3D饼图组件
37
+ * 该组件基于echarts-gl实现了一个可交互的3D饼图
38
+ * 支持鼠标悬停高亮、点击选中等交互效果
39
+ */
40
+ export default {
41
+ name: "MffCharts",
42
+ props: {
43
+ // 饼图数据
44
+ optionData: {
45
+ type: Array,
46
+ default: () => [],
47
+ },
48
+ id: {
49
+ type: String,
50
+ default: "",
51
+ required: true,
52
+ },
53
+ isShowBtn: {
54
+ type: Boolean,
55
+ default: true,
56
+ }
57
+ },
58
+ data() {
59
+ return {
60
+ // 控制所有扇区是否等高,true表示所有扇区高度相同
61
+ isEqualHeight: false,
62
+ // 是否旋转
63
+ isRotate: false,
64
+
65
+ };
66
+ },
67
+ mounted() {
68
+ // 组件挂载后初始化3D饼图
69
+ this.init();
70
+ },
71
+ methods: {
72
+
73
+ // 切换所有扇区是否等高
74
+ toggleEqualHeight() {
75
+ this.isEqualHeight = !this.isEqualHeight;
76
+ this.init(false);
77
+ },
78
+
79
+ // 切换是否旋转
80
+ toggleRotate() {
81
+ this.isRotate =!this.isRotate;
82
+ this.init(true);
83
+ },
84
+
85
+ /**
86
+ * @description 初始化3D饼图
87
+ * 创建echarts实例,生成3D饼图配置,添加标签引导线
88
+ */
89
+ init(isInit = false) {
90
+ console.log(1111);
91
+
92
+ // 初始化echarts实例
93
+ let myChart = echarts.init(
94
+ document.getElementById(`mff-charts-${this.id}`)
95
+ );
96
+ let myChartCopy = echarts.init(
97
+ document.getElementById(`mff-charts-copy-${this.id}`)
98
+ );
99
+ // 生成3D饼图配置,0.8为内部空心比例
100
+ this.option = this.getPie3D(this.optionData, 0.8);
101
+ this.optionCopy = this.getPie3D(this.optionData, 0.8);
102
+
103
+ // myChart.setOption(this.option,isInit);
104
+ // 添加透明2D饼图用于显示标签引导线
105
+ // 通过调整起始角度和方向使引导线与3D饼图对齐
106
+ const data = this.optionData.map((item) => {
107
+ return {
108
+ value: item.value,
109
+ name: item.name,
110
+ };
111
+ });
112
+ this.option.series.push({
113
+ name: "pie2d",
114
+ type: "pie",
115
+ itemStyle: {
116
+ // opacity: 0,
117
+ color: 'rgba(0,0,0,0)',
118
+ },
119
+ labelLine: {
120
+ show: !this.isRotate,
121
+ length: 20,
122
+ length2: 10,
123
+ },
124
+ label: {
125
+ show: true,
126
+ color: "#fff",
127
+ fontSize: 12,
128
+ rich: {
129
+ name: {
130
+ fontSize: 14,
131
+ fontWeight: 'bold',
132
+ padding: [0, 0, 5, 0]
133
+ },
134
+ value: {
135
+ fontSize: 12
136
+ },
137
+ percent: {
138
+ fontSize: 12,
139
+ color: '#42f59e'
140
+ }
141
+ },
142
+ formatter: function (params) {
143
+ return [
144
+ '{name|' + params.name + '}',
145
+ '{value|' + params.value + '}',
146
+ '{percent|' + params.percent + '%}'
147
+ ].join('\n');
148
+ }
149
+ },
150
+ startAngle: -40, //起始角度,支持范围[0, 360]。
151
+ clockwise: false, //饼图的扇区是否是顺时针排布。上述这两项配置主要是为了对齐3d的样式
152
+ radius: ["20%", "70%"],
153
+ center: ["50%", "50%"],
154
+ data,
155
+
156
+
157
+ });
158
+ this.optionCopy.series.push({
159
+ name: "pie2d",
160
+ type: "pie",
161
+ itemStyle: {
162
+ opacity: 0,
163
+ // color: 'rgba(0,0,0,0)',
164
+ },
165
+ labelLine: {
166
+ show: !this.isRotate,
167
+ length: 20,
168
+ length2: 10,
169
+ },
170
+ label: {
171
+ show: true,
172
+ color: "#fff",
173
+ fontSize: 12,
174
+ rich: {
175
+ name: {
176
+ fontSize: 14,
177
+ fontWeight: 'bold',
178
+ padding: [0, 0, 5, 0]
179
+ },
180
+ value: {
181
+ fontSize: 12
182
+ },
183
+ percent: {
184
+ fontSize: 12,
185
+ color: '#42f59e'
186
+ }
187
+ },
188
+ formatter: function (params) {
189
+ return [
190
+ '{name|' + params.name + '}',
191
+ '{value|' + params.value + '}',
192
+ '{percent|' + params.percent + '%}'
193
+ ].join('\n');
194
+ }
195
+ },
196
+ startAngle: -40, //起始角度,支持范围[0, 360]。
197
+ clockwise: false, //饼图的扇区是否是顺时针排布。上述这两项配置主要是为了对齐3d的样式
198
+ radius: ["20%", "70%"],
199
+ center: ["50%", "50%"],
200
+ data,
201
+
202
+ })
203
+ myChart.setOption(this.option, isInit);
204
+ myChartCopy.setOption(this.optionCopy, isInit);
205
+ this.bindListen(myChart);
206
+ this.bindListen(myChartCopy);
207
+ },
208
+
209
+ /**
210
+ * @description 生成3D饼图的配置项
211
+ * @param {Array} pieData 饼图数据数组
212
+ * @param {number} internalDiameterRatio 内部空心占比(0-1)
213
+ * @returns {Object} echarts配置项
214
+ */
215
+ getPie3D(pieData, internalDiameterRatio) {
216
+ //internalDiameterRatio:透明的空心占比
217
+ let that = this;
218
+ let series = [];
219
+ let sumValue = 0;
220
+ let startValue = 0;
221
+ let endValue = 0;
222
+ let legendData = [];
223
+ let legendBfb = [];
224
+ let k = 1 - internalDiameterRatio;
225
+ pieData.sort((a, b) => {
226
+ return b.value - a.value;
227
+ });
228
+ // 为每一个饼图数据,生成一个 series-surface 配置
229
+ for (let i = 0; i < pieData.length; i++) {
230
+ sumValue += pieData[i].value;
231
+ let seriesItem = {
232
+ name:
233
+ typeof pieData[i].name === "undefined"
234
+ ? `series${i}`
235
+ : pieData[i].name,
236
+ type: "surface",
237
+ parametric: true,
238
+ wireframe: {
239
+ show: false,
240
+ },
241
+ pieData: pieData[i],
242
+ pieStatus: {
243
+ selected: false,
244
+ hovered: false,
245
+ k: k,
246
+ },
247
+ center: ["10%", "50%"],
248
+ };
249
+
250
+ if (typeof pieData[i].itemStyle != "undefined") {
251
+ let itemStyle = {};
252
+ typeof pieData[i].itemStyle.color != "undefined"
253
+ ? (itemStyle.color = pieData[i].itemStyle.color)
254
+ : null;
255
+ typeof pieData[i].itemStyle.opacity != "undefined"
256
+ ? (itemStyle.opacity = pieData[i].itemStyle.opacity)
257
+ : null;
258
+ seriesItem.itemStyle = itemStyle;
259
+ }
260
+ series.push(seriesItem);
261
+ }
262
+
263
+ // 使用上一次遍历时,计算出的数据和 sumValue,调用 getParametricEquation 函数,
264
+ // 向每个 series-surface 传入不同的参数方程 series-surface.parametricEquation,也就是实现每一个扇形。
265
+ legendData = [];
266
+ legendBfb = [];
267
+ for (let i = 0; i < series.length; i++) {
268
+ endValue = startValue + series[i].pieData.value;
269
+ series[i].pieData.startRatio = startValue / sumValue;
270
+ series[i].pieData.endRatio = endValue / sumValue;
271
+ series[i].parametricEquation = this.getParametricEquation(
272
+ series[i].pieData.startRatio,
273
+ series[i].pieData.endRatio,
274
+ false,
275
+ false,
276
+ k,
277
+ series[i].pieData.value
278
+ );
279
+ startValue = endValue;
280
+ let bfb = that.fomatFloat(series[i].pieData.value / sumValue, 4);
281
+ legendData.push({
282
+ name: series[i].name,
283
+ value: bfb,
284
+ });
285
+ legendBfb.push({
286
+ name: series[i].name,
287
+ value: bfb,
288
+ });
289
+ }
290
+ let boxHeight = this.getHeight3D(series, 26);
291
+ //通过传参设定3d饼/环的高度,26代表26px
292
+ // 准备待返回的配置项,把准备好的 legendData、series 传入。
293
+ let option = {
294
+ legend: {
295
+ show: false,
296
+ },
297
+ labelLine: {
298
+ show: false,
299
+ },
300
+
301
+ tooltip: {
302
+ formatter: (params) => {
303
+ if (
304
+ params.seriesName !== "mouseoutSeries" &&
305
+ params.seriesName !== "pie2d"
306
+ ) {
307
+ let bfb = (
308
+ (option.series[params.seriesIndex].pieData.endRatio -
309
+ option.series[params.seriesIndex].pieData.startRatio) *
310
+ 100
311
+ ).toFixed(2);
312
+ return (
313
+ `${params.seriesName}<br/>` +
314
+ `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
315
+ this.formatNumberWithCommas(option.series[params.seriesIndex].pieData.value)
316
+ );
317
+ }
318
+ },
319
+ },
320
+ xAxis3D: {
321
+ min: -1,
322
+ max: 1,
323
+ },
324
+ yAxis3D: {
325
+ min: -1,
326
+ max: 1,
327
+ },
328
+ zAxis3D: {
329
+ min: -1,
330
+ max: 2,
331
+ },
332
+ grid3D: {
333
+ show: false,
334
+ boxHeight: boxHeight, //圆环的高度
335
+ viewControl: {
336
+ //3d效果可以放大、旋转等,请自己去查看官方配置
337
+ alpha: 44, //角度
338
+ distance: 190, //调整视角到主体的距离,类似调整zoom
339
+ rotateSensitivity: 0, //设置为0无法旋转
340
+ zoomSensitivity: 0, //设置为0无法缩放
341
+ panSensitivity: 0, //设置为0无法平移
342
+ autoRotate: this.isRotate, //自动旋转
343
+ },
344
+ },
345
+ series: series,
346
+ };
347
+ return option;
348
+ },
349
+
350
+ //获取3d丙图的最高扇区的高度
351
+ /**
352
+ * @description 计算3D饼图的高度
353
+ * @param {Array} series 系列数据
354
+ * @param {number} height 基础高度
355
+ * @returns {number} 计算后的高度
356
+ */
357
+ getHeight3D(series, height) {
358
+ // if(this.isEqualHeight) return height * 3;
359
+ series.sort((a, b) => {
360
+ return b.pieData.value - a.pieData.value;
361
+ });
362
+ return (height * 25) / series[0].pieData.value;
363
+ },
364
+
365
+ // 生成扇形的曲面参数方程,用于 series-surface.parametricEquation
366
+ /**
367
+ * @description 生成3D扇形的参数方程
368
+ * @param {number} startRatio 起始比例
369
+ * @param {number} endRatio 结束比例
370
+ * @param {boolean} isSelected 是否被选中
371
+ * @param {boolean} isHovered 是否被悬停
372
+ * @param {number} k 内外径比例
373
+ * @param {number} h 高度
374
+ * @returns {Object} 参数方程对象
375
+ */
376
+ getParametricEquation(startRatio, endRatio, isSelected, isHovered, k, h) {
377
+ if (this.isEqualHeight) {
378
+ if(this.id === "1") {
379
+ h = 20000;
380
+ }
381
+ if(this.id === "2") {
382
+ h = 1500;
383
+ }
384
+ // // 添加缩放因子,使大数值的柱子间距更合理
385
+ }
386
+ k = k * 1.3;
387
+
388
+ // 计算
389
+ let midRatio = (startRatio + endRatio) / 2;
390
+ let startRadian = startRatio * Math.PI * 2;
391
+ let endRadian = endRatio * Math.PI * 2;
392
+ let midRadian = midRatio * Math.PI * 2;
393
+ // 如果只有一个扇形,则不实现选中效果。
394
+ if (startRatio === 0 && endRatio === 1) {
395
+ isSelected = false;
396
+ }
397
+ // 通过扇形内径/外径的值,换算出辅助参数 k(默认值 1/3)
398
+ k = typeof k !== "undefined" ? k : 1 / 3;
399
+ // 计算选中效果分别在 x 轴、y 轴方向上的位移(未选中,则位移均为 0)
400
+ let offsetX = isSelected ? Math.cos(midRadian) * 0.1 : 0;
401
+ let offsetY = isSelected ? Math.sin(midRadian) * 0.1 : 0;
402
+ // 计算高亮效果的放大比例(未高亮,则比例为 1)
403
+ let hoverRate = isHovered ? 1.05 : 1;
404
+ // 返回曲面参数方程
405
+ return {
406
+ u: {
407
+ min: -Math.PI,
408
+ max: Math.PI * 3,
409
+ step: Math.PI / 32,
410
+ },
411
+ v: {
412
+ min: 0,
413
+ max: Math.PI * 2,
414
+ step: Math.PI / 20,
415
+ },
416
+ x: function (u, v) {
417
+ if (u < startRadian) {
418
+ return (
419
+ offsetX +
420
+ Math.cos(startRadian) * (1 + Math.cos(v) * k) * hoverRate
421
+ );
422
+ }
423
+ if (u > endRadian) {
424
+ return (
425
+ offsetX + Math.cos(endRadian) * (1 + Math.cos(v) * k) * hoverRate
426
+ );
427
+ }
428
+ return offsetX + Math.cos(u) * (1 + Math.cos(v) * k) * hoverRate;
429
+ },
430
+ y: function (u, v) {
431
+ if (u < startRadian) {
432
+ return (
433
+ offsetY +
434
+ Math.sin(startRadian) * (1 + Math.cos(v) * k) * hoverRate
435
+ );
436
+ }
437
+ if (u > endRadian) {
438
+ return (
439
+ offsetY + Math.sin(endRadian) * (1 + Math.cos(v) * k) * hoverRate
440
+ );
441
+ }
442
+ return offsetY + Math.sin(u) * (1 + Math.cos(v) * k) * hoverRate;
443
+ },
444
+ z: function (u, v) {
445
+ if (u < -Math.PI * 0.5) {
446
+ return Math.sin(u);
447
+ }
448
+ if (u > Math.PI * 2.5) {
449
+ return Math.sin(u) * h * 0.1;
450
+ }
451
+ return Math.sin(v) > 0 ? 1 * h * 0.1 : -1;
452
+ },
453
+ };
454
+ },
455
+
456
+ /**
457
+ * @description 格式化浮点数
458
+ * @param {number} num 需要格式化的数字
459
+ * @param {number} n 保留小数位数
460
+ * @returns {string} 格式化后的字符串
461
+ */
462
+ fomatFloat(num, n) {
463
+ var f = parseFloat(num);
464
+ if (isNaN(f)) {
465
+ return false;
466
+ }
467
+ f = Math.round(num * Math.pow(10, n)) / Math.pow(10, n); // n 幂
468
+ var s = f.toString();
469
+ var rs = s.indexOf(".");
470
+ //判定如果是整数,增加小数点再补0
471
+ if (rs < 0) {
472
+ rs = s.length;
473
+ s += ".";
474
+ }
475
+ while (s.length <= rs + n) {
476
+ s += "0";
477
+ }
478
+ return s;
479
+ },
480
+
481
+ /**
482
+ * @description 绑定图表交互事件
483
+ * @param {Object} myChart echarts实例
484
+ * 实现饼图的选中效果(单选)和高亮(放大)效果
485
+ */
486
+ bindListen(myChart) {
487
+ // // 监听鼠标事件,实现饼图选中效果(单选),近似实现高亮(放大)效果。
488
+ // let that = this;
489
+ // let selectedIndex = "";
490
+ // let hoveredIndex = "";
491
+ // 监听点击事件,实现选中效果(单选)
492
+ myChart.on("click", function (params) {
493
+ console.log('click');
494
+
495
+ return
496
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否选中取反。
497
+ let isSelected =
498
+ !that.option.series[params.seriesIndex].pieStatus.selected;
499
+ let isHovered =
500
+ that.option.series[params.seriesIndex].pieStatus.hovered;
501
+ let k = that.option.series[params.seriesIndex].pieStatus.k;
502
+ let startRatio =
503
+ that.option.series[params.seriesIndex].pieData.startRatio;
504
+ let endRatio = that.option.series[params.seriesIndex].pieData.endRatio;
505
+ // 如果之前选中过其他扇形,将其取消选中(对 option 更新)
506
+ if (selectedIndex !== "" && selectedIndex !== params.seriesIndex) {
507
+ that.option.series[selectedIndex].parametricEquation =
508
+ that.getParametricEquation(
509
+ that.option.series[selectedIndex].pieData.startRatio,
510
+ that.option.series[selectedIndex].pieData.endRatio,
511
+ false,
512
+ false,
513
+ k,
514
+ that.option.series[selectedIndex].pieData.value
515
+ );
516
+ that.option.series[selectedIndex].pieStatus.selected = false;
517
+ }
518
+ // 对当前点击的扇形,执行选中/取消选中操作(对 option 更新)
519
+ that.option.series[params.seriesIndex].parametricEquation =
520
+ that.getParametricEquation(
521
+ startRatio,
522
+ endRatio,
523
+ isSelected,
524
+ isHovered,
525
+ k,
526
+ that.option.series[params.seriesIndex].pieData.value
527
+ );
528
+ that.option.series[params.seriesIndex].pieStatus.selected = isSelected;
529
+ // 如果本次是选中操作,记录上次选中的扇形对应的系列号 seriesIndex
530
+ isSelected ? (selectedIndex = params.seriesIndex) : null;
531
+ // 使用更新后的 option,渲染图表
532
+ myChart.setOption(that.option);
533
+ });
534
+
535
+ return
536
+ // 监听 mouseover,近似实现高亮(放大)效果
537
+ myChart.on("mouseover", function (params) {
538
+ // 准备重新渲染扇形所需的参数
539
+ let isSelected;
540
+ let isHovered;
541
+ let startRatio;
542
+ let endRatio;
543
+ let k;
544
+ // 如果触发 mouseover 的扇形当前已高亮,则不做操作
545
+ if (hoveredIndex === params.seriesIndex) {
546
+ return;
547
+ // 否则进行高亮及必要的取消高亮操作
548
+ } else {
549
+ // 如果当前有高亮的扇形,取消其高亮状态(对 option 更新)
550
+ if (hoveredIndex !== "") {
551
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否高亮设置为 false。
552
+ isSelected = that.option.series[hoveredIndex].pieStatus.selected;
553
+ isHovered = false;
554
+ startRatio = that.option.series[hoveredIndex].pieData.startRatio;
555
+ endRatio = that.option.series[hoveredIndex].pieData.endRatio;
556
+ k = that.option.series[hoveredIndex].pieStatus.k;
557
+ // 对当前点击的扇形,执行取消高亮操作(对 option 更新)
558
+ that.option.series[hoveredIndex].parametricEquation =
559
+ that.getParametricEquation(
560
+ startRatio,
561
+ endRatio,
562
+ isSelected,
563
+ isHovered,
564
+ k,
565
+ that.option.series[hoveredIndex].pieData.value
566
+ );
567
+ that.option.series[hoveredIndex].pieStatus.hovered = isHovered;
568
+ // 将此前记录的上次选中的扇形对应的系列号 seriesIndex 清空
569
+ hoveredIndex = "";
570
+ }
571
+ // 如果触发 mouseover 的扇形不是透明圆环,将其高亮(对 option 更新)
572
+ if (
573
+ params.seriesName !== "mouseoutSeries" &&
574
+ params.seriesName !== "pie2d"
575
+ ) {
576
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否高亮设置为 true。
577
+ isSelected =
578
+ that.option.series[params.seriesIndex].pieStatus.selected;
579
+ isHovered = true;
580
+ startRatio =
581
+ that.option.series[params.seriesIndex].pieData.startRatio;
582
+ endRatio = that.option.series[params.seriesIndex].pieData.endRatio;
583
+ k = that.option.series[params.seriesIndex].pieStatus.k;
584
+ // 对当前点击的扇形,执行高亮操作(对 option 更新)
585
+ that.option.series[params.seriesIndex].parametricEquation =
586
+ that.getParametricEquation(
587
+ startRatio,
588
+ endRatio,
589
+ isSelected,
590
+ isHovered,
591
+ k,
592
+ that.option.series[params.seriesIndex].pieData.value + 5
593
+ );
594
+ that.option.series[params.seriesIndex].pieStatus.hovered =
595
+ isHovered;
596
+ // 记录上次高亮的扇形对应的系列号 seriesIndex
597
+ hoveredIndex = params.seriesIndex;
598
+ }
599
+ // 使用更新后的 option,渲染图表
600
+ myChart.setOption(that.option);
601
+ }
602
+ });
603
+ // 修正取消高亮失败的 bug
604
+ myChart.on("globalout", function () {
605
+ // 准备重新渲染扇形所需的参数
606
+ let isSelected;
607
+ let isHovered;
608
+ let startRatio;
609
+ let endRatio;
610
+ let k;
611
+ if (hoveredIndex !== "") {
612
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否高亮设置为 true。
613
+ isSelected = that.option.series[hoveredIndex].pieStatus.selected;
614
+ isHovered = false;
615
+ k = that.option.series[hoveredIndex].pieStatus.k;
616
+ startRatio = that.option.series[hoveredIndex].pieData.startRatio;
617
+ endRatio = that.option.series[hoveredIndex].pieData.endRatio;
618
+ // 对当前点击的扇形,执行取消高亮操作(对 option 更新)
619
+ that.option.series[hoveredIndex].parametricEquation =
620
+ that.getParametricEquation(
621
+ startRatio,
622
+ endRatio,
623
+ isSelected,
624
+ isHovered,
625
+ k,
626
+ that.option.series[hoveredIndex].pieData.value
627
+ );
628
+ that.option.series[hoveredIndex].pieStatus.hovered = isHovered;
629
+ // 将此前记录的上次选中的扇形对应的系列号 seriesIndex 清空
630
+ hoveredIndex = "";
631
+ }
632
+ // 使用更新后的 option,渲染图表
633
+ myChart.setOption(that.option);
634
+ });
635
+ },
636
+
637
+ formatNumberWithCommas(num) {
638
+ return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
639
+ }
640
+ },
641
+ };
642
+ </script>
643
+
644
+ <style scoped>
645
+ .pei3d-page {
646
+ width: 100%;
647
+ height: 100%;
648
+ }
649
+ .mff-main {
650
+ width: 100%;
651
+ height: 100%;
652
+ background-color: #000a3b;
653
+ }
654
+ .mff-charts {
655
+ width: 100%;
656
+ height: 100%;
657
+ }
658
+ </style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div>
3
+ <Diagram class="home" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import Diagram from '@/components/diagram'
9
+
10
+ export default {
11
+ components: {
12
+ Diagram
13
+ }
14
+ }
15
+ </script>