Compare commits
351 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
471610963b | ||
|
|
f6424245fd | ||
|
|
d9834482f3 | ||
|
|
6fe20c4655 | ||
|
|
6afbe59828 | ||
|
|
52389fa6fc | ||
|
|
bcb2ca1cb5 | ||
|
|
346c8d439a | ||
|
|
c7f7c6a731 | ||
|
|
6063408d94 | ||
|
|
ff4140cbfb | ||
|
|
d8bcb4ab4f | ||
|
|
3d4e05b514 | ||
|
|
bb48745484 | ||
|
|
f9adeac742 | ||
|
|
8867a489a2 | ||
|
|
adfd8c63e2 | ||
|
|
d8c55b6325 | ||
|
|
44ace74ca9 | ||
|
|
2e84b3d196 | ||
|
|
8f82c1fa59 | ||
|
|
7098e2e5e7 | ||
|
|
11af941590 | ||
|
|
051ddcc2d4 | ||
|
|
773ae65085 | ||
|
|
e4db7cb8ff | ||
|
|
8bb0f5e3a5 | ||
|
|
93ed31f093 | ||
|
|
76e511daa0 | ||
|
|
a2184b19b3 | ||
|
|
ec9210d7e7 | ||
|
|
e0fe8f673c | ||
|
|
95466aa076 | ||
|
|
6e8e38e737 | ||
|
|
3008073829 | ||
|
|
0e0794338a | ||
|
|
5059c9ea65 | ||
|
|
50a8342c49 | ||
|
|
afad8e49b1 | ||
|
|
a3d97e56ab | ||
|
|
816c11a877 | ||
|
|
6fee63600b | ||
|
|
1dd055294c | ||
|
|
4aa41bbe36 | ||
|
|
9585bd07a3 | ||
|
|
aecba9c95e | ||
|
|
57ad9a2c7a | ||
|
|
e71fb22b22 | ||
|
|
d177ebc900 | ||
|
|
e18cf847cd | ||
|
|
31ed863d53 | ||
|
|
c7b2daa0b8 | ||
|
|
3a6990f124 | ||
|
|
9f41ad1811 | ||
|
|
0ec0a12b0f | ||
|
|
c18bc019d3 | ||
|
|
6bbe489162 | ||
|
|
54cdada560 | ||
|
|
048f3426fe | ||
|
|
c508aaa400 | ||
|
|
606cb753c4 | ||
|
|
66e376a87d | ||
|
|
318821680a | ||
|
|
114fe5626a | ||
|
|
afb364b362 | ||
|
|
01be79ee9a | ||
|
|
3137109c6d | ||
|
|
1d876418fe | ||
|
|
fd37ce6ede | ||
|
|
9693c0dedf | ||
|
|
dc8d7c86d7 | ||
|
|
8499d574dc | ||
|
|
5c1af11788 | ||
|
|
c953ccd238 | ||
|
|
697542f804 | ||
|
|
0bb83c4131 | ||
|
|
38d542ce77 | ||
|
|
663cc94ae1 | ||
|
|
0370bc5c6c | ||
|
|
4dc8725b3e | ||
|
|
7b9da32215 | ||
|
|
9ce042cc8a | ||
|
|
9b8cf36135 | ||
|
|
a400526108 | ||
|
|
2a8d0717f8 | ||
|
|
a6194b8fa9 | ||
|
|
09a21f44c5 | ||
|
|
de681dbcd4 | ||
|
|
465fbf713c | ||
|
|
3b41bf480c | ||
|
|
59b9ca0569 | ||
|
|
c930e3433f | ||
|
|
8e1731354c | ||
|
|
93f398d5a7 | ||
|
|
0f61ee728b | ||
|
|
234755cd34 | ||
|
|
8ef4ab8175 | ||
|
|
c289252546 | ||
|
|
5207a98ce4 | ||
|
|
e411cb9b09 | ||
|
|
a2f32b0289 | ||
|
|
db7a4801d8 | ||
|
|
47d1dcbc04 | ||
|
|
9fd408e8ef | ||
|
|
77a5f47e82 | ||
|
|
4915f9e077 | ||
|
|
ce46f609ec | ||
|
|
ba425d44cc | ||
|
|
e6338f89dd | ||
|
|
24361e63c2 | ||
|
|
5effb94b1d | ||
|
|
f68aee1f3a | ||
|
|
233f3210c6 | ||
|
|
ab52fcaaf9 | ||
|
|
99eadd96af | ||
|
|
480e328306 | ||
|
|
bd52c4454c | ||
|
|
6b87618622 | ||
|
|
4e9f96505a | ||
|
|
dde03274c2 | ||
|
|
41444026f9 | ||
|
|
8b76f6e219 | ||
|
|
5ed3e4e8b1 | ||
|
|
55221ff756 | ||
|
|
b534619649 | ||
|
|
421ea3dc84 | ||
|
|
4bb3c34bc2 | ||
|
|
2cbb851948 | ||
|
|
5676a323d7 | ||
|
|
b435366ac4 | ||
|
|
0f93b0285b | ||
|
|
f51a6a8a46 | ||
|
|
f6afbcfe5a | ||
|
|
e821556400 | ||
|
|
a27110df34 | ||
|
|
72ec2e37a1 | ||
|
|
2799463d53 | ||
|
|
ebd08bc3a4 | ||
|
|
cfb8b038ce | ||
|
|
1130deab48 | ||
|
|
f3bfdeaccd | ||
|
|
8f0f9ea334 | ||
|
|
34b4eb77ba | ||
|
|
40453c51bb | ||
|
|
63db4f8c87 | ||
|
|
b2594d2f66 | ||
|
|
4edc639cf8 | ||
|
|
35dd70ef08 | ||
|
|
c2e733aaaa | ||
|
|
0db6976e4a | ||
|
|
05bb2a5eb6 | ||
|
|
3f3f54f3b7 | ||
|
|
35664e7e3d | ||
|
|
495d93a835 | ||
|
|
26116685e1 | ||
|
|
eccb39acad | ||
|
|
ccd5b8f0d0 | ||
|
|
aafa8bd8c3 | ||
|
|
59502e4be5 | ||
|
|
c5532f46bb | ||
|
|
fec03fe3fd | ||
|
|
b5738f5cf4 | ||
|
|
dbd33cd676 | ||
|
|
032956e03b | ||
|
|
b94b44090b | ||
|
|
19a382afe5 | ||
|
|
02fe552d1b | ||
|
|
22924eb36f | ||
|
|
a626f64e57 | ||
|
|
00a4c752ed | ||
|
|
134b44944e | ||
|
|
1eb0485a86 | ||
|
|
35e5374628 | ||
|
|
432cceed2a | ||
|
|
5b828d4982 | ||
|
|
605fd14b3d | ||
|
|
1b2b319467 | ||
|
|
dc458ea88e | ||
|
|
6f4e967b49 | ||
|
|
97899f275a | ||
|
|
8b6c616a15 | ||
|
|
87386e69a3 | ||
|
|
196df94aee | ||
|
|
a407d118fa | ||
|
|
0fc7bde348 | ||
|
|
9a8899ae40 | ||
|
|
8cb711b892 | ||
|
|
49d8c35747 | ||
|
|
125856677a | ||
|
|
bcf0417624 | ||
|
|
4b81a09293 | ||
|
|
bcaffd1579 | ||
|
|
7309d603f5 | ||
|
|
ada4ce9885 | ||
|
|
7758fb30d0 | ||
|
|
6ddea30289 | ||
|
|
ac42782f12 | ||
|
|
4348688e34 | ||
|
|
d447c85830 | ||
|
|
0a3c1b3438 | ||
|
|
b3bff2ee45 | ||
|
|
d90e0953b9 | ||
|
|
ba04005b09 | ||
|
|
fc58df2148 | ||
|
|
4f2609a121 | ||
|
|
f21c9f1246 | ||
|
|
16d7ae8176 | ||
|
|
0e77b196b6 | ||
|
|
0ea81aeaee | ||
|
|
d7aa41094b | ||
|
|
4ec1bbd912 | ||
|
|
a7b98fe3d6 | ||
|
|
bc02950a6f | ||
|
|
4e5c921bf2 | ||
|
|
14c5d935c4 | ||
|
|
b73893a6af | ||
|
|
cf85574c67 | ||
|
|
923b7759f8 | ||
|
|
c7988f2d83 | ||
|
|
0111f42803 | ||
|
|
cec39d693a | ||
|
|
c250f9d4d8 | ||
|
|
97ca3e8664 | ||
|
|
ad72070af1 | ||
|
|
8824d636f4 | ||
|
|
8e28c524b3 | ||
|
|
01d971b902 | ||
|
|
855d810d0d | ||
|
|
5dd39926f8 | ||
|
|
cbf541282a | ||
|
|
279f414db0 | ||
|
|
bc10d06c78 | ||
|
|
fa2530634d | ||
|
|
98b38640d1 | ||
|
|
9aff88c678 | ||
|
|
f82cde2faf | ||
|
|
462a613bd3 | ||
|
|
5e0baa4923 | ||
|
|
fb93d35c91 | ||
|
|
fc2b1fc42e | ||
|
|
d46a0b5134 | ||
|
|
45cadcecc3 | ||
|
|
7b262c9db2 | ||
|
|
4e091c7f49 | ||
|
|
1310234803 | ||
|
|
8fd121a335 | ||
|
|
d183c5815b | ||
|
|
661f56e773 | ||
|
|
3c1b741c37 | ||
|
|
36fdc22634 | ||
|
|
5261a09381 | ||
|
|
25864dc3b6 | ||
|
|
09c2ec06d4 | ||
|
|
2378be571d | ||
|
|
59fd7ebceb | ||
|
|
e0d99a6b28 | ||
|
|
e4514505c3 | ||
|
|
f2c49b171e | ||
|
|
de9e304dd4 | ||
|
|
1fb57ad1ff | ||
|
|
65127ced7f | ||
|
|
5b1458b22f | ||
|
|
89194848de | ||
|
|
6f74be7092 | ||
|
|
1f9790e5f5 | ||
|
|
0b8ab9adfa | ||
|
|
a17d7a4182 | ||
|
|
4ef77fcf25 | ||
|
|
d204b459d9 | ||
|
|
6ae6645d3c | ||
|
|
a925ced533 | ||
|
|
8dcccef54d | ||
|
|
dff639e901 | ||
|
|
0376703fd2 | ||
|
|
7341ff11f3 | ||
|
|
57193beeab | ||
|
|
405e884e70 | ||
|
|
0d4e83c940 | ||
|
|
b8ed389f60 | ||
|
|
b308275d99 | ||
|
|
f9c715c72c | ||
|
|
e2b3118d9d | ||
|
|
0cd31f48c1 | ||
|
|
e35e98c023 | ||
|
|
11cd4d0da1 | ||
|
|
8987dd1682 | ||
|
|
ff1384c825 | ||
|
|
0e42f4ff35 | ||
|
|
cfcc262fd6 | ||
|
|
f4c3a2b04f | ||
|
|
31a8957de9 | ||
|
|
36ca877d49 | ||
|
|
3bad7ec758 | ||
|
|
e1e26cafcf | ||
|
|
99cd66c835 | ||
|
|
e4aac1597f | ||
|
|
2dc7bc3b61 | ||
|
|
07b7eec457 | ||
|
|
eaab8d1d49 | ||
|
|
9903e73a69 | ||
|
|
7c1bcd0605 | ||
|
|
7f1c001c99 | ||
|
|
46f20f61b5 | ||
|
|
dba5ab3ef3 | ||
|
|
2251bebee6 | ||
|
|
c1d98b03a9 | ||
|
|
21ba5c02b0 | ||
|
|
66f4768285 | ||
|
|
500795b7e5 | ||
|
|
3ac9ffc73c | ||
|
|
5ea963fb93 | ||
|
|
c420ae467f | ||
|
|
be014225c1 | ||
|
|
8334fe5bcc | ||
|
|
f99edce6f4 | ||
|
|
936d78975e | ||
|
|
a25f9bc5a1 | ||
|
|
ec6d8dedec | ||
|
|
5454f19f3d | ||
|
|
b95cf946a8 | ||
|
|
1b9a3f6f5b | ||
|
|
d91cd00310 | ||
|
|
e4f821f46d | ||
|
|
ed5a452e2f | ||
|
|
907a0afb77 | ||
|
|
b32c718780 | ||
|
|
adbdad1e88 | ||
|
|
f8229a0518 | ||
|
|
48f00e44f6 | ||
|
|
8c089b800a | ||
|
|
44199fa4c4 | ||
|
|
99d20d99f9 | ||
|
|
5e20689356 | ||
|
|
9a9b752a96 | ||
|
|
1ddf056ca6 | ||
|
|
572ab73c92 | ||
|
|
afc8f907ce | ||
|
|
f6bad1513b | ||
|
|
fce514c490 | ||
|
|
30a9deaee7 | ||
|
|
f47acca703 | ||
|
|
73a6c6b920 | ||
|
|
0106d43467 | ||
|
|
231fb9dd29 | ||
|
|
f2ae08e62a | ||
|
|
e930ca1587 | ||
|
|
ddb125656a | ||
|
|
35cda43d95 | ||
|
|
e3faaad5e0 | ||
|
|
24ef446fd6 | ||
|
|
53b9e03e69 |
134
README.md
@@ -1,4 +1,4 @@
|
|||||||
## 总览
|
#### 总览
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="readme/logo-t-y.png" alt="go-view" />
|
<img src="readme/logo-t-y.png" alt="go-view" />
|
||||||
@@ -6,7 +6,62 @@
|
|||||||
|
|
||||||
<h4 align="center">开源、精美、便捷的「数据可视化」低代码开发平台</h4>
|
<h4 align="center">开源、精美、便捷的「数据可视化」低代码开发平台</h4>
|
||||||
|
|
||||||
#### 😶 **纯前端** 分支: **`master`**
|
#### 长期赞助商
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div align="center" style="column-gap: 20px;">
|
||||||
|
<a
|
||||||
|
href="http://www.ccflow.org/?from=goviewGitee"
|
||||||
|
target="_blank"
|
||||||
|
style="
|
||||||
|
padding: 10px 20px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #f9f9f9;
|
||||||
|
">
|
||||||
|
<img src="readme/sponsors/ccflow-banner.png" alt="go-view" style="width: 250px;" width="250px" />
|
||||||
|
</a>
|
||||||
|
<span> </span>
|
||||||
|
<a
|
||||||
|
href="https://fastbee.cn/"
|
||||||
|
target="_blank"
|
||||||
|
style="
|
||||||
|
padding: 10px 20px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #f9f9f9;
|
||||||
|
">
|
||||||
|
<img src="readme/sponsors/fb-banner.gif" alt="go-view" style="width: 250px;" width="250px"/>
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<a
|
||||||
|
href="https://www.qeasy.cloud/"
|
||||||
|
target="_blank"
|
||||||
|
style="
|
||||||
|
padding: 10px 20px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #f9f9f9;
|
||||||
|
">
|
||||||
|
<img src="readme/sponsors/qyy-banner.png" alt="go-view" style="width: 250px;" width="250px"/>
|
||||||
|
</a>
|
||||||
|
<span> </span>
|
||||||
|
<a
|
||||||
|
href="http://doc.zyplayer.com/#/integrate/zyplayer-doc?utm=goview"
|
||||||
|
target="_blank"
|
||||||
|
style="
|
||||||
|
padding: 10px 20px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #f9f9f9;
|
||||||
|
">
|
||||||
|
<img src="readme/sponsors/zyplayer-banner.png" alt="go-view" style="width: 250px;" width="250px"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
#### 😶 **纯前端** 分支: **`master`**
|
||||||
|
|
||||||
#### 👻 携带 **后端** 请求分支: **`master-fetch`**
|
#### 👻 携带 **后端** 请求分支: **`master-fetch`**
|
||||||
|
|
||||||
@@ -16,15 +71,19 @@
|
|||||||
|
|
||||||
项目带后端-Demo 地址:[https://demo.mtruning.club/](https://demo.mtruning.club/)
|
项目带后端-Demo 地址:[https://demo.mtruning.club/](https://demo.mtruning.club/)
|
||||||
|
|
||||||
文档-源码地址:[https://gitee.com/MTrun/go-view-doc](https://gitee.com/MTrun/go-view-doc)
|
Cloud IDE 代码在线预览地址:[https://idegitee.com/dromara/go-view](https://idegitee.com/dromara/go-view)
|
||||||
|
|
||||||
#### 🤯 后端项目看这里!
|
#### 🤯 后端项目看这里!
|
||||||
|
|
||||||
后端项目 gitee 地址:[https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve)
|
后端地址(社区实现,仅供参考):
|
||||||
|
|
||||||
接口说明地址:[https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb)
|
- `JAVA` [https://gitee.com/MTrun/go-view-serve](https://gitee.com/MTrun/go-view-serve) (当前使用)
|
||||||
|
- `.NET` [https://gitee.com/sun_xiang_yu/go-view-dotnet](https://gitee.com/sun_xiang_yu/go-view-dotnet)
|
||||||
|
- `NODE` [https://gitee.com/qwdingyu/led](https://gitee.com/qwdingyu/led)
|
||||||
|
- `Docker 镜像` [https://gitee.com/AHEAD4/go-view-docker](https://gitee.com/AHEAD4/go-view-docker)
|
||||||
|
- `接口文档`[https://docs.apipost.cn](https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3) (不是最新, 以前端代码为准)
|
||||||
|
|
||||||
技术点:
|
#### 整体介绍
|
||||||
|
|
||||||
- 框架:基于 `Vue3` 框架编写,使用 `hooks` 写法抽离部分逻辑,使代码结构更加清晰;
|
- 框架:基于 `Vue3` 框架编写,使用 `hooks` 写法抽离部分逻辑,使代码结构更加清晰;
|
||||||
|
|
||||||
@@ -36,6 +95,8 @@
|
|||||||
|
|
||||||
- 封装:项目进行了详细的工具类封装如:路由、存储、加/解密、文件处理、主题、NaiveUI 全局方法、组件等
|
- 封装:项目进行了详细的工具类封装如:路由、存储、加/解密、文件处理、主题、NaiveUI 全局方法、组件等
|
||||||
|
|
||||||
|
- 入选 NaiveUI 社区精选资源推荐:[查看 NaiveUI 推荐列表](https://www.naiveui.com/zh-CN/light/docs/community)
|
||||||
|
|
||||||
说明文档:
|
说明文档:
|
||||||

|

|
||||||
|
|
||||||
@@ -51,6 +112,9 @@
|
|||||||
高级事件编辑:
|
高级事件编辑:
|
||||||

|

|
||||||
|
|
||||||
|
自定义组件颜色:
|
||||||
|

|
||||||
|
|
||||||
快捷主页:
|
快捷主页:
|
||||||

|

|
||||||
|
|
||||||
@@ -65,7 +129,7 @@
|
|||||||
| 名称 | 版本 | 名称 | 版本 |
|
| 名称 | 版本 | 名称 | 版本 |
|
||||||
| ------------------- | ----- | ----------- | ------ |
|
| ------------------- | ----- | ----------- | ------ |
|
||||||
| Vue | 3.2.x | TypeScript4 | 4.6.x |
|
| Vue | 3.2.x | TypeScript4 | 4.6.x |
|
||||||
| Vite | 2.9.x | NaiveUI | 2.27.x |
|
| Vite | 4.2.x | NaiveUI | 2.34.x |
|
||||||
| ECharts | 5.3.x | Pinia | 2.0.x |
|
| ECharts | 5.3.x | Pinia | 2.0.x |
|
||||||
| 详见 `package.json` | 😁 | 🥰 | 🤗 |
|
| 详见 `package.json` | 😁 | 🥰 | 🤗 |
|
||||||
|
|
||||||
@@ -73,7 +137,7 @@
|
|||||||
|
|
||||||
| 名称 | 版本 | 名称 | 版本 |
|
| 名称 | 版本 | 名称 | 版本 |
|
||||||
| ---- | ------- | ------- | ----- |
|
| ---- | ------- | ------- | ----- |
|
||||||
| node | 16.14.x | npm | 8.5.x |
|
| node | 16.16.x | npm | 8.5.x |
|
||||||
| pnpm | 7.1.x | windows | 11 |
|
| pnpm | 7.1.x | windows | 11 |
|
||||||
|
|
||||||
已完成图表:
|
已完成图表:
|
||||||
@@ -96,52 +160,7 @@
|
|||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
本项目采用` pnpm` 进行包管理
|
请查看文档:[https://www.mtruning.club/](https://www.mtruning.club/)
|
||||||
|
|
||||||
```shell
|
|
||||||
#建议使用 nrm 切换到淘宝源 https://registry.npmmirror.com/
|
|
||||||
#pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
#yarn
|
|
||||||
yarn install
|
|
||||||
|
|
||||||
#npm
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
## 启动
|
|
||||||
|
|
||||||
```shell
|
|
||||||
#pnpm
|
|
||||||
pnpm dev
|
|
||||||
|
|
||||||
# npm
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
#yarn
|
|
||||||
yarn dev
|
|
||||||
|
|
||||||
#Makefile
|
|
||||||
make dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## 编译
|
|
||||||
|
|
||||||
```shell
|
|
||||||
#pnpm
|
|
||||||
pnpm run build
|
|
||||||
|
|
||||||
# npm
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
#yarn
|
|
||||||
yarn run build
|
|
||||||
|
|
||||||
#Makefile
|
|
||||||
make dist
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## 代码提交
|
## 代码提交
|
||||||
|
|
||||||
@@ -157,10 +176,9 @@ make dist
|
|||||||
- style: 不影响程序逻辑的代码修改
|
- style: 不影响程序逻辑的代码修改
|
||||||
- chore: 不属于以上类型的其他类型(日常事务)
|
- chore: 不属于以上类型的其他类型(日常事务)
|
||||||
|
|
||||||
## 交流
|
## 交流群
|
||||||
|
|
||||||
QQ 群:1030129384
|
QQ 群:663629294
|
||||||
|
<img width="260px" src="readme/go-view-qq.png" alt="QQ群" style="border-radius: 20px" />
|
||||||

|
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import path from 'path'
|
||||||
export const OUTPUT_DIR = 'dist'
|
export const OUTPUT_DIR = 'dist'
|
||||||
|
|
||||||
// monaco-editor 路径
|
// monaco-editor 路径
|
||||||
@@ -6,7 +7,7 @@ export const prefix = `monaco-editor/esm/vs`
|
|||||||
// chunk 警告大小
|
// chunk 警告大小
|
||||||
export const chunkSizeWarningLimit = 2000
|
export const chunkSizeWarningLimit = 2000
|
||||||
|
|
||||||
// 禁用 brotli 压缩大小报告
|
// 禁用 brotliSize 压缩大小报告
|
||||||
export const brotliSize = false
|
export const brotliSize = false
|
||||||
|
|
||||||
// 分包
|
// 分包
|
||||||
@@ -14,7 +15,12 @@ export const rollupOptions = {
|
|||||||
output: {
|
output: {
|
||||||
chunkFileNames: 'static/js/[name]-[hash].js',
|
chunkFileNames: 'static/js/[name]-[hash].js',
|
||||||
entryFileNames: 'static/js/[name]-[hash].js',
|
entryFileNames: 'static/js/[name]-[hash].js',
|
||||||
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
|
assetFileNames: (chunkInfo) => {
|
||||||
|
if(['.png', '.jpg', '.jpeg'].includes(path.extname(chunkInfo.name))) {
|
||||||
|
return `static/[ext]/[name].[ext]`
|
||||||
|
}
|
||||||
|
return `static/[ext]/[name]-[hash].[ext]`
|
||||||
|
},
|
||||||
manualChunks: {
|
manualChunks: {
|
||||||
jsonWorker: [`${prefix}/language/json/json.worker`],
|
jsonWorker: [`${prefix}/language/json/json.worker`],
|
||||||
cssWorker: [`${prefix}/language/css/css.worker`],
|
cssWorker: [`${prefix}/language/css/css.worker`],
|
||||||
|
|||||||
22
package.json
@@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "go-view",
|
"name": "go-view",
|
||||||
"version": "1.1.4",
|
"version": "1.2.6",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "vite --host",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
@@ -21,6 +24,8 @@
|
|||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
|
"dayjs": "^1.11.7",
|
||||||
|
"dom-helpers": "^5.2.1",
|
||||||
"echarts-liquidfill": "^3.1.0",
|
"echarts-liquidfill": "^3.1.0",
|
||||||
"echarts-stat": "^1.2.0",
|
"echarts-stat": "^1.2.0",
|
||||||
"echarts-wordcloud": "^2.0.0",
|
"echarts-wordcloud": "^2.0.0",
|
||||||
@@ -28,14 +33,15 @@
|
|||||||
"highlight.js": "^11.5.0",
|
"highlight.js": "^11.5.0",
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"keymaster": "^1.6.2",
|
"keymaster": "^1.6.2",
|
||||||
|
"mitt": "^3.0.0",
|
||||||
"monaco-editor": "^0.33.0",
|
"monaco-editor": "^0.33.0",
|
||||||
"naive-ui": "2.33.4",
|
"naive-ui": "2.34.3",
|
||||||
"pinia": "^2.0.13",
|
"pinia": "^2.0.13",
|
||||||
"screenfull": "^6.0.1",
|
"screenfull": "^6.0.1",
|
||||||
"three": "^0.145.0",
|
"three": "^0.145.0",
|
||||||
"vue": "^3.2.31",
|
"vue": "^3.2.31",
|
||||||
"vue-demi": "^0.13.1",
|
"vue-demi": "^0.13.1",
|
||||||
"vue-i18n": "9.1.9",
|
"vue-i18n": "^9.2.2",
|
||||||
"vue-router": "4.0.12",
|
"vue-router": "4.0.12",
|
||||||
"vue3-lazyload": "^0.2.5-beta",
|
"vue3-lazyload": "^0.2.5-beta",
|
||||||
"vue3-sketch-ruler": "^1.3.3",
|
"vue3-sketch-ruler": "^1.3.3",
|
||||||
@@ -44,14 +50,16 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^17.0.2",
|
"@commitlint/cli": "^17.0.2",
|
||||||
"@commitlint/config-conventional": "^17.0.2",
|
"@commitlint/config-conventional": "^17.0.2",
|
||||||
|
"@iconify/types": "^2.0.0",
|
||||||
|
"@iconify/vue": "^4.1.1",
|
||||||
"@types/node": "^16.11.26",
|
"@types/node": "^16.11.26",
|
||||||
"@types/three": "^0.144.0",
|
"@types/three": "^0.144.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||||
"@typescript-eslint/parser": "^5.18.0",
|
"@typescript-eslint/parser": "^5.18.0",
|
||||||
"@vicons/carbon": "^0.12.0",
|
"@vicons/carbon": "^0.12.0",
|
||||||
"@vicons/ionicons5": "~0.11.0",
|
"@vicons/ionicons5": "~0.11.0",
|
||||||
"@vitejs/plugin-vue": "^1.10.2",
|
"@vitejs/plugin-vue": "^4.2.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^1.3.9",
|
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||||
"@vue/compiler-sfc": "^3.2.31",
|
"@vue/compiler-sfc": "^3.2.31",
|
||||||
"@vueuse/core": "^7.7.1",
|
"@vueuse/core": "^7.7.1",
|
||||||
"commitlint": "^17.0.2",
|
"commitlint": "^17.0.2",
|
||||||
@@ -70,7 +78,7 @@
|
|||||||
"sass": "^1.49.11",
|
"sass": "^1.49.11",
|
||||||
"sass-loader": "^12.6.0",
|
"sass-loader": "^12.6.0",
|
||||||
"typescript": "4.6.3",
|
"typescript": "4.6.3",
|
||||||
"vite": "2.9.9",
|
"vite": "4.3.6",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-importer": "^0.2.5",
|
"vite-plugin-importer": "^0.2.5",
|
||||||
"vite-plugin-mock": "^2.9.6",
|
"vite-plugin-mock": "^2.9.6",
|
||||||
@@ -78,4 +86,4 @@
|
|||||||
"vue-echarts": "^6.0.2",
|
"vue-echarts": "^6.0.2",
|
||||||
"vue-tsc": "^0.28.10"
|
"vue-tsc": "^0.28.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3310
pnpm-lock.yaml
generated
10
preview.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# preview.yml
|
||||||
|
autoOpen: true # 打开工作空间时是否自动开启所有应用的预览
|
||||||
|
apps:
|
||||||
|
- port: 3000 # 应用的端口
|
||||||
|
run: npm i --registry=https://registry.npmmirror.com && npm run dev # 应用的启动命令
|
||||||
|
command: # 使用此命令启动服务,且不执行run
|
||||||
|
root: ./ # 应用的启动目录
|
||||||
|
name: GoView # 应用名称
|
||||||
|
description: 开源、精美、便捷的「数据可视化」低代码开发平台 # 应用描述
|
||||||
|
autoOpen: true # 打开工作空间时是否自动开启预览(优先级高于根级 autoOpen)
|
||||||
BIN
readme/go-view-echarts-color.png
Normal file
|
After Width: | Height: | Size: 292 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 70 KiB |
BIN
readme/sponsors/ccflow-banner.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
readme/sponsors/fb-banner.gif
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
readme/sponsors/qyy-banner.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
readme/sponsors/zyplayer-banner.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
@@ -21,6 +21,7 @@ axiosInstance.interceptors.request.use(
|
|||||||
axiosInstance.interceptors.response.use(
|
axiosInstance.interceptors.response.use(
|
||||||
(res: AxiosResponse) => {
|
(res: AxiosResponse) => {
|
||||||
const { code } = res.data as { code: number }
|
const { code } = res.data as { code: number }
|
||||||
|
if (code === undefined || code === null) return Promise.resolve(res.data)
|
||||||
if (code === ResultEnum.DATA_SUCCESS) return Promise.resolve(res.data)
|
if (code === ResultEnum.DATA_SUCCESS) return Promise.resolve(res.data)
|
||||||
// 重定向
|
// 重定向
|
||||||
if (ErrorPageNameMap.get(code)) redirectErrorPage(code)
|
if (ErrorPageNameMap.get(code)) redirectErrorPage(code)
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
|||||||
if (!targetParams || !globalParams) {
|
if (!targetParams || !globalParams) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全局
|
// 全局
|
||||||
const {
|
const {
|
||||||
// 全局请求源地址
|
// 全局请求源地址
|
||||||
@@ -173,7 +172,9 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
|||||||
|
|
||||||
case RequestBodyEnum.JSON:
|
case RequestBodyEnum.JSON:
|
||||||
headers['Content-Type'] = ContentTypeEnum.JSON
|
headers['Content-Type'] = ContentTypeEnum.JSON
|
||||||
data = translateStr(JSON.parse(targetRequestParams.Body['json']))
|
//json对象也能使用'javasctipt:'来动态拼接参数
|
||||||
|
data = translateStr(targetRequestParams.Body['json'])
|
||||||
|
if(typeof data === 'string') data = JSON.parse(data)
|
||||||
// json 赋值给 data
|
// json 赋值给 data
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
100
src/api/mock/graph.json
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "0",
|
||||||
|
"name": "Myriel",
|
||||||
|
"symbolSize": "@integer(0, 50)",
|
||||||
|
"x": -266.82776,
|
||||||
|
"y": 299.6904,
|
||||||
|
"value": "@integer(0, 50)",
|
||||||
|
"category": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "Napoleon",
|
||||||
|
"symbolSize": "@integer(0, 50)",
|
||||||
|
"x": -418.08344,
|
||||||
|
"y": 446.8853,
|
||||||
|
"value": "@integer(0, 50)",
|
||||||
|
"category": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2",
|
||||||
|
"name": "MlleBaptistine",
|
||||||
|
"symbolSize": "@integer(0, 50)",
|
||||||
|
"x": -212.76357,
|
||||||
|
"y": 245.29176,
|
||||||
|
"value": "@integer(0, 50)",
|
||||||
|
"category": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3",
|
||||||
|
"name": "MmeMagloire",
|
||||||
|
"symbolSize": "@integer(0, 50)",
|
||||||
|
"x": -242.82404,
|
||||||
|
"y": 235.26283,
|
||||||
|
"value": "@integer(0, 50)",
|
||||||
|
"category": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "4",
|
||||||
|
"name": "CountessDeLo",
|
||||||
|
"symbolSize": "@integer(0, 50)",
|
||||||
|
"x": -379.30386,
|
||||||
|
"y": 429.06424,
|
||||||
|
"value": "@integer(0, 50)",
|
||||||
|
"category": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"source": "1",
|
||||||
|
"target": "@integer(2, 4)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "2",
|
||||||
|
"target": "@integer(3, 4)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "3",
|
||||||
|
"target": "@integer(0, 2)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "3",
|
||||||
|
"target": "@integer(0, 1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "4",
|
||||||
|
"target": "@integer(0, 3)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
{
|
||||||
|
"name": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "C"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "E"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "F"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "G"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "H"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "I"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -19,6 +19,8 @@ export const capsuleUrl = '/mock/capsule'
|
|||||||
export const wordCloudUrl = '/mock/wordCloud'
|
export const wordCloudUrl = '/mock/wordCloud'
|
||||||
export const treemapUrl = '/mock/treemap'
|
export const treemapUrl = '/mock/treemap'
|
||||||
export const threeEarth01Url = '/mock/threeEarth01Data'
|
export const threeEarth01Url = '/mock/threeEarth01Data'
|
||||||
|
export const sankeyUrl = '/mock/sankey'
|
||||||
|
export const graphUrl = '/mock/graphData'
|
||||||
|
|
||||||
const mockObject: MockMethod[] = [
|
const mockObject: MockMethod[] = [
|
||||||
{
|
{
|
||||||
@@ -103,6 +105,16 @@ const mockObject: MockMethod[] = [
|
|||||||
method: RequestHttpEnum.GET,
|
method: RequestHttpEnum.GET,
|
||||||
response: () => test.threeEarth01Data
|
response: () => test.threeEarth01Data
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
url: sankeyUrl,
|
||||||
|
method: RequestHttpEnum.GET,
|
||||||
|
response: () => test.fetchSankey
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: graphUrl,
|
||||||
|
method: RequestHttpEnum.GET,
|
||||||
|
response: () => test.graphData
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export default mockObject
|
export default mockObject
|
||||||
|
|||||||
86
src/api/mock/sankey.json
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"label": [
|
||||||
|
{
|
||||||
|
"name": "a"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "a1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "a2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "b1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "b2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"source": "a",
|
||||||
|
"target": "a1",
|
||||||
|
"value": "@integer(0, 10)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "a",
|
||||||
|
"target": "a2",
|
||||||
|
"value": "@integer(0, 10)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "b",
|
||||||
|
"target": "b1",
|
||||||
|
"value": "@integer(0, 10)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "a",
|
||||||
|
"target": "b1",
|
||||||
|
"value": "@integer(0, 10)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "b1",
|
||||||
|
"target": "a1",
|
||||||
|
"value": "@integer(0, 10)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "b1",
|
||||||
|
"target": "b2",
|
||||||
|
"value": "@integer(0, 10)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"levels": [
|
||||||
|
{
|
||||||
|
"depth": 0,
|
||||||
|
"itemStyle": {
|
||||||
|
"color": "#decbe4"
|
||||||
|
},
|
||||||
|
"lineStyle": {
|
||||||
|
"color": "source",
|
||||||
|
"opacity": 0.9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depth": 1,
|
||||||
|
"itemStyle": {
|
||||||
|
"color": "#b3cde3"
|
||||||
|
},
|
||||||
|
"lineStyle": {
|
||||||
|
"color": "source",
|
||||||
|
"opacity": 0.6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depth": 2,
|
||||||
|
"itemStyle": {
|
||||||
|
"color": "#ccebc5"
|
||||||
|
},
|
||||||
|
"lineStyle": {
|
||||||
|
"color": "source",
|
||||||
|
"opacity": 0.6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ import heatmapJson from './heatMapData.json'
|
|||||||
import scatterJson from './scatter.json'
|
import scatterJson from './scatter.json'
|
||||||
import mapJson from './map.json'
|
import mapJson from './map.json'
|
||||||
import tTreemapJson from './treemap.json'
|
import tTreemapJson from './treemap.json'
|
||||||
|
import sankeyJson from './sankey.json'
|
||||||
|
import graphDataJson from './graph.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// 单图表
|
// 单图表
|
||||||
@@ -10,8 +12,8 @@ export default {
|
|||||||
status: 200,
|
status: 200,
|
||||||
msg: '请求成功',
|
msg: '请求成功',
|
||||||
data: {
|
data: {
|
||||||
dimensions: ['product', 'dataOne'],
|
dimensions: ['product', 'dataOne'],
|
||||||
'source|50': [
|
'source|20': [
|
||||||
{
|
{
|
||||||
product: '@name',
|
product: '@name',
|
||||||
'dataOne|0-900': 3
|
'dataOne|0-900': 3
|
||||||
@@ -26,12 +28,8 @@ export default {
|
|||||||
msg: '请求成功',
|
msg: '请求成功',
|
||||||
data: {
|
data: {
|
||||||
dimensions: ['name', 'value'],
|
dimensions: ['name', 'value'],
|
||||||
source: [
|
"source|2-5": [
|
||||||
{ name: '厦门', 'value|0-40': 20 },
|
{ 'name|+1': ["厦门","福州","北京","上海","新疆","郑州","湖南","内蒙古"], 'value|0-40': 20 },
|
||||||
{ name: '南阳', 'value|20-60': 40 },
|
|
||||||
{ name: '北京', 'value|40-80': 60 },
|
|
||||||
{ name: '上海', 'value|60-100': 80 },
|
|
||||||
{ name: '新疆', value: 100 }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -41,12 +39,13 @@ export default {
|
|||||||
status: 200,
|
status: 200,
|
||||||
msg: '请求成功',
|
msg: '请求成功',
|
||||||
data: {
|
data: {
|
||||||
dimensions: ['product', 'dataOne', 'dataTwo'],
|
dimensions: ['product', 'dataOne', 'dataTwo', 'dataThree'],
|
||||||
'source|50': [
|
'source|20': [
|
||||||
{
|
{
|
||||||
product: '@name',
|
product: '@name',
|
||||||
'dataOne|100-900': 3,
|
'dataOne|100-900': 3,
|
||||||
'dataTwo|100-900': 3
|
'dataTwo|100-900': 3,
|
||||||
|
'dataThree|100-900': 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -222,5 +221,19 @@ export default {
|
|||||||
'endArray|10': [{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' }]
|
'endArray|10': [{ name: '@name', N: '@integer(10, 100)', E: '@integer(10, 100)' }]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
// 桑基图
|
||||||
|
fetchSankey: {
|
||||||
|
code: 0,
|
||||||
|
status: 200,
|
||||||
|
msg: '请求成功',
|
||||||
|
data: sankeyJson
|
||||||
|
},
|
||||||
|
// 关系图
|
||||||
|
graphData: {
|
||||||
|
code: 0,
|
||||||
|
status: 200,
|
||||||
|
msg: '请求成功',
|
||||||
|
data: graphDataJson
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/assets/images/canvas/noData.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
src/assets/images/chart/charts/dial.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
src/assets/images/chart/charts/graph.png
Normal file
|
After Width: | Height: | Size: 377 KiB |
BIN
src/assets/images/chart/charts/sankey.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
src/assets/images/chart/decorates/Pipeline_H.png
Normal file
|
After Width: | Height: | Size: 999 B |
BIN
src/assets/images/chart/decorates/Pipeline_V.png
Normal file
|
After Width: | Height: | Size: 983 B |
BIN
src/assets/images/chart/icons/icon.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
src/assets/images/chart/informations/inputs_date.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
src/assets/images/chart/informations/inputs_select.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
src/assets/images/chart/informations/inputs_tab.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
src/assets/images/chart/informations/photo_carousel.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src/assets/images/chart/photos/upload.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
@@ -14,16 +14,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { useLangStore } from '@/store/modules/langStore/langStore'
|
import { useLangStore } from '@/store/modules/langStore/langStore'
|
||||||
import { langList } from '@/i18n/index'
|
import { langList } from '@/i18n/index'
|
||||||
import { LangEnum } from '@/enums/styleEnum'
|
import { LangEnum } from '@/enums/styleEnum'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
|
||||||
const { LanguageIcon } = icon.ionicons5
|
const { LanguageIcon } = icon.ionicons5
|
||||||
|
const { locale } = useI18n();
|
||||||
const langStore = useLangStore()
|
const langStore = useLangStore()
|
||||||
const options = langList
|
const options = langList
|
||||||
|
|
||||||
const handleSelect = (key: LangEnum) => {
|
const handleSelect = (key: LangEnum) => {
|
||||||
|
locale.value = key;
|
||||||
langStore.changeLang(key)
|
langStore.changeLang(key)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-modal v-model:show="modelShow" @afterLeave="closeHandle">
|
<n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
|
||||||
<n-list bordered class="go-system-info">
|
<n-list bordered class="go-system-info">
|
||||||
<template #header>
|
<template #header>
|
||||||
<n-space justify="space-between">
|
<n-space justify="space-between">
|
||||||
@@ -42,15 +42,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
|
||||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
const props = defineProps({
|
||||||
const emit = defineEmits(['update:modelShow'])
|
|
||||||
|
|
||||||
defineProps({
|
|
||||||
modelShow: Boolean
|
modelShow: Boolean
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelShow'])
|
||||||
|
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||||
|
const modelShowRef = ref(false)
|
||||||
|
|
||||||
|
watch(() => props.modelShow, (newValue) => {
|
||||||
|
modelShowRef.value = newValue
|
||||||
|
})
|
||||||
|
|
||||||
const closeHandle = () => {
|
const closeHandle = () => {
|
||||||
emit('update:modelShow', false)
|
emit('update:modelShow', false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-modal v-model:show="modelShow" @afterLeave="closeHandle">
|
<n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
|
||||||
<n-list bordered class="go-system-setting">
|
<n-list bordered class="go-system-setting">
|
||||||
<template #header>
|
<template #header>
|
||||||
<n-space justify="space-between">
|
<n-space justify="space-between">
|
||||||
@@ -69,21 +69,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script script lang="ts" setup>
|
<script script lang="ts" setup>
|
||||||
import { reactive } from 'vue'
|
import { reactive, ref, watch } from 'vue'
|
||||||
import { ListType } from './index.d'
|
import { ListType } from './index.d'
|
||||||
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
||||||
import { SettingStoreEnums, ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
|
import { SettingStoreEnums, ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
|
||||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
const props = defineProps({
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelShow'])
|
|
||||||
|
|
||||||
defineProps({
|
|
||||||
modelShow: Boolean
|
modelShow: Boolean
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelShow'])
|
||||||
|
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||||
const settingStore = useSettingStore()
|
const settingStore = useSettingStore()
|
||||||
|
const modelShowRef = ref(false)
|
||||||
|
|
||||||
const list = reactive<ListType[]>([
|
const list = reactive<ListType[]>([
|
||||||
{
|
{
|
||||||
@@ -168,6 +167,10 @@ const list = reactive<ListType[]>([
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
watch(() => props.modelShow, (newValue) => {
|
||||||
|
modelShowRef.value = newValue
|
||||||
|
})
|
||||||
|
|
||||||
const closeHandle = () => {
|
const closeHandle = () => {
|
||||||
emit('update:modelShow', false)
|
emit('update:modelShow', false)
|
||||||
}
|
}
|
||||||
|
|||||||
3
src/components/Pages/ChartGlobImage/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import ChartGlobImage from './index.vue'
|
||||||
|
|
||||||
|
export { ChartGlobImage }
|
||||||
31
src/components/Pages/ChartGlobImage/index.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<img class="list-img" v-lazy="imageInfo" alt="图表图片" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, PropType, watch } from 'vue'
|
||||||
|
import { fetchImages } from '@/packages'
|
||||||
|
import { ConfigType } from '@/packages/index.d'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
chartConfig: {
|
||||||
|
type: Object as PropType<ConfigType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const imageInfo = ref('')
|
||||||
|
|
||||||
|
// 获取图片
|
||||||
|
const fetchImageUrl = async () => {
|
||||||
|
imageInfo.value = await fetchImages(props.chartConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.chartConfig.key,
|
||||||
|
() => fetchImageUrl(),
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<template>
|
||||||
|
<n-radio-group :value="props.modelValue || INHERIT_VALUE" @update:value="handleChange">
|
||||||
|
<n-space>
|
||||||
|
<n-tooltip :show-arrow="false" trigger="hover" v-for="item in rendererList" :key="item.value">
|
||||||
|
<template #trigger>
|
||||||
|
<n-radio :value="item.value">
|
||||||
|
{{ item.value }}
|
||||||
|
</n-radio>
|
||||||
|
</template>
|
||||||
|
{{ item.desc }}
|
||||||
|
</n-tooltip>
|
||||||
|
</n-space>
|
||||||
|
</n-radio-group>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { type EchartsRenderer } from '@/settings/chartThemes'
|
||||||
|
|
||||||
|
const props = defineProps<{ modelValue?: EchartsRenderer; includeInherit?: boolean }>()
|
||||||
|
const emits = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
const INHERIT_VALUE = 'inherit'
|
||||||
|
|
||||||
|
const handleChange = (val: EchartsRenderer & typeof INHERIT_VALUE) => {
|
||||||
|
emits('update:modelValue', val === INHERIT_VALUE ? undefined : val)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rendererList = [
|
||||||
|
{
|
||||||
|
value: 'svg',
|
||||||
|
desc: '在缩放场景下具有更好的表现'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'canvas',
|
||||||
|
desc: '数据量较大(经验判断 > 1k)、较多交互时,建议选择'
|
||||||
|
},
|
||||||
|
...(props.includeInherit
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
value: INHERIT_VALUE,
|
||||||
|
desc: '默认继承全局配置'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
</script>
|
||||||
@@ -1,4 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<collapse-item name="渲染器">
|
||||||
|
<setting-item-box :alone="true">
|
||||||
|
<template #name>
|
||||||
|
<n-text>全局</n-text>
|
||||||
|
<n-tooltip trigger="hover">
|
||||||
|
<template #trigger>
|
||||||
|
<n-icon size="21" :depth="3">
|
||||||
|
<help-outline-icon></help-outline-icon>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
|
<n-text>所有echarts图表组件默认都将采用所选的渲染器进行渲染</n-text>
|
||||||
|
</n-tooltip>
|
||||||
|
</template>
|
||||||
|
<EchartsRendererSetting v-model="themeSetting.renderer" />
|
||||||
|
</setting-item-box>
|
||||||
|
<setting-item-box :alone="true">
|
||||||
|
<template #name>
|
||||||
|
<n-text>当前</n-text>
|
||||||
|
<n-tooltip trigger="hover">
|
||||||
|
<template #trigger>
|
||||||
|
<n-icon size="21" :depth="3">
|
||||||
|
<help-outline-icon></help-outline-icon>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
|
<n-text>仅当前组件采用指定渲染器渲染</n-text>
|
||||||
|
</n-tooltip>
|
||||||
|
</template>
|
||||||
|
<EchartsRendererSetting v-model="optionData.renderer" includeInherit />
|
||||||
|
</setting-item-box>
|
||||||
|
</collapse-item>
|
||||||
<collapse-item v-if="title" name="标题">
|
<collapse-item v-if="title" name="标题">
|
||||||
<template #header>
|
<template #header>
|
||||||
<n-switch v-model:value="title.show" size="small"></n-switch>
|
<n-switch v-model:value="title.show" size="small"></n-switch>
|
||||||
@@ -227,9 +257,36 @@
|
|||||||
<n-switch v-model:value="legend.show" size="small"></n-switch>
|
<n-switch v-model:value="legend.show" size="small"></n-switch>
|
||||||
</template>
|
</template>
|
||||||
<setting-item-box name="图例文字">
|
<setting-item-box name="图例文字">
|
||||||
<setting-item>
|
<setting-item name="颜色">
|
||||||
<n-color-picker size="small" v-model:value="legend.textStyle.color"></n-color-picker>
|
<n-color-picker size="small" v-model:value="legend.textStyle.color"></n-color-picker>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
|
<setting-item name="大小">
|
||||||
|
<n-input-number v-model:value="legend.textStyle.fontSize" :min="1" size="small"></n-input-number>
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
<setting-item-box name="图例位置">
|
||||||
|
<setting-item name="x轴">
|
||||||
|
<n-select v-model:value="legend.x" size="small" :options="legendConfig.lengendX" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="y轴">
|
||||||
|
<n-select v-model:value="legend.y" size="small" :options="legendConfig.lengendY" />
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
<setting-item-box name="图例信息">
|
||||||
|
<setting-item name="方向">
|
||||||
|
<n-select v-model:value="legend.orient" size="small" :options="legendConfig.orient" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="形状">
|
||||||
|
<n-select v-model:value="legend.icon" size="small" :options="legendConfig.shape" />
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
<setting-item-box name="图例大小">
|
||||||
|
<setting-item name="宽">
|
||||||
|
<n-input-number v-model:value="legend.itemWidth" :min="1" size="small"></n-input-number>
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="高">
|
||||||
|
<n-input-number v-model:value="legend.itemHeight" :min="1" size="small"></n-input-number>
|
||||||
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
</collapse-item>
|
</collapse-item>
|
||||||
|
|
||||||
@@ -279,10 +336,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, computed } from 'vue'
|
import { PropType, computed, watch } from 'vue'
|
||||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||||
import { axisConfig } from '@/packages/chartConfiguration/echarts/index'
|
import { axisConfig, legendConfig } from '@/packages/chartConfiguration/echarts/index'
|
||||||
import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting'
|
import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { icon } from '@/plugins'
|
||||||
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import EchartsRendererSetting from './EchartsRendererSetting.vue'
|
||||||
|
|
||||||
|
const { HelpOutlineIcon } = icon.ionicons5
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
optionData: {
|
optionData: {
|
||||||
@@ -296,6 +358,12 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const chartEditStore = useChartEditStore()
|
||||||
|
const themeSetting = computed(() => {
|
||||||
|
const chartThemeSetting = chartEditStore.getEditCanvasConfig.chartThemeSetting
|
||||||
|
return chartThemeSetting
|
||||||
|
})
|
||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
return props.optionData.title
|
return props.optionData.title
|
||||||
})
|
})
|
||||||
@@ -319,4 +387,14 @@ const grid = computed(() => {
|
|||||||
const visualMap = computed(() => {
|
const visualMap = computed(() => {
|
||||||
return props.optionData.visualMap
|
return props.optionData.visualMap
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 监听legend color颜色改变type = scroll的颜色
|
||||||
|
watch(() => legend.value && legend.value.textStyle.color, (newVal) => {
|
||||||
|
if (legend.value && newVal) {
|
||||||
|
legend.value.pageTextStyle.color = newVal
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="go-Flipper" :class="[flipType, { go: isFlipping }]">
|
<div class="go-flipper" :class="[flipType, { go: isFlipping }]">
|
||||||
<div class="digital front" :data-front="frontTextFromData"></div>
|
<div class="digital front" :data-front="frontTextFromData"></div>
|
||||||
<div class="digital back" :data-back="backTextFromData"></div>
|
<div class="digital back" :data-back="backTextFromData"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, PropType, watch } from 'vue'
|
import { ref, PropType, watch, nextTick } from 'vue'
|
||||||
import { FlipType } from './index'
|
import { FlipType } from './index'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
flipType: {
|
flipType: {
|
||||||
@@ -43,6 +43,10 @@ const props = defineProps({
|
|||||||
backColor: {
|
backColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#000000'
|
default: '#000000'
|
||||||
|
},
|
||||||
|
borderWidth: {
|
||||||
|
type: Number,
|
||||||
|
default: 2
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -50,19 +54,27 @@ const isFlipping = ref(false)
|
|||||||
const frontTextFromData = ref(props.count || 0)
|
const frontTextFromData = ref(props.count || 0)
|
||||||
const backTextFromData = ref(props.count || 0)
|
const backTextFromData = ref(props.count || 0)
|
||||||
|
|
||||||
|
let timeoutID: any = 0
|
||||||
|
|
||||||
// 翻牌
|
// 翻牌
|
||||||
const flip = (front: string | number, back: string | number) => {
|
const flip = async (front: string | number, back: string | number) => {
|
||||||
// 如果处于翻转中,则不执行
|
// 如果处于翻转中,则不执行
|
||||||
if (isFlipping.value) return
|
if (isFlipping.value) {
|
||||||
|
isFlipping.value = false // 立即结束此次动画
|
||||||
|
clearTimeout(timeoutID) // 清除上一个计时器任务
|
||||||
|
await nextTick()
|
||||||
|
await flip(front, back) // 开始最后一次翻牌任务
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 设置翻盘前后数据
|
// 设置翻盘前后数据
|
||||||
backTextFromData.value = back
|
backTextFromData.value = back
|
||||||
frontTextFromData.value = front
|
frontTextFromData.value = front
|
||||||
|
|
||||||
// 设置翻转状态为true
|
// 设置翻转状态为true
|
||||||
isFlipping.value = true
|
isFlipping.value = true
|
||||||
|
|
||||||
// 翻牌结束的行为
|
// 翻牌结束的行为
|
||||||
setTimeout(() => {
|
timeoutID = setTimeout(() => {
|
||||||
isFlipping.value = false // 设置翻转状态为false
|
isFlipping.value = false // 设置翻转状态为false
|
||||||
frontTextFromData.value = back
|
frontTextFromData.value = back
|
||||||
}, props.duration)
|
}, props.duration)
|
||||||
@@ -86,6 +98,7 @@ $radius: v-bind('`${props.radius}px`');
|
|||||||
$width: v-bind('`${props.width}px`');
|
$width: v-bind('`${props.width}px`');
|
||||||
$height: v-bind('`${props.height}px`');
|
$height: v-bind('`${props.height}px`');
|
||||||
$perspective: v-bind('`${props.height * 2}px`');
|
$perspective: v-bind('`${props.height * 2}px`');
|
||||||
|
$borderWidth: v-bind('`${props.borderWidth * 2}px`');
|
||||||
$speed: v-bind('`${props.duration / 1000}s`');
|
$speed: v-bind('`${props.duration / 1000}s`');
|
||||||
$shadowColor: #000000;
|
$shadowColor: #000000;
|
||||||
$lineColor: #4a9ef8;
|
$lineColor: #4a9ef8;
|
||||||
@@ -125,13 +138,12 @@ $lineColor: #4a9ef8;
|
|||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
.go-Flipper {
|
.go-flipper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: $width;
|
width: $width;
|
||||||
height: $height;
|
height: $height;
|
||||||
line-height: $height;
|
line-height: $height;
|
||||||
border: solid 1px $backColor;
|
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
background: $frontColor;
|
background: $frontColor;
|
||||||
font-size: $width;
|
font-size: $width;
|
||||||
@@ -139,6 +151,17 @@ $lineColor: #4a9ef8;
|
|||||||
box-shadow: 0 0 6px rgba($color: $shadowColor, $alpha: 0.5); // 阴影部分
|
box-shadow: 0 0 6px rgba($color: $shadowColor, $alpha: 0.5); // 阴影部分
|
||||||
text-align: center;
|
text-align: center;
|
||||||
// font-family: 'Helvetica Neue';
|
// font-family: 'Helvetica Neue';
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
z-index: 10;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
box-shadow: inset 0 0 $borderWidth 0 $frontColor; // 内测阴影部分
|
||||||
|
border-radius: $radius;
|
||||||
|
}
|
||||||
|
|
||||||
.digital:before,
|
.digital:before,
|
||||||
.digital:after {
|
.digital:after {
|
||||||
@@ -186,11 +209,13 @@ $lineColor: #4a9ef8;
|
|||||||
&.down.go .front:before {
|
&.down.go .front:before {
|
||||||
transform-origin: 50% 100%;
|
transform-origin: 50% 100%;
|
||||||
animation: frontFlipDown $speed ease-in-out both;
|
animation: frontFlipDown $speed ease-in-out both;
|
||||||
box-shadow: 0 -2px 6px rgba($color: $lineColor, $alpha: 0.3);
|
box-shadow: 0 -2px $borderWidth 0 $frontColor;
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
}
|
}
|
||||||
&.down.go .back:after {
|
&.down.go .back:after {
|
||||||
animation: backFlipDown $speed ease-in-out both;
|
animation: backFlipDown $speed ease-in-out both;
|
||||||
|
box-shadow: 0 2px $borderWidth 0 $frontColor;
|
||||||
|
backface-visibility: hidden;
|
||||||
}
|
}
|
||||||
/*向上翻*/
|
/*向上翻*/
|
||||||
&.up .front:after {
|
&.up .front:after {
|
||||||
@@ -208,11 +233,13 @@ $lineColor: #4a9ef8;
|
|||||||
&.up.go .front:after {
|
&.up.go .front:after {
|
||||||
transform-origin: 50% 0;
|
transform-origin: 50% 0;
|
||||||
animation: frontFlipUp $speed ease-in-out both;
|
animation: frontFlipUp $speed ease-in-out both;
|
||||||
box-shadow: 0 2px 6px rgba($color: $lineColor, $alpha: 0.3);
|
box-shadow: 0 2px $borderWidth 0 $frontColor;
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
}
|
}
|
||||||
&.up.go .back:before {
|
&.up.go .back:before {
|
||||||
animation: backFlipUp $speed ease-in-out both;
|
animation: backFlipUp $speed ease-in-out both;
|
||||||
|
box-shadow: 0 -2px $borderWidth 0 $frontColor;
|
||||||
|
backface-visibility: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ const colorSelectHandle = (color: AppThemeColorType) => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
@extend .go-background-filter-shallow;
|
@extend .go-background-filter-shallow;
|
||||||
|
backdrop-filter: none;
|
||||||
}
|
}
|
||||||
&-color {
|
&-color {
|
||||||
width: 8px;
|
width: 8px;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="model-footer">
|
<div class="model-footer">
|
||||||
中国色列表来自于:
|
中国色列表来自于:
|
||||||
<n-a href="http://zhongguose.com">http://zhongguose.com</n-a>
|
<n-a href="http://zhongguose.com" target="_blank">http://zhongguose.com</n-a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
@@ -157,6 +157,7 @@ $height: 85vh;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.model-footer {
|
.model-footer {
|
||||||
|
z-index: 1;
|
||||||
text-align: end;
|
text-align: end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ export enum DragKeyEnum {
|
|||||||
// 不同页面保存操作
|
// 不同页面保存操作
|
||||||
export enum SavePageEnum {
|
export enum SavePageEnum {
|
||||||
CHART = 'SaveChart',
|
CHART = 'SaveChart',
|
||||||
JSON = 'SaveJSON'
|
CHART_TO_PREVIEW = 'ChartToPreview',
|
||||||
|
JSON = 'SaveJSON',
|
||||||
|
CLOSE = 'close'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作枚举
|
// 操作枚举
|
||||||
@@ -67,7 +69,8 @@ export enum WinKeyboard {
|
|||||||
ALT = ' alt',
|
ALT = ' alt',
|
||||||
CTRL_SOURCE_KEY = 'control',
|
CTRL_SOURCE_KEY = 'control',
|
||||||
SHIFT_SOURCE_KEY = 'shift',
|
SHIFT_SOURCE_KEY = 'shift',
|
||||||
ALT_SOURCE_KEY = 'alt'
|
ALT_SOURCE_KEY = 'alt',
|
||||||
|
SPACE = 'Space'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mac 键盘枚举
|
// Mac 键盘枚举
|
||||||
@@ -78,5 +81,6 @@ export enum MacKeyboard {
|
|||||||
ALT = '⌥',
|
ALT = '⌥',
|
||||||
CTRL_SOURCE_KEY = '⌘',
|
CTRL_SOURCE_KEY = '⌘',
|
||||||
SHIFT_SOURCE_KEY = '⇧',
|
SHIFT_SOURCE_KEY = '⇧',
|
||||||
ALT_SOURCE_KEY = '⌥'
|
ALT_SOURCE_KEY = '⌥',
|
||||||
|
SPACE = 'Space'
|
||||||
}
|
}
|
||||||
|
|||||||
59
src/enums/eventEnum.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
// 基础事件类型(vue不加 on)
|
||||||
|
export enum BaseEvent {
|
||||||
|
// 点击
|
||||||
|
ON_CLICK = 'click',
|
||||||
|
// 双击
|
||||||
|
ON_DBL_CLICK = 'dblclick',
|
||||||
|
// 移入
|
||||||
|
ON_MOUSE_ENTER = 'mouseenter',
|
||||||
|
// 移出
|
||||||
|
ON_MOUSE_LEAVE = 'mouseleave'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件交互回调事件
|
||||||
|
export enum InteractEvents {
|
||||||
|
INTERACT_ON = 'interactOn',
|
||||||
|
INTERACT_COMPONENT_ID = 'interactComponentId',
|
||||||
|
INTERACT_FN = 'interactFn'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全局组件交互回调事件触发的类型(当然可以自定义名称)
|
||||||
|
export enum InteractEventOn {
|
||||||
|
CLICK = 'click',
|
||||||
|
CHANGE = 'change'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确定交互组件触发类型 key名称
|
||||||
|
export const COMPONENT_INTERACT_EVENT_KET = 'componentInteractEventKey'
|
||||||
|
|
||||||
|
// 交互式组件的触发配置
|
||||||
|
export type InteractActionsType = {
|
||||||
|
interactType: InteractEventOn
|
||||||
|
interactName: string
|
||||||
|
componentEmitEvents: { [T: string]: { value: any; label: string }[] }
|
||||||
|
}
|
||||||
|
|
||||||
|
// vue3 生命周期事件
|
||||||
|
export enum EventLife {
|
||||||
|
// 渲染之后
|
||||||
|
VNODE_MOUNTED = 'vnodeMounted',
|
||||||
|
// 渲染之前
|
||||||
|
VNODE_BEFORE_MOUNT = 'vnodeBeforeMount'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 内置字符串函数对象列表
|
||||||
|
export const excludeParseEventKeyList = [
|
||||||
|
EventLife.VNODE_BEFORE_MOUNT,
|
||||||
|
EventLife.VNODE_MOUNTED,
|
||||||
|
BaseEvent.ON_CLICK,
|
||||||
|
BaseEvent.ON_DBL_CLICK,
|
||||||
|
BaseEvent.ON_MOUSE_ENTER,
|
||||||
|
BaseEvent.ON_MOUSE_LEAVE,
|
||||||
|
//过滤器
|
||||||
|
'filter'
|
||||||
|
]
|
||||||
|
// 内置字符串函数键值列表
|
||||||
|
export const excludeParseEventValueList = [
|
||||||
|
// 请求里的函数语句
|
||||||
|
'javascript:'
|
||||||
|
]
|
||||||
@@ -15,7 +15,9 @@ export enum RequestDataTypeEnum {
|
|||||||
// 静态数据
|
// 静态数据
|
||||||
STATIC = 0,
|
STATIC = 0,
|
||||||
// 请求数据
|
// 请求数据
|
||||||
AJAX = 1
|
AJAX = 1,
|
||||||
|
// 数据池
|
||||||
|
Pond = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求主体类型
|
// 请求主体类型
|
||||||
|
|||||||
@@ -12,5 +12,7 @@ export enum StorageEnum {
|
|||||||
// 工作台布局配置
|
// 工作台布局配置
|
||||||
GO_CHART_LAYOUT_STORE = 'GO_CHART_LAYOUT',
|
GO_CHART_LAYOUT_STORE = 'GO_CHART_LAYOUT',
|
||||||
// 工作台需要保存的数据
|
// 工作台需要保存的数据
|
||||||
GO_CHART_STORAGE_LIST = 'GO_CHART_STORAGE_LIST'
|
GO_CHART_STORAGE_LIST = 'GO_CHART_STORAGE_LIST',
|
||||||
|
// 用户存储的图片媒体
|
||||||
|
GO_USER_MEDIA_PHOTOS = 'GO_USER_MEDIA_PHOTOS'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,7 @@ export * from '@/hooks/useTheme.hook'
|
|||||||
export * from '@/hooks/usePreviewScale.hook'
|
export * from '@/hooks/usePreviewScale.hook'
|
||||||
export * from '@/hooks/useCode.hook'
|
export * from '@/hooks/useCode.hook'
|
||||||
export * from '@/hooks/useChartDataFetch.hook'
|
export * from '@/hooks/useChartDataFetch.hook'
|
||||||
|
export * from '@/hooks/useChartDataPondFetch.hook'
|
||||||
export * from '@/hooks/useLifeHandler.hook'
|
export * from '@/hooks/useLifeHandler.hook'
|
||||||
export * from '@/hooks/useLang.hook'
|
export * from '@/hooks/useLang.hook'
|
||||||
|
export * from '@/hooks/useChartInteract.hook'
|
||||||
26
src/hooks/useCanvasInitOptions.hook.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { inject, type Ref } from 'vue'
|
||||||
|
import { EchartsRenderer } from '@/settings/chartThemes'
|
||||||
|
import { SCALE_KEY } from '@/views/preview/hooks/useScale.hook'
|
||||||
|
import { use } from 'echarts/core'
|
||||||
|
import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'
|
||||||
|
|
||||||
|
use([CanvasRenderer, SVGRenderer])
|
||||||
|
|
||||||
|
type InitOptions = {
|
||||||
|
renderer: EchartsRenderer
|
||||||
|
devicePixelRatio?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取需要给当前echarts组件设置什么初始值
|
||||||
|
export function useCanvasInitOptions(option: any, themeSetting: any) {
|
||||||
|
const renderer = option.renderer || themeSetting.renderer
|
||||||
|
const initOptions: InitOptions = { renderer }
|
||||||
|
const scaleRef = inject<Ref<{ width: number; height: number }>>(SCALE_KEY) || { value: { width: 1, height: 1 } }
|
||||||
|
|
||||||
|
if (renderer === 'canvas') {
|
||||||
|
initOptions.devicePixelRatio = Math.ceil(
|
||||||
|
Math.max(window.devicePixelRatio, scaleRef.value.width, scaleRef.value.height)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return initOptions
|
||||||
|
}
|
||||||
@@ -1,99 +1,123 @@
|
|||||||
import { ref, toRefs, toRaw } from 'vue'
|
import { ref, toRefs, toRaw, watch } from 'vue'
|
||||||
import type VChart from 'vue-echarts'
|
import type VChart from 'vue-echarts'
|
||||||
import { customizeHttp } from '@/api/http'
|
import { customizeHttp } from '@/api/http'
|
||||||
import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d'
|
import { useChartDataPondFetch } from '@/hooks/'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { isPreview, newFunctionHandle, intervalUnitHandle } from '@/utils'
|
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||||
|
import { isPreview, newFunctionHandle, intervalUnitHandle } from '@/utils'
|
||||||
// 获取类型
|
import { setOption } from '@/packages/public/chart'
|
||||||
type ChartEditStoreType = typeof useChartEditStore
|
|
||||||
|
// 获取类型
|
||||||
/**
|
type ChartEditStoreType = typeof useChartEditStore
|
||||||
* setdata 数据监听与更改
|
|
||||||
* @param targetComponent
|
/**
|
||||||
* @param useChartEditStore 若直接引会报错,只能动态传递
|
* setdata 数据监听与更改
|
||||||
* @param updateCallback 自定义更新函数
|
* @param targetComponent
|
||||||
*/
|
* @param useChartEditStore 若直接引会报错,只能动态传递
|
||||||
export const useChartDataFetch = (
|
* @param updateCallback 自定义更新函数
|
||||||
targetComponent: CreateComponentType,
|
*/
|
||||||
useChartEditStore: ChartEditStoreType,
|
export const useChartDataFetch = (
|
||||||
updateCallback?: (...args: any) => any
|
targetComponent: CreateComponentType,
|
||||||
) => {
|
useChartEditStore: ChartEditStoreType,
|
||||||
const vChartRef = ref<typeof VChart | null>(null)
|
updateCallback?: (...args: any) => any
|
||||||
let fetchInterval: any = 0
|
) => {
|
||||||
|
const vChartRef = ref<typeof VChart | null>(null)
|
||||||
const requestIntervalFn = () => {
|
let fetchInterval: any = 0
|
||||||
const chartEditStore = useChartEditStore()
|
|
||||||
|
// 数据池
|
||||||
// 全局数据
|
const { addGlobalDataInterface } = useChartDataPondFetch()
|
||||||
const {
|
|
||||||
requestOriginUrl,
|
// 组件类型
|
||||||
requestIntervalUnit: globalUnit,
|
const { chartFrame } = targetComponent.chartConfig
|
||||||
requestInterval: globalRequestInterval
|
|
||||||
} = toRefs(chartEditStore.getRequestGlobalConfig)
|
// eCharts 组件配合 vChart 库更新方式
|
||||||
|
const echartsUpdateHandle = (dataset: any) => {
|
||||||
// 目标组件
|
if (chartFrame === ChartFrameEnum.ECHARTS) {
|
||||||
const {
|
if (vChartRef.value) {
|
||||||
requestDataType,
|
setOption(vChartRef.value, { dataset: dataset })
|
||||||
requestUrl,
|
}
|
||||||
requestIntervalUnit: targetUnit,
|
}
|
||||||
requestInterval: targetInterval
|
}
|
||||||
} = toRefs(targetComponent.request)
|
|
||||||
|
const requestIntervalFn = () => {
|
||||||
// 组件类型
|
const chartEditStore = useChartEditStore()
|
||||||
const { chartFrame } = targetComponent.chartConfig
|
|
||||||
|
// 全局数据
|
||||||
// 非请求类型
|
const {
|
||||||
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
|
requestOriginUrl,
|
||||||
|
requestIntervalUnit: globalUnit,
|
||||||
try {
|
requestInterval: globalRequestInterval
|
||||||
// 处理地址
|
} = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||||
// @ts-ignore
|
|
||||||
if (requestUrl?.value) {
|
// 目标组件
|
||||||
// requestOriginUrl 允许为空
|
const {
|
||||||
const completePath = requestOriginUrl && requestOriginUrl.value + requestUrl.value
|
requestDataType,
|
||||||
if (!completePath) return
|
requestUrl,
|
||||||
|
requestIntervalUnit: targetUnit,
|
||||||
clearInterval(fetchInterval)
|
requestInterval: targetInterval
|
||||||
|
} = toRefs(targetComponent.request)
|
||||||
const fetchFn = async () => {
|
|
||||||
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.requestGlobalConfig))
|
// 非请求类型
|
||||||
if (res) {
|
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
|
||||||
try {
|
|
||||||
const filter = targetComponent.filter
|
try {
|
||||||
// eCharts 组件配合 vChart 库更新方式
|
// 处理地址
|
||||||
if (chartFrame === ChartFrameEnum.ECHARTS) {
|
// @ts-ignore
|
||||||
if (vChartRef.value) {
|
if (requestUrl?.value) {
|
||||||
vChartRef.value.setOption({ dataset: newFunctionHandle(res?.data, res, filter) })
|
// requestOriginUrl 允许为空
|
||||||
}
|
const completePath = requestOriginUrl && requestOriginUrl.value + requestUrl.value
|
||||||
}
|
if (!completePath) return
|
||||||
// 更新回调函数
|
|
||||||
if (updateCallback) {
|
clearInterval(fetchInterval)
|
||||||
updateCallback(newFunctionHandle(res?.data, res, filter))
|
|
||||||
}
|
const fetchFn = async () => {
|
||||||
} catch (error) {
|
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
||||||
console.error(error)
|
if (res) {
|
||||||
}
|
try {
|
||||||
}
|
const filter = targetComponent.filter
|
||||||
}
|
const { data } = res
|
||||||
|
echartsUpdateHandle(newFunctionHandle(data, res, filter))
|
||||||
// 立即调用
|
// 更新回调函数
|
||||||
fetchFn()
|
if (updateCallback) {
|
||||||
|
updateCallback(newFunctionHandle(data, res, filter))
|
||||||
// 定时时间
|
}
|
||||||
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
|
} catch (error) {
|
||||||
// 单位
|
console.error(error)
|
||||||
const unit = targetInterval && targetInterval.value ? targetUnit.value : globalUnit.value
|
}
|
||||||
// 开启轮询
|
}
|
||||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
}
|
||||||
}
|
|
||||||
// eslint-disable-next-line no-empty
|
// 普通初始化与组件交互处理监听
|
||||||
} catch (error) {
|
watch(
|
||||||
console.log(error)
|
() => targetComponent.request,
|
||||||
}
|
() => {
|
||||||
}
|
fetchFn()
|
||||||
|
},
|
||||||
isPreview() && requestIntervalFn()
|
{
|
||||||
return { vChartRef }
|
immediate: true,
|
||||||
}
|
deep: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 定时时间
|
||||||
|
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
|
||||||
|
// 单位
|
||||||
|
const unit = targetInterval && targetInterval.value ? targetUnit.value : globalUnit.value
|
||||||
|
// 开启轮询
|
||||||
|
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPreview()) {
|
||||||
|
// 判断是否是数据池类型
|
||||||
|
targetComponent.request.requestDataType === RequestDataTypeEnum.Pond
|
||||||
|
? addGlobalDataInterface(targetComponent, useChartEditStore, updateCallback || echartsUpdateHandle)
|
||||||
|
: requestIntervalFn()
|
||||||
|
}
|
||||||
|
return { vChartRef }
|
||||||
|
}
|
||||||
|
|||||||
115
src/hooks/useChartDataPondFetch.hook.ts
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
import { toRaw } from 'vue'
|
||||||
|
import { customizeHttp } from '@/api/http'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import { RequestGlobalConfigType, RequestDataPondItemType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||||
|
import { newFunctionHandle, intervalUnitHandle } from '@/utils'
|
||||||
|
|
||||||
|
// 获取类型
|
||||||
|
type ChartEditStoreType = typeof useChartEditStore
|
||||||
|
|
||||||
|
// 数据池存储的数据类型
|
||||||
|
type DataPondMapType = {
|
||||||
|
updateCallback: (...args: any) => any
|
||||||
|
filter?: string | undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数据池 Map 中请求对应 callback
|
||||||
|
const mittDataPondMap = new Map<string, DataPondMapType[]>()
|
||||||
|
|
||||||
|
// 创建单个数据项轮询接口
|
||||||
|
const newPondItemInterval = (
|
||||||
|
requestGlobalConfig: RequestGlobalConfigType,
|
||||||
|
requestDataPondItem: RequestDataPondItemType,
|
||||||
|
dataPondMapItem?: DataPondMapType[]
|
||||||
|
) => {
|
||||||
|
if (!dataPondMapItem) return
|
||||||
|
let fetchInterval: any = 0
|
||||||
|
|
||||||
|
clearInterval(fetchInterval)
|
||||||
|
|
||||||
|
// 请求
|
||||||
|
const fetchFn = async () => {
|
||||||
|
try {
|
||||||
|
const res = await customizeHttp(toRaw(requestDataPondItem.dataPondRequestConfig), toRaw(requestGlobalConfig))
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
try {
|
||||||
|
// 遍历更新回调函数
|
||||||
|
dataPondMapItem.forEach(item => {
|
||||||
|
item.updateCallback(newFunctionHandle(res?.data, res, item.filter))
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即调用
|
||||||
|
fetchFn()
|
||||||
|
|
||||||
|
const targetInterval = requestDataPondItem.dataPondRequestConfig.requestInterval
|
||||||
|
const targetUnit = requestDataPondItem.dataPondRequestConfig.requestIntervalUnit
|
||||||
|
|
||||||
|
const globalRequestInterval = requestGlobalConfig.requestInterval
|
||||||
|
const globalUnit = requestGlobalConfig.requestIntervalUnit
|
||||||
|
|
||||||
|
// 定时时间
|
||||||
|
const time = targetInterval ? targetInterval : globalRequestInterval
|
||||||
|
// 单位
|
||||||
|
const unit = targetInterval ? targetUnit : globalUnit
|
||||||
|
// 开启轮询
|
||||||
|
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据池接口处理
|
||||||
|
*/
|
||||||
|
export const useChartDataPondFetch = () => {
|
||||||
|
// 新增全局接口
|
||||||
|
const addGlobalDataInterface = (
|
||||||
|
targetComponent: CreateComponentType,
|
||||||
|
useChartEditStore: ChartEditStoreType,
|
||||||
|
updateCallback: (...args: any) => any
|
||||||
|
) => {
|
||||||
|
const chartEditStore = useChartEditStore()
|
||||||
|
const { requestDataPond } = chartEditStore.getRequestGlobalConfig
|
||||||
|
|
||||||
|
// 组件对应的数据池 Id
|
||||||
|
const requestDataPondId = targetComponent.request.requestDataPondId as string
|
||||||
|
// 新增数据项
|
||||||
|
const mittPondIdArr = mittDataPondMap.get(requestDataPondId) || []
|
||||||
|
mittPondIdArr.push({
|
||||||
|
updateCallback: updateCallback,
|
||||||
|
filter: targetComponent.filter
|
||||||
|
})
|
||||||
|
mittDataPondMap.set(requestDataPondId, mittPondIdArr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除旧数据
|
||||||
|
const clearMittDataPondMap = () => {
|
||||||
|
mittDataPondMap.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化数据池
|
||||||
|
const initDataPond = (requestGlobalConfig: RequestGlobalConfigType) => {
|
||||||
|
const { requestDataPond } = requestGlobalConfig
|
||||||
|
// 根据 mapId 查找对应的数据池配置
|
||||||
|
for (let pondKey of mittDataPondMap.keys()) {
|
||||||
|
const requestDataPondItem = requestDataPond.find(item => item.dataPondId === pondKey)
|
||||||
|
if (requestDataPondItem) {
|
||||||
|
newPondItemInterval(requestGlobalConfig, requestDataPondItem, mittDataPondMap.get(pondKey))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
addGlobalDataInterface,
|
||||||
|
clearMittDataPondMap,
|
||||||
|
initDataPond
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/hooks/useChartInteract.hook.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { toRefs } from 'vue'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
|
||||||
|
// 获取类型
|
||||||
|
type ChartEditStoreType = typeof useChartEditStore
|
||||||
|
|
||||||
|
// Params 参数修改触发 api 更新图表请求
|
||||||
|
export const useChartInteract = (
|
||||||
|
chartConfig: CreateComponentType,
|
||||||
|
useChartEditStore: ChartEditStoreType,
|
||||||
|
param: { [T: string]: any },
|
||||||
|
interactEventOn: string
|
||||||
|
) => {
|
||||||
|
const chartEditStore = useChartEditStore()
|
||||||
|
const { interactEvents } = chartConfig.events
|
||||||
|
const fnOnEvent = interactEvents.filter(item => {
|
||||||
|
return item.interactOn === interactEventOn
|
||||||
|
})
|
||||||
|
|
||||||
|
if (fnOnEvent.length === 0) return
|
||||||
|
fnOnEvent.forEach(item => {
|
||||||
|
const index = chartEditStore.fetchTargetIndex(item.interactComponentId)
|
||||||
|
if (index === -1) return
|
||||||
|
const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams)
|
||||||
|
Object.keys(item.interactFn).forEach(key => {
|
||||||
|
if (Params.value[key]) {
|
||||||
|
Params.value[key] = param[item.interactFn[key]]
|
||||||
|
}
|
||||||
|
if (Header.value[key]) {
|
||||||
|
Header.value[key] = param[item.interactFn[key]]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 联动事件触发的 type 变更时,清除当前绑定内容
|
||||||
|
export const clearInteractEvent = (chartConfig: CreateComponentType) => {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { CreateComponentType, EventLife } from '@/packages/index.d'
|
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
||||||
|
import { EventLife } from '@/enums/eventEnum'
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts'
|
||||||
|
|
||||||
// 所有图表组件集合对象
|
// 所有图表组件集合对象
|
||||||
@@ -7,26 +8,57 @@ const components: { [K in string]?: any } = {}
|
|||||||
// 项目提供的npm 包变量
|
// 项目提供的npm 包变量
|
||||||
export const npmPkgs = { echarts }
|
export const npmPkgs = { echarts }
|
||||||
|
|
||||||
export const useLifeHandler = (chartConfig: CreateComponentType) => {
|
// 组件事件处理 hook
|
||||||
const events = chartConfig.events || {}
|
export const useLifeHandler = (chartConfig: CreateComponentType | CreateComponentGroupType) => {
|
||||||
|
if (!chartConfig.events) return {}
|
||||||
|
|
||||||
|
// 处理基础事件
|
||||||
|
const baseEvent: { [key: string]: any } = {}
|
||||||
|
for (const key in chartConfig.events.baseEvent) {
|
||||||
|
const fnStr: string | undefined = (chartConfig.events.baseEvent as any)[key]
|
||||||
|
// 动态绑定基础事件
|
||||||
|
if (fnStr) {
|
||||||
|
baseEvent[key] = generateBaseFunc(fnStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 生成生命周期事件
|
// 生成生命周期事件
|
||||||
|
const events = chartConfig.events.advancedEvents || {}
|
||||||
const lifeEvents = {
|
const lifeEvents = {
|
||||||
[EventLife.BEFORE_MOUNT](e: any) {
|
[EventLife.VNODE_BEFORE_MOUNT](e: any) {
|
||||||
// 存储组件
|
// 存储组件
|
||||||
components[chartConfig.id] = e.component
|
components[chartConfig.id] = e.component
|
||||||
const fnStr = (events[EventLife.BEFORE_MOUNT] || '').trim()
|
const fnStr = (events[EventLife.VNODE_BEFORE_MOUNT] || '').trim()
|
||||||
generateFunc(fnStr, e)
|
generateFunc(fnStr, e)
|
||||||
},
|
},
|
||||||
[EventLife.MOUNTED](e: any) {
|
[EventLife.VNODE_MOUNTED](e: any) {
|
||||||
const fnStr = (events[EventLife.MOUNTED] || '').trim()
|
const fnStr = (events[EventLife.VNODE_MOUNTED] || '').trim()
|
||||||
generateFunc(fnStr, e)
|
generateFunc(fnStr, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lifeEvents
|
return { ...baseEvent, ...lifeEvents }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 生成基础函数
|
||||||
|
* @param fnStr 用户方法体代码
|
||||||
|
* @param event 鼠标事件
|
||||||
|
*/
|
||||||
|
export function generateBaseFunc(fnStr: string) {
|
||||||
|
try {
|
||||||
|
return new Function(`
|
||||||
|
return (
|
||||||
|
async function(mouseEvent){
|
||||||
|
${fnStr}
|
||||||
|
}
|
||||||
|
)`)()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成高级函数
|
||||||
* @param fnStr 用户方法体代码
|
* @param fnStr 用户方法体代码
|
||||||
* @param e 执行生命周期的动态组件实例
|
* @param e 执行生命周期的动态组件实例
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ export const langList = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
|
legacy: false,
|
||||||
|
globalInjection:true,
|
||||||
locale: langStorage?.lang || lang,
|
locale: langStorage?.lang || lang,
|
||||||
fallbackLocale: langStorage?.lang || lang,
|
fallbackLocale: langStorage?.lang || lang,
|
||||||
messages: {
|
messages: {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-layout-header bordered class="go-header">
|
<n-layout-header bordered class="go-header">
|
||||||
<header class="go-header-box">
|
<header class="go-header-box" :class="{ 'is-project': isProject }">
|
||||||
<div class="header-item left">
|
<div class="header-item left">
|
||||||
<n-space>
|
<n-space>
|
||||||
<slot name="left"></slot>
|
<slot name="left"></slot>
|
||||||
@@ -23,17 +23,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
import { GoThemeSelect } from '@/components/GoThemeSelect'
|
import { GoThemeSelect } from '@/components/GoThemeSelect'
|
||||||
import { GoLangSelect } from '@/components/GoLangSelect'
|
import { GoLangSelect } from '@/components/GoLangSelect'
|
||||||
import { ThemeColorSelect } from '@/components/Pages/ThemeColorSelect'
|
import { ThemeColorSelect } from '@/components/Pages/ThemeColorSelect'
|
||||||
|
import { PageEnum } from '@/enums/pageEnum'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const isProject = computed(() => {
|
||||||
|
return route.fullPath === PageEnum.BASE_HOME_ITEMS
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$min-width: 400px;
|
$min-width: 520px;
|
||||||
@include go(header) {
|
@include go(header) {
|
||||||
&-box {
|
&-box {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 33.33%);
|
grid-template-columns: repeat(3, 33%);
|
||||||
|
&.is-project {
|
||||||
|
grid-template-columns: none;
|
||||||
|
}
|
||||||
.header-item {
|
.header-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -49,7 +61,7 @@ $min-width: 400px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
height: $--header-height;
|
height: $--header-height;
|
||||||
padding: 0 60px;
|
padding: 0 20px 0 60px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view>
|
<router-view>
|
||||||
<template #default="{ Component, route }">
|
<template #default="{ Component, route }">
|
||||||
<component
|
<component v-if="route.meta.noKeepAlive" :is="Component"></component>
|
||||||
v-if="route.noKeepAlive"
|
|
||||||
:is="Component"
|
|
||||||
:key="route.fullPath"
|
|
||||||
></component>
|
|
||||||
<keep-alive v-else>
|
<keep-alive v-else>
|
||||||
<component :is="Component" :key="route.fullPath"></component>
|
<component :is="Component"></component>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</template>
|
</template>
|
||||||
</router-view>
|
</router-view>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view #default="{ Component, route }">
|
<router-view #default="{ Component, route }">
|
||||||
<transition name="fade" mode="out-in" appear>
|
<transition name="fade" mode="out-in" appear>
|
||||||
<component
|
<component
|
||||||
v-if="route.noKeepAlive"
|
v-if="route.meta.noKeepAlive"
|
||||||
:is="Component"
|
:is="Component"
|
||||||
:key="route.fullPath"
|
:key="route.fullPath"
|
||||||
></component>
|
></component>
|
||||||
<keep-alive v-else>
|
<keep-alive v-else>
|
||||||
<component :is="Component" :key="route.fullPath"></component>
|
<component :is="Component" :key="route.fullPath"></component>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import App from './App.vue'
|
|||||||
import router, { setupRouter } from '@/router'
|
import router, { setupRouter } from '@/router'
|
||||||
import i18n from '@/i18n/index'
|
import i18n from '@/i18n/index'
|
||||||
import { setupStore } from '@/store'
|
import { setupStore } from '@/store'
|
||||||
import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins'
|
import { setupNaive, setupDirectives, setupCustomComponents, initFunction } from '@/plugins'
|
||||||
import { GoAppProvider } from '@/components/GoAppProvider/index'
|
import { GoAppProvider } from '@/components/GoAppProvider/index'
|
||||||
import { setHtmlTheme } from '@/utils'
|
import { setHtmlTheme } from '@/utils'
|
||||||
|
|
||||||
@@ -53,4 +53,7 @@ async function appInit() {
|
|||||||
window['$vue'] = app
|
window['$vue'] = app
|
||||||
}
|
}
|
||||||
|
|
||||||
void appInit()
|
appInit().then(() => {
|
||||||
|
initFunction()
|
||||||
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
export * from './axis'
|
export * from './axis'
|
||||||
export * from './line'
|
export * from './line'
|
||||||
|
export * from './label'
|
||||||
|
export * from './legend'
|
||||||
7
src/packages/chartConfiguration/echarts/label.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const labelConfig = {
|
||||||
|
position: [
|
||||||
|
{ label: '外侧', value: 'outside' },
|
||||||
|
{ label: '内部', value: 'inside' },
|
||||||
|
{ label: '中心', value: 'center' }
|
||||||
|
]
|
||||||
|
}
|
||||||
70
src/packages/chartConfiguration/echarts/legend.ts
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
export const legendConfig = {
|
||||||
|
// X轴位置
|
||||||
|
lengendX: [
|
||||||
|
{
|
||||||
|
label: '靠左',
|
||||||
|
value: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '居中',
|
||||||
|
value: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '靠右',
|
||||||
|
value: 'right'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// y轴位置
|
||||||
|
lengendY: [
|
||||||
|
{
|
||||||
|
label: '靠上',
|
||||||
|
value: 'top'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '居中',
|
||||||
|
value: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '靠下',
|
||||||
|
value: 'bottom'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 排列方向
|
||||||
|
orient: [
|
||||||
|
{
|
||||||
|
label: '水平',
|
||||||
|
value: 'horizontal'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '垂直',
|
||||||
|
value: 'vertical'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 形状
|
||||||
|
shape: [
|
||||||
|
{
|
||||||
|
label: '圆形',
|
||||||
|
value: 'circle'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '方形',
|
||||||
|
value: 'rect'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '圆角方形',
|
||||||
|
value: 'roundRect'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '三角形',
|
||||||
|
value: 'triangle'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '钢笔形',
|
||||||
|
value: 'pin'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '箭头形',
|
||||||
|
value: 'arrow'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/bar_x.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const BarCommonConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.BAR,
|
categoryName: ChatCategoryEnumName.BAR,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'bar_x.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()"
|
||||||
ref="vChartRef"
|
|
||||||
:theme="themeColor"
|
|
||||||
:option="option"
|
|
||||||
:manual-update="isPreview()"
|
|
||||||
:update-options="{
|
:update-options="{
|
||||||
replaceMerge: replaceMergeArr
|
replaceMerge: replaceMergeArr
|
||||||
}"
|
}" autoresize></v-chart>
|
||||||
autoresize
|
|
||||||
></v-chart>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, nextTick, computed, watch, PropType } from 'vue'
|
import { ref, nextTick, computed, watch, PropType } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { BarChart } from 'echarts/charts'
|
import { BarChart } from 'echarts/charts'
|
||||||
@@ -25,6 +20,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
|||||||
import { isPreview } from '@/utils'
|
import { isPreview } from '@/utils'
|
||||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||||
import isObject from 'lodash/isObject'
|
import isObject from 'lodash/isObject'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
themeSetting: {
|
themeSetting: {
|
||||||
@@ -41,6 +37,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
const replaceMergeArr = ref<string[]>()
|
const replaceMergeArr = ref<string[]>()
|
||||||
@@ -57,11 +55,23 @@ watch(
|
|||||||
if (!isObject(newData) || !('dimensions' in newData)) return
|
if (!isObject(newData) || !('dimensions' in newData)) return
|
||||||
if (Array.isArray(newData?.dimensions)) {
|
if (Array.isArray(newData?.dimensions)) {
|
||||||
const seriesArr = []
|
const seriesArr = []
|
||||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
// 对oldData进行判断,防止传入错误数据之后对旧维度判断产生干扰
|
||||||
seriesArr.push(seriesItem)
|
// 此处计算的是dimensions的Y轴维度,若是dimensions.length为0或1,则默认为1,排除X轴维度干扰
|
||||||
|
const oldDimensions = Array.isArray(oldData?.dimensions)&&oldData.dimensions.length >= 1 ? oldData.dimensions.length : 1;
|
||||||
|
const newDimensions = newData.dimensions.length >= 1 ? newData.dimensions.length : 1;
|
||||||
|
const dimensionsGap = newDimensions - oldDimensions;
|
||||||
|
if (dimensionsGap < 0) {
|
||||||
|
props.chartConfig.option.series.splice(newDimensions - 1)
|
||||||
|
} else if (dimensionsGap > 0) {
|
||||||
|
if(!oldData || !oldData?.dimensions || !Array.isArray(oldData?.dimensions) || !oldData?.dimensions.length ) {
|
||||||
|
props.chartConfig.option.series=[]
|
||||||
|
}
|
||||||
|
for (let i = 0; i < dimensionsGap; i++) {
|
||||||
|
seriesArr.push(cloneDeep(seriesItem))
|
||||||
|
}
|
||||||
|
props.chartConfig.option.series.push(...seriesArr)
|
||||||
}
|
}
|
||||||
replaceMergeArr.value = ['series']
|
replaceMergeArr.value = ['series']
|
||||||
props.chartConfig.option.series = seriesArr
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
replaceMergeArr.value = []
|
replaceMergeArr.value = []
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/bar_y.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const BarCrossrangeConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.BAR,
|
categoryName: ChatCategoryEnumName.BAR,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'bar_y.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart
|
<v-chart
|
||||||
ref="vChartRef"
|
ref="vChartRef"
|
||||||
|
:init-options="initOptions"
|
||||||
:theme="themeColor"
|
:theme="themeColor"
|
||||||
:option="option"
|
:option="option"
|
||||||
:manual-update="isPreview()"
|
:manual-update="isPreview()"
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, nextTick, computed, watch, PropType } from 'vue'
|
import { ref, nextTick, computed, watch, PropType } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { BarChart } from 'echarts/charts'
|
import { BarChart } from 'echarts/charts'
|
||||||
@@ -24,6 +26,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
|||||||
import { isPreview } from '@/utils'
|
import { isPreview } from '@/utils'
|
||||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||||
import isObject from 'lodash/isObject'
|
import isObject from 'lodash/isObject'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
themeSetting: {
|
themeSetting: {
|
||||||
@@ -40,6 +43,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
const replaceMergeArr = ref<string[]>()
|
const replaceMergeArr = ref<string[]>()
|
||||||
@@ -57,7 +62,7 @@ watch(
|
|||||||
if (Array.isArray(newData?.dimensions)) {
|
if (Array.isArray(newData?.dimensions)) {
|
||||||
const seriesArr = []
|
const seriesArr = []
|
||||||
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
for (let i = 0; i < newData.dimensions.length - 1; i++) {
|
||||||
seriesArr.push(seriesItem)
|
seriesArr.push(cloneDeep(seriesItem))
|
||||||
}
|
}
|
||||||
replaceMergeArr.value = ['series']
|
replaceMergeArr.value = ['series']
|
||||||
props.chartConfig.option.series = seriesArr
|
props.chartConfig.option.series = seriesArr
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/capsule.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const CapsuleChartConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.BAR,
|
categoryName: ChatCategoryEnumName.BAR,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'capsule.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
v-if="state.mergedConfig"
|
v-if="state.mergedConfig"
|
||||||
class="go-dv-capsule-chart"
|
class="go-dv-capsule-chart"
|
||||||
:style="{
|
:style="{
|
||||||
fontSize: numberSizeHandle(state.mergedConfig.valueFontSize),
|
fontSize: numberSizeHandle(state.mergedConfig.valueFontSize),
|
||||||
paddingLeft: numberSizeHandle(state.mergedConfig.paddingLeft),
|
paddingLeft: numberSizeHandle(state.mergedConfig.paddingLeft),
|
||||||
paddingRight: numberSizeHandle(state.mergedConfig.paddingRight)
|
paddingRight: numberSizeHandle(state.mergedConfig.paddingRight)
|
||||||
@@ -53,11 +53,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, watch, reactive, PropType } from 'vue'
|
import { onMounted, watch, reactive, PropType } from 'vue'
|
||||||
import merge from 'lodash/merge'
|
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import config, { option } from './config'
|
import config, { option } from './config'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
type DataProps = {
|
type DataProps = {
|
||||||
name: string | number
|
name: string | number
|
||||||
@@ -112,35 +111,39 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const calcData = (data: any) => {
|
const calcData = (data: any, type?: string) => {
|
||||||
mergeConfig(props.chartConfig.option)
|
let cloneConfig = cloneDeep(props.chartConfig.option || {})
|
||||||
|
state.mergedConfig = cloneConfig
|
||||||
calcCapsuleLengthAndLabelData()
|
if (type == 'preview') {
|
||||||
}
|
cloneConfig.dataset = data
|
||||||
|
}
|
||||||
const mergeConfig = (data: any) => {
|
calcCapsuleLengthAndLabelData(state.mergedConfig.dataset)
|
||||||
state.mergedConfig = merge(cloneDeep(state.defaultConfig), data || {})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据解析
|
// 数据解析
|
||||||
const calcCapsuleLengthAndLabelData = () => {
|
const calcCapsuleLengthAndLabelData = (dataset: any) => {
|
||||||
const { source } = state.mergedConfig.dataset
|
try {
|
||||||
if (!source.length) return
|
const { source } = dataset
|
||||||
|
if (!source || !source.length) return
|
||||||
|
|
||||||
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
||||||
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
|
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
|
||||||
|
|
||||||
const maxValue = Math.max(...capsuleValue)
|
const maxValue = Math.max(...capsuleValue)
|
||||||
|
|
||||||
state.capsuleValue = capsuleValue
|
state.capsuleValue = capsuleValue
|
||||||
|
|
||||||
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
|
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
|
||||||
|
|
||||||
const oneFifth = maxValue / 5
|
const oneFifth = maxValue / 5
|
||||||
|
|
||||||
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
|
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
|
||||||
|
|
||||||
state.labelData = labelData
|
state.labelData = labelData
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberSizeHandle = (val: string | number) => {
|
const numberSizeHandle = (val: string | number) => {
|
||||||
@@ -153,7 +156,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
// 预览
|
// 预览
|
||||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
||||||
calcData(newData)
|
calcData(newData, 'preview')
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
||||||
import { LineCommonConfig } from './index'
|
import { LineCommonConfig } from './index'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
@@ -47,7 +47,7 @@ export const option = {
|
|||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key: string = LineCommonConfig.key
|
public key: string = LineCommonConfig.key
|
||||||
public chartConfig = LineCommonConfig
|
public chartConfig = cloneDeep(LineCommonConfig)
|
||||||
// 图表配置项
|
// 图表配置项
|
||||||
public option = echartOptionProfixHandle(option, includes)
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/line.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const LineCommonConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.LINE,
|
categoryName: ChatCategoryEnumName.LINE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'line.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart
|
<v-chart
|
||||||
ref="vChartRef"
|
ref="vChartRef"
|
||||||
|
:init-options="initOptions"
|
||||||
:theme="themeColor"
|
:theme="themeColor"
|
||||||
:option="option"
|
:option="option"
|
||||||
:manual-update="isPreview()"
|
:manual-update="isPreview()"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, computed, watch, ref, nextTick } from 'vue'
|
import { PropType, computed, watch, ref, nextTick } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { LineChart } from 'echarts/charts'
|
import { LineChart } from 'echarts/charts'
|
||||||
@@ -41,6 +43,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
const replaceMergeArr = ref<string[]>()
|
const replaceMergeArr = ref<string[]>()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { LineGradientSingleConfig } from './index'
|
|||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { graphic } from 'echarts/core'
|
import { graphic } from 'echarts/core'
|
||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
@@ -58,7 +59,7 @@ const options = {
|
|||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key: string = LineGradientSingleConfig.key
|
public key: string = LineGradientSingleConfig.key
|
||||||
public chartConfig = LineGradientSingleConfig
|
public chartConfig = cloneDeep(LineGradientSingleConfig)
|
||||||
// 图表配置项
|
// 图表配置项
|
||||||
public option = echartOptionProfixHandle(options, includes)
|
public option = echartOptionProfixHandle(options, includes)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/line_gradient_single.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const LineGradientSingleConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.LINE,
|
categoryName: ChatCategoryEnumName.LINE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'line_gradient_single.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
||||||
</v-chart>
|
</v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, watch, PropType } from 'vue'
|
import { reactive, watch, PropType } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use, graphic } from 'echarts/core'
|
import { use, graphic } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { LineChart } from 'echarts/charts'
|
import { LineChart } from 'echarts/charts'
|
||||||
@@ -15,7 +16,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
|||||||
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
||||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { isPreview } from '@/utils'
|
import { isPreview, colorGradientCustomMerge} from '@/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
themeSetting: {
|
themeSetting: {
|
||||||
@@ -32,6 +33,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
|
|
||||||
@@ -45,7 +48,9 @@ watch(
|
|||||||
(newColor: keyof typeof chartColorsSearch) => {
|
(newColor: keyof typeof chartColorsSearch) => {
|
||||||
try {
|
try {
|
||||||
if (!isPreview()) {
|
if (!isPreview()) {
|
||||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
const themeColor =
|
||||||
|
colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] ||
|
||||||
|
colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme]
|
||||||
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
||||||
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { LineGradientsConfig } from './index'
|
|||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { graphic } from 'echarts/core'
|
import { graphic } from 'echarts/core'
|
||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
@@ -85,7 +86,7 @@ const option = {
|
|||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key: string = LineGradientsConfig.key
|
public key: string = LineGradientsConfig.key
|
||||||
public chartConfig = LineGradientsConfig
|
public chartConfig = cloneDeep(LineGradientsConfig)
|
||||||
// 图表配置项
|
// 图表配置项
|
||||||
public option = echartOptionProfixHandle(option, includes)
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/line_gradient.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const LineGradientsConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.LINE,
|
categoryName: ChatCategoryEnumName.LINE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'line_gradient.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, watch, PropType } from 'vue'
|
import { reactive, watch, PropType } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use, graphic } from 'echarts/core'
|
import { use, graphic } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { LineChart } from 'echarts/charts'
|
import { LineChart } from 'echarts/charts'
|
||||||
@@ -14,7 +15,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
|||||||
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
||||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { isPreview } from '@/utils'
|
import { isPreview, colorGradientCustomMerge} from '@/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
themeSetting: {
|
themeSetting: {
|
||||||
@@ -31,6 +32,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
|
|
||||||
@@ -44,7 +47,9 @@ watch(
|
|||||||
(newColor: keyof typeof chartColorsSearch) => {
|
(newColor: keyof typeof chartColorsSearch) => {
|
||||||
try {
|
try {
|
||||||
if (!isPreview()) {
|
if (!isPreview()) {
|
||||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
const themeColor =
|
||||||
|
colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] ||
|
||||||
|
colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme]
|
||||||
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
props.chartConfig.option.series.forEach((value: any, index: number) => {
|
||||||
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
|||||||
import { LineLinearSingleConfig } from './index'
|
import { LineLinearSingleConfig } from './index'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
@@ -54,7 +55,7 @@ export const option = {
|
|||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key: string = LineLinearSingleConfig.key
|
public key: string = LineLinearSingleConfig.key
|
||||||
public chartConfig = LineLinearSingleConfig
|
public chartConfig = cloneDeep(LineLinearSingleConfig)
|
||||||
// 图表配置项
|
// 图表配置项
|
||||||
public option = echartOptionProfixHandle(option, includes)
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/line_linear_single.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const LineLinearSingleConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.LINE,
|
categoryName: ChatCategoryEnumName.LINE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'line_linear_single.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
||||||
</v-chart>
|
</v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, watch, reactive } from 'vue'
|
import { PropType, watch, reactive } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { LineChart } from 'echarts/charts'
|
import { LineChart } from 'echarts/charts'
|
||||||
@@ -15,7 +16,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
|||||||
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
||||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { isPreview } from '@/utils'
|
import { isPreview, colorGradientCustomMerge } from '@/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
themeSetting: {
|
themeSetting: {
|
||||||
@@ -32,6 +33,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
@@ -45,7 +48,9 @@ watch(
|
|||||||
(newColor: keyof typeof chartColorsSearch) => {
|
(newColor: keyof typeof chartColorsSearch) => {
|
||||||
try {
|
try {
|
||||||
if (!isPreview()) {
|
if (!isPreview()) {
|
||||||
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
|
const themeColor =
|
||||||
|
colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] ||
|
||||||
|
colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme]
|
||||||
props.chartConfig.option.series.forEach((value: any) => {
|
props.chartConfig.option.series.forEach((value: any) => {
|
||||||
value.lineStyle.shadowColor = themeColor[2]
|
value.lineStyle.shadowColor = themeColor[2]
|
||||||
value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => {
|
value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => {
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ export enum ThemeEnum {
|
|||||||
MACARON = 'macaron',
|
MACARON = 'macaron',
|
||||||
BLUE = 'blue',
|
BLUE = 'blue',
|
||||||
DARKBLUE = 'darkblue',
|
DARKBLUE = 'darkblue',
|
||||||
WINE = 'wine'
|
WINE = 'wine',
|
||||||
|
WEIXIN = 'tileLayer'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum LangEnum {
|
export enum LangEnum {
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ const themeOptions = [
|
|||||||
{
|
{
|
||||||
value: ThemeEnum.WINE,
|
value: ThemeEnum.WINE,
|
||||||
label: '酱籽'
|
label: '酱籽'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: ThemeEnum.WEIXIN,
|
||||||
|
label: '卫星'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import image from '@/assets/images/chart/charts/map_amap.png'
|
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
export const MapAmapConfig: ConfigType = {
|
export const MapAmapConfig: ConfigType = {
|
||||||
@@ -11,5 +10,5 @@ export const MapAmapConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MAP,
|
categoryName: ChatCategoryEnumName.MAP,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'map_amap.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import AMapLoader from '@amap/amap-jsapi-loader'
|
|||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { MarkerEnum } from './config'
|
import { MarkerEnum, ThemeEnum } from './config'
|
||||||
import { isArray } from '@/utils'
|
import { isArray } from '@/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -51,7 +51,6 @@ const initMap = (newData: any) => {
|
|||||||
resizeEnable: true,
|
resizeEnable: true,
|
||||||
zoom: amapZindex.value, // 地图显示的缩放级别
|
zoom: amapZindex.value, // 地图显示的缩放级别
|
||||||
center: [amapLon.value, amapLat.value],
|
center: [amapLon.value, amapLat.value],
|
||||||
mapStyle: `amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`, //自定义地图的显示样式
|
|
||||||
lang: lang.value,
|
lang: lang.value,
|
||||||
features: features.value,
|
features: features.value,
|
||||||
pitch: pitch.value, // 地图俯仰角度,有效范围 0 度- 83 度
|
pitch: pitch.value, // 地图俯仰角度,有效范围 0 度- 83 度
|
||||||
@@ -60,6 +59,14 @@ const initMap = (newData: any) => {
|
|||||||
willReadFrequently: true
|
willReadFrequently: true
|
||||||
})
|
})
|
||||||
dataHandle(props.chartConfig.option.dataset)
|
dataHandle(props.chartConfig.option.dataset)
|
||||||
|
let satellite = new AMap.TileLayer.Satellite()
|
||||||
|
let roadNet = new AMap.TileLayer.RoadNet()
|
||||||
|
if (newData.amapStyleKey === ThemeEnum.WEIXIN) {
|
||||||
|
mapIns.add([satellite, roadNet])
|
||||||
|
} else {
|
||||||
|
mapIns.remove([satellite, roadNet])
|
||||||
|
mapIns.setMapStyle(`amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {})
|
.catch(e => {})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
|||||||
import { MapBaseConfig } from './index'
|
import { MapBaseConfig } from './index'
|
||||||
import { chartInitConfig } from '@/settings/designSetting'
|
import { chartInitConfig } from '@/settings/designSetting'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = []
|
export const includes = []
|
||||||
@@ -151,6 +152,6 @@ export const MapDefaultConfig = { ...option }
|
|||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key: string = MapBaseConfig.key
|
public key: string = MapBaseConfig.key
|
||||||
public attr = { ...chartInitConfig, w: 750, h: 800, zIndex: -1 }
|
public attr = { ...chartInitConfig, w: 750, h: 800, zIndex: -1 }
|
||||||
public chartConfig = MapBaseConfig
|
public chartConfig = cloneDeep(MapBaseConfig)
|
||||||
public option = echartOptionProfixHandle(option, includes)
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import image from '@/assets/images/chart/charts/map.png'
|
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
export const MapBaseConfig: ConfigType = {
|
export const MapBaseConfig: ConfigType = {
|
||||||
@@ -11,5 +10,5 @@ export const MapBaseConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MAP,
|
categoryName: ChatCategoryEnumName.MAP,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'map.png'
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
|
||||||
</v-chart>
|
</v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -7,11 +7,12 @@
|
|||||||
import { PropType, reactive, watch, ref, nextTick } from 'vue'
|
import { PropType, reactive, watch, ref, nextTick } from 'vue'
|
||||||
import config, { includes } from './config'
|
import config, { includes } from './config'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use, registerMap } from 'echarts/core'
|
import { use, registerMap } from 'echarts/core'
|
||||||
import { EffectScatterChart, MapChart } from 'echarts/charts'
|
import { EffectScatterChart, MapChart } from 'echarts/charts'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { mergeTheme } from '@/packages/public/chart'
|
import { mergeTheme, setOption } from '@/packages/public/chart'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { isPreview } from '@/utils'
|
import { isPreview } from '@/utils'
|
||||||
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
|
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
|
||||||
@@ -32,6 +33,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([
|
use([
|
||||||
MapChart,
|
MapChart,
|
||||||
DatasetComponent,
|
DatasetComponent,
|
||||||
@@ -59,13 +62,14 @@ const getGeojson = (regionId: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//异步时先注册空的 保证初始化不报错
|
//异步时先注册空的 保证初始化不报错
|
||||||
registerMap(props.chartConfig.option.mapRegion.adcode, { geoJSON: {} as any, specialAreas: {} })
|
registerMap(`${props.chartConfig.option.mapRegion.adcode}`, { geoJSON: {} as any, specialAreas: {} })
|
||||||
|
|
||||||
// 进行更换初始化地图 如果为china 单独处理
|
// 进行更换初始化地图 如果为china 单独处理
|
||||||
const registerMapInitAsync = async () => {
|
const registerMapInitAsync = async () => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
if (props.chartConfig.option.mapRegion.adcode != 'china') {
|
const adCode = `${props.chartConfig.option.mapRegion.adcode}`;
|
||||||
await getGeojson(props.chartConfig.option.mapRegion.adcode)
|
if (adCode !== 'china') {
|
||||||
|
await getGeojson(adCode)
|
||||||
} else {
|
} else {
|
||||||
await hainanLandsHandle(props.chartConfig.option.mapRegion.showHainanIsLands)
|
await hainanLandsHandle(props.chartConfig.option.mapRegion.showHainanIsLands)
|
||||||
}
|
}
|
||||||
@@ -76,7 +80,7 @@ registerMapInitAsync()
|
|||||||
// 手动触发渲染
|
// 手动触发渲染
|
||||||
const vEchartsSetOption = () => {
|
const vEchartsSetOption = () => {
|
||||||
option.value = props.chartConfig.option
|
option.value = props.chartConfig.option
|
||||||
vChartRef.value?.setOption(props.chartConfig.option)
|
setOption(vChartRef.value, props.chartConfig.option)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新数据处理
|
// 更新数据处理
|
||||||
@@ -127,7 +131,7 @@ watch(
|
|||||||
|
|
||||||
//监听地图展示区域发生变化
|
//监听地图展示区域发生变化
|
||||||
watch(
|
watch(
|
||||||
() => props.chartConfig.option.mapRegion.adcode,
|
() => `${props.chartConfig.option.mapRegion.adcode}`,
|
||||||
async newData => {
|
async newData => {
|
||||||
try {
|
try {
|
||||||
await getGeojson(newData)
|
await getGeojson(newData)
|
||||||
|
|||||||
91
src/packages/components/Charts/Mores/Dial/config.ts
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
||||||
|
import { DialConfig } from './index'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
|
export const includes = []
|
||||||
|
const option = {
|
||||||
|
backgroundColor: '#0E1327',
|
||||||
|
dataset:70,
|
||||||
|
series: [{
|
||||||
|
type: "gauge",
|
||||||
|
data: [{
|
||||||
|
value: 70,
|
||||||
|
itemStyle: { // 指针样式
|
||||||
|
color: '#2AF4FF'
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
min: 0, //最小刻度
|
||||||
|
max: 100, //最大刻度
|
||||||
|
splitNumber: 10, //刻度数量
|
||||||
|
center: ['50%', '55%'],
|
||||||
|
radius: '80%',
|
||||||
|
axisLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: [
|
||||||
|
[0, 'rgba(0,212,230,0.5)'],
|
||||||
|
[1, 'rgba(28,128,245,0)']
|
||||||
|
],
|
||||||
|
width: 170
|
||||||
|
}
|
||||||
|
},
|
||||||
|
axisLabel: { // 文字样式
|
||||||
|
color: '#eee',
|
||||||
|
fontSize: 14,
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
detail: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
pointer: {
|
||||||
|
length: '80%',
|
||||||
|
width: 4
|
||||||
|
},
|
||||||
|
animationDuration: 2000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '外部刻度',
|
||||||
|
type: 'gauge',
|
||||||
|
center: ['50%', '55%'],
|
||||||
|
radius: '90%',
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
width: 25,
|
||||||
|
color: [ // 表盘外部颜色
|
||||||
|
[0, '#1369E380'],
|
||||||
|
[1, '#1369E380']
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
show:false,
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
splitNumber: 5,
|
||||||
|
lineStyle: { //刻度颜色
|
||||||
|
color: '#42E5FB',
|
||||||
|
width: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
length: 15,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#42E5FB',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
|
public key: string = DialConfig.key
|
||||||
|
public chartConfig = cloneDeep(DialConfig)
|
||||||
|
// 图表配置项
|
||||||
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
|
}
|
||||||
84
src/packages/components/Charts/Mores/Dial/config.vue
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 遍历 seriesList -->
|
||||||
|
<CollapseItem :name="`圆环`" :expanded="true">
|
||||||
|
<SettingItemBox name="数据">
|
||||||
|
<SettingItem name="数值">
|
||||||
|
<n-input-number v-model:value="config.dataset" :min="dialConfig.min" :max="dialConfig.max" :step="1" size="small" placeholder="数值">
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<!-- Echarts 全局设置 -->
|
||||||
|
<!-- 表盘刻度字体 -->
|
||||||
|
<SettingItemBox name="字体">
|
||||||
|
<SettingItem name="颜色">
|
||||||
|
<n-color-picker size="small" :modes="['hex']" v-model:value="dialConfig.axisLabel.color"></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="字体大小">
|
||||||
|
<n-input-number
|
||||||
|
v-model:value="dialConfig.axisLabel.fontSize"
|
||||||
|
:min="0"
|
||||||
|
:step="1"
|
||||||
|
size="small"
|
||||||
|
placeholder="字体大小"
|
||||||
|
>
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<!-- 表盘 -->
|
||||||
|
<SettingItemBox name="表盘外部">
|
||||||
|
<SettingItem name="颜色" >
|
||||||
|
<n-color-picker size="small" :modes="['hex']" v-model:value="config.series[1].axisLine.lineStyle.color[1][1]"></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<!-- 指针 -->
|
||||||
|
<SettingItemBox name="指针">
|
||||||
|
<SettingItem name="颜色" >
|
||||||
|
<n-color-picker size="small" :modes="['hex']" v-model:value="dialConfig.data[0].itemStyle.color"></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="宽度">
|
||||||
|
<n-input-number v-model:value="dialConfig.pointer.width" :min="0" :step="1" size="small" placeholder="数值">
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="刻度">
|
||||||
|
<SettingItem name="最小值">
|
||||||
|
<n-input-number v-model:value="dialConfig.min" :min="0" :step="1" size="small" placeholder="数值">
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="最大值">
|
||||||
|
<n-input-number v-model:value="dialConfig.max" :min="0" :step="1" size="small" placeholder="数值">
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="颜色" >
|
||||||
|
<n-color-picker size="small" :modes="['hex']" v-model:value="config.series[1].axisTick.lineStyle.color" @update:value="updateClick"></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
|
||||||
|
</CollapseItem>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType, computed } from 'vue'
|
||||||
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { GlobalThemeJsonType } from '@/settings/chartThemes'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<GlobalThemeJsonType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const config = computed(() => {
|
||||||
|
return props.optionData
|
||||||
|
})
|
||||||
|
|
||||||
|
const dialConfig = computed(() => {
|
||||||
|
return props.optionData.series[0]
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateClick = (val: any) => {
|
||||||
|
props.optionData.series[1].splitLine.lineStyle.color=val
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
14
src/packages/components/Charts/Mores/Dial/index.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
|
export const DialConfig: ConfigType = {
|
||||||
|
key: 'Dial',
|
||||||
|
chartKey: 'VDial',
|
||||||
|
conKey: 'VCDial',
|
||||||
|
title: '表盘',
|
||||||
|
category: ChatCategoryEnum.MORE,
|
||||||
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
|
image:'dial.png'
|
||||||
|
}
|
||||||
69
src/packages/components/Charts/Mores/Dial/index.vue
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<template>
|
||||||
|
<v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize> </v-chart>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType, reactive, watch } from 'vue'
|
||||||
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
|
import { use } from 'echarts/core'
|
||||||
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
|
import { PieChart } from 'echarts/charts'
|
||||||
|
import { mergeTheme } from '@/packages/public/chart'
|
||||||
|
import config, { includes } from './config'
|
||||||
|
import { useChartDataFetch } from '@/hooks'
|
||||||
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
themeSetting: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
themeColor: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
chartConfig: {
|
||||||
|
type: Object as PropType<config>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
|
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent])
|
||||||
|
|
||||||
|
const option = reactive({
|
||||||
|
value: {}
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataHandle = (newData: any) => {
|
||||||
|
let config = props.chartConfig.option
|
||||||
|
config.series[0].data[0].value = newData
|
||||||
|
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||||
|
option.value = props.chartConfig.option
|
||||||
|
}
|
||||||
|
|
||||||
|
// 配置时
|
||||||
|
watch(
|
||||||
|
() => props.chartConfig.option.dataset,
|
||||||
|
newData => {
|
||||||
|
try {
|
||||||
|
dataHandle(newData)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
deep: false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 预览时
|
||||||
|
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: number) => {
|
||||||
|
// @ts-ignore
|
||||||
|
option.value.series[0].data[0].value = resData
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/funnel.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const FunnelConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MORE,
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'funnel.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, PropType } from 'vue'
|
import { computed, PropType } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { FunnelChart } from 'echarts/charts'
|
import { FunnelChart } from 'echarts/charts'
|
||||||
@@ -31,6 +32,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, FunnelChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, FunnelChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
const option = computed(() => {
|
const option = computed(() => {
|
||||||
|
|||||||
71
src/packages/components/Charts/Mores/Graph/config.ts
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
||||||
|
import { GraphConfig } from './index'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
import dataJson from './data.json'
|
||||||
|
|
||||||
|
export const includes = []
|
||||||
|
|
||||||
|
// 关系图布局
|
||||||
|
export const GraphLayout = [
|
||||||
|
{ label: '无', value: 'none' },
|
||||||
|
{ label: '环形', value: 'circular' }
|
||||||
|
]
|
||||||
|
|
||||||
|
// 标签开关
|
||||||
|
export const LabelSwitch = [
|
||||||
|
{ label: '开启', value: 1 },
|
||||||
|
{ label: '关闭', value: 0 }
|
||||||
|
]
|
||||||
|
|
||||||
|
// 标签位置
|
||||||
|
export const LabelPosition = [
|
||||||
|
{ label: '左侧', value: 'left' },
|
||||||
|
{ label: '右侧', value: 'right' },
|
||||||
|
{ label: '顶部', value: 'top' },
|
||||||
|
{ label: '底部', value: 'bottom' },
|
||||||
|
{ label: '内部', value: 'inside' },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const option = {
|
||||||
|
dataset: { ...dataJson },
|
||||||
|
tooltip: {},
|
||||||
|
legend:{
|
||||||
|
show:true,
|
||||||
|
textStyle:{
|
||||||
|
color:"#eee",
|
||||||
|
fontSize: 14 ,
|
||||||
|
},
|
||||||
|
data: dataJson.categories.map(function (a) {
|
||||||
|
return a.name;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: 'graph',
|
||||||
|
layout: 'none', // none circular环形布局
|
||||||
|
data: dataJson.nodes,
|
||||||
|
links: dataJson.links,
|
||||||
|
categories: dataJson.categories,
|
||||||
|
label: { // 标签
|
||||||
|
show: 1,
|
||||||
|
position: 'right',
|
||||||
|
formatter: '{b}'
|
||||||
|
},
|
||||||
|
labelLayout: {
|
||||||
|
hideOverlap: true
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
color: 'source', // 线条颜色
|
||||||
|
curveness: 0.2 // 线条卷曲程度
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
|
public key = GraphConfig.key
|
||||||
|
public chartConfig = cloneDeep(GraphConfig)
|
||||||
|
// 图表配置项
|
||||||
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
|
}
|
||||||
62
src/packages/components/Charts/Mores/Graph/config.vue
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<CollapseItem name="关系图" :expanded="true">
|
||||||
|
<SettingItemBox name="样式">
|
||||||
|
<setting-item name="布局">
|
||||||
|
<n-select v-model:value="graphConfig.layout" :options="GraphLayout" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="标签">
|
||||||
|
<setting-item name="展示">
|
||||||
|
<n-select v-model:value="graphConfig.label.show" :options="LabelSwitch" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="位置">
|
||||||
|
<n-select v-model:value="graphConfig.label.position" :options="LabelPosition" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="线条">
|
||||||
|
<SettingItem name="弧线">
|
||||||
|
<!-- 需要输入两位的小数才会变化 -->
|
||||||
|
<n-input-number
|
||||||
|
v-model:value="optionData.series[0].lineStyle.curveness"
|
||||||
|
:min="0"
|
||||||
|
:step="0.01"
|
||||||
|
placeholder="弯曲程度"
|
||||||
|
size="small"
|
||||||
|
></n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="图例">
|
||||||
|
<SettingItem name="颜色">
|
||||||
|
<n-color-picker
|
||||||
|
size="small"
|
||||||
|
:modes="['hex']"
|
||||||
|
v-model:value="optionData.legend.textStyle.color"
|
||||||
|
></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="文本">
|
||||||
|
<n-input-number v-model:value="optionData.legend.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="文字大小">
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
</CollapseItem>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType, computed } from 'vue'
|
||||||
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { option, GraphLayout, LabelSwitch, LabelPosition } from './config'
|
||||||
|
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<typeof option & GlobalThemeJsonType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const graphConfig = computed<typeof option.series[0]>(() => {
|
||||||
|
return props.optionData.series[0]
|
||||||
|
})
|
||||||
|
</script>
|
||||||
1744
src/packages/components/Charts/Mores/Graph/data.json
Normal file
14
src/packages/components/Charts/Mores/Graph/index.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
|
export const GraphConfig: ConfigType = {
|
||||||
|
key: 'Graph',
|
||||||
|
chartKey: 'VGraph',
|
||||||
|
conKey: 'VCGraph',
|
||||||
|
title: '关系图',
|
||||||
|
category: ChatCategoryEnum.MORE,
|
||||||
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
|
image: 'graph.png'
|
||||||
|
}
|
||||||
80
src/packages/components/Charts/Mores/Graph/index.vue
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<template>
|
||||||
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, PropType, watch } from 'vue'
|
||||||
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
|
import dataJson from './data.json'
|
||||||
|
import { use } from 'echarts/core'
|
||||||
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
|
import { RadarChart } from 'echarts/charts'
|
||||||
|
import { includes } from './config'
|
||||||
|
import { mergeTheme, setOption } from '@/packages/public/chart'
|
||||||
|
import { useChartDataFetch } from '@/hooks'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import { isPreview } from '@/utils'
|
||||||
|
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
themeSetting: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
themeColor: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
chartConfig: {
|
||||||
|
type: Object as PropType<CreateComponentType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
|
use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
|
const vChartRef = ref<typeof VChart>()
|
||||||
|
|
||||||
|
const option = computed(() => {
|
||||||
|
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataSetHandle = (dataset: typeof dataJson) => {
|
||||||
|
if (dataset.nodes) {
|
||||||
|
props.chartConfig.option.series[0].data = dataset.nodes
|
||||||
|
}
|
||||||
|
if (dataset.links) {
|
||||||
|
props.chartConfig.option.series[0].links = dataset.links
|
||||||
|
}
|
||||||
|
if (dataset.categories) {
|
||||||
|
props.chartConfig.option.series[0].categories = dataset.categories
|
||||||
|
// @ts-ignore
|
||||||
|
props.chartConfig.option.legend.data = dataset.categories.map((i: { name: string }) => i.name)
|
||||||
|
}
|
||||||
|
if (vChartRef.value && isPreview()) {
|
||||||
|
setOption(vChartRef.value, props.chartConfig.option)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.chartConfig.option.dataset,
|
||||||
|
newData => {
|
||||||
|
try {
|
||||||
|
dataSetHandle(newData)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
||||||
|
dataSetHandle(newData)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/heatmap.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const HeatmapConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MORE,
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'heatmap.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, computed, PropType } from 'vue'
|
import { ref, watch, computed, PropType } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { HeatmapChart } from 'echarts/charts'
|
import { HeatmapChart } from 'echarts/charts'
|
||||||
import { includes } from './config'
|
import { includes } from './config'
|
||||||
import { mergeTheme } from '@/packages/public/chart'
|
import { mergeTheme, setOption } from '@/packages/public/chart'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
@@ -38,6 +39,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([
|
use([
|
||||||
DatasetComponent,
|
DatasetComponent,
|
||||||
CanvasRenderer,
|
CanvasRenderer,
|
||||||
@@ -68,7 +71,7 @@ const dataSetHandle = (dataset: typeof dataJson) => {
|
|||||||
props.chartConfig.option.series[0].data = seriesData
|
props.chartConfig.option.series[0].data = seriesData
|
||||||
}
|
}
|
||||||
if (vChartRef.value && isPreview()) {
|
if (vChartRef.value && isPreview()) {
|
||||||
vChartRef.value.setOption(props.chartConfig.option)
|
setOption(vChartRef.value, props.chartConfig.option)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// 展示图片
|
|
||||||
import image from '@/assets/images/chart/charts/process.png'
|
|
||||||
// 公共类型声明
|
// 公共类型声明
|
||||||
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
||||||
// 当前[信息模块]分类声明
|
// 当前[信息模块]分类声明
|
||||||
@@ -21,5 +19,5 @@ export const ProcessConfig: ConfigType = {
|
|||||||
// 包分类
|
// 包分类
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
// 图片
|
// 图片
|
||||||
image: image
|
image: 'process.png'
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/radar.png'
|
|
||||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
@@ -11,5 +10,5 @@ export const RadarConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MORE,
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'radar.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, PropType, watch } from 'vue'
|
import { ref, computed, PropType, watch } from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
|
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { RadarChart } from 'echarts/charts'
|
import { RadarChart } from 'echarts/charts'
|
||||||
import { includes } from './config'
|
import { includes } from './config'
|
||||||
import { mergeTheme } from '@/packages/public/chart'
|
import { mergeTheme, setOption } from '@/packages/public/chart'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
@@ -32,6 +33,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent])
|
use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent])
|
||||||
|
|
||||||
const vChartRef = ref<typeof VChart>()
|
const vChartRef = ref<typeof VChart>()
|
||||||
@@ -50,7 +53,7 @@ const dataSetHandle = (dataset: typeof dataJson) => {
|
|||||||
props.chartConfig.option.radar.indicator = dataset.radarIndicator
|
props.chartConfig.option.radar.indicator = dataset.radarIndicator
|
||||||
}
|
}
|
||||||
if (vChartRef.value && isPreview()) {
|
if (vChartRef.value && isPreview()) {
|
||||||
vChartRef.value.setOption(props.chartConfig.option)
|
setOption(vChartRef.value, props.chartConfig.option)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
43
src/packages/components/Charts/Mores/Sankey/config.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
||||||
|
import { SankeyConfig } from './index'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
import dataJson from './data.json'
|
||||||
|
|
||||||
|
export const includes = ['legend']
|
||||||
|
|
||||||
|
// 图表方向
|
||||||
|
export const orientList = [
|
||||||
|
{ label: '水平', value: 'horizontal' },
|
||||||
|
{ label: '垂直', value: 'vertical' }
|
||||||
|
]
|
||||||
|
|
||||||
|
// 标签展示
|
||||||
|
export const toolTipSwitch = [
|
||||||
|
{ label: '开启', value: 1 },
|
||||||
|
{ label: '关闭', value: 0 }
|
||||||
|
]
|
||||||
|
|
||||||
|
export const option = {
|
||||||
|
dataset: { ...dataJson },
|
||||||
|
tooltip: {
|
||||||
|
show: 1,
|
||||||
|
trigger: 'item',
|
||||||
|
triggerOn: 'mousemove'
|
||||||
|
},
|
||||||
|
series: {
|
||||||
|
type: 'sankey',
|
||||||
|
layout: 'none',
|
||||||
|
orient:'horizontal',
|
||||||
|
data: dataJson.label,
|
||||||
|
links: dataJson.links,
|
||||||
|
levels: dataJson.levels
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
|
public key = SankeyConfig.key
|
||||||
|
public chartConfig = cloneDeep(SankeyConfig)
|
||||||
|
// 图表配置项
|
||||||
|
public option = echartOptionProfixHandle(option, includes)
|
||||||
|
}
|
||||||
43
src/packages/components/Charts/Mores/Sankey/config.vue
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<CollapseItem name="桑基图" :expanded="true">
|
||||||
|
<SettingItemBox name="样式">
|
||||||
|
<SettingItem name="方向">
|
||||||
|
<n-select
|
||||||
|
v-model:value="sankeyConfig.orient"
|
||||||
|
size="small"
|
||||||
|
:options="orientList"
|
||||||
|
placeholder="选择方向"
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="提示标签">
|
||||||
|
<n-select
|
||||||
|
v-model:value="optionData.tooltip.show"
|
||||||
|
size="small"
|
||||||
|
:options="toolTipSwitch"
|
||||||
|
placeholder="是否开启"
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
</CollapseItem>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType, computed } from 'vue'
|
||||||
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { option, orientList, toolTipSwitch } from './config'
|
||||||
|
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<typeof option & GlobalThemeJsonType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const sankeyConfig = computed<typeof option.series>(() => {
|
||||||
|
return props.optionData.series
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||