Compare commits
368 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0816f3fcbf | ||
|
|
6843f24263 | ||
|
|
7076c4deb7 | ||
|
|
59bfc78f0a | ||
|
|
4064339848 | ||
|
|
d2af67d6ad | ||
|
|
e979149cfb | ||
|
|
d0d031d1bb | ||
|
|
9127e6f44c | ||
|
|
bb610ff7ae | ||
|
|
c575cff727 | ||
|
|
5443c9647b | ||
|
|
271a02ff12 | ||
|
|
f747fd3506 | ||
|
|
b59c28b8ae | ||
|
|
b1a0e7b5e2 | ||
|
|
0d762f7d30 | ||
|
|
cc156a0a6b | ||
|
|
a77f4d6bf4 | ||
|
|
9e5676e5ed | ||
|
|
bc79e2f01f | ||
|
|
80f06afa02 | ||
|
|
3da84b2fa2 | ||
|
|
58ab3dee6d | ||
|
|
d7a3bb7ba0 | ||
|
|
2ad2af97e6 | ||
|
|
5387a7ad90 | ||
|
|
291a7bbc61 | ||
|
|
fe37435f79 | ||
|
|
1ef6d9797a | ||
|
|
27e2e2c68d | ||
|
|
c70d54c622 | ||
|
|
d74645d7b0 | ||
|
|
86910de3b2 | ||
|
|
47636ee680 | ||
|
|
9485931f5d | ||
|
|
20fa9e4afe | ||
|
|
cbd629d7f8 | ||
|
|
18e0729e54 | ||
|
|
d6afc50ac5 | ||
|
|
37676176e7 | ||
|
|
1551aa9ded | ||
|
|
895bca92ee | ||
|
|
1460ceb07e | ||
|
|
30bb48f294 | ||
|
|
d5eb3ec4e2 | ||
|
|
7eff3a29c1 | ||
|
|
33ca7af62d | ||
|
|
915e4a69e8 | ||
|
|
d9834482f3 | ||
|
|
6fe20c4655 | ||
|
|
0546b37186 | ||
|
|
9e0736c693 | ||
|
|
52389fa6fc | ||
|
|
bd7960b09a | ||
|
|
ddc09da8cb | ||
|
|
d84e47faa9 | ||
|
|
bcb2ca1cb5 | ||
|
|
23efce86fe | ||
|
|
6abeef182f | ||
|
|
346c8d439a | ||
|
|
c7f7c6a731 | ||
|
|
6063408d94 | ||
|
|
ff4140cbfb | ||
|
|
d8bcb4ab4f | ||
|
|
3d4e05b514 | ||
|
|
bb48745484 | ||
|
|
f9adeac742 | ||
|
|
8867a489a2 | ||
|
|
d8c55b6325 | ||
|
|
44ace74ca9 | ||
|
|
2e84b3d196 | ||
|
|
8f82c1fa59 | ||
|
|
7098e2e5e7 | ||
|
|
051ddcc2d4 | ||
|
|
773ae65085 | ||
|
|
e4db7cb8ff | ||
|
|
8bb0f5e3a5 | ||
|
|
93ed31f093 | ||
|
|
76e511daa0 | ||
|
|
a2184b19b3 | ||
|
|
ec9210d7e7 | ||
|
|
e0fe8f673c | ||
|
|
e3d388b5d9 | ||
|
|
7cf9c29a34 | ||
|
|
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 | ||
|
|
01be79ee9a | ||
|
|
3137109c6d | ||
|
|
1d876418fe | ||
|
|
fd37ce6ede | ||
|
|
9693c0dedf | ||
|
|
dc8d7c86d7 | ||
|
|
8499d574dc | ||
|
|
e7ab632a92 | ||
|
|
1681513d68 | ||
|
|
bd53c68ee2 | ||
|
|
0bb83c4131 | ||
|
|
40673dddb3 | ||
|
|
38d542ce77 | ||
|
|
663cc94ae1 | ||
|
|
0370bc5c6c | ||
|
|
4dc8725b3e | ||
|
|
460aa47ee5 | ||
|
|
1237e16142 | ||
|
|
1565249e2a | ||
|
|
ffd4e165e5 | ||
|
|
9ce042cc8a | ||
|
|
60c7c36800 | ||
|
|
186538afc9 | ||
|
|
a400526108 | ||
|
|
2a8d0717f8 | ||
|
|
76f0183acc | ||
|
|
a6194b8fa9 | ||
|
|
09a21f44c5 | ||
|
|
de681dbcd4 | ||
|
|
2e74522cc3 | ||
|
|
2d8e99bed6 | ||
|
|
59b9ca0569 | ||
|
|
c930e3433f | ||
|
|
8e1731354c | ||
|
|
93f398d5a7 | ||
|
|
0f61ee728b | ||
|
|
afd42fb1fe | ||
|
|
980b91401b | ||
|
|
8ef4ab8175 | ||
|
|
ba1868eb8b | ||
|
|
82f026a1b5 | ||
|
|
5213ea0273 | ||
|
|
0308004a61 | ||
|
|
d030f89895 | ||
|
|
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 | ||
|
|
2386687f2e | ||
|
|
f0f9905583 | ||
|
|
0f93b0285b | ||
|
|
8d57af2dab | ||
|
|
98b1380d0d | ||
|
|
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 | ||
|
|
a448bb678b | ||
|
|
ca580db132 | ||
|
|
dbd33cd676 | ||
|
|
b248f73a88 | ||
|
|
8bff2f9b12 | ||
|
|
19a382afe5 | ||
|
|
02fe552d1b | ||
|
|
aa1b11d9f0 | ||
|
|
d5fb0b54de | ||
|
|
3d88a39a02 | ||
|
|
a626f64e57 | ||
|
|
873c6fef53 | ||
|
|
b2f53a7123 | ||
|
|
2a850e4249 | ||
|
|
00a4c752ed | ||
|
|
0b89aeca82 | ||
|
|
134b44944e | ||
|
|
126c7ce5d2 | ||
|
|
e2ba151794 | ||
|
|
1eb0485a86 | ||
|
|
92dcd7fecd | ||
|
|
e841d3db17 | ||
|
|
800a0141a5 | ||
|
|
c92d7cab97 | ||
|
|
dc458ea88e | ||
|
|
86de4e105e | ||
|
|
6f4e967b49 | ||
|
|
62a2ed2b4a | ||
|
|
97899f275a | ||
|
|
8b6c616a15 | ||
|
|
87386e69a3 | ||
|
|
196df94aee | ||
|
|
a407d118fa | ||
|
|
0fc7bde348 | ||
|
|
9a8899ae40 | ||
|
|
8cb711b892 | ||
|
|
49d8c35747 | ||
|
|
125856677a | ||
|
|
e8e05033cd | ||
|
|
3790bc0207 | ||
|
|
b3bff2ee45 | ||
|
|
8c4e3e8965 | ||
|
|
b03107d8cb | ||
|
|
e9a4ebe38f | ||
|
|
a702decfd4 | ||
|
|
fc58df2148 | ||
|
|
0eecc1e19d | ||
|
|
4f2609a121 | ||
|
|
f21c9f1246 | ||
|
|
182b2c508a | ||
|
|
d7aa41094b | ||
|
|
4ec1bbd912 | ||
|
|
a7b98fe3d6 | ||
|
|
bc02950a6f | ||
|
|
4e5c921bf2 | ||
|
|
14c5d935c4 | ||
|
|
b73893a6af | ||
|
|
2907d1b514 | ||
|
|
7bda46021a | ||
|
|
923b7759f8 | ||
|
|
6d91262faa | ||
|
|
c7988f2d83 | ||
|
|
0111f42803 | ||
|
|
1672978730 | ||
|
|
36a6bb4214 | ||
|
|
ad72070af1 | ||
|
|
14b37d82d0 | ||
|
|
8824d636f4 | ||
|
|
4300b1f617 | ||
|
|
8e28c524b3 | ||
|
|
de4bd655ed | ||
|
|
0434c779cd | ||
|
|
aa0578776c | ||
|
|
5dd39926f8 | ||
|
|
3bd8cbe535 | ||
|
|
cbf541282a | ||
|
|
279f414db0 | ||
|
|
98b38640d1 | ||
|
|
c81aff2c57 | ||
|
|
59eaed5b09 | ||
|
|
9aff88c678 | ||
|
|
5d0c6f4487 | ||
|
|
f82cde2faf | ||
|
|
c903b607df | ||
|
|
ec5bed5b13 | ||
|
|
462a613bd3 | ||
|
|
5e0baa4923 | ||
|
|
ec97340c25 | ||
|
|
7bbf285e8e | ||
|
|
d652b06137 | ||
|
|
d46a0b5134 | ||
|
|
45cadcecc3 | ||
|
|
7b262c9db2 | ||
|
|
4e091c7f49 | ||
|
|
1310234803 | ||
|
|
e55e63bca1 | ||
|
|
9b47d353c0 | ||
|
|
c3f9a470fc | ||
|
|
bd2557f3e4 | ||
|
|
730099efb9 | ||
|
|
3c1b741c37 | ||
|
|
36fdc22634 | ||
|
|
5261a09381 | ||
|
|
25864dc3b6 | ||
|
|
09c2ec06d4 | ||
|
|
2378be571d | ||
|
|
59fd7ebceb | ||
|
|
e0d99a6b28 | ||
|
|
e4514505c3 | ||
|
|
f2c49b171e | ||
|
|
c5706f839e | ||
|
|
de9e304dd4 | ||
|
|
faa0d6538f | ||
|
|
1fb57ad1ff | ||
|
|
65127ced7f | ||
|
|
5b1458b22f | ||
|
|
89194848de | ||
|
|
6f74be7092 | ||
|
|
1f9790e5f5 | ||
|
|
0b8ab9adfa | ||
|
|
a17d7a4182 | ||
|
|
4ef77fcf25 | ||
|
|
d204b459d9 | ||
|
|
6ae6645d3c | ||
|
|
a925ced533 | ||
|
|
8dcccef54d | ||
|
|
dff639e901 | ||
|
|
0376703fd2 | ||
|
|
7341ff11f3 | ||
|
|
57193beeab | ||
|
|
405e884e70 | ||
|
|
0d4e83c940 | ||
|
|
b8ed389f60 | ||
|
|
b308275d99 | ||
|
|
7c1bcd0605 | ||
|
|
c1d98b03a9 | ||
|
|
66f4768285 | ||
|
|
ec6d8dedec | ||
|
|
99d20d99f9 | ||
|
|
0106d43467 | ||
|
|
231fb9dd29 | ||
|
|
f2ae08e62a | ||
|
|
e930ca1587 | ||
|
|
ddb125656a | ||
|
|
35cda43d95 | ||
|
|
e3faaad5e0 | ||
|
|
24ef446fd6 | ||
|
|
53b9e03e69 |
51
.workflow/branch-pipeline.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
version: '1.0'
|
||||||
|
name: branch-pipeline
|
||||||
|
displayName: BranchPipeline
|
||||||
|
stages:
|
||||||
|
- stage:
|
||||||
|
name: compile
|
||||||
|
displayName: 编译
|
||||||
|
steps:
|
||||||
|
- step: build@nodejs
|
||||||
|
name: build_nodejs
|
||||||
|
displayName: Nodejs 构建
|
||||||
|
# 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
|
||||||
|
nodeVersion: 14.16.0
|
||||||
|
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
|
||||||
|
commands:
|
||||||
|
- npm install && rm -rf ./dist && npm run build
|
||||||
|
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
|
||||||
|
artifacts:
|
||||||
|
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
|
||||||
|
- name: BUILD_ARTIFACT
|
||||||
|
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
|
||||||
|
path:
|
||||||
|
- ./dist
|
||||||
|
- step: publish@general_artifacts
|
||||||
|
name: publish_general_artifacts
|
||||||
|
displayName: 上传制品
|
||||||
|
# 上游构建任务定义的产物名,默认BUILD_ARTIFACT
|
||||||
|
dependArtifact: BUILD_ARTIFACT
|
||||||
|
# 上传到制品库时的制品命名,默认output
|
||||||
|
artifactName: output
|
||||||
|
dependsOn: build_nodejs
|
||||||
|
- stage:
|
||||||
|
name: release
|
||||||
|
displayName: 发布
|
||||||
|
steps:
|
||||||
|
- step: publish@release_artifacts
|
||||||
|
name: publish_release_artifacts
|
||||||
|
displayName: '发布'
|
||||||
|
# 上游上传制品任务的产出
|
||||||
|
dependArtifact: output
|
||||||
|
# 发布制品版本号
|
||||||
|
version: '1.0.0.0'
|
||||||
|
# 是否开启版本号自增,默认开启
|
||||||
|
autoIncrement: true
|
||||||
|
triggers:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
exclude:
|
||||||
|
- master
|
||||||
|
include:
|
||||||
|
- .*
|
||||||
49
.workflow/master-pipeline.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
version: '1.0'
|
||||||
|
name: master-pipeline
|
||||||
|
displayName: MasterPipeline
|
||||||
|
stages:
|
||||||
|
- stage:
|
||||||
|
name: compile
|
||||||
|
displayName: 编译
|
||||||
|
steps:
|
||||||
|
- step: build@nodejs
|
||||||
|
name: build_nodejs
|
||||||
|
displayName: Nodejs 构建
|
||||||
|
# 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
|
||||||
|
nodeVersion: 14.16.0
|
||||||
|
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
|
||||||
|
commands:
|
||||||
|
- npm install && rm -rf ./dist && npm run build
|
||||||
|
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
|
||||||
|
artifacts:
|
||||||
|
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
|
||||||
|
- name: BUILD_ARTIFACT
|
||||||
|
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
|
||||||
|
path:
|
||||||
|
- ./dist
|
||||||
|
- step: publish@general_artifacts
|
||||||
|
name: publish_general_artifacts
|
||||||
|
displayName: 上传制品
|
||||||
|
# 上游构建任务定义的产物名,默认BUILD_ARTIFACT
|
||||||
|
dependArtifact: BUILD_ARTIFACT
|
||||||
|
# 上传到制品库时的制品命名,默认output
|
||||||
|
artifactName: output
|
||||||
|
dependsOn: build_nodejs
|
||||||
|
- stage:
|
||||||
|
name: release
|
||||||
|
displayName: 发布
|
||||||
|
steps:
|
||||||
|
- step: publish@release_artifacts
|
||||||
|
name: publish_release_artifacts
|
||||||
|
displayName: '发布'
|
||||||
|
# 上游上传制品任务的产出
|
||||||
|
dependArtifact: output
|
||||||
|
# 发布制品版本号
|
||||||
|
version: '1.0.0.0'
|
||||||
|
# 是否开启版本号自增,默认开启
|
||||||
|
autoIncrement: true
|
||||||
|
triggers:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
36
.workflow/pr-pipeline.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
version: '1.0'
|
||||||
|
name: pr-pipeline
|
||||||
|
displayName: PRPipeline
|
||||||
|
stages:
|
||||||
|
- stage:
|
||||||
|
name: compile
|
||||||
|
displayName: 编译
|
||||||
|
steps:
|
||||||
|
- step: build@nodejs
|
||||||
|
name: build_nodejs
|
||||||
|
displayName: Nodejs 构建
|
||||||
|
# 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
|
||||||
|
nodeVersion: 14.16.0
|
||||||
|
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
|
||||||
|
commands:
|
||||||
|
- npm install && rm -rf ./dist && npm run build
|
||||||
|
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
|
||||||
|
artifacts:
|
||||||
|
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
|
||||||
|
- name: BUILD_ARTIFACT
|
||||||
|
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
|
||||||
|
path:
|
||||||
|
- ./dist
|
||||||
|
- step: publish@general_artifacts
|
||||||
|
name: publish_general_artifacts
|
||||||
|
displayName: 上传制品
|
||||||
|
# 上游构建任务定义的产物名,默认BUILD_ARTIFACT
|
||||||
|
dependArtifact: BUILD_ARTIFACT
|
||||||
|
# 上传到制品库时的制品命名,默认output
|
||||||
|
artifactName: output
|
||||||
|
dependsOn: build_nodejs
|
||||||
|
triggers:
|
||||||
|
pr:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
24
package.json
@@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "go-view",
|
"name": "go-view",
|
||||||
"version": "2.1.3",
|
"version": "2.2.4",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "vite --host",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
@@ -18,9 +21,11 @@
|
|||||||
"@types/keymaster": "^1.6.30",
|
"@types/keymaster": "^1.6.30",
|
||||||
"@types/lodash": "^4.14.184",
|
"@types/lodash": "^4.14.184",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^0.27.2",
|
"axios": "^1.4.0",
|
||||||
"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.10",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3421
pnpm-lock.yaml
generated
@@ -1,6 +1,6 @@
|
|||||||
import axios, { AxiosResponse, AxiosRequestConfig, Axios } from 'axios'
|
import axios, { AxiosResponse, AxiosRequestConfig, Axios, AxiosError, InternalAxiosRequestConfig } from 'axios'
|
||||||
import { ResultEnum, ModuleTypeEnum } from "@/enums/httpEnum"
|
import { RequestHttpHeaderEnum, ResultEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
||||||
import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum"
|
import { PageEnum, ErrorPageNameMap } from '@/enums/pageEnum'
|
||||||
import { StorageEnum } from '@/enums/storageEnum'
|
import { StorageEnum } from '@/enums/storageEnum'
|
||||||
import { axiosPre } from '@/settings/httpSetting'
|
import { axiosPre } from '@/settings/httpSetting'
|
||||||
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
|
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||||
@@ -20,11 +20,11 @@ export interface MyRequestInstance extends Axios {
|
|||||||
|
|
||||||
const axiosInstance = axios.create({
|
const axiosInstance = axios.create({
|
||||||
baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`,
|
baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`,
|
||||||
timeout: ResultEnum.TIMEOUT,
|
timeout: ResultEnum.TIMEOUT
|
||||||
}) as unknown as MyRequestInstance
|
}) as unknown as MyRequestInstance
|
||||||
|
|
||||||
axiosInstance.interceptors.request.use(
|
axiosInstance.interceptors.request.use(
|
||||||
(config: AxiosRequestConfig) => {
|
(config: InternalAxiosRequestConfig) => {
|
||||||
// 白名单校验
|
// 白名单校验
|
||||||
if (includes(fetchAllowList, config.url)) return config
|
if (includes(fetchAllowList, config.url)) return config
|
||||||
// 获取 token
|
// 获取 token
|
||||||
@@ -35,13 +35,10 @@ axiosInstance.interceptors.request.use(
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
const userInfo = info[SystemStoreEnum.USER_INFO]
|
const userInfo = info[SystemStoreEnum.USER_INFO]
|
||||||
config.headers = {
|
config.headers[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token'] = userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||||
...config.headers,
|
|
||||||
[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
|
||||||
}
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
(err: AxiosRequestConfig) => {
|
(err: AxiosError) => {
|
||||||
Promise.reject(err)
|
Promise.reject(err)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -55,6 +52,8 @@ axiosInstance.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
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.SUCCESS) {
|
if (code === ResultEnum.SUCCESS) {
|
||||||
return Promise.resolve(res.data)
|
return Promise.resolve(res.data)
|
||||||
@@ -72,13 +71,23 @@ axiosInstance.interceptors.response.use(
|
|||||||
redirectErrorPage(code)
|
redirectErrorPage(code)
|
||||||
return Promise.resolve(res.data)
|
return Promise.resolve(res.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提示错误
|
// 提示错误
|
||||||
window['$message'].error(window['$t']((res.data as any).msg))
|
window['$message'].error(window['$t']((res.data as any).msg))
|
||||||
return Promise.resolve(res.data)
|
return Promise.resolve(res.data)
|
||||||
},
|
},
|
||||||
(err: AxiosResponse) => {
|
(err: AxiosError) => {
|
||||||
Promise.reject(err)
|
const status = err.response?.status
|
||||||
|
switch (status) {
|
||||||
|
case 401:
|
||||||
|
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||||
|
Promise.reject(err)
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
Promise.reject(err)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
|||||||
params = translateStr(params)
|
params = translateStr(params)
|
||||||
// form 类型处理
|
// form 类型处理
|
||||||
let formData: FormData = new FormData()
|
let formData: FormData = new FormData()
|
||||||
formData.set('default', 'defaultData')
|
|
||||||
// 类型处理
|
// 类型处理
|
||||||
|
|
||||||
switch (requestParamsBodyType) {
|
switch (requestParamsBodyType) {
|
||||||
@@ -172,7 +171,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
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ export const uploadFile = async (data: object) => {
|
|||||||
/**
|
/**
|
||||||
* 文件地址
|
* 文件地址
|
||||||
*/
|
*/
|
||||||
fileName: string
|
fileName: string,
|
||||||
|
fileurl: string,
|
||||||
}>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA)
|
}>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA)
|
||||||
return res
|
return res
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
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">
|
||||||
@@ -51,10 +51,10 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['update:modelShow'])
|
const emit = defineEmits(['update:modelShow'])
|
||||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||||
const modelShow = ref(false)
|
const modelShowRef = ref(false)
|
||||||
|
|
||||||
watch(() => props.modelShow, (newValue) => {
|
watch(() => props.modelShow, (newValue) => {
|
||||||
modelShow.value = newValue
|
modelShowRef.value = newValue
|
||||||
})
|
})
|
||||||
|
|
||||||
const closeHandle = () => {
|
const closeHandle = () => {
|
||||||
|
|||||||
@@ -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">
|
||||||
@@ -82,7 +82,7 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['update:modelShow'])
|
const emit = defineEmits(['update:modelShow'])
|
||||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||||
const settingStore = useSettingStore()
|
const settingStore = useSettingStore()
|
||||||
const modelShow = ref(false)
|
const modelShowRef = ref(false)
|
||||||
|
|
||||||
const list = reactive<ListType[]>([
|
const list = reactive<ListType[]>([
|
||||||
{
|
{
|
||||||
@@ -168,7 +168,7 @@ const list = reactive<ListType[]>([
|
|||||||
])
|
])
|
||||||
|
|
||||||
watch(() => props.modelShow, (newValue) => {
|
watch(() => props.modelShow, (newValue) => {
|
||||||
modelShow.value = newValue
|
modelShowRef.value = newValue
|
||||||
})
|
})
|
||||||
|
|
||||||
const closeHandle = () => {
|
const closeHandle = () => {
|
||||||
|
|||||||
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,18 @@ 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) {
|
||||||
|
if (!legend.value.pageTextStyle) {
|
||||||
|
legend.value.pageTextStyle = { color: newVal }
|
||||||
|
} else {
|
||||||
|
legend.value.pageTextStyle.color = newVal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -69,6 +69,22 @@
|
|||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
|
<!-- 预设滤镜 -->
|
||||||
|
<div v-if="presetImageList.length" class="preset-filter">
|
||||||
|
<n-image
|
||||||
|
class="preset-img"
|
||||||
|
width="46"
|
||||||
|
preview-disabled
|
||||||
|
object-fit="scale-down"
|
||||||
|
v-for="(item, index) in presetImageList"
|
||||||
|
:key="index"
|
||||||
|
:class="{ 'active-preset': item.hueRotate === chartStyles.hueRotate }"
|
||||||
|
:style="{ filter: `hue-rotate(${item.hueRotate}deg)` }"
|
||||||
|
:src="item.src"
|
||||||
|
@click="() => (chartStyles.hueRotate = item.hueRotate)"
|
||||||
|
></n-image>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 混合模式 -->
|
<!-- 混合模式 -->
|
||||||
<setting-item-box v-if="!isCanvas" :alone="true">
|
<setting-item-box v-if="!isCanvas" :alone="true">
|
||||||
<template #name>
|
<template #name>
|
||||||
@@ -149,10 +165,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from 'vue'
|
import { ref, PropType } from 'vue'
|
||||||
import { PickCreateComponentType, BlendModeEnumList } from '@/packages/index.d'
|
import { PickCreateComponentType, BlendModeEnumList } from '@/packages/index.d'
|
||||||
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
import logoImg from '@/assets/logo.png'
|
||||||
|
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isGroup: {
|
isGroup: {
|
||||||
@@ -175,10 +193,48 @@ const { HelpOutlineIcon } = icon.ionicons5
|
|||||||
const sliderFormatTooltip = (v: string) => {
|
const sliderFormatTooltip = (v: string) => {
|
||||||
return `${(parseFloat(v) * 100).toFixed(0)}%`
|
return `${(parseFloat(v) * 100).toFixed(0)}%`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 角度格式化
|
// 角度格式化
|
||||||
const degFormatTooltip = (v: string) => {
|
const degFormatTooltip = (v: string) => {
|
||||||
return `${v}deg`
|
return `${v}deg`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 预设滤镜
|
||||||
|
interface presetImageData {
|
||||||
|
index: number
|
||||||
|
src: string
|
||||||
|
hueRotate: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const presetImageList = ref([] as presetImageData[])
|
||||||
|
for (let i = 1; i <= 12; i++) {
|
||||||
|
presetImageList.value.push({
|
||||||
|
index: i,
|
||||||
|
src: logoImg,
|
||||||
|
hueRotate: i * 30
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
// 预设滤镜
|
||||||
|
.preset-filter {
|
||||||
|
margin: 20px 0 10px 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
.preset-img {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 2px;
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: 0.2s all;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
box-shadow: 0 0 0 2px #66a9c9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.active-preset {
|
||||||
|
box-shadow: 0 0 0 2px #66a9c9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作枚举
|
// 操作枚举
|
||||||
@@ -66,7 +68,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 键盘枚举
|
||||||
@@ -77,7 +80,8 @@ 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:'
|
||||||
|
]
|
||||||
@@ -10,5 +10,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'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export * from '@/hooks/useChartDataFetch.hook'
|
|||||||
export * from '@/hooks/useSystemInit.hook'
|
export * from '@/hooks/useSystemInit.hook'
|
||||||
export * from '@/hooks/useChartDataPondFetch.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,111 +1,128 @@
|
|||||||
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 { useChartDataPondFetch } from '@/hooks/'
|
import { useChartDataPondFetch } from '@/hooks/'
|
||||||
import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d'
|
import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||||
import { isPreview, newFunctionHandle, intervalUnitHandle } from '@/utils'
|
import { isPreview, newFunctionHandle, intervalUnitHandle } from '@/utils'
|
||||||
|
import { setOption } from '@/packages/public/chart'
|
||||||
// 获取类型
|
|
||||||
type ChartEditStoreType = typeof useChartEditStore
|
// 获取类型
|
||||||
|
type ChartEditStoreType = typeof useChartEditStore
|
||||||
/**
|
|
||||||
* setdata 数据监听与更改
|
/**
|
||||||
* @param targetComponent
|
* setdata 数据监听与更改
|
||||||
* @param useChartEditStore 若直接引会报错,只能动态传递
|
* @param targetComponent
|
||||||
* @param updateCallback 自定义更新函数
|
* @param useChartEditStore 若直接引会报错,只能动态传递
|
||||||
*/
|
* @param updateCallback 自定义更新函数
|
||||||
export const useChartDataFetch = (
|
*/
|
||||||
targetComponent: CreateComponentType,
|
export const useChartDataFetch = (
|
||||||
useChartEditStore: ChartEditStoreType,
|
targetComponent: CreateComponentType,
|
||||||
updateCallback?: (...args: any) => any
|
useChartEditStore: ChartEditStoreType,
|
||||||
) => {
|
updateCallback?: (...args: any) => any
|
||||||
const vChartRef = ref<typeof VChart | null>(null)
|
) => {
|
||||||
let fetchInterval: any = 0
|
const vChartRef = ref<typeof VChart | null>(null)
|
||||||
|
let fetchInterval: any = 0
|
||||||
// 数据池
|
|
||||||
const { addGlobalDataInterface } = useChartDataPondFetch()
|
// 数据池
|
||||||
|
const { addGlobalDataInterface } = useChartDataPondFetch()
|
||||||
// 组件类型
|
|
||||||
const { chartFrame } = targetComponent.chartConfig
|
// 组件类型
|
||||||
|
const { chartFrame } = targetComponent.chartConfig
|
||||||
// eCharts 组件配合 vChart 库更新方式
|
|
||||||
const echartsUpdateHandle = (dataset: any) => {
|
// eCharts 组件配合 vChart 库更新方式
|
||||||
if (chartFrame === ChartFrameEnum.ECHARTS) {
|
const echartsUpdateHandle = (dataset: any) => {
|
||||||
if (vChartRef.value) {
|
if (chartFrame === ChartFrameEnum.ECHARTS) {
|
||||||
vChartRef.value.setOption({ dataset: dataset })
|
if (vChartRef.value) {
|
||||||
}
|
setOption(vChartRef.value, { dataset: dataset })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const requestIntervalFn = () => {
|
|
||||||
const chartEditStore = useChartEditStore()
|
const requestIntervalFn = () => {
|
||||||
|
const chartEditStore = useChartEditStore()
|
||||||
// 全局数据
|
|
||||||
const {
|
// 全局数据
|
||||||
requestOriginUrl,
|
const {
|
||||||
requestIntervalUnit: globalUnit,
|
requestOriginUrl,
|
||||||
requestInterval: globalRequestInterval
|
requestIntervalUnit: globalUnit,
|
||||||
} = toRefs(chartEditStore.getRequestGlobalConfig)
|
requestInterval: globalRequestInterval
|
||||||
|
} = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||||
// 目标组件
|
|
||||||
const {
|
// 目标组件
|
||||||
requestDataType,
|
const {
|
||||||
requestUrl,
|
requestDataType,
|
||||||
requestIntervalUnit: targetUnit,
|
requestUrl,
|
||||||
requestInterval: targetInterval
|
requestIntervalUnit: targetUnit,
|
||||||
} = toRefs(targetComponent.request)
|
requestInterval: targetInterval
|
||||||
|
} = toRefs(targetComponent.request)
|
||||||
// 非请求类型
|
|
||||||
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
|
// 非请求类型
|
||||||
|
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
|
||||||
try {
|
|
||||||
// 处理地址
|
try {
|
||||||
// @ts-ignore
|
// 处理地址
|
||||||
if (requestUrl?.value) {
|
// @ts-ignore
|
||||||
// requestOriginUrl 允许为空
|
if (requestUrl?.value) {
|
||||||
const completePath = requestOriginUrl && requestOriginUrl.value + requestUrl.value
|
// requestOriginUrl 允许为空
|
||||||
if (!completePath) return
|
const completePath = requestOriginUrl && requestOriginUrl.value + requestUrl.value
|
||||||
|
if (!completePath) return
|
||||||
clearInterval(fetchInterval)
|
|
||||||
|
clearInterval(fetchInterval)
|
||||||
const fetchFn = async () => {
|
|
||||||
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
const fetchFn = async () => {
|
||||||
if (res) {
|
const res = await customizeHttp(toRaw(targetComponent.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
||||||
try {
|
if (res) {
|
||||||
const filter = targetComponent.filter
|
try {
|
||||||
echartsUpdateHandle(newFunctionHandle(res?.data, res, filter))
|
const filter = targetComponent.filter
|
||||||
// 更新回调函数
|
const { data } = res
|
||||||
if (updateCallback) {
|
echartsUpdateHandle(newFunctionHandle(data, res, filter))
|
||||||
updateCallback(newFunctionHandle(res?.data, res, filter))
|
// 更新回调函数
|
||||||
}
|
if (updateCallback) {
|
||||||
} catch (error) {
|
updateCallback(newFunctionHandle(data, res, filter))
|
||||||
console.error(error)
|
}
|
||||||
}
|
} catch (error) {
|
||||||
}
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 立即调用
|
}
|
||||||
fetchFn()
|
|
||||||
// 定时时间
|
// 普通初始化与组件交互处理监听
|
||||||
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
|
watch(
|
||||||
// 单位
|
() => targetComponent.request.requestParams,
|
||||||
const unit = targetInterval && targetInterval.value ? targetUnit.value : globalUnit.value
|
() => {
|
||||||
// 开启轮询
|
fetchFn()
|
||||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
},
|
||||||
}
|
{
|
||||||
// eslint-disable-next-line no-empty
|
immediate: false,
|
||||||
} catch (error) {
|
deep: true
|
||||||
console.log(error)
|
}
|
||||||
}
|
)
|
||||||
}
|
|
||||||
|
// 定时时间
|
||||||
if (isPreview()) {
|
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
|
||||||
// 判断是否是数据池类型
|
// 单位
|
||||||
targetComponent.request.requestDataType === RequestDataTypeEnum.Pond
|
const unit = targetInterval && targetInterval.value ? targetUnit.value : globalUnit.value
|
||||||
? addGlobalDataInterface(targetComponent, useChartEditStore, updateCallback || echartsUpdateHandle)
|
// 开启轮询
|
||||||
: requestIntervalFn()
|
if (time) {
|
||||||
}
|
fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||||
return { vChartRef }
|
} else {
|
||||||
}
|
fetchFn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPreview()) {
|
||||||
|
targetComponent.request.requestDataType === RequestDataTypeEnum.Pond
|
||||||
|
? addGlobalDataInterface(targetComponent, useChartEditStore, updateCallback || echartsUpdateHandle)
|
||||||
|
: requestIntervalFn()
|
||||||
|
} else {
|
||||||
|
requestIntervalFn()
|
||||||
|
}
|
||||||
|
return { vChartRef }
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { toRaw } from 'vue'
|
import { toRaw, watch, computed, ComputedRef } from 'vue'
|
||||||
import { customizeHttp } from '@/api/http'
|
import { customizeHttp } from '@/api/http'
|
||||||
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'
|
||||||
@@ -20,7 +20,7 @@ const mittDataPondMap = new Map<string, DataPondMapType[]>()
|
|||||||
// 创建单个数据项轮询接口
|
// 创建单个数据项轮询接口
|
||||||
const newPondItemInterval = (
|
const newPondItemInterval = (
|
||||||
requestGlobalConfig: RequestGlobalConfigType,
|
requestGlobalConfig: RequestGlobalConfigType,
|
||||||
requestDataPondItem: RequestDataPondItemType,
|
requestDataPondItem: ComputedRef<RequestDataPondItemType>,
|
||||||
dataPondMapItem?: DataPondMapType[]
|
dataPondMapItem?: DataPondMapType[]
|
||||||
) => {
|
) => {
|
||||||
if (!dataPondMapItem) return
|
if (!dataPondMapItem) return
|
||||||
@@ -31,8 +31,7 @@ const newPondItemInterval = (
|
|||||||
// 请求
|
// 请求
|
||||||
const fetchFn = async () => {
|
const fetchFn = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await customizeHttp(toRaw(requestDataPondItem.dataPondRequestConfig), toRaw(requestGlobalConfig))
|
const res = await customizeHttp(toRaw(requestDataPondItem.value.dataPondRequestConfig), toRaw(requestGlobalConfig))
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
try {
|
try {
|
||||||
// 遍历更新回调函数
|
// 遍历更新回调函数
|
||||||
@@ -49,19 +48,32 @@ const newPondItemInterval = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => requestDataPondItem.value.dataPondRequestConfig.requestParams.Params,
|
||||||
|
() => {
|
||||||
|
fetchFn()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: false,
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
// 立即调用
|
// 立即调用
|
||||||
fetchFn()
|
fetchFn()
|
||||||
|
|
||||||
const targetInterval = requestDataPondItem.dataPondRequestConfig.requestInterval
|
|
||||||
const targetUnit = requestDataPondItem.dataPondRequestConfig.requestIntervalUnit
|
const targetInterval = requestDataPondItem.value.dataPondRequestConfig.requestInterval
|
||||||
|
const targetUnit = requestDataPondItem.value.dataPondRequestConfig.requestIntervalUnit
|
||||||
|
|
||||||
const globalRequestInterval = requestGlobalConfig.requestInterval
|
const globalRequestInterval = requestGlobalConfig.requestInterval
|
||||||
const globalUnit = requestGlobalConfig.requestIntervalUnit
|
const globalUnit = requestGlobalConfig.requestIntervalUnit
|
||||||
|
|
||||||
// 定时时间
|
// 定时时间
|
||||||
const time = targetInterval ? targetInterval : globalRequestInterval
|
const time = targetInterval ? targetInterval : globalRequestInterval
|
||||||
// 单位
|
// 单位
|
||||||
const unit = targetInterval ? targetUnit : globalUnit
|
const unit = targetInterval ? targetUnit : globalUnit
|
||||||
// 开启轮询
|
// 开启轮询
|
||||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||||
}
|
}
|
||||||
@@ -96,13 +108,16 @@ export const useChartDataPondFetch = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化数据池
|
// 初始化数据池
|
||||||
const initDataPond = (requestGlobalConfig: RequestGlobalConfigType) => {
|
const initDataPond = (useChartEditStore: ChartEditStoreType) => {
|
||||||
const { requestDataPond } = requestGlobalConfig
|
const { requestGlobalConfig } = useChartEditStore()
|
||||||
|
const chartEditStore = useChartEditStore()
|
||||||
// 根据 mapId 查找对应的数据池配置
|
// 根据 mapId 查找对应的数据池配置
|
||||||
for (let pondKey of mittDataPondMap.keys()) {
|
for (let pondKey of mittDataPondMap.keys()) {
|
||||||
const requestDataPondItem = requestDataPond.find(item => item.dataPondId === pondKey)
|
const requestDataPondItem = computed(() => {
|
||||||
|
return requestGlobalConfig.requestDataPond.find(item => item.dataPondId === pondKey)
|
||||||
|
}) as ComputedRef<RequestDataPondItemType>
|
||||||
if (requestDataPondItem) {
|
if (requestDataPondItem) {
|
||||||
newPondItemInterval(requestGlobalConfig, requestDataPondItem, mittDataPondMap.get(pondKey))
|
newPondItemInterval(chartEditStore.requestGlobalConfig, requestDataPondItem, mittDataPondMap.get(pondKey))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
59
src/hooks/useChartInteract.hook.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import { toRefs } from 'vue'
|
||||||
|
import { isPreview } from '@/utils'
|
||||||
|
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
|
||||||
|
) => {
|
||||||
|
if (!isPreview()) return
|
||||||
|
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 globalConfigPindAprndex = chartEditStore.requestGlobalConfig.requestDataPond.findIndex(cItem =>
|
||||||
|
cItem.dataPondId === item.interactComponentId
|
||||||
|
)
|
||||||
|
if (globalConfigPindAprndex !== -1) {
|
||||||
|
const { Params, Header } = toRefs(chartEditStore.requestGlobalConfig.requestDataPond[globalConfigPindAprndex].dataPondRequestConfig.requestParams)
|
||||||
|
|
||||||
|
Object.keys(item.interactFn).forEach(key => {
|
||||||
|
if (key in Params.value) {
|
||||||
|
Params.value[key] = param[item.interactFn[key]]
|
||||||
|
}
|
||||||
|
if (key in Header.value) {
|
||||||
|
Header.value[key] = param[item.interactFn[key]]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
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 (key in Params.value) {
|
||||||
|
Params.value[key] = param[item.interactFn[key]]
|
||||||
|
}
|
||||||
|
if (key in Header.value) {
|
||||||
|
Header.value[key] = param[item.interactFn[key]]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 联动事件触发的 type 变更时,清除当前绑定内容
|
||||||
|
export const clearInteractEvent = (chartConfig: CreateComponentType) => {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { CreateComponentType, CreateComponentGroupType, EventLife, BaseEvent } 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'
|
||||||
|
|
||||||
// 所有图表组件集合对象
|
// 所有图表组件集合对象
|
||||||
|
|||||||
@@ -1,218 +1,218 @@
|
|||||||
import throttle from 'lodash/throttle'
|
import throttle from 'lodash/throttle'
|
||||||
|
|
||||||
// 拆出来是为了更好的分离单独复用
|
// 拆出来是为了更好的分离单独复用
|
||||||
|
|
||||||
// * 屏幕缩放适配(两边留白)
|
// * 屏幕缩放适配(两边留白)
|
||||||
export const usePreviewFitScale = (
|
export const usePreviewFitScale = (
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
scaleDom: HTMLElement | null,
|
scaleDom: HTMLElement | null,
|
||||||
callback?: (scale: {
|
callback?: (scale: {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
}) => void
|
}) => void
|
||||||
) => {
|
) => {
|
||||||
// * 画布尺寸(px)
|
// * 画布尺寸(px)
|
||||||
const baseWidth = width
|
const baseWidth = width
|
||||||
const baseHeight = height
|
const baseHeight = height
|
||||||
|
|
||||||
// * 默认缩放值
|
// * 默认缩放值
|
||||||
const scale = {
|
const scale = {
|
||||||
width: 1,
|
width: 1,
|
||||||
height: 1,
|
height: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 需保持的比例
|
// * 需保持的比例
|
||||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||||
const calcRate = () => {
|
const calcRate = () => {
|
||||||
// 当前屏幕宽高比
|
// 当前屏幕宽高比
|
||||||
const currentRate = parseFloat(
|
const currentRate = parseFloat(
|
||||||
(window.innerWidth / window.innerHeight).toFixed(5)
|
(window.innerWidth / window.innerHeight).toFixed(5)
|
||||||
)
|
)
|
||||||
if (scaleDom) {
|
if (scaleDom) {
|
||||||
if (currentRate > baseProportion) {
|
if (currentRate > baseProportion) {
|
||||||
// 表示更宽
|
// 表示更宽
|
||||||
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
||||||
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
||||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||||
} else {
|
} else {
|
||||||
// 表示更高
|
// 表示更高
|
||||||
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
||||||
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
||||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||||
}
|
}
|
||||||
if (callback) callback(scale)
|
if (callback) callback(scale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resize = throttle(() => {
|
const resize = throttle(() => {
|
||||||
calcRate()
|
calcRate()
|
||||||
}, 200)
|
}, 200)
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 改变窗口大小重新绘制
|
||||||
const windowResize = () => {
|
const windowResize = () => {
|
||||||
window.addEventListener('resize', resize)
|
window.addEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 卸载监听
|
||||||
const unWindowResize = () => {
|
const unWindowResize = () => {
|
||||||
window.removeEventListener('resize', resize)
|
window.removeEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
calcRate,
|
calcRate,
|
||||||
windowResize,
|
windowResize,
|
||||||
unWindowResize,
|
unWindowResize,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * X轴撑满,Y轴滚动条
|
// * X轴撑满,Y轴滚动条
|
||||||
export const usePreviewScrollYScale = (
|
export const usePreviewScrollYScale = (
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
scaleDom: HTMLElement | null,
|
scaleDom: HTMLElement | null,
|
||||||
callback?: (scale: {
|
callback?: (scale: {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
}) => void
|
}) => void
|
||||||
) => {
|
) => {
|
||||||
// * 画布尺寸(px)
|
// * 画布尺寸(px)
|
||||||
const baseWidth = width
|
const baseWidth = width
|
||||||
const baseHeight = height
|
const baseHeight = height
|
||||||
|
|
||||||
// * 默认缩放值
|
// * 默认缩放值
|
||||||
const scale = {
|
const scale = {
|
||||||
width: 1,
|
width: 1,
|
||||||
height: 1,
|
height: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 需保持的比例
|
// * 需保持的比例
|
||||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||||
const calcRate = () => {
|
const calcRate = () => {
|
||||||
if (scaleDom) {
|
if (scaleDom) {
|
||||||
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
scale.height = parseFloat(((window.innerWidth / baseProportion) / baseHeight).toFixed(5))
|
||||||
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
scale.width = parseFloat((window.innerWidth / baseWidth).toFixed(5))
|
||||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||||
if (callback) callback(scale)
|
if (callback) callback(scale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resize = throttle(() => {
|
const resize = throttle(() => {
|
||||||
calcRate()
|
calcRate()
|
||||||
}, 200)
|
}, 200)
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 改变窗口大小重新绘制
|
||||||
const windowResize = () => {
|
const windowResize = () => {
|
||||||
window.addEventListener('resize', resize)
|
window.addEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 卸载监听
|
||||||
const unWindowResize = () => {
|
const unWindowResize = () => {
|
||||||
window.removeEventListener('resize', resize)
|
window.removeEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
calcRate,
|
calcRate,
|
||||||
windowResize,
|
windowResize,
|
||||||
unWindowResize,
|
unWindowResize,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * Y轴撑满,X轴滚动条
|
// * Y轴撑满,X轴滚动条
|
||||||
export const usePreviewScrollXScale = (
|
export const usePreviewScrollXScale = (
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
scaleDom: HTMLElement | null,
|
scaleDom: HTMLElement | null,
|
||||||
callback?: (scale: {
|
callback?: (scale: {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
}) => void
|
}) => void
|
||||||
) => {
|
) => {
|
||||||
// * 画布尺寸(px)
|
// * 画布尺寸(px)
|
||||||
const baseWidth = width
|
const baseWidth = width
|
||||||
const baseHeight = height
|
const baseHeight = height
|
||||||
|
|
||||||
// * 默认缩放值
|
// * 默认缩放值
|
||||||
const scale = {
|
const scale = {
|
||||||
height: 1,
|
height: 1,
|
||||||
width: 1,
|
width: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 需保持的比例
|
// * 需保持的比例
|
||||||
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))
|
||||||
const calcRate = () => {
|
const calcRate = () => {
|
||||||
if (scaleDom) {
|
if (scaleDom) {
|
||||||
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
scale.width = parseFloat(((window.innerHeight * baseProportion) / baseWidth).toFixed(5))
|
||||||
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
scale.height = parseFloat((window.innerHeight / baseHeight).toFixed(5))
|
||||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||||
if (callback) callback(scale)
|
if (callback) callback(scale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resize = throttle(() => {
|
const resize = throttle(() => {
|
||||||
calcRate()
|
calcRate()
|
||||||
}, 200)
|
}, 200)
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 改变窗口大小重新绘制
|
||||||
const windowResize = () => {
|
const windowResize = () => {
|
||||||
window.addEventListener('resize', resize)
|
window.addEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 卸载监听
|
||||||
const unWindowResize = () => {
|
const unWindowResize = () => {
|
||||||
window.removeEventListener('resize', resize)
|
window.removeEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
calcRate,
|
calcRate,
|
||||||
windowResize,
|
windowResize,
|
||||||
unWindowResize,
|
unWindowResize,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 变形内容,宽高铺满
|
// * 变形内容,宽高铺满
|
||||||
export const usePreviewFullScale = (
|
export const usePreviewFullScale = (
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
scaleDom: HTMLElement | null,
|
scaleDom: HTMLElement | null,
|
||||||
callback?: (scale: {
|
callback?: (scale: {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
}) => void
|
}) => void
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
// * 默认缩放值
|
// * 默认缩放值
|
||||||
const scale = {
|
const scale = {
|
||||||
width: 1,
|
width: 1,
|
||||||
height: 1,
|
height: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
const calcRate = () => {
|
const calcRate = () => {
|
||||||
if (scaleDom) {
|
if (scaleDom) {
|
||||||
scale.width = parseFloat((window.innerWidth / width).toFixed(5))
|
scale.width = parseFloat((window.innerWidth / width).toFixed(5))
|
||||||
scale.height = parseFloat((window.innerHeight / height).toFixed(5))
|
scale.height = parseFloat((window.innerHeight / height).toFixed(5))
|
||||||
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
scaleDom.style.transform = `scale(${scale.width}, ${scale.height})`
|
||||||
if (callback) callback(scale)
|
if (callback) callback(scale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resize = throttle(() => {
|
const resize = throttle(() => {
|
||||||
calcRate()
|
calcRate()
|
||||||
}, 200)
|
}, 200)
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 改变窗口大小重新绘制
|
||||||
const windowResize = () => {
|
const windowResize = () => {
|
||||||
window.addEventListener('resize', resize)
|
window.addEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// * 改变窗口大小重新绘制
|
// * 卸载监听
|
||||||
const unWindowResize = () => {
|
const unWindowResize = () => {
|
||||||
window.removeEventListener('resize', resize)
|
window.removeEventListener('resize', resize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
calcRate,
|
calcRate,
|
||||||
windowResize,
|
windowResize,
|
||||||
unWindowResize,
|
unWindowResize,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,3 +1,4 @@
|
|||||||
export * from './axis'
|
export * from './axis'
|
||||||
export * from './line'
|
export * from './line'
|
||||||
export * from './label'
|
export * from './label'
|
||||||
|
export * from './legend'
|
||||||
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'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,34 +111,39 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const calcData = (data: any) => {
|
const calcData = (data: any, type?: string) => {
|
||||||
mergeConfig(props.chartConfig.option)
|
let cloneConfig = cloneDeep(props.chartConfig.option || {})
|
||||||
calcCapsuleLengthAndLabelData()
|
state.mergedConfig = cloneConfig
|
||||||
}
|
if (type == 'preview') {
|
||||||
|
cloneConfig.dataset = data
|
||||||
const mergeConfig = (data: any) => {
|
}
|
||||||
state.mergedConfig = cloneDeep(data || {})
|
calcCapsuleLengthAndLabelData(state.mergedConfig.dataset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据解析
|
// 数据解析
|
||||||
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) => {
|
||||||
@@ -151,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,6 @@
|
|||||||
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 cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
|
|||||||
@@ -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[]>()
|
||||||
|
|||||||
@@ -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, [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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, [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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 => {})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
86
src/packages/components/Charts/Mores/Sankey/data.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": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "a",
|
||||||
|
"target": "a2",
|
||||||
|
"value": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "b",
|
||||||
|
"target": "b1",
|
||||||
|
"value": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "a",
|
||||||
|
"target": "b1",
|
||||||
|
"value": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "b1",
|
||||||
|
"target": "a1",
|
||||||
|
"value": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "b1",
|
||||||
|
"target": "b2",
|
||||||
|
"value": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
14
src/packages/components/Charts/Mores/Sankey/index.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||||
|
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
|
||||||
|
|
||||||
|
export const SankeyConfig: ConfigType = {
|
||||||
|
key: 'Sankey',
|
||||||
|
chartKey: 'VSankey',
|
||||||
|
conKey: 'VCSankey',
|
||||||
|
title: '桑基图',
|
||||||
|
category: ChatCategoryEnum.MORE,
|
||||||
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
|
image: 'sankey.png'
|
||||||
|
}
|
||||||
78
src/packages/components/Charts/Mores/Sankey/index.vue
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<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 dataHandle = (dataset: typeof dataJson) => {
|
||||||
|
if (dataset.label) {
|
||||||
|
props.chartConfig.option.series.data = dataset.label
|
||||||
|
}
|
||||||
|
if (dataset.links) {
|
||||||
|
props.chartConfig.option.series.links = dataset.links
|
||||||
|
}
|
||||||
|
if (dataset.levels) {
|
||||||
|
props.chartConfig.option.series.levels = dataset.levels
|
||||||
|
}
|
||||||
|
if (vChartRef.value && isPreview()) {
|
||||||
|
setOption(vChartRef.value, props.chartConfig.option)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.chartConfig.option.dataset,
|
||||||
|
newData => {
|
||||||
|
try {
|
||||||
|
dataHandle(newData)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
||||||
|
dataHandle(newData)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/tree_map.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 TreeMapConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MORE,
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'tree_map.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 { TreemapChart } from 'echarts/charts'
|
import { TreemapChart } 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'
|
||||||
@@ -31,6 +32,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([CanvasRenderer, TreemapChart])
|
use([CanvasRenderer, TreemapChart])
|
||||||
|
|
||||||
const vChartRef = ref<typeof VChart>()
|
const vChartRef = ref<typeof VChart>()
|
||||||
@@ -42,7 +45,7 @@ const option = computed(() => {
|
|||||||
const dataSetHandle = (dataset: typeof dataJson) => {
|
const dataSetHandle = (dataset: typeof dataJson) => {
|
||||||
if (dataset) {
|
if (dataset) {
|
||||||
props.chartConfig.option.series[0].data = dataset
|
props.chartConfig.option.series[0].data = dataset
|
||||||
vChartRef.value?.setOption(props.chartConfig.option)
|
setOption(vChartRef.value, props.chartConfig.option)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import image from '@/assets/images/chart/charts/water_WaterPolo.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 WaterPoloConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.MORE,
|
categoryName: ChatCategoryEnumName.MORE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.COMMON,
|
chartFrame: ChartFrameEnum.COMMON,
|
||||||
image
|
image: 'water_WaterPolo.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart :theme="themeColor" :option="option.value" autoresize></v-chart>
|
<v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize></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 'echarts-liquidfill/src/liquidFill.js'
|
import 'echarts-liquidfill/src/liquidFill.js'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { GridComponent } from 'echarts/components'
|
import { GridComponent } from 'echarts/components'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import { isPreview, isString, isNumber } from '@/utils'
|
import { isPreview, isString, isNumber, colorGradientCustomMerge } from '@/utils'
|
||||||
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
@@ -30,6 +31,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([CanvasRenderer, GridComponent])
|
use([CanvasRenderer, GridComponent])
|
||||||
|
|
||||||
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[0].backgroundStyle.color = themeColor[2]
|
props.chartConfig.option.series[0].backgroundStyle.color = themeColor[2]
|
||||||
// 水球颜色
|
// 水球颜色
|
||||||
|
|||||||
@@ -4,5 +4,8 @@ import { FunnelConfig } from './Funnel/index'
|
|||||||
import { HeatmapConfig } from './Heatmap/index'
|
import { HeatmapConfig } from './Heatmap/index'
|
||||||
import { WaterPoloConfig } from './WaterPolo/index'
|
import { WaterPoloConfig } from './WaterPolo/index'
|
||||||
import { TreeMapConfig } from './TreeMap/index'
|
import { TreeMapConfig } from './TreeMap/index'
|
||||||
|
import { DialConfig } from './Dial/index'
|
||||||
|
import { SankeyConfig } from './Sankey/index'
|
||||||
|
import { GraphConfig } from './Graph/index'
|
||||||
|
|
||||||
export default [ProcessConfig, RadarConfig, FunnelConfig, HeatmapConfig, WaterPoloConfig, TreeMapConfig]
|
export default [ProcessConfig, RadarConfig, FunnelConfig, HeatmapConfig, WaterPoloConfig, TreeMapConfig, GraphConfig, SankeyConfig, DialConfig]
|
||||||
|
|||||||
@@ -7,6 +7,22 @@
|
|||||||
</n-input-number>
|
</n-input-number>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
|
<!-- 中心标题 -->
|
||||||
|
<SettingItemBox v-if="config.title" name="标题">
|
||||||
|
<SettingItem name="颜色">
|
||||||
|
<n-color-picker size="small" :modes="['hex']" v-model:value="config.title.textStyle.color"></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="字体大小">
|
||||||
|
<n-input-number
|
||||||
|
v-model:value="config.title.textStyle.fontSize"
|
||||||
|
:min="0"
|
||||||
|
:step="1"
|
||||||
|
size="small"
|
||||||
|
placeholder="字体大小"
|
||||||
|
>
|
||||||
|
</n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
<!-- Echarts 全局设置 -->
|
<!-- Echarts 全局设置 -->
|
||||||
<SettingItemBox name="进度条">
|
<SettingItemBox name="进度条">
|
||||||
<SettingItem name="颜色">
|
<SettingItem name="颜色">
|
||||||
@@ -31,24 +47,8 @@
|
|||||||
></n-color-picker>
|
></n-color-picker>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
<!-- 中心标题 -->
|
|
||||||
<SettingItemBox v-if="config.title" name="标题">
|
|
||||||
<SettingItem name="颜色">
|
|
||||||
<n-color-picker size="small" :modes="['hex']" v-model:value="config.title.textStyle.color"></n-color-picker>
|
|
||||||
</SettingItem>
|
|
||||||
<SettingItem name="字体大小">
|
|
||||||
<n-input-number
|
|
||||||
v-model:value="config.title.textStyle.fontSize"
|
|
||||||
:min="0"
|
|
||||||
:step="1"
|
|
||||||
size="small"
|
|
||||||
placeholder="字体大小"
|
|
||||||
>
|
|
||||||
</n-input-number>
|
|
||||||
</SettingItem>
|
|
||||||
</SettingItemBox>
|
|
||||||
<!-- 其他样式 -->
|
<!-- 其他样式 -->
|
||||||
<SettingItemBox name="轨道样式">
|
<SettingItemBox name="轨道">
|
||||||
<SettingItem name="颜色">
|
<SettingItem name="颜色">
|
||||||
<n-color-picker size="small" :modes="['hex']" v-model:value="item.data[1].itemStyle.color"></n-color-picker>
|
<n-color-picker size="small" :modes="['hex']" v-model:value="item.data[1].itemStyle.color"></n-color-picker>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
@@ -69,6 +69,18 @@
|
|||||||
v-model:value="item.data[1].itemStyle.shadowColor"
|
v-model:value="item.data[1].itemStyle.shadowColor"
|
||||||
></n-color-picker>
|
></n-color-picker>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
<SettingItem name="轨道宽度">
|
||||||
|
<n-select
|
||||||
|
v-model:value="item.radius[0]"
|
||||||
|
size="small"
|
||||||
|
:options="[
|
||||||
|
{ label: '窄', value: '75%' },
|
||||||
|
{ label: '中', value: '60%' },
|
||||||
|
{ label: '宽', value: '45%' },
|
||||||
|
{ label: '更宽', value: '30%' }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
</CollapseItem>
|
</CollapseItem>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ export const PieCircleConfig: ConfigType = {
|
|||||||
categoryName: ChatCategoryEnumName.PIE,
|
categoryName: ChatCategoryEnumName.PIE,
|
||||||
package: PackagesCategoryEnum.CHARTS,
|
package: PackagesCategoryEnum.CHARTS,
|
||||||
chartFrame: ChartFrameEnum.ECHARTS,
|
chartFrame: ChartFrameEnum.ECHARTS,
|
||||||
image
|
image: 'pie-circle.png'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart :theme="themeColor" :option="option.value" autoresize> </v-chart>
|
<v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize> </v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, reactive, watch } from 'vue'
|
import { PropType, reactive, watch } 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 { PieChart } from 'echarts/charts'
|
import { PieChart } from 'echarts/charts'
|
||||||
@@ -29,6 +30,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
|
||||||
|
|
||||||
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent])
|
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent])
|
||||||
|
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
@@ -38,7 +41,7 @@ const option = reactive({
|
|||||||
const dataHandle = (newData: any) => {
|
const dataHandle = (newData: any) => {
|
||||||
const d = parseFloat(`${newData}`) * 100
|
const d = parseFloat(`${newData}`) * 100
|
||||||
let config = props.chartConfig.option
|
let config = props.chartConfig.option
|
||||||
config.title.text = d.toFixed(2) + '%'
|
config.title.text = `${+d.toFixed(2)}%`
|
||||||
config.series[0].data[0].value[0] = d
|
config.series[0].data[0].value[0] = d
|
||||||
config.series[0].data[1].value[0] = 100 - d
|
config.series[0].data[1].value[0] = 100 - d
|
||||||
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
||||||
@@ -65,7 +68,7 @@ watch(
|
|||||||
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: number) => {
|
useChartDataFetch(props.chartConfig, useChartEditStore, (resData: number) => {
|
||||||
let d = parseFloat(`${resData}`) * 100
|
let d = parseFloat(`${resData}`) * 100
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
option.value.title.text = d.toFixed(2) + '%'
|
option.value.title.text = `${+d.toFixed(2)}%`
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
option.value.series[0].data[0].value[0] = d
|
option.value.series[0].data[0].value[0] = d
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||