mirror of
https://gitee.com/dromara/go-view.git
synced 2026-02-22 00:00:02 +08:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
6f74be7092 | ||
|
|
1f9790e5f5 | ||
|
|
0b8ab9adfa | ||
|
|
a17d7a4182 | ||
|
|
4ef77fcf25 | ||
|
|
d204b459d9 | ||
|
|
6ae6645d3c | ||
|
|
a925ced533 | ||
|
|
8dcccef54d | ||
|
|
dff639e901 | ||
|
|
0376703fd2 | ||
|
|
7341ff11f3 | ||
|
|
57193beeab | ||
|
|
405e884e70 | ||
|
|
0d4e83c940 | ||
|
|
b8ed389f60 | ||
|
|
b308275d99 | ||
|
|
f15e0cd15f | ||
|
|
aa17e93966 | ||
|
|
feb9796449 | ||
|
|
e4b641a9c9 | ||
|
|
0cd31f48c1 | ||
|
|
e35e98c023 | ||
|
|
352a1742cf | ||
|
|
11cd4d0da1 | ||
|
|
8987dd1682 | ||
|
|
ff1384c825 | ||
|
|
1af7ae865d | ||
|
|
0e42f4ff35 | ||
|
|
cfcc262fd6 | ||
|
|
36ca877d49 | ||
|
|
3bad7ec758 | ||
|
|
e1e26cafcf | ||
|
|
99cd66c835 | ||
|
|
e4aac1597f | ||
|
|
2dc7bc3b61 | ||
|
|
07b7eec457 | ||
|
|
eaab8d1d49 | ||
|
|
7bc6ff7619 | ||
|
|
9903e73a69 | ||
|
|
7f1c001c99 | ||
|
|
67f6dcd1fe | ||
|
|
de60c7cde5 | ||
|
|
889e5075ba | ||
|
|
2bba1dcae0 | ||
|
|
9d81159141 | ||
|
|
f8ebaa60b1 | ||
|
|
02ec3c78d6 | ||
|
|
21ba5c02b0 | ||
|
|
500795b7e5 | ||
|
|
8230757bd1 | ||
|
|
e75e2ccfe6 |
51
.workflow/branch-pipeline.yml
Normal file
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
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
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
|
||||
@@ -1,3 +1,4 @@
|
||||
import path from 'path'
|
||||
export const OUTPUT_DIR = 'dist'
|
||||
|
||||
// monaco-editor 路径
|
||||
@@ -6,7 +7,7 @@ export const prefix = `monaco-editor/esm/vs`
|
||||
// chunk 警告大小
|
||||
export const chunkSizeWarningLimit = 2000
|
||||
|
||||
// 禁用 brotli 压缩大小报告
|
||||
// 禁用 brotliSize 压缩大小报告
|
||||
export const brotliSize = false
|
||||
|
||||
// 分包
|
||||
@@ -14,7 +15,12 @@ export const rollupOptions = {
|
||||
output: {
|
||||
chunkFileNames: 'static/js/[name]-[hash].js',
|
||||
entryFileNames: 'static/js/[name]-[hash].js',
|
||||
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
|
||||
assetFileNames: (chunkInfo) => {
|
||||
if(['.png', '.jpg', '.jpeg'].includes(path.extname(chunkInfo.name))) {
|
||||
return `static/[ext]/[name].[ext]`
|
||||
}
|
||||
return `static/[ext]/[name]-[hash].[ext]`
|
||||
},
|
||||
manualChunks: {
|
||||
jsonWorker: [`${prefix}/language/json/json.worker`],
|
||||
cssWorker: [`${prefix}/language/css/css.worker`],
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"name": "go-view",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.5",
|
||||
"engines": {
|
||||
"node": ">=16.14 <18.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite --host",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
@@ -21,6 +24,7 @@
|
||||
"axios": "^0.27.2",
|
||||
"color": "^4.2.3",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dom-helpers": "^5.2.1",
|
||||
"echarts-liquidfill": "^3.1.0",
|
||||
"echarts-stat": "^1.2.0",
|
||||
"echarts-wordcloud": "^2.0.0",
|
||||
@@ -29,13 +33,13 @@
|
||||
"html2canvas": "^1.4.1",
|
||||
"keymaster": "^1.6.2",
|
||||
"monaco-editor": "^0.33.0",
|
||||
"naive-ui": "2.33.4",
|
||||
"naive-ui": "2.34.3",
|
||||
"pinia": "^2.0.13",
|
||||
"screenfull": "^6.0.1",
|
||||
"three": "^0.145.0",
|
||||
"vue": "^3.2.31",
|
||||
"vue-demi": "^0.13.1",
|
||||
"vue-i18n": "9.1.10",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-router": "4.0.12",
|
||||
"vue3-lazyload": "^0.2.5-beta",
|
||||
"vue3-sketch-ruler": "^1.3.3",
|
||||
@@ -78,4 +82,4 @@
|
||||
"vue-echarts": "^6.0.2",
|
||||
"vue-tsc": "^0.28.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
127
pnpm-lock.yaml
generated
127
pnpm-lock.yaml
generated
@@ -25,6 +25,7 @@ specifiers:
|
||||
commitlint: ^17.0.2
|
||||
crypto-js: ^4.1.1
|
||||
default-passive-events: ^2.0.0
|
||||
dom-helpers: ^5.2.1
|
||||
echarts: ^5.3.2
|
||||
echarts-liquidfill: ^3.1.0
|
||||
echarts-stat: ^1.2.0
|
||||
@@ -42,7 +43,7 @@ specifiers:
|
||||
lodash: ~4.17.21
|
||||
mockjs: ^1.1.0
|
||||
monaco-editor: ^0.33.0
|
||||
naive-ui: 2.33.4
|
||||
naive-ui: 2.34.3
|
||||
pinia: ^2.0.13
|
||||
plop: ^3.0.5
|
||||
prettier: ^2.6.2
|
||||
@@ -59,7 +60,7 @@ specifiers:
|
||||
vue: ^3.2.31
|
||||
vue-demi: ^0.13.1
|
||||
vue-echarts: ^6.0.2
|
||||
vue-i18n: 9.1.10
|
||||
vue-i18n: ^9.2.2
|
||||
vue-router: 4.0.12
|
||||
vue-tsc: ^0.28.10
|
||||
vue3-lazyload: ^0.2.5-beta
|
||||
@@ -77,6 +78,7 @@ dependencies:
|
||||
axios: 0.27.2
|
||||
color: 4.2.3
|
||||
crypto-js: 4.1.1
|
||||
dom-helpers: 5.2.1
|
||||
echarts-liquidfill: 3.1.0_echarts@5.3.3
|
||||
echarts-stat: 1.2.0
|
||||
echarts-wordcloud: 2.0.0_echarts@5.3.3
|
||||
@@ -85,13 +87,13 @@ dependencies:
|
||||
html2canvas: 1.4.1
|
||||
keymaster: 1.6.2
|
||||
monaco-editor: 0.33.0
|
||||
naive-ui: 2.33.4_vue@3.2.37
|
||||
naive-ui: 2.34.3_vue@3.2.37
|
||||
pinia: 2.0.14_ub5l46u3nefphax5x2tezui4oq
|
||||
screenfull: 6.0.1
|
||||
three: 0.145.0
|
||||
vue: 3.2.37
|
||||
vue-demi: 0.13.1_vue@3.2.37
|
||||
vue-i18n: 9.1.10_vue@3.2.37
|
||||
vue-i18n: 9.2.2_vue@3.2.37
|
||||
vue-router: 4.0.12_vue@3.2.37
|
||||
vue3-lazyload: 0.2.5-beta_2yymnzrok6eda47acnj2yjm3ae
|
||||
vue3-sketch-ruler: 1.3.4_vue@3.2.37
|
||||
@@ -402,6 +404,13 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@babel/runtime/7.20.6:
|
||||
resolution: {integrity: sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
regenerator-runtime: 0.13.11
|
||||
dev: false
|
||||
|
||||
/@babel/template/7.16.7:
|
||||
resolution: {integrity: sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@@ -671,60 +680,42 @@ packages:
|
||||
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
|
||||
dev: true
|
||||
|
||||
/@intlify/core-base/9.1.10:
|
||||
resolution: {integrity: sha512-So9CNUavB/IsZ+zBmk2Cv6McQp6vc2wbGi1S0XQmJ8Vz+UFcNn9MFXAe9gY67PreIHrbLsLxDD0cwo1qsxM1Nw==}
|
||||
engines: {node: '>= 10'}
|
||||
/@intlify/core-base/9.2.2:
|
||||
resolution: {integrity: sha512-JjUpQtNfn+joMbrXvpR4hTF8iJQ2sEFzzK3KIESOx+f+uwIjgw20igOyaIdhfsVVBCds8ZM64MoeNSx+PHQMkA==}
|
||||
engines: {node: '>= 14'}
|
||||
dependencies:
|
||||
'@intlify/devtools-if': 9.1.10
|
||||
'@intlify/message-compiler': 9.1.10
|
||||
'@intlify/message-resolver': 9.1.10
|
||||
'@intlify/runtime': 9.1.10
|
||||
'@intlify/shared': 9.1.10
|
||||
'@intlify/vue-devtools': 9.1.10
|
||||
'@intlify/devtools-if': 9.2.2
|
||||
'@intlify/message-compiler': 9.2.2
|
||||
'@intlify/shared': 9.2.2
|
||||
'@intlify/vue-devtools': 9.2.2
|
||||
dev: false
|
||||
|
||||
/@intlify/devtools-if/9.1.10:
|
||||
resolution: {integrity: sha512-SHaKoYu6sog3+Q8js1y3oXLywuogbH1sKuc7NSYkN3GElvXSBaMoCzW+we0ZSFqj/6c7vTNLg9nQ6rxhKqYwnQ==}
|
||||
engines: {node: '>= 10'}
|
||||
/@intlify/devtools-if/9.2.2:
|
||||
resolution: {integrity: sha512-4ttr/FNO29w+kBbU7HZ/U0Lzuh2cRDhP8UlWOtV9ERcjHzuyXVZmjyleESK6eVP60tGC9QtQW9yZE+JeRhDHkg==}
|
||||
engines: {node: '>= 14'}
|
||||
dependencies:
|
||||
'@intlify/shared': 9.1.10
|
||||
'@intlify/shared': 9.2.2
|
||||
dev: false
|
||||
|
||||
/@intlify/message-compiler/9.1.10:
|
||||
resolution: {integrity: sha512-+JiJpXff/XTb0EadYwdxOyRTB0hXNd4n1HaJ/a4yuV960uRmPXaklJsedW0LNdcptd/hYUZtCkI7Lc9J5C1gxg==}
|
||||
engines: {node: '>= 10'}
|
||||
/@intlify/message-compiler/9.2.2:
|
||||
resolution: {integrity: sha512-IUrQW7byAKN2fMBe8z6sK6riG1pue95e5jfokn8hA5Q3Bqy4MBJ5lJAofUsawQJYHeoPJ7svMDyBaVJ4d0GTtA==}
|
||||
engines: {node: '>= 14'}
|
||||
dependencies:
|
||||
'@intlify/message-resolver': 9.1.10
|
||||
'@intlify/shared': 9.1.10
|
||||
'@intlify/shared': 9.2.2
|
||||
source-map: 0.6.1
|
||||
dev: false
|
||||
|
||||
/@intlify/message-resolver/9.1.10:
|
||||
resolution: {integrity: sha512-5YixMG/M05m0cn9+gOzd4EZQTFRUu8RGhzxJbR1DWN21x/Z3bJ8QpDYj6hC4FwBj5uKsRfKpJQ3Xqg98KWoA+w==}
|
||||
engines: {node: '>= 10'}
|
||||
/@intlify/shared/9.2.2:
|
||||
resolution: {integrity: sha512-wRwTpsslgZS5HNyM7uDQYZtxnbI12aGiBZURX3BTR9RFIKKRWpllTsgzHWvj3HKm3Y2Sh5LPC1r0PDCKEhVn9Q==}
|
||||
engines: {node: '>= 14'}
|
||||
dev: false
|
||||
|
||||
/@intlify/runtime/9.1.10:
|
||||
resolution: {integrity: sha512-7QsuByNzpe3Gfmhwq6hzgXcMPpxz8Zxb/XFI6s9lQdPLPe5Lgw4U1ovRPZTOs6Y2hwitR3j/HD8BJNGWpJnOFA==}
|
||||
engines: {node: '>= 10'}
|
||||
/@intlify/vue-devtools/9.2.2:
|
||||
resolution: {integrity: sha512-+dUyqyCHWHb/UcvY1MlIpO87munedm3Gn6E9WWYdWrMuYLcoIoOEVDWSS8xSwtlPU+kA+MEQTP6Q1iI/ocusJg==}
|
||||
engines: {node: '>= 14'}
|
||||
dependencies:
|
||||
'@intlify/message-compiler': 9.1.10
|
||||
'@intlify/message-resolver': 9.1.10
|
||||
'@intlify/shared': 9.1.10
|
||||
dev: false
|
||||
|
||||
/@intlify/shared/9.1.10:
|
||||
resolution: {integrity: sha512-Om54xJeo1Vw+K1+wHYyXngE8cAbrxZHpWjYzMR9wCkqbhGtRV5VLhVc214Ze2YatPrWlS2WSMOWXR8JktX/IgA==}
|
||||
engines: {node: '>= 10'}
|
||||
dev: false
|
||||
|
||||
/@intlify/vue-devtools/9.1.10:
|
||||
resolution: {integrity: sha512-5l3qYARVbkWAkagLu1XbDUWRJSL8br1Dj60wgMaKB0+HswVsrR6LloYZTg7ozyvM621V6+zsmwzbQxbVQyrytQ==}
|
||||
engines: {node: '>= 10'}
|
||||
dependencies:
|
||||
'@intlify/message-resolver': 9.1.10
|
||||
'@intlify/runtime': 9.1.10
|
||||
'@intlify/shared': 9.1.10
|
||||
'@intlify/core-base': 9.2.2
|
||||
'@intlify/shared': 9.2.2
|
||||
dev: false
|
||||
|
||||
/@jridgewell/gen-mapping/0.1.1:
|
||||
@@ -889,6 +880,10 @@ packages:
|
||||
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
|
||||
dev: true
|
||||
|
||||
/@types/katex/0.14.0:
|
||||
resolution: {integrity: sha512-+2FW2CcT0K3P+JMR8YG846bmDwplKUTsWgT2ENwdQ1UdVfRk3GQrh6Mi4sTopy30gI8Uau5CEqHTDZ6YvWIUPA==}
|
||||
dev: false
|
||||
|
||||
/@types/keymaster/1.6.30:
|
||||
resolution: {integrity: sha512-mtL/NuDBX72zmyIa3cYHA1bQj1WAYlSC4eZcIQj+DHJkcRyTRF2XJXo7DBmkkY8TEq7XaAf7B8TGxs5PHhjRtw==}
|
||||
dev: false
|
||||
@@ -1219,6 +1214,10 @@ packages:
|
||||
resolution: {integrity: sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==}
|
||||
dev: false
|
||||
|
||||
/@vue/devtools-api/6.4.5:
|
||||
resolution: {integrity: sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ==}
|
||||
dev: false
|
||||
|
||||
/@vue/reactivity-transform/3.2.37:
|
||||
resolution: {integrity: sha512-IWopkKEb+8qpu/1eMKVeXrK0NLw9HicGviJzhJDEyfxTR9e1WtpnnbYkJWurX6WwoFP0sz10xQg8yL8lgskAZg==}
|
||||
dependencies:
|
||||
@@ -1912,7 +1911,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/csstype/2.6.20:
|
||||
resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/csstype/-/csstype-2.6.20.tgz}
|
||||
resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==}
|
||||
dev: false
|
||||
|
||||
/csstype/3.0.11:
|
||||
@@ -2065,6 +2064,13 @@ packages:
|
||||
resolution: {integrity: sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ==}
|
||||
dev: true
|
||||
|
||||
/dom-helpers/5.2.1:
|
||||
resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.20.6
|
||||
csstype: 3.0.11
|
||||
dev: false
|
||||
|
||||
/dom-serializer/1.4.1:
|
||||
resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==}
|
||||
dependencies:
|
||||
@@ -3074,7 +3080,7 @@ packages:
|
||||
source-map: 0.6.1
|
||||
wordwrap: 1.0.0
|
||||
optionalDependencies:
|
||||
uglify-js: 3.16.0
|
||||
uglify-js: 3.17.4
|
||||
dev: true
|
||||
|
||||
/hard-rejection/2.1.0:
|
||||
@@ -3830,13 +3836,14 @@ packages:
|
||||
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
|
||||
dev: true
|
||||
|
||||
/naive-ui/2.33.4_vue@3.2.37:
|
||||
resolution: {integrity: sha512-4tK2lWx3v8sbEeTLG/tL5Ur9VvZyUxSnC0VcTO6NO1rM/D15JXg8jVwQCRFYnEp7mp3gfD5B3i8kN4JisTeiFA==}
|
||||
/naive-ui/2.34.3_vue@3.2.37:
|
||||
resolution: {integrity: sha512-fUMr0dzb/iGsOTWgoblPVobY5X5dihQ1eam5dA+H74oyLYAvgX4pL96xQFPBLIYqvyRFBAsN85kHN5pLqdtpxA==}
|
||||
peerDependencies:
|
||||
vue: ^3.0.0
|
||||
dependencies:
|
||||
'@css-render/plugin-bem': 0.15.10_css-render@0.15.10
|
||||
'@css-render/vue3-ssr': 0.15.10_vue@3.2.37
|
||||
'@types/katex': 0.14.0
|
||||
'@types/lodash': 4.14.185
|
||||
'@types/lodash-es': 4.17.6
|
||||
async-validator: 4.1.1
|
||||
@@ -4462,6 +4469,10 @@ packages:
|
||||
strip-indent: 3.0.0
|
||||
dev: true
|
||||
|
||||
/regenerator-runtime/0.13.11:
|
||||
resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}
|
||||
dev: false
|
||||
|
||||
/regexp.prototype.flags/1.4.3:
|
||||
resolution: {integrity: sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -5014,8 +5025,8 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/uglify-js/3.16.0:
|
||||
resolution: {integrity: sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw==}
|
||||
/uglify-js/3.17.4:
|
||||
resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
@@ -5385,16 +5396,16 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/vue-i18n/9.1.10_vue@3.2.37:
|
||||
resolution: {integrity: sha512-jpr7gV5KPk4n+sSPdpZT8Qx3XzTcNDWffRlHV/cT2NUyEf+sEgTTmLvnBAibjOFJ0zsUyZlVTAWH5DDnYep+1g==}
|
||||
engines: {node: '>= 10'}
|
||||
/vue-i18n/9.2.2_vue@3.2.37:
|
||||
resolution: {integrity: sha512-yswpwtj89rTBhegUAv9Mu37LNznyu3NpyLQmozF3i1hYOhwpG8RjcjIFIIfnu+2MDZJGSZPXaKWvnQA71Yv9TQ==}
|
||||
engines: {node: '>= 14'}
|
||||
peerDependencies:
|
||||
vue: ^3.0.0
|
||||
dependencies:
|
||||
'@intlify/core-base': 9.1.10
|
||||
'@intlify/shared': 9.1.10
|
||||
'@intlify/vue-devtools': 9.1.10
|
||||
'@vue/devtools-api': 6.1.4
|
||||
'@intlify/core-base': 9.2.2
|
||||
'@intlify/shared': 9.2.2
|
||||
'@intlify/vue-devtools': 9.2.2
|
||||
'@vue/devtools-api': 6.4.5
|
||||
vue: 3.2.37
|
||||
dev: false
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import axios, { AxiosResponse, AxiosRequestConfig } from 'axios'
|
||||
import axios, { AxiosResponse, AxiosRequestConfig, Axios } from 'axios'
|
||||
import { ResultEnum, ModuleTypeEnum } from "@/enums/httpEnum"
|
||||
import { PageEnum, ErrorPageNameMap } from "@/enums/pageEnum"
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
@@ -8,10 +8,20 @@ import { redirectErrorPage, getLocalStorage, routerTurnByName, isPreview } from
|
||||
import { fetchAllowList } from './axios.config'
|
||||
import includes from 'lodash/includes'
|
||||
|
||||
export interface MyResponseType<T> {
|
||||
code: ResultEnum
|
||||
data: T
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface MyRequestInstance extends Axios {
|
||||
<T = any>(config: AxiosRequestConfig): Promise<MyResponseType<T>>
|
||||
}
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: `${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axiosPre}`,
|
||||
timeout: ResultEnum.TIMEOUT,
|
||||
})
|
||||
}) as unknown as MyRequestInstance
|
||||
|
||||
axiosInstance.interceptors.request.use(
|
||||
(config: AxiosRequestConfig) => {
|
||||
|
||||
@@ -9,16 +9,16 @@ import {
|
||||
} from '@/enums/httpEnum'
|
||||
import type { RequestGlobalConfigType, RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
|
||||
export const get = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
export const get = <T = any>(url: string, params?: object) => {
|
||||
return axiosInstance<T>({
|
||||
url: url,
|
||||
method: RequestHttpEnum.GET,
|
||||
params: params,
|
||||
})
|
||||
}
|
||||
|
||||
export const post = (url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance({
|
||||
export const post = <T = any>(url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance<T>({
|
||||
url: url,
|
||||
method: RequestHttpEnum.POST,
|
||||
data: data,
|
||||
@@ -28,8 +28,8 @@ export const post = (url: string, data?: object, headersType?: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const patch = (url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance({
|
||||
export const patch = <T = any>(url: string, data?: object, headersType?: string) => {
|
||||
return axiosInstance<T>({
|
||||
url: url,
|
||||
method: RequestHttpEnum.PATCH,
|
||||
data: data,
|
||||
@@ -39,8 +39,8 @@ export const patch = (url: string, data?: object, headersType?: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const put = (url: string, data?: object, headersType?: ContentTypeEnum) => {
|
||||
return axiosInstance({
|
||||
export const put = <T = any>(url: string, data?: object, headersType?: ContentTypeEnum) => {
|
||||
return axiosInstance<T>({
|
||||
url: url,
|
||||
method: RequestHttpEnum.PUT,
|
||||
data: data,
|
||||
@@ -50,8 +50,8 @@ export const put = (url: string, data?: object, headersType?: ContentTypeEnum) =
|
||||
})
|
||||
}
|
||||
|
||||
export const del = (url: string, params?: object) => {
|
||||
return axiosInstance({
|
||||
export const del = <T = any>(url: string, params?: object) => {
|
||||
return axiosInstance<T>({
|
||||
url: url,
|
||||
method: RequestHttpEnum.DELETE,
|
||||
params
|
||||
@@ -82,11 +82,11 @@ export const http = (type?: RequestHttpEnum) => {
|
||||
}
|
||||
const prefix = 'javascript:'
|
||||
// 对输入字符进行转义处理
|
||||
export const translateStr = (target: string | object) => {
|
||||
export const translateStr = (target: string | Record<any, any>) => {
|
||||
if (typeof target === 'string') {
|
||||
if (target.startsWith(prefix)) {
|
||||
const funcStr = target.split(prefix)[1]
|
||||
let result;
|
||||
let result
|
||||
try {
|
||||
result = new Function(`${funcStr}`)()
|
||||
} catch (error) {
|
||||
@@ -100,8 +100,8 @@ export const translateStr = (target: string | object) => {
|
||||
}
|
||||
for (const key in target) {
|
||||
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
||||
const subTarget = (target as any)[key];
|
||||
(target as any)[key] = translateStr(subTarget)
|
||||
const subTarget = target[key]
|
||||
target[key] = translateStr(subTarget)
|
||||
}
|
||||
}
|
||||
return target
|
||||
@@ -116,7 +116,6 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
||||
if (!targetParams || !globalParams) {
|
||||
return
|
||||
}
|
||||
|
||||
// 全局
|
||||
const {
|
||||
// 全局请求源地址
|
||||
|
||||
@@ -26,12 +26,8 @@ export default {
|
||||
msg: '请求成功',
|
||||
data: {
|
||||
dimensions: ['name', 'value'],
|
||||
source: [
|
||||
{ name: '厦门', 'value|0-40': 20 },
|
||||
{ name: '南阳', 'value|20-60': 40 },
|
||||
{ name: '北京', 'value|40-80': 60 },
|
||||
{ name: '上海', 'value|60-100': 80 },
|
||||
{ name: '新疆', value: 100 }
|
||||
"source|2-5": [
|
||||
{ 'name|+1': ["厦门","福州","北京","上海","新疆","郑州","湖南","内蒙古"], 'value|0-40': 20 },
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,84 +1,98 @@
|
||||
import { http } from '@/api/http'
|
||||
import { httpErrorHandle } from '@/utils'
|
||||
import { ContentTypeEnum, RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
||||
import { ProjectItem, ProjectDetail } from './project'
|
||||
|
||||
// * 项目列表
|
||||
export const projectListApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/list`, data);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.GET)<ProjectItem[]>(`${ModuleTypeEnum.PROJECT}/list`, data)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 新增项目
|
||||
export const createProjectApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/create`, data);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)<{
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
id: number
|
||||
}>(`${ModuleTypeEnum.PROJECT}/create`, data)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 获取项目
|
||||
export const fetchProjectApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/getData`, data);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.GET)<ProjectDetail>(`${ModuleTypeEnum.PROJECT}/getData`, data)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 保存项目
|
||||
export const saveProjectApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/save/data`, data, ContentTypeEnum.FORM_URLENCODED);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)(
|
||||
`${ModuleTypeEnum.PROJECT}/save/data`,
|
||||
data,
|
||||
ContentTypeEnum.FORM_URLENCODED
|
||||
)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 修改项目基础信息
|
||||
export const updateProjectApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data);
|
||||
return res;
|
||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * 删除项目
|
||||
export const deleteProjectApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 修改发布状态 [-1未发布,1发布]
|
||||
export const changeProjectReleaseApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 上传文件
|
||||
export const uploadFile = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA);
|
||||
return res;
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)<{
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
fileName: string
|
||||
}>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA)
|
||||
return res
|
||||
} catch {
|
||||
httpErrorHandle();
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
src/api/path/project.d.ts
vendored
Normal file
39
src/api/path/project.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
export type ProjectItem = {
|
||||
/**
|
||||
* 项目 id
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
projectName: string
|
||||
/**
|
||||
* 项目状态:\
|
||||
* -1: 未发布\
|
||||
* 1: 已发布
|
||||
*/
|
||||
state: number
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string
|
||||
/**
|
||||
* 预览图片url
|
||||
*/
|
||||
indexImage: string
|
||||
/**
|
||||
* 创建者 id
|
||||
*/
|
||||
createUserId: string
|
||||
/**
|
||||
* 项目备注
|
||||
*/
|
||||
remarks: string
|
||||
}
|
||||
|
||||
export interface ProjectDetail extends ProjectItem {
|
||||
/**
|
||||
* 项目参数
|
||||
*/
|
||||
content: string
|
||||
}
|
||||
@@ -1,33 +1,39 @@
|
||||
import { http } from '@/api/http'
|
||||
import { httpErrorHandle } from '@/utils'
|
||||
import { RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
||||
import { LoginResult } from './system'
|
||||
|
||||
// * 登录
|
||||
export const loginApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.SYSTEM}/login`, data);
|
||||
return res;
|
||||
} catch(err) {
|
||||
httpErrorHandle();
|
||||
const res = await http(RequestHttpEnum.POST)<LoginResult>(`${ModuleTypeEnum.SYSTEM}/login`, data)
|
||||
return res
|
||||
} catch (err) {
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 登出
|
||||
export const logoutApi = async () => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/logout`);
|
||||
return res;
|
||||
} catch(err) {
|
||||
httpErrorHandle();
|
||||
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/logout`)
|
||||
return res
|
||||
} catch (err) {
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
|
||||
// * 获取 oss 上传接口
|
||||
export const ossUrlApi = async (data: object) => {
|
||||
try {
|
||||
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/getOssInfo`, data);
|
||||
return res;
|
||||
} catch(err) {
|
||||
httpErrorHandle();
|
||||
const res = await http(RequestHttpEnum.GET)<{
|
||||
/**
|
||||
* bucket 地址
|
||||
*/
|
||||
bucketURL?: string
|
||||
}>(`${ModuleTypeEnum.SYSTEM}/getOssInfo`, data)
|
||||
return res
|
||||
} catch (err) {
|
||||
httpErrorHandle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
26
src/api/path/system.d.ts
vendored
Normal file
26
src/api/path/system.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface LoginResult {
|
||||
token: {
|
||||
/**
|
||||
* token 值
|
||||
*/
|
||||
tokenValue: string
|
||||
/**
|
||||
* token key
|
||||
*/
|
||||
tokenName: string
|
||||
}
|
||||
userinfo: {
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
nickname: string
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
username: string
|
||||
/**
|
||||
* 用户 id
|
||||
*/
|
||||
id: string
|
||||
}
|
||||
}
|
||||
BIN
src/assets/images/canvas/noData.png
Normal file
BIN
src/assets/images/canvas/noData.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
@@ -14,16 +14,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useLangStore } from '@/store/modules/langStore/langStore'
|
||||
import { langList } from '@/i18n/index'
|
||||
import { LangEnum } from '@/enums/styleEnum'
|
||||
import { icon } from '@/plugins'
|
||||
|
||||
const { LanguageIcon } = icon.ionicons5
|
||||
const { locale } = useI18n();
|
||||
const langStore = useLangStore()
|
||||
const options = langList
|
||||
|
||||
const handleSelect = (key: LangEnum) => {
|
||||
locale.value = key;
|
||||
langStore.changeLang(key)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-modal v-model:show="modelShow" @afterLeave="closeHandle">
|
||||
<n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
|
||||
<n-list bordered class="go-system-info">
|
||||
<template #header>
|
||||
<n-space justify="space-between">
|
||||
@@ -42,15 +42,21 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
|
||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||
const emit = defineEmits(['update:modelShow'])
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
modelShow: Boolean
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelShow'])
|
||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||
const modelShowRef = ref(false)
|
||||
|
||||
watch(() => props.modelShow, (newValue) => {
|
||||
modelShowRef.value = newValue
|
||||
})
|
||||
|
||||
const closeHandle = () => {
|
||||
emit('update:modelShow', false)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-modal v-model:show="modelShow" @afterLeave="closeHandle">
|
||||
<n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
|
||||
<n-list bordered class="go-system-setting">
|
||||
<template #header>
|
||||
<n-space justify="space-between">
|
||||
@@ -69,21 +69,20 @@
|
||||
</template>
|
||||
|
||||
<script script lang="ts" setup>
|
||||
import { reactive } from 'vue'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { ListType } from './index.d'
|
||||
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
||||
import { SettingStoreEnums, ToolsStatusEnum } from '@/store/modules/settingStore/settingStore.d'
|
||||
import { icon } from '@/plugins'
|
||||
|
||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||
|
||||
const emit = defineEmits(['update:modelShow'])
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
modelShow: Boolean
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelShow'])
|
||||
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
|
||||
const settingStore = useSettingStore()
|
||||
const modelShowRef = ref(false)
|
||||
|
||||
const list = reactive<ListType[]>([
|
||||
{
|
||||
@@ -168,6 +167,10 @@ const list = reactive<ListType[]>([
|
||||
}
|
||||
])
|
||||
|
||||
watch(() => props.modelShow, (newValue) => {
|
||||
modelShowRef.value = newValue
|
||||
})
|
||||
|
||||
const closeHandle = () => {
|
||||
emit('update:modelShow', false)
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ const colorSelectHandle = (color: AppThemeColorType) => {
|
||||
overflow: hidden;
|
||||
border-radius: 5px;
|
||||
@extend .go-background-filter-shallow;
|
||||
backdrop-filter: none;
|
||||
}
|
||||
&-color {
|
||||
width: 8px;
|
||||
|
||||
@@ -66,7 +66,8 @@ export enum WinKeyboard {
|
||||
ALT = ' alt',
|
||||
CTRL_SOURCE_KEY = 'control',
|
||||
SHIFT_SOURCE_KEY = 'shift',
|
||||
ALT_SOURCE_KEY = 'alt'
|
||||
ALT_SOURCE_KEY = 'alt',
|
||||
SPACE = 'Space'
|
||||
}
|
||||
|
||||
// Mac 键盘枚举
|
||||
@@ -77,7 +78,8 @@ export enum MacKeyboard {
|
||||
ALT = '⌥',
|
||||
CTRL_SOURCE_KEY = '⌘',
|
||||
SHIFT_SOURCE_KEY = '⇧',
|
||||
ALT_SOURCE_KEY = '⌥'
|
||||
ALT_SOURCE_KEY = '⌥',
|
||||
SPACE = 'Space'
|
||||
}
|
||||
|
||||
// 同步状态枚举
|
||||
|
||||
@@ -20,7 +20,9 @@ export enum RequestDataTypeEnum {
|
||||
// 静态数据
|
||||
STATIC = 0,
|
||||
// 请求数据
|
||||
AJAX = 1
|
||||
AJAX = 1,
|
||||
// 数据池
|
||||
Pond = 2
|
||||
}
|
||||
|
||||
// 请求主体类型
|
||||
|
||||
@@ -26,11 +26,10 @@ export const useChartDataFetch = (
|
||||
|
||||
// 数据池
|
||||
const { addGlobalDataInterface } = useChartDataPondFetch()
|
||||
const { requestDataPondId } = toRefs(targetComponent.request)
|
||||
|
||||
// 组件类型
|
||||
const { chartFrame } = targetComponent.chartConfig
|
||||
|
||||
|
||||
// eCharts 组件配合 vChart 库更新方式
|
||||
const echartsUpdateHandle = (dataset: any) => {
|
||||
if (chartFrame === ChartFrameEnum.ECHARTS) {
|
||||
@@ -89,7 +88,6 @@ export const useChartDataFetch = (
|
||||
|
||||
// 立即调用
|
||||
fetchFn()
|
||||
|
||||
// 定时时间
|
||||
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
|
||||
// 单位
|
||||
@@ -104,8 +102,8 @@ export const useChartDataFetch = (
|
||||
}
|
||||
|
||||
if (isPreview()) {
|
||||
// 判断是否有数据池对应 id
|
||||
requestDataPondId
|
||||
// 判断是否是数据池类型
|
||||
targetComponent.request.requestDataType === RequestDataTypeEnum.Pond
|
||||
? addGlobalDataInterface(targetComponent, useChartEditStore, updateCallback || echartsUpdateHandle)
|
||||
: requestIntervalFn()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { customizeHttp } from '@/api/http'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { RequestGlobalConfigType, RequestDataPondItemType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { newFunctionHandle } from '@/utils'
|
||||
import { newFunctionHandle, intervalUnitHandle } from '@/utils'
|
||||
|
||||
// 获取类型
|
||||
type ChartEditStoreType = typeof useChartEditStore
|
||||
@@ -24,6 +24,9 @@ const newPondItemInterval = (
|
||||
dataPondMapItem?: DataPondMapType[]
|
||||
) => {
|
||||
if (!dataPondMapItem) return
|
||||
let fetchInterval: any = 0
|
||||
|
||||
clearInterval(fetchInterval)
|
||||
|
||||
// 请求
|
||||
const fetchFn = async () => {
|
||||
@@ -48,6 +51,19 @@ const newPondItemInterval = (
|
||||
|
||||
// 立即调用
|
||||
fetchFn()
|
||||
|
||||
const targetInterval = requestDataPondItem.dataPondRequestConfig.requestInterval
|
||||
const targetUnit = requestDataPondItem.dataPondRequestConfig.requestIntervalUnit
|
||||
|
||||
const globalRequestInterval = requestGlobalConfig.requestInterval
|
||||
const globalUnit = requestGlobalConfig.requestIntervalUnit
|
||||
|
||||
// 定时时间
|
||||
const time = targetInterval ? targetInterval : globalRequestInterval
|
||||
// 单位
|
||||
const unit = targetInterval ? targetUnit : globalUnit
|
||||
// 开启轮询
|
||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +80,7 @@ export const useChartDataPondFetch = () => {
|
||||
const { requestDataPond } = chartEditStore.getRequestGlobalConfig
|
||||
|
||||
// 组件对应的数据池 Id
|
||||
const requestDataPondId = '111' || (targetComponent.request.requestDataPondId as string)
|
||||
const requestDataPondId = targetComponent.request.requestDataPondId as string
|
||||
// 新增数据项
|
||||
const mittPondIdArr = mittDataPondMap.get(requestDataPondId) || []
|
||||
mittPondIdArr.push({
|
||||
@@ -74,6 +90,11 @@ export const useChartDataPondFetch = () => {
|
||||
mittDataPondMap.set(requestDataPondId, mittPondIdArr)
|
||||
}
|
||||
|
||||
// 清除旧数据
|
||||
const clearMittDataPondMap = () => {
|
||||
mittDataPondMap.clear()
|
||||
}
|
||||
|
||||
// 初始化数据池
|
||||
const initDataPond = (requestGlobalConfig: RequestGlobalConfigType) => {
|
||||
const { requestDataPond } = requestGlobalConfig
|
||||
@@ -88,6 +109,7 @@ export const useChartDataPondFetch = () => {
|
||||
|
||||
return {
|
||||
addGlobalDataInterface,
|
||||
clearMittDataPondMap,
|
||||
initDataPond
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ export const useSystemInit = async () => {
|
||||
|
||||
// 获取 OSS 信息的 url 地址,用来拼接展示图片的地址
|
||||
const getOssUrl = async () => {
|
||||
const res = await ossUrlApi({}) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
const res = await ossUrlApi({})
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
systemStore.setItem(SystemStoreEnum.FETCH_INFO, {
|
||||
OSSUrl: res.data?.bucketURL
|
||||
})
|
||||
|
||||
@@ -23,6 +23,8 @@ export const langList = [
|
||||
]
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
globalInjection:true,
|
||||
locale: langStorage?.lang || lang,
|
||||
fallbackLocale: langStorage?.lang || lang,
|
||||
messages: {
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './axis'
|
||||
export * from './line'
|
||||
export * from './line'
|
||||
export * from './label'
|
||||
7
src/packages/chartConfiguration/echarts/label.ts
Normal file
7
src/packages/chartConfiguration/echarts/label.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const labelConfig = {
|
||||
position: [
|
||||
{ label: '外侧', value: 'outside' },
|
||||
{ label: '内部', value: 'inside' },
|
||||
{ label: '中心', value: 'center' }
|
||||
]
|
||||
}
|
||||
@@ -111,18 +111,18 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
const calcData = (data: any) => {
|
||||
mergeConfig(props.chartConfig.option)
|
||||
calcCapsuleLengthAndLabelData()
|
||||
}
|
||||
|
||||
const mergeConfig = (data: any) => {
|
||||
state.mergedConfig = cloneDeep(data || {})
|
||||
const calcData = (data: any, type?: string) => {
|
||||
let cloneConfig = cloneDeep(props.chartConfig.option || {})
|
||||
state.mergedConfig = cloneConfig
|
||||
if (type == 'preview') {
|
||||
cloneConfig.dataset = data
|
||||
}
|
||||
calcCapsuleLengthAndLabelData(state.mergedConfig.dataset)
|
||||
}
|
||||
|
||||
// 数据解析
|
||||
const calcCapsuleLengthAndLabelData = () => {
|
||||
const { source } = state.mergedConfig.dataset
|
||||
const calcCapsuleLengthAndLabelData = (dataset: any) => {
|
||||
const { source } = dataset
|
||||
if (!source.length) return
|
||||
|
||||
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
||||
@@ -151,7 +151,7 @@ onMounted(() => {
|
||||
|
||||
// 预览
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
||||
calcData(newData)
|
||||
calcData(newData, 'preview')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ const option = {
|
||||
},
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
position: 'center',
|
||||
formatter: '{b}',
|
||||
fontSize:12
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
|
||||
@@ -7,6 +7,48 @@
|
||||
<n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.series[0].label.show" size="small"></n-switch>
|
||||
<n-text>展示标签</n-text>
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.series[0].labelLine.show" size="small"></n-switch>
|
||||
<n-text>引导线</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<SettingItem name="位置">
|
||||
<n-select v-model:value="optionData.series[0].label.position" size="small" :options="labelConfig.position" />
|
||||
</SettingItem>
|
||||
<setting-item name="展示类型">
|
||||
<n-select v-model:value="optionData.series[0].label.formatter" size="small" :options="labelFormatterOptions" />
|
||||
</setting-item>
|
||||
</SettingItemBox>
|
||||
<setting-item-box name="圆角">
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].itemStyle.borderRadius"
|
||||
size="small"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
<n-text>圆角大小</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-input-number
|
||||
v-model:value="optionData.series[0].itemStyle.borderWidth"
|
||||
size="small"
|
||||
:min="0"
|
||||
></n-input-number>
|
||||
<n-text>线条宽度</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
@@ -15,6 +57,7 @@ import { PropType, watch } from 'vue'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { PieTypeObject, PieTypeEnum } from './config'
|
||||
import { labelConfig } from '@/packages/chartConfiguration/echarts'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
@@ -36,4 +79,10 @@ const fontWeightOptions = [
|
||||
value: PieTypeObject[PieTypeEnum.ROSE]
|
||||
}
|
||||
]
|
||||
|
||||
const labelFormatterOptions = [
|
||||
{ label: '数据名', value: '{b}' },
|
||||
{ label: '百分比', value: '{d}' },
|
||||
{ label: '列名:百分比', value: '{b}:{d}%' }
|
||||
]
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@ export const FlipperNumberConfig: ConfigType = {
|
||||
key: 'FlipperNumber',
|
||||
chartKey: 'VFlipperNumber',
|
||||
conKey: 'VCFlipperNumber',
|
||||
title: '数字翻牌',
|
||||
title: '数字翻牌-需动态触发',
|
||||
category: ChatCategoryEnum.MORE,
|
||||
categoryName: ChatCategoryEnumName.MORE,
|
||||
package: PackagesCategoryEnum.DECORATES,
|
||||
|
||||
@@ -20,7 +20,7 @@ import { chartInitConfig } from '@/settings/designSetting'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
// 请求基础属性
|
||||
const requestConfig: RequestConfigType = {
|
||||
export const requestConfig: RequestConfigType = {
|
||||
requestDataType: RequestDataTypeEnum.STATIC,
|
||||
requestHttpType: RequestHttpEnum.GET,
|
||||
requestUrl: '',
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
NH2,
|
||||
NH3,
|
||||
NH4,
|
||||
NH5,
|
||||
NCode,
|
||||
NCountdown,
|
||||
NText,
|
||||
@@ -109,6 +110,7 @@ const naive = create({
|
||||
NH2,
|
||||
NH3,
|
||||
NH4,
|
||||
NH5,
|
||||
NCode,
|
||||
NCountdown,
|
||||
NText,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export enum ChartModeEnum {
|
||||
SINGLE= 'single',
|
||||
SINGLE = 'single',
|
||||
DOUBLE = 'double'
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ export enum ChartLayoutStoreEnum {
|
||||
CHARTS = 'charts',
|
||||
DETAILS = 'details',
|
||||
Chart_TYPE = 'chartType',
|
||||
LAYER_TYPE = 'layerType'
|
||||
LAYER_TYPE = 'layerType',
|
||||
PERCENTAGE = 'percentage',
|
||||
RE_POSITION_CANVAS = 'rePositionCanvas'
|
||||
}
|
||||
|
||||
export interface ChartLayoutType {
|
||||
@@ -27,4 +29,8 @@ export interface ChartLayoutType {
|
||||
[ChartLayoutStoreEnum.Chart_TYPE]: ChartModeEnum
|
||||
// 层级展示方式
|
||||
[ChartLayoutStoreEnum.LAYER_TYPE]: LayerModeEnum
|
||||
// 当前正在加载的数量
|
||||
[ChartLayoutStoreEnum.PERCENTAGE]: number
|
||||
// 是否重置当前画布位置
|
||||
[ChartLayoutStoreEnum.RE_POSITION_CANVAS]: boolean
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ export const useChartLayoutStore = defineStore({
|
||||
chartType: ChartModeEnum.SINGLE,
|
||||
// 图层类型(默认图片)
|
||||
layerType: LayerModeEnum.THUMBNAIL,
|
||||
// 当前加载数量
|
||||
percentage: 0,
|
||||
// 是否重置当前画布位置
|
||||
rePositionCanvas: false,
|
||||
// 防止值不存在
|
||||
...storageChartLayout
|
||||
}),
|
||||
@@ -42,6 +46,12 @@ export const useChartLayoutStore = defineStore({
|
||||
},
|
||||
getLayerType(): LayerModeEnum {
|
||||
return this.layerType
|
||||
},
|
||||
getPercentage(): number {
|
||||
return this.percentage
|
||||
},
|
||||
getRePositionCanvas(): boolean {
|
||||
return this.rePositionCanvas
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -49,11 +59,19 @@ export const useChartLayoutStore = defineStore({
|
||||
this.$patch(state => {
|
||||
state[key] = value
|
||||
})
|
||||
// 存储本地
|
||||
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
|
||||
// 这里需要标记重置画布位置
|
||||
this.rePositionCanvas = true;
|
||||
// 重新计算拖拽区域缩放比例
|
||||
setTimeout(() => {
|
||||
chartEditStore.computedScale()
|
||||
}, 500)
|
||||
},
|
||||
setItemUnHandle<T extends keyof ChartLayoutType, K extends ChartLayoutType[T]>(key: T, value: K): void {
|
||||
this.$patch(state => {
|
||||
state[key] = value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
|
||||
import { lang } from '@/settings/designSetting'
|
||||
import { LangStateType } from './langStore.d'
|
||||
import { LangEnum } from '@/enums/styleEnum'
|
||||
import i18n from '@/i18n/index'
|
||||
import { setLocalStorage, getLocalStorage, reloadRoutePage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
||||
@@ -25,10 +24,8 @@ export const useLangStore = defineStore({
|
||||
actions: {
|
||||
changeLang(lang: LangEnum): void {
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
if (this.lang === lang) return
|
||||
this.lang = lang
|
||||
i18n.global.locale = lang
|
||||
setLocalStorage(GO_LANG_STORE, this.$state)
|
||||
|
||||
if (settingStore.getChangeLangReload) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
@mixin deep() {
|
||||
:deep {
|
||||
:deep() {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ export const reloadRoutePage = () => {
|
||||
*/
|
||||
export const logout = async () => {
|
||||
try {
|
||||
const res = await logoutApi() as unknown as MyResponseType
|
||||
if(res.code === ResultEnum.SUCCESS) {
|
||||
const res = await logoutApi()
|
||||
if(res && res.code === ResultEnum.SUCCESS) {
|
||||
window['$message'].success(window['$t']('global.logout_success'))
|
||||
clearCookie(RequestHttpHeaderEnum.COOKIE)
|
||||
clearLocalStorage(StorageEnum.GO_SYSTEM_STORE)
|
||||
|
||||
@@ -250,15 +250,21 @@ export const objToCookie = (obj: RequestParamsObjType) => {
|
||||
* @returns
|
||||
*/
|
||||
export const setKeyboardDressShow = (keyCode?: number) => {
|
||||
const code = new Map([[17, WinKeyboard.CTRL]])
|
||||
const code = new Map([
|
||||
[17, WinKeyboard.CTRL],
|
||||
[32, WinKeyboard.SPACE]
|
||||
])
|
||||
|
||||
const dom = document.getElementById('keyboard-dress-show')
|
||||
if (!dom) return
|
||||
if (!keyCode) {
|
||||
window.onKeySpacePressHold?.(false)
|
||||
dom.innerText = ''
|
||||
return
|
||||
}
|
||||
if (keyCode && code.has(keyCode)) {
|
||||
if (keyCode == 32) window.onKeySpacePressHold?.(true)
|
||||
dom.innerText = `按下了「${code.get(keyCode)}」键`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
</n-space>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="content"
|
||||
:class="{
|
||||
'content-height-show-top-bottom': showBottom || showTop,
|
||||
'content-height-show-both': showBottom && showTop
|
||||
}"
|
||||
>
|
||||
<template v-if="xScroll">
|
||||
<div class="content" :class="{
|
||||
'content-height-show-top-bottom': showBottom || showTop,
|
||||
'content-height-show-both': showBottom && showTop
|
||||
}">
|
||||
<template v-if="disabledScroll">
|
||||
<slot></slot>
|
||||
</template>
|
||||
<template v-else-if="xScroll">
|
||||
<n-scrollbar x-scrollable>
|
||||
<n-scrollbar>
|
||||
<slot></slot>
|
||||
@@ -83,7 +83,11 @@ defineProps({
|
||||
xScroll: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
disabledScroll: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
|
||||
const backHandle = () => {
|
||||
@@ -93,41 +97,52 @@ const backHandle = () => {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$topOrBottomHeight: 40px;
|
||||
|
||||
@include go(content-box) {
|
||||
height: calc(100vh - #{$--header-height});
|
||||
margin: 1px;
|
||||
margin-bottom: 0;
|
||||
|
||||
&.bg-depth0 {
|
||||
@include fetch-bg-color('background-color1');
|
||||
|
||||
.bottom,
|
||||
.top {
|
||||
@include fetch-bg-color('background-color1');
|
||||
}
|
||||
}
|
||||
|
||||
&.bg-depth1 {
|
||||
@include fetch-bg-color('background-color1');
|
||||
|
||||
.bottom,
|
||||
.top {
|
||||
@include fetch-bg-color('background-color2');
|
||||
}
|
||||
}
|
||||
|
||||
&.bg-depth2 {
|
||||
@include fetch-bg-color('background-color2');
|
||||
|
||||
.bottom,
|
||||
.top {
|
||||
@include fetch-bg-color('background-color3');
|
||||
}
|
||||
}
|
||||
|
||||
&.bg-depth3 {
|
||||
@include fetch-bg-color('background-color3');
|
||||
|
||||
.bottom,
|
||||
.top {
|
||||
@include fetch-bg-color('background-color4');
|
||||
}
|
||||
}
|
||||
|
||||
&.flex {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.top,
|
||||
.bottom {
|
||||
display: flex;
|
||||
@@ -138,10 +153,12 @@ $topOrBottomHeight: 40px;
|
||||
padding: 0 10px;
|
||||
border-top: 1px solid;
|
||||
@include fetch-border-color('hover-border-color');
|
||||
|
||||
.mt-1 {
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
border-bottom: 1px solid;
|
||||
@include fetch-border-color('background-color1');
|
||||
@@ -159,6 +176,7 @@ $topOrBottomHeight: 40px;
|
||||
.content-height-show-top-bottom {
|
||||
height: calc(100vh - #{$--header-height} - #{$topOrBottomHeight});
|
||||
}
|
||||
|
||||
.content-height-show-both {
|
||||
height: calc(100vh - #{$--header-height} - #{$topOrBottomHeight} - #{$topOrBottomHeight});
|
||||
}
|
||||
|
||||
@@ -1,35 +1,41 @@
|
||||
<template>
|
||||
<div class="go-content-charts-item-box" :class="{ double: chartMode === ChartModeEnum.DOUBLE }">
|
||||
<!-- 每一项组件的渲染 -->
|
||||
<div class="go-content-charts-item-animation-patch">
|
||||
<div
|
||||
class="item-box"
|
||||
v-for="(item, index) in menuOptions"
|
||||
:key="index"
|
||||
draggable
|
||||
@dragstart="dragStartHandle($event, item)"
|
||||
@dragend="dragendHandle"
|
||||
@dblclick="dblclickHandle(item)"
|
||||
ref="contentChartsItemBoxRef"
|
||||
class="go-content-charts-item-box"
|
||||
:class="[chartMode === ChartModeEnum.DOUBLE ? 'double' : 'single']"
|
||||
>
|
||||
<div class="list-header">
|
||||
<mac-os-control-btn class="list-header-control-btn" :mini="true" :disabled="true"></mac-os-control-btn>
|
||||
<n-text class="list-header-text" depth="3">
|
||||
<n-ellipsis>{{ item.title }}</n-ellipsis>
|
||||
</n-text>
|
||||
</div>
|
||||
<div class="list-center go-flex-center">
|
||||
<img class="list-img" v-lazy="item.image" alt="图表图片" />
|
||||
</div>
|
||||
<div class="list-bottom">
|
||||
<n-text class="list-bottom-text" depth="3">
|
||||
<n-ellipsis style="max-width: 90%">{{ item.title }}</n-ellipsis>
|
||||
</n-text>
|
||||
<!-- 每一项组件的渲染 -->
|
||||
<div
|
||||
class="item-box"
|
||||
v-for="(item, index) in menuOptions"
|
||||
:key="index"
|
||||
draggable
|
||||
@dragstart="dragStartHandle($event, item)"
|
||||
@dragend="dragendHandle"
|
||||
@dblclick="dblclickHandle(item)"
|
||||
>
|
||||
<div class="list-header">
|
||||
<mac-os-control-btn class="list-header-control-btn" :mini="true" :disabled="true"></mac-os-control-btn>
|
||||
<n-text class="list-header-text" depth="3">
|
||||
<n-ellipsis>{{ item.title }}</n-ellipsis>
|
||||
</n-text>
|
||||
</div>
|
||||
<div class="list-center go-flex-center go-transition">
|
||||
<img class="list-img" v-lazy="item.image" alt="图表图片" />
|
||||
</div>
|
||||
<div class="list-bottom">
|
||||
<n-text class="list-bottom-text" depth="3">
|
||||
<n-ellipsis style="max-width: 90%">{{ item.title }}</n-ellipsis>
|
||||
</n-text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, ref, Ref, computed } from 'vue'
|
||||
import { PropType, watch, ref, Ref, computed, nextTick } from 'vue'
|
||||
import { MacOsControlBtn } from '@/components/Tips/MacOsControlBtn/index'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
@@ -51,6 +57,7 @@ defineProps({
|
||||
})
|
||||
|
||||
const chartLayoutStore = useChartLayoutStore()
|
||||
const contentChartsItemBoxRef = ref()
|
||||
|
||||
// 组件展示状态
|
||||
const chartMode: Ref<ChartModeEnum> = computed(() => {
|
||||
@@ -92,21 +99,38 @@ const dblclickHandle = async (item: ConfigType) => {
|
||||
window['$message'].warning(`图表正在研发中, 敬请期待...`)
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => chartMode.value,
|
||||
(newValue: ChartModeEnum) => {
|
||||
if (newValue === ChartModeEnum.DOUBLE) {
|
||||
nextTick(() => {
|
||||
contentChartsItemBoxRef.value.classList.add('miniAnimation')
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 列表项宽度 */
|
||||
$itemWidth: 100%;
|
||||
$maxItemWidth: 180px;
|
||||
$halfItemWidth: 46%;
|
||||
/* 内容高度 */
|
||||
$centerHeight: 100px;
|
||||
$halfCenterHeight: 50px;
|
||||
|
||||
@include go('content-charts-item-animation-patch') {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
@include go('content-charts-item-box') {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 9px;
|
||||
padding: 10px;
|
||||
transition: all 0.7s linear;
|
||||
.item-box {
|
||||
margin: 0;
|
||||
width: $itemWidth;
|
||||
@@ -115,7 +139,6 @@ $halfCenterHeight: 50px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(0, 0, 0, 0);
|
||||
@include fetch-bg-color('background-color2');
|
||||
@extend .go-transition;
|
||||
&:hover {
|
||||
@include hover-border-color('background-color4');
|
||||
.list-img {
|
||||
@@ -152,7 +175,11 @@ $halfCenterHeight: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 缩小展示 */
|
||||
&.single {
|
||||
.item-box {
|
||||
@extend .go-transition;
|
||||
}
|
||||
}
|
||||
&.double {
|
||||
.list-header {
|
||||
padding: 2px 5px;
|
||||
@@ -165,6 +192,7 @@ $halfCenterHeight: 50px;
|
||||
}
|
||||
.item-box {
|
||||
width: $halfItemWidth;
|
||||
max-width: $maxItemWidth;
|
||||
}
|
||||
.list-center {
|
||||
height: $halfCenterHeight;
|
||||
@@ -172,11 +200,24 @@ $halfCenterHeight: 50px;
|
||||
.list-img {
|
||||
height: $halfCenterHeight;
|
||||
width: auto;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
}
|
||||
.list-bottom {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
/* 缩小展示 */
|
||||
@keyframes miniAnimation {
|
||||
from {
|
||||
width: $itemWidth * 2;
|
||||
}
|
||||
to {
|
||||
width: $itemWidth;
|
||||
}
|
||||
}
|
||||
&.miniAnimation {
|
||||
animation: miniAnimation 0.5s;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -282,9 +282,9 @@ const customRequest = (options: UploadCustomRequestOptions) => {
|
||||
)
|
||||
let uploadParams = new FormData()
|
||||
uploadParams.append('object', newNameFile)
|
||||
const uploadRes = await uploadFile(uploadParams) as unknown as MyResponseType
|
||||
const uploadRes = await uploadFile(uploadParams)
|
||||
|
||||
if(uploadRes.code === ResultEnum.SUCCESS) {
|
||||
if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
|
||||
chartEditStore.setEditCanvasConfig(
|
||||
EditCanvasConfigEnum.BACKGROUND_IMAGE,
|
||||
`${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}?time=${new Date().getTime()}`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="go-chart-configurations-animations" v-if="targetData">
|
||||
<n-button
|
||||
class="clear-btn"
|
||||
class="clear-btn go-my-2"
|
||||
:disabled="!targetData.styles.animations.length"
|
||||
@click="clearAnimation"
|
||||
>
|
||||
@@ -72,7 +72,7 @@ const addAnimation = (item: { label: string; value: string }) => {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('chart-configurations-animations') {
|
||||
padding: 20px 10px;
|
||||
padding: 0;
|
||||
.clear-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<n-input size="small" :placeholder="targetData.request.requestHttpType || '暂无'" :disabled="true"></n-input>
|
||||
</setting-item>
|
||||
|
||||
<setting-item name="组件间隔(高级)">
|
||||
<setting-item name="组件间隔">
|
||||
<n-input size="small" :placeholder="`${targetData.request.requestInterval || '暂无'}`" :disabled="true">
|
||||
<template #suffix> {{ SelectHttpTimeNameObj[targetData.request.requestIntervalUnit] }} </template>
|
||||
</n-input>
|
||||
@@ -41,13 +41,9 @@
|
||||
</n-input>
|
||||
</setting-item-box>
|
||||
|
||||
<n-space justify="end">
|
||||
<n-text depth="3" style="font-size: 12px">更新内容请点击展示区域</n-text>
|
||||
</n-space>
|
||||
|
||||
<div class="edit-text" @click="requestModelHandle">
|
||||
<div class="go-absolute-center">
|
||||
<n-button type="primary" secondary>查看更多</n-button>
|
||||
<n-button type="primary" secondary>编辑配置</n-button>
|
||||
</div>
|
||||
</div>
|
||||
</n-card>
|
||||
@@ -76,10 +72,16 @@
|
||||
|
||||
<!-- 底部数据展示 -->
|
||||
<chart-data-matching-and-show :show="showMatching && !loading" :ajax="true"></chart-data-matching-and-show>
|
||||
|
||||
<!-- 骨架图 -->
|
||||
<go-skeleton :load="loading" :repeat="3"></go-skeleton>
|
||||
|
||||
<!-- 请求配置model -->
|
||||
<chart-data-request v-model:modelShow="requestShow" @sendHandle="sendHandle"></chart-data-request>
|
||||
<chart-data-request
|
||||
v-model:modelShow="requestShow"
|
||||
:targetData="targetData"
|
||||
@sendHandle="sendHandle"
|
||||
></chart-data-request>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -95,7 +97,7 @@ import { http, customizeHttp } from '@/api/http'
|
||||
import { SelectHttpType } from '../../index.d'
|
||||
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||
import { isDev, newFunctionHandle } from '@/utils'
|
||||
import { newFunctionHandle } from '@/utils'
|
||||
|
||||
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
|
||||
const { targetData, chartEditStore } = useTargetData()
|
||||
@@ -128,7 +130,7 @@ const sendHandle = async () => {
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
||||
loading.value = false
|
||||
if (res) {
|
||||
if(!res?.data && !targetData.value.filter) window['$message'].warning('您的数据不符合默认格式,请配置过滤器!')
|
||||
if (!res?.data && !targetData.value.filter) window['$message'].warning('您的数据不符合默认格式,请配置过滤器!')
|
||||
targetData.value.option.dataset = newFunctionHandle(res?.data, res, targetData.value.filter)
|
||||
showMatching.value = true
|
||||
return
|
||||
@@ -175,7 +177,7 @@ onBeforeUnmount(() => {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 325px;
|
||||
height: 292px;
|
||||
height: 270px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: all 0.3s;
|
||||
|
||||
@@ -117,7 +117,7 @@ const { uploadFileListRef, customRequest, beforeUpload, download } = useFile(tar
|
||||
|
||||
// 是否展示过滤器
|
||||
const filterShow = computed(() => {
|
||||
return targetData.value.request.requestDataType === RequestDataTypeEnum.AJAX
|
||||
return targetData.value.request.requestDataType !== RequestDataTypeEnum.STATIC
|
||||
})
|
||||
|
||||
// 是支持 dataset 的图表类型
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</template>
|
||||
|
||||
<!-- 弹窗 -->
|
||||
<n-modal class="go-chart-data-monaco-editor" v-model:show="showModal" :mask-closable="false">
|
||||
<n-modal class="go-chart-data-monaco-editor" v-model:show="showModal" :mask-closable="false" :closeOnEsc="false">
|
||||
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 600px">
|
||||
<template #header>
|
||||
<n-space>
|
||||
@@ -101,7 +101,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch, toRefs, toRaw } from 'vue'
|
||||
import { ref, computed, watch, toRef, toRefs, toRaw, reactive } from 'vue'
|
||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||
import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
||||
import { icon } from '@/plugins'
|
||||
@@ -187,7 +187,10 @@ const saveFilter = () => {
|
||||
watch(
|
||||
() => showModal.value,
|
||||
(newData: boolean) => {
|
||||
if (newData) fetchTargetData()
|
||||
if (newData) {
|
||||
fetchTargetData()
|
||||
filter.value = targetData.value.filter || `return data`
|
||||
}
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<n-table
|
||||
:bordered="false"
|
||||
:single-line="false"
|
||||
size="small"
|
||||
style="border-bottom-right-radius: 7px; border-bottom-left-radius: 7px"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>key</th>
|
||||
<th>value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in tableArray.content" :key="index">
|
||||
<td>
|
||||
{{ item.key || '暂无'}}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.value || '暂无'}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</n-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, reactive, ref, toRefs, watch } from 'vue'
|
||||
import { RequestParamsObjType } from '@/enums/httpEnum'
|
||||
import noData from '@/assets/images/canvas/noData.png'
|
||||
|
||||
const props = defineProps({
|
||||
target: Object as PropType<RequestParamsObjType>
|
||||
})
|
||||
|
||||
// 默认表格
|
||||
const defaultItem = {
|
||||
key: '',
|
||||
value: ''
|
||||
}
|
||||
const tableArray = reactive<{
|
||||
content: typeof defaultItem[]
|
||||
}>({ content: [] })
|
||||
|
||||
// 监听选项
|
||||
watch(
|
||||
() => props.target as RequestParamsObjType,
|
||||
(target: RequestParamsObjType) => {
|
||||
tableArray.content = []
|
||||
for (const k in target) {
|
||||
tableArray.content.push({
|
||||
key: k,
|
||||
value: target[k]
|
||||
})
|
||||
}
|
||||
// 默认值
|
||||
if (!tableArray.content.length) tableArray.content = [JSON.parse(JSON.stringify(defaultItem))]
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
import ChartDataDisplay from './index.vue'
|
||||
|
||||
export { ChartDataDisplay }
|
||||
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<div class="go-chart-data-display">
|
||||
<n-scrollbar style="max-height: 570px">
|
||||
<div class="go-mr-3">
|
||||
<div>
|
||||
<setting-item-box name="主体信息">
|
||||
<setting-item name="接口名称">
|
||||
<n-input size="small" :placeholder="targetData?.dataPondName || '暂无'" :disabled="true"> </n-input>
|
||||
</setting-item>
|
||||
<setting-item name="接口类型">
|
||||
<n-input size="small" :placeholder="requestHttpType || '暂无'" :disabled="true"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box>
|
||||
<setting-item name="组件间隔">
|
||||
<n-input size="small" :placeholder="`${requestInterval || '暂无'}`" :disabled="true">
|
||||
<template #suffix>
|
||||
{{ targetData && SelectHttpTimeNameObj[requestIntervalUnit] }}
|
||||
</template>
|
||||
</n-input>
|
||||
</setting-item>
|
||||
<setting-item name="全局间隔(默认)">
|
||||
<n-input size="small" :placeholder="`${globalData?.requestInterval || '暂无'}`" :disabled="true">
|
||||
<template #suffix> {{ globalData && SelectHttpTimeNameObj[globalData.requestIntervalUnit] }} </template>
|
||||
</n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="源地址" :alone="true">
|
||||
<n-input size="small" :placeholder="globalData?.requestOriginUrl || '暂无'" :disabled="true">
|
||||
<template #prefix>
|
||||
<n-icon :component="PulseIcon" />
|
||||
</template>
|
||||
</n-input>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="接口地址" :alone="true">
|
||||
<n-input
|
||||
size="small"
|
||||
:placeholder="requestUrl || '暂无'"
|
||||
:disabled="true"
|
||||
>
|
||||
<template #prefix>
|
||||
<n-icon :component="FlashIcon" />
|
||||
</template>
|
||||
</n-input>
|
||||
</setting-item-box>
|
||||
</div>
|
||||
<n-divider />
|
||||
<setting-item-box name="类型">
|
||||
<setting-item name="配置类型">
|
||||
<n-input
|
||||
size="small"
|
||||
:placeholder="targetData && requestContentTypeObj[requestContentType]"
|
||||
:disabled="true"
|
||||
></n-input>
|
||||
</setting-item>
|
||||
<setting-item name="body 类型" v-if="requestContentType === RequestContentTypeEnum.DEFAULT">
|
||||
<n-input size="small" :placeholder="targetData && requestParamsBodyType" :disabled="true"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<div v-if="requestContentType === RequestContentTypeEnum.DEFAULT">
|
||||
<n-tabs type="line" animated v-model:value="tabValue">
|
||||
<n-tab v-for="item in RequestParamsTypeEnum" :key="item" :name="item" :tab="item"> {{ item }} </n-tab>
|
||||
</n-tabs>
|
||||
<!-- 各个页面 -->
|
||||
<div class="go-mt-3">
|
||||
<div v-if="tabValue !== RequestParamsTypeEnum.BODY">
|
||||
<display-table class="go-my-3" :target="requestParams[tabValue]"> </display-table>
|
||||
</div>
|
||||
|
||||
<!-- 选择了 body -->
|
||||
<div v-else>
|
||||
<!-- 为 none 时 -->
|
||||
<n-card class="go-mt-3 go-pb-3" v-if="requestParamsBodyType === RequestBodyEnum['NONE']">
|
||||
<n-text depth="3">该接口没有 Body 体</n-text>
|
||||
</n-card>
|
||||
|
||||
<!-- 具有对象属性时 -->
|
||||
<template
|
||||
v-else-if="
|
||||
requestParamsBodyType === RequestBodyEnum['FORM_DATA'] ||
|
||||
requestParamsBodyType === RequestBodyEnum['X_WWW_FORM_URLENCODED']
|
||||
"
|
||||
>
|
||||
<display-table
|
||||
class="go-my-3"
|
||||
:target="requestParams[RequestParamsTypeEnum.BODY][requestParamsBodyType]"
|
||||
></display-table>
|
||||
</template>
|
||||
|
||||
<!-- json -->
|
||||
<template v-else-if="requestParamsBodyType === RequestBodyEnum['JSON']">
|
||||
<n-card size="small" style="padding-bottom: 7px">
|
||||
<n-code
|
||||
:code="requestParams[RequestParamsTypeEnum.BODY][requestParamsBodyType] || '暂无内容'"
|
||||
language="json"
|
||||
></n-code>
|
||||
</n-card>
|
||||
</template>
|
||||
|
||||
<!-- xml -->
|
||||
<template v-else-if="requestParamsBodyType === RequestBodyEnum['XML']">
|
||||
<n-code
|
||||
:code="requestParams[RequestParamsTypeEnum.BODY][requestParamsBodyType] || ''"
|
||||
language="html"
|
||||
></n-code>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- SQL 请求 -->
|
||||
<div v-else>
|
||||
<setting-item-box name="键名">
|
||||
<n-text>sql</n-text>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="键值">
|
||||
<n-code :code="requestSQLContent.sql || ''" language="sql"></n-code>
|
||||
</setting-item-box>
|
||||
</div>
|
||||
</div>
|
||||
</n-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, ref, toRefs } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
||||
import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { RequestDataPondItemType, RequestGlobalConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import displayTable from './displayTable.vue'
|
||||
import {
|
||||
RequestBodyEnum,
|
||||
RequestParamsTypeEnum,
|
||||
SelectHttpTimeNameObj,
|
||||
RequestContentTypeEnum,
|
||||
RequestBodyEnumList,
|
||||
RequestParamsObjType
|
||||
} from '@/enums/httpEnum'
|
||||
|
||||
const props = defineProps({
|
||||
globalData: Object as PropType<RequestGlobalConfigType>,
|
||||
targetData: Object as PropType<RequestDataPondItemType>
|
||||
})
|
||||
|
||||
const { HelpOutlineIcon, FlashIcon, PulseIcon } = icon.ionicons5
|
||||
const {
|
||||
requestUrl,
|
||||
requestInterval,
|
||||
requestHttpType,
|
||||
requestContentType,
|
||||
requestSQLContent,
|
||||
requestParams,
|
||||
requestParamsBodyType,
|
||||
requestIntervalUnit
|
||||
} = toRefs((props.targetData as RequestDataPondItemType).dataPondRequestConfig)
|
||||
|
||||
const tabs = [RequestParamsTypeEnum.HEADER]
|
||||
const requestContentTypeObj = {
|
||||
[RequestContentTypeEnum.DEFAULT]: '普通请求',
|
||||
[RequestContentTypeEnum.SQL]: 'SQL 请求'
|
||||
}
|
||||
const tabValue = ref<RequestParamsTypeEnum>(RequestParamsTypeEnum.PARAMS)
|
||||
|
||||
// 更新参数表格数据
|
||||
const updateRequestParams = (paramsObj: RequestParamsObjType) => {
|
||||
if (tabValue.value !== RequestParamsTypeEnum.BODY) {
|
||||
requestParams.value[tabValue.value] = paramsObj
|
||||
}
|
||||
}
|
||||
|
||||
// 更新参数表格数据
|
||||
const updateRequestBodyTable = (paramsObj: RequestParamsObjType) => {
|
||||
if (
|
||||
tabValue.value === RequestParamsTypeEnum.BODY &&
|
||||
// 仅有两种类型有 body
|
||||
(requestParamsBodyType.value === RequestBodyEnum.FORM_DATA ||
|
||||
requestParamsBodyType.value === RequestBodyEnum.X_WWW_FORM_URLENCODED)
|
||||
) {
|
||||
requestParams.value[RequestParamsTypeEnum.BODY][requestParamsBodyType.value] = paramsObj
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('chart-data-display') {
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
import ChartDataPondControl from './index.vue'
|
||||
|
||||
export { ChartDataPondControl }
|
||||
@@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<n-modal class="go-chart-data-pond-control" v-model:show="modelShowRef" :mask-closable="false">
|
||||
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 900px; height: 650px">
|
||||
<template #header></template>
|
||||
<template #header-extra> </template>
|
||||
<div class="pond-content">
|
||||
<!-- 展示区域 -->
|
||||
<chart-data-display
|
||||
v-if="pondData && !loading"
|
||||
:targetData="pondData"
|
||||
:globalData="chartEditStore.getRequestGlobalConfig"
|
||||
></chart-data-display>
|
||||
<!-- 无数据 -->
|
||||
<div v-else class="no-data go-flex-center">
|
||||
<img :src="noData" alt="暂无数据" />
|
||||
<n-text :depth="3">暂未选择公共接口</n-text>
|
||||
</div>
|
||||
<!-- 左侧列表 -->
|
||||
<chart-data-pond-list @createPond="createPond" @deletePond="deletePond"></chart-data-pond-list>
|
||||
</div>
|
||||
<!-- 底部 -->
|
||||
<template #action>
|
||||
<n-space justify="space-between">
|
||||
<n-button type="info" secondary :disabled="!pondData" @click="openPond(true)">
|
||||
编辑内容
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<pencil-icon />
|
||||
</n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-button type="primary" @click="closeHandle">保存 & 发送请求</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-card>
|
||||
</n-modal>
|
||||
|
||||
<!-- 请求配置model -->
|
||||
<pond-data-request
|
||||
v-model:modelShow="requestShow"
|
||||
:targetDataRequest="editData"
|
||||
:isEdit="isEdit"
|
||||
@editSaveHandle="saveHandle"
|
||||
></pond-data-request>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, toRefs, computed, nextTick, watch, toRaw } from 'vue'
|
||||
import noData from '@/assets/images/canvas/noData.png'
|
||||
import { ChartDataPondList } from '../ChartDataPondList'
|
||||
import { PondDataRequest } from '../../../ChartDataRequest'
|
||||
import { ChartDataDisplay } from '../ChartDataDisplay'
|
||||
import { requestConfig } from '@/packages/public/publicConfig'
|
||||
import { useTargetData } from '@/views/chart/ContentConfigurations/components/hooks/useTargetData.hook'
|
||||
import { RequestDataPondItemType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||
import { icon } from '@/plugins'
|
||||
import { getUUID, goDialog } from '@/utils'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const props = defineProps({
|
||||
modelShow: Boolean
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelShow', 'sendHandle'])
|
||||
const { PencilIcon } = icon.ionicons5
|
||||
const { chartEditStore, targetData } = useTargetData()
|
||||
const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||
const requestShow = ref(false)
|
||||
const modelShowRef = ref(false)
|
||||
const loading = ref(false)
|
||||
const isEdit = ref(false)
|
||||
const editData = ref<RequestDataPondItemType>()
|
||||
|
||||
// 所选数据池
|
||||
const pondData = computed(() => {
|
||||
const selectId = targetData?.value?.request?.requestDataPondId
|
||||
if (!selectId) return undefined
|
||||
const data = requestDataPond.value.filter(item => {
|
||||
return selectId === item.dataPondId
|
||||
})
|
||||
return data[0]
|
||||
})
|
||||
|
||||
watch(() => props.modelShow, (newValue) => {
|
||||
modelShowRef.value = newValue
|
||||
})
|
||||
|
||||
watch(
|
||||
() => pondData.value,
|
||||
newValue => {
|
||||
loading.value = true
|
||||
editData.value = newValue
|
||||
nextTick(() => {
|
||||
loading.value = false
|
||||
})
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
// 打开/编辑
|
||||
const openPond = (isEditFlag: boolean = false) => {
|
||||
isEdit.value = !!isEditFlag
|
||||
requestShow.value = true
|
||||
}
|
||||
|
||||
// 创建
|
||||
const createPond = () => {
|
||||
const id = getUUID()
|
||||
editData.value = {
|
||||
dataPondId: id,
|
||||
dataPondName: id,
|
||||
dataPondRequestConfig: cloneDeep({ ...requestConfig, requestDataType: RequestDataTypeEnum.Pond })
|
||||
}
|
||||
openPond()
|
||||
}
|
||||
|
||||
// 完成创建/编辑
|
||||
const saveHandle = (newData: RequestDataPondItemType) => {
|
||||
// 走创建
|
||||
if (isEdit.value) {
|
||||
editSaveHandle(newData)
|
||||
} else {
|
||||
createSaveHandle(newData)
|
||||
}
|
||||
isEdit.value = false
|
||||
requestShow.value = false
|
||||
}
|
||||
|
||||
// 编辑保存之后
|
||||
const editSaveHandle = (newData: RequestDataPondItemType) => {
|
||||
try {
|
||||
const targetIndex = requestDataPond.value.findIndex(item => item.dataPondId === newData.dataPondId)
|
||||
if (targetIndex !== -1) {
|
||||
requestDataPond.value.splice(targetIndex, 1, newData)
|
||||
// 修改数据池后, 修改所有关联的组件
|
||||
chartEditStore.getComponentList.forEach(item => {
|
||||
if (
|
||||
item.request.requestDataType === RequestDataTypeEnum.Pond &&
|
||||
item.request.requestDataPondId === newData.dataPondId
|
||||
) {
|
||||
item.request = {
|
||||
...toRaw(newData.dataPondRequestConfig),
|
||||
requestDataPondId: newData.dataPondId
|
||||
}
|
||||
}
|
||||
})
|
||||
window.$message.success('保存成功!')
|
||||
} else {
|
||||
window.$message.error('编辑失败,请稍后重试!')
|
||||
}
|
||||
} catch (error) {
|
||||
window.$message.error('编辑失败,请稍后重试!')
|
||||
}
|
||||
}
|
||||
|
||||
// 创建保存成功之后
|
||||
const createSaveHandle = (newData: RequestDataPondItemType) => {
|
||||
try {
|
||||
if (editData.value) {
|
||||
requestDataPond.value.unshift(newData)
|
||||
window.$message.success('创建成功!')
|
||||
} else {
|
||||
window.$message.error('创建失败,请稍后重试!')
|
||||
}
|
||||
} catch (error) {
|
||||
window.$message.error('创建失败,请稍后重试!')
|
||||
}
|
||||
}
|
||||
|
||||
// 删除数据池
|
||||
const deletePond = (targetData: RequestDataPondItemType) => {
|
||||
goDialog({
|
||||
message: '删除数据后,需手动处理使用改接口的组件,是否继续?',
|
||||
isMaskClosable: true,
|
||||
transformOrigin: 'center',
|
||||
onPositiveCallback: () => {
|
||||
const targetIndex = requestDataPond.value.findIndex(item => item.dataPondId === targetData.dataPondId)
|
||||
if (targetIndex !== -1) {
|
||||
requestDataPond.value.splice(targetIndex, 1)
|
||||
window.$message.success('删除成功!')
|
||||
} else {
|
||||
window.$message.error('删除失败,请稍后重试!')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 关闭
|
||||
const closeHandle = () => {
|
||||
// 将所选内容赋值给对象
|
||||
if (pondData.value) {
|
||||
targetData.value.request = {
|
||||
...toRaw(pondData.value.dataPondRequestConfig),
|
||||
requestDataPondId: pondData.value.dataPondId
|
||||
}
|
||||
}
|
||||
emit('update:modelShow', false)
|
||||
emit('sendHandle')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('chart-data-pond-control') {
|
||||
/* 中间 */
|
||||
.pond-content {
|
||||
display: flex;
|
||||
}
|
||||
.no-data {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
img {
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
&.n-card.n-modal,
|
||||
.n-card {
|
||||
@extend .go-background-filter;
|
||||
}
|
||||
.n-card-shallow {
|
||||
background-color: rgba(0, 0, 0, 0) !important;
|
||||
}
|
||||
@include deep() {
|
||||
& > .n-card__content {
|
||||
padding-right: 0;
|
||||
}
|
||||
.n-card__content {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
import ChartDataPondList from './index.vue'
|
||||
|
||||
export { ChartDataPondList }
|
||||
@@ -0,0 +1,202 @@
|
||||
<template>
|
||||
<div class="go-chart-data-pond-list">
|
||||
<n-timeline style="width: 20px">
|
||||
<n-timeline-item type="info"> </n-timeline-item>
|
||||
<n-timeline-item type="success"></n-timeline-item>
|
||||
</n-timeline>
|
||||
<div class="pond-item-box">
|
||||
<!-- 新增 -->
|
||||
<n-button class="create-btn go-py-4" ghost @click="createPond">
|
||||
<span> 创建 </span>
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<DuplicateOutlineIcon></DuplicateOutlineIcon>
|
||||
</n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-divider style="margin: 10px 0"></n-divider>
|
||||
<n-space v-if="!requestDataPond.length" justify="center">
|
||||
<n-text class="not-layer-text" :depth="3">
|
||||
暂无数据内容,
|
||||
<n-a @click="createPond">立即创建</n-a>
|
||||
</n-text>
|
||||
</n-space>
|
||||
<n-scrollbar style="max-height: 490px">
|
||||
<div
|
||||
v-for="item in requestDataPond"
|
||||
:key="item.dataPondId"
|
||||
:class="{ select: item.dataPondId === selectPondId }"
|
||||
class="pond-item"
|
||||
@click="clickHandle(item)"
|
||||
>
|
||||
<div class="item-content">
|
||||
<div class="item-content-body">
|
||||
<div>
|
||||
<n-tag class="go-mr-1" :type="item.dataPondId === selectPondId ? 'warning' : ''" :bordered="false">
|
||||
名称
|
||||
</n-tag>
|
||||
<n-ellipsis style="max-width: 180px">
|
||||
{{ item.dataPondName || '暂无' }}
|
||||
</n-ellipsis>
|
||||
</div>
|
||||
<div>
|
||||
<n-tag class="go-mr-1" :type="item.dataPondId === selectPondId ? 'warning' : ''" :bordered="false">
|
||||
地址
|
||||
</n-tag>
|
||||
<n-ellipsis style="max-width: 180px">
|
||||
{{ item.dataPondRequestConfig.requestUrl || '暂无' }}
|
||||
</n-ellipsis>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-content-icon go-transition-quick" @click="deletePond($event, item)">
|
||||
<n-icon>
|
||||
<trash-icon></trash-icon>
|
||||
</n-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="{ 'select-modal': item.dataPondId === selectPondId }"></div>
|
||||
</div>
|
||||
</n-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { toRefs, computed } from 'vue'
|
||||
import { useTargetData } from '@/views/chart/ContentConfigurations/components/hooks/useTargetData.hook'
|
||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||
import { RequestDataPondItemType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { icon } from '@/plugins'
|
||||
|
||||
const emit = defineEmits(['createPond', 'deletePond'])
|
||||
|
||||
const { DuplicateOutlineIcon, TrashIcon } = icon.ionicons5
|
||||
const designStore = useDesignStore()
|
||||
const { chartEditStore, targetData } = useTargetData()
|
||||
const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||
|
||||
// 选中的全局数据
|
||||
const selectPondId = computed(() => {
|
||||
return targetData.value.request.requestDataPondId
|
||||
})
|
||||
|
||||
// 颜色
|
||||
const themeColor = computed(() => {
|
||||
return designStore.getAppTheme
|
||||
})
|
||||
|
||||
// 创建数据池
|
||||
const createPond = () => {
|
||||
emit('createPond', true)
|
||||
}
|
||||
|
||||
// 删除数据池
|
||||
const deletePond = (target: Event, targetData: RequestDataPondItemType) => {
|
||||
target.stopPropagation()
|
||||
target.preventDefault()
|
||||
emit('deletePond', targetData)
|
||||
}
|
||||
|
||||
// 选中
|
||||
const clickHandle = (item: RequestDataPondItemType) => {
|
||||
targetData.value.request.requestDataPondId = item.dataPondId
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$height: 530px;
|
||||
$listWidth: 280px;
|
||||
$centerHeight: 60px;
|
||||
$centerMiniHeight: 28px;
|
||||
$textSize: 10px;
|
||||
|
||||
@include go('chart-data-pond-list') {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
margin-right: 5px;
|
||||
display: flex;
|
||||
@include deep() {
|
||||
.n-timeline > .n-timeline-item {
|
||||
&:first-child {
|
||||
height: $height;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pond-item-box {
|
||||
width: $listWidth;
|
||||
position: relative;
|
||||
.create-btn {
|
||||
width: calc(#{$listWidth - 15px});
|
||||
margin-right: 15px;
|
||||
}
|
||||
.pond-item {
|
||||
position: relative;
|
||||
height: $centerHeight;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 15px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(0, 0, 0, 0);
|
||||
@include fetch-bg-color('background-color3');
|
||||
@extend .go-transition-quick;
|
||||
&.hover,
|
||||
&:hover {
|
||||
@include fetch-bg-color('background-color4');
|
||||
}
|
||||
&:hover {
|
||||
@include deep() {
|
||||
.icon-item {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.item-content-icon {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.select {
|
||||
border: 1px solid v-bind('themeColor');
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
.item-content-icon {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.select-modal,
|
||||
.item-content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.item-content {
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
.item-content-body {
|
||||
width: 230px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}
|
||||
.item-content-icon {
|
||||
opacity: 0;
|
||||
height: $centerHeight;
|
||||
line-height: $centerHeight;
|
||||
padding-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.select-modal {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0.3;
|
||||
background-color: v-bind('themeColor');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
import ChartDataPond from './index.vue'
|
||||
|
||||
export { ChartDataPond }
|
||||
@@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<!-- 选中内容 -->
|
||||
<div class="go-chart-data-pond">
|
||||
<n-card class="n-card-shallow">
|
||||
<setting-item-box name="请求名称" :alone="true">
|
||||
<n-input size="small" :placeholder="pondData?.dataPondName || '暂无'" :disabled="true">
|
||||
<template #prefix>
|
||||
<n-icon :component="FishIcon" />
|
||||
</template>
|
||||
</n-input>
|
||||
</setting-item-box>
|
||||
|
||||
<setting-item-box name="接口地址" :alone="true">
|
||||
<n-input size="small" :placeholder="pondData?.dataPondRequestConfig.requestUrl || '暂无'" :disabled="true">
|
||||
<template #prefix>
|
||||
<n-icon :component="FlashIcon" />
|
||||
</template>
|
||||
</n-input>
|
||||
</setting-item-box>
|
||||
|
||||
<div class="edit-text" @click="controlModelHandle">
|
||||
<div class="go-absolute-center">
|
||||
<n-button type="primary" secondary>编辑配置</n-button>
|
||||
</div>
|
||||
</div>
|
||||
</n-card>
|
||||
</div>
|
||||
|
||||
<setting-item-box :alone="true">
|
||||
<template #name>
|
||||
测试
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-icon size="21" :depth="3">
|
||||
<help-outline-icon></help-outline-icon>
|
||||
</n-icon>
|
||||
</template>
|
||||
默认赋值给 dataset 字段
|
||||
</n-tooltip>
|
||||
</template>
|
||||
<n-button type="primary" ghost @click="sendHandle">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<flash-icon />
|
||||
</n-icon>
|
||||
</template>
|
||||
发送请求
|
||||
</n-button>
|
||||
</setting-item-box>
|
||||
|
||||
<!-- 底部数据展示 -->
|
||||
<chart-data-matching-and-show :show="showMatching && !loading" :ajax="true"></chart-data-matching-and-show>
|
||||
|
||||
<!-- 骨架图 -->
|
||||
<go-skeleton :load="loading" :repeat="3"></go-skeleton>
|
||||
|
||||
<!-- 编辑 / 新增弹窗 -->
|
||||
<chart-data-pond-control v-model:modelShow="controlModel" @sendHandle="sendHandle"></chart-data-pond-control>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, toRefs, toRaw, onBeforeUnmount, computed, watchEffect } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
import { http, customizeHttp } from '@/api/http'
|
||||
import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { ChartDataPondControl } from './components/ChartDataPondControl'
|
||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
||||
import { newFunctionHandle } from '@/utils'
|
||||
|
||||
const designStore = useDesignStore()
|
||||
const { HelpOutlineIcon, FlashIcon, PulseIcon, FishIcon } = icon.ionicons5
|
||||
const { targetData, chartEditStore } = useTargetData()
|
||||
|
||||
const {
|
||||
requestDataPond,
|
||||
requestInterval: GlobalRequestInterval,
|
||||
requestIntervalUnit: GlobalRequestIntervalUnit
|
||||
} = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||
|
||||
const loading = ref(false)
|
||||
const controlModel = ref(false)
|
||||
const showMatching = ref(false)
|
||||
|
||||
let firstFocus = 0
|
||||
let lastFilter: any = undefined
|
||||
|
||||
// 所选数据池
|
||||
const pondData = computed(() => {
|
||||
const selectId = targetData.value.request.requestDataPondId
|
||||
if (!selectId) return undefined
|
||||
const data = requestDataPond.value.filter(item => {
|
||||
return selectId === item.dataPondId
|
||||
})
|
||||
return data[0]
|
||||
})
|
||||
|
||||
// 颜色
|
||||
const themeColor = computed(() => {
|
||||
return designStore.getAppTheme
|
||||
})
|
||||
|
||||
// 请求配置 model
|
||||
const controlModelHandle = () => {
|
||||
controlModel.value = true
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
const sendHandle = async () => {
|
||||
if (!targetData.value?.request) {
|
||||
window.$message.warning('请选择一个公共接口!')
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
// const res = await customizeHttp(
|
||||
// toRaw(pondData.value?.dataPondRequestConfig),
|
||||
// toRaw(chartEditStore.getRequestGlobalConfig)
|
||||
// )
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
||||
loading.value = false
|
||||
if (res) {
|
||||
if (!res?.data && !targetData.value.filter) window['$message'].warning('您的数据不符合默认格式,请配置过滤器!')
|
||||
targetData.value.option.dataset = newFunctionHandle(res?.data, res, targetData.value.filter)
|
||||
showMatching.value = true
|
||||
return
|
||||
}
|
||||
window['$message'].warning('数据异常,请检查参数!')
|
||||
} catch (error) {
|
||||
loading.value = false
|
||||
window['$message'].warning('数据异常,请检查参数!')
|
||||
}
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
const filter = targetData.value?.filter
|
||||
if (lastFilter !== filter && firstFocus) {
|
||||
lastFilter = filter
|
||||
sendHandle()
|
||||
}
|
||||
firstFocus++
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
lastFilter = null
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@include go('chart-data-pond') {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.n-card-shallow {
|
||||
&.n-card {
|
||||
@extend .go-background-filter;
|
||||
@include deep() {
|
||||
.n-card__content {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.edit-text {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 325px;
|
||||
height: 136px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: all 0.3s;
|
||||
@extend .go-background-filter;
|
||||
backdrop-filter: blur(2px) !important;
|
||||
}
|
||||
&:hover {
|
||||
border-color: v-bind('themeColor');
|
||||
.edit-text {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<!-- 全局配置 -->
|
||||
<n-card class="n-card-shallow">
|
||||
<n-tag type="info" :bordered="false" style="border-radius: 5px"> 全局配置 </n-tag>
|
||||
<n-tag type="info" :bordered="false" style="border-radius: 5px"> 全局公共配置 </n-tag>
|
||||
<setting-item-box
|
||||
name="服务"
|
||||
:itemRightStyle="{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<!-- 为 none 时 -->
|
||||
<n-card class="go-mt-3 go-pb-3" v-if="requestParamsBodyType === RequestBodyEnum['NONE']">
|
||||
<n-text depth="3">该请求没有 Body 体</n-text>
|
||||
<n-text depth="3">该接口没有 Body 体</n-text>
|
||||
</n-card>
|
||||
|
||||
<!-- 具有对象属性时 -->
|
||||
@@ -86,13 +86,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, toRefs } from 'vue'
|
||||
|
||||
import { ref, toRefs, PropType } from 'vue'
|
||||
import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
||||
import { RequestHeaderTable } from '../RequestHeaderTable/index'
|
||||
import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { useTargetData } from '@/views/chart/ContentConfigurations/components/hooks/useTargetData.hook'
|
||||
import { RequestHeaderTable } from '../RequestHeaderTable/index'
|
||||
|
||||
import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import {
|
||||
RequestParamsTypeEnum,
|
||||
RequestContentTypeEnum,
|
||||
@@ -102,9 +101,13 @@ import {
|
||||
RequestHttpEnum
|
||||
} from '@/enums/httpEnum'
|
||||
|
||||
const { targetData } = useTargetData()
|
||||
const props = defineProps({
|
||||
targetDataRequest: Object as PropType<RequestConfigType>
|
||||
})
|
||||
|
||||
const { requestHttpType, requestContentType, requestSQLContent, requestParams, requestParamsBodyType } = toRefs(targetData.value.request)
|
||||
const { requestHttpType, requestContentType, requestSQLContent, requestParams, requestParamsBodyType } = toRefs(
|
||||
props.targetDataRequest as RequestConfigType
|
||||
)
|
||||
|
||||
const tabValue = ref<RequestParamsTypeEnum>(RequestParamsTypeEnum.PARAMS)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:itemRightStyle="{
|
||||
gridTemplateColumns: '6fr 2fr'
|
||||
}"
|
||||
style="padding-right: 25px;"
|
||||
style="padding-right: 25px"
|
||||
>
|
||||
<template #name>
|
||||
地址
|
||||
@@ -51,15 +51,16 @@
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="选择方式" class="go-mt-0">
|
||||
<request-header></request-header>
|
||||
<request-header :targetDataRequest="targetDataRequest"></request-header>
|
||||
</setting-item-box>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, toRefs } from 'vue'
|
||||
import { PropType, toRefs } from 'vue'
|
||||
import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { useTargetData } from '@/views/chart/ContentConfigurations/components/hooks/useTargetData.hook'
|
||||
import { selectTypeOptions, selectTimeOptions } from '@/views/chart/ContentConfigurations/components/ChartData/index.d'
|
||||
import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { RequestHeader } from '../RequestHeader'
|
||||
import { isDev } from '@/utils'
|
||||
import { icon } from '@/plugins'
|
||||
@@ -82,10 +83,16 @@ import {
|
||||
threeEarth01Url
|
||||
} from '@/api/mock'
|
||||
|
||||
const props = defineProps({
|
||||
targetDataRequest: Object as PropType<RequestConfigType>
|
||||
})
|
||||
|
||||
const { HelpOutlineIcon } = icon.ionicons5
|
||||
const { targetData, chartEditStore } = useTargetData()
|
||||
const { chartEditStore } = useTargetData()
|
||||
const { requestOriginUrl } = toRefs(chartEditStore.getRequestGlobalConfig)
|
||||
const { requestInterval, requestIntervalUnit, requestHttpType, requestUrl } = toRefs(targetData.value.request)
|
||||
const { requestInterval, requestIntervalUnit, requestHttpType, requestUrl } = toRefs(
|
||||
props.targetDataRequest as RequestConfigType
|
||||
)
|
||||
|
||||
const apiList = [
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import ChartDataRequest from './index.vue'
|
||||
import PondDataRequest from './pondIndex.vue'
|
||||
|
||||
export { ChartDataRequest }
|
||||
export { ChartDataRequest, PondDataRequest }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false">
|
||||
<n-modal class="go-chart-data-request" v-model:show="modelShowRef" :mask-closable="false" :closeOnEsc="false">
|
||||
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
|
||||
<template #header></template>
|
||||
<template #header-extra> </template>
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="go-pr-3">
|
||||
<n-space vertical>
|
||||
<request-global-config></request-global-config>
|
||||
<request-target-config></request-target-config>
|
||||
<request-target-config :target-data-request="targetData?.request"></request-target-config>
|
||||
</n-space>
|
||||
</div>
|
||||
</n-scrollbar>
|
||||
@@ -17,9 +17,11 @@
|
||||
<div>
|
||||
<n-text>「 {{ chartConfig.categoryName }} 」</n-text>
|
||||
<n-text>—— </n-text>
|
||||
<n-tag type="primary" :bordered="false" style="border-radius: 5px"> {{ requestContentTypeObj[requestContentType] }} </n-tag>
|
||||
<n-tag type="primary" :bordered="false" style="border-radius: 5px">
|
||||
{{ requestContentTypeObj[requestContentType] }}
|
||||
</n-tag>
|
||||
</div>
|
||||
<n-button type="primary" @click="closeHandle">保存 & 发送请求</n-button>
|
||||
<n-button type="primary" @click="closeAndSendHandle"> {{ saveBtnText || '保存 & 发送请求' }}</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-card>
|
||||
@@ -27,31 +29,49 @@
|
||||
</template>
|
||||
|
||||
<script script lang="ts" setup>
|
||||
import { toRefs } from 'vue'
|
||||
import { ref, toRefs, PropType, watch } from 'vue'
|
||||
import { RequestContentTypeEnum } from '@/enums/httpEnum'
|
||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||
import { RequestGlobalConfig } from './components/RequestGlobalConfig'
|
||||
import { RequestTargetConfig } from './components/RequestTargetConfig'
|
||||
import { useSync } from '@/views/chart/hooks/useSync.hook'
|
||||
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
||||
|
||||
const props = defineProps({
|
||||
modelShow: Boolean,
|
||||
targetData: Object as PropType<CreateComponentType>,
|
||||
saveBtnText: String || null
|
||||
})
|
||||
const emit = defineEmits(['update:modelShow', 'sendHandle'])
|
||||
|
||||
const { targetData } = useTargetData()
|
||||
const { dataSyncUpdate } = useSync()
|
||||
|
||||
// 解构基础配置
|
||||
const { chartConfig } = toRefs(targetData.value)
|
||||
const { requestContentType } = toRefs(targetData.value.request)
|
||||
const { chartConfig } = toRefs(props.targetData as CreateComponentType)
|
||||
const { requestContentType } = toRefs((props.targetData as CreateComponentType).request)
|
||||
const modelShowRef = ref(false)
|
||||
const requestContentTypeObj = {
|
||||
[RequestContentTypeEnum.DEFAULT]: '普通请求',
|
||||
[RequestContentTypeEnum.SQL]: 'SQL 请求'
|
||||
}
|
||||
|
||||
defineProps({
|
||||
modelShow: Boolean
|
||||
})
|
||||
watch(
|
||||
() => props.modelShow,
|
||||
newValue => {
|
||||
modelShowRef.value = newValue
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const closeHandle = () => {
|
||||
emit('update:modelShow', false)
|
||||
}
|
||||
|
||||
const closeAndSendHandle = () => {
|
||||
emit('update:modelShow', false)
|
||||
emit('sendHandle')
|
||||
dataSyncUpdate()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<n-modal class="go-chart-data-request" v-model:show="modelShowRef" :mask-closable="false" :closeOnEsc="false">
|
||||
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
|
||||
<template #header></template>
|
||||
<template #header-extra> </template>
|
||||
<n-scrollbar style="max-height: 718px">
|
||||
<div class="go-pr-3">
|
||||
<n-space vertical>
|
||||
<request-global-config></request-global-config>
|
||||
<request-target-config
|
||||
:target-data-request="targetDataRequest?.dataPondRequestConfig"
|
||||
></request-target-config>
|
||||
</n-space>
|
||||
</div>
|
||||
</n-scrollbar>
|
||||
<!-- 底部 -->
|
||||
<template #action>
|
||||
<n-space justify="space-between">
|
||||
<n-space v-if="targetDataRequest">
|
||||
<n-tag :bordered="false" type="primary">名称:</n-tag>
|
||||
<n-input
|
||||
v-model:value="targetDataRequest.dataPondName"
|
||||
ref="inputInstRef"
|
||||
type="text"
|
||||
size="small"
|
||||
:autofocus="true"
|
||||
:clearable="true"
|
||||
:minlength="1"
|
||||
:maxlength="16"
|
||||
placeholder="请输入名称"
|
||||
></n-input>
|
||||
</n-space>
|
||||
<span v-else></span>
|
||||
<n-space>
|
||||
<n-button @click="closeHandle">取消</n-button>
|
||||
<n-button type="primary" @click="closeAndSendHandle">保存</n-button>
|
||||
</n-space>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-card>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script script lang="ts" setup>
|
||||
import { PropType, ref, watch } from 'vue'
|
||||
import { RequestContentTypeEnum } from '@/enums/httpEnum'
|
||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||
import { RequestGlobalConfig } from './components/RequestGlobalConfig'
|
||||
import { RequestTargetConfig } from './components/RequestTargetConfig'
|
||||
import { RequestDataPondItemType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { useSync } from '@/views/chart/hooks/useSync.hook'
|
||||
import { goDialog } from '@/utils'
|
||||
|
||||
const props = defineProps({
|
||||
modelShow: Boolean,
|
||||
targetDataRequest: Object as PropType<RequestDataPondItemType>
|
||||
})
|
||||
const emit = defineEmits(['update:modelShow', 'editSaveHandle'])
|
||||
|
||||
const { dataSyncUpdate } = useSync()
|
||||
const pondName = ref()
|
||||
const inputInstRef = ref()
|
||||
const modelShowRef = ref(false)
|
||||
|
||||
watch(() => props.modelShow, (newValue) => {
|
||||
modelShowRef.value = newValue
|
||||
})
|
||||
|
||||
|
||||
const closeHandle = () => {
|
||||
emit('update:modelShow', false)
|
||||
}
|
||||
|
||||
const closeAndSendHandle = () => {
|
||||
if (!props.targetDataRequest?.dataPondName) {
|
||||
window.$message.warning('请在左下角输入名称!')
|
||||
inputInstRef.value?.focus()
|
||||
return
|
||||
}
|
||||
goDialog({
|
||||
message: '保存内容将同步修改所有使用此接口的组件, 是否继续?',
|
||||
isMaskClosable: true,
|
||||
transformOrigin: 'center',
|
||||
onPositiveCallback: () => {
|
||||
emit('update:modelShow', false)
|
||||
emit('editSaveHandle', props.targetDataRequest)
|
||||
dataSyncUpdate()
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('chart-data-request') {
|
||||
&.n-card.n-modal,
|
||||
.n-card {
|
||||
@extend .go-background-filter;
|
||||
}
|
||||
.n-card-shallow {
|
||||
background-color: rgba(0, 0, 0, 0) !important;
|
||||
}
|
||||
@include deep() {
|
||||
& > .n-card__content {
|
||||
padding-right: 0;
|
||||
}
|
||||
.n-card__content {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -16,6 +16,7 @@ export enum TimelineTitleEnum {
|
||||
export enum SelectCreateDataEnum {
|
||||
STATIC = '静态数据',
|
||||
AJAX = '动态请求',
|
||||
Pond = '公共接口',
|
||||
}
|
||||
|
||||
export interface SelectCreateDataType {
|
||||
|
||||
@@ -3,24 +3,27 @@
|
||||
<setting-item-box name="请求方式" :alone="true">
|
||||
<n-select v-model:value="targetData.request.requestDataType" :disabled="isNotData" :options="selectOptions" />
|
||||
</setting-item-box>
|
||||
|
||||
<!-- 静态 -->
|
||||
<chart-data-static v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"></chart-data-static>
|
||||
|
||||
<!-- 动态 -->
|
||||
<chart-data-ajax v-else></chart-data-ajax>
|
||||
<chart-data-ajax v-if="targetData.request.requestDataType === RequestDataTypeEnum.AJAX"></chart-data-ajax>
|
||||
<!-- 数据池 -->
|
||||
<chart-data-pond v-if="targetData.request.requestDataType === RequestDataTypeEnum.Pond"></chart-data-pond>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { loadAsyncComponent } from '@/utils'
|
||||
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
||||
import { useTargetData } from '../hooks/useTargetData.hook'
|
||||
import { ChartDataStatic } from './components/ChartDataStatic/index'
|
||||
import { ChartDataAjax } from './components/ChartDataAjax/index'
|
||||
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
|
||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||
|
||||
const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue'))
|
||||
const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue'))
|
||||
const ChartDataPond = loadAsyncComponent(() => import('./components/ChartDataPond/index.vue'))
|
||||
|
||||
const { targetData } = useTargetData()
|
||||
|
||||
// 选项
|
||||
@@ -32,6 +35,10 @@ const selectOptions: SelectCreateDataType[] = [
|
||||
{
|
||||
label: SelectCreateDataEnum.AJAX,
|
||||
value: RequestDataTypeEnum.AJAX
|
||||
},
|
||||
{
|
||||
label: SelectCreateDataEnum.Pond,
|
||||
value: RequestDataTypeEnum.Pond
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ $max-width: 670px;
|
||||
.scale-slider {
|
||||
position: relative;
|
||||
top: -4px;
|
||||
width: 200px;
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ const rangeModelStyle = computed(() => {
|
||||
position: relative;
|
||||
transform-origin: left top;
|
||||
background-size: cover;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
@include fetch-border-color('hover-border-color');
|
||||
@include fetch-bg-color('background-color2');
|
||||
@include go(edit-range-model) {
|
||||
|
||||
@@ -1,49 +1,166 @@
|
||||
<template>
|
||||
<sketch-rule
|
||||
v-if="configShow"
|
||||
:thick="thick"
|
||||
:scale="scale"
|
||||
:width="canvasBox().width"
|
||||
:height="canvasBox().height"
|
||||
:startX="startX"
|
||||
:startY="startY"
|
||||
:lines="lines"
|
||||
></sketch-rule>
|
||||
<div class="go-sketch-rule">
|
||||
<sketch-rule
|
||||
v-if="sketchRuleReDraw"
|
||||
:thick="thick"
|
||||
:scale="scale"
|
||||
:width="canvasBox().width"
|
||||
:height="canvasBox().height"
|
||||
:startX="startX"
|
||||
:startY="startY"
|
||||
:lines="lines"
|
||||
:palette="paletteStyle"
|
||||
>
|
||||
</sketch-rule>
|
||||
<div ref="$app" class="edit-screens" @scroll="handleScroll">
|
||||
<div ref="$container" class="edit-screen-container" :style="{ width: width * 2 + 'px' }">
|
||||
<div
|
||||
ref="refSketchRuleBox"
|
||||
class="canvas"
|
||||
@mousedown="dragCanvas"
|
||||
:style="{ marginLeft: '-' + (canvasBox().width / 2 - 25) + 'px' }"
|
||||
>
|
||||
<div :style="{ pointerEvents: isPressSpace ? 'none' : 'auto' }">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 修复右下角白点用的 -->
|
||||
<div v-if="designStore.getDarkTheme" class="fix-edit-screens-block"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, toRefs, computed, watch, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { ref, reactive, onMounted, toRefs, watch, onUnmounted, computed } from 'vue'
|
||||
import { listen } from 'dom-helpers'
|
||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||
import throttle from 'lodash/throttle'
|
||||
|
||||
const chartEditStore = useChartEditStore()
|
||||
const chartLayoutStore = useChartLayoutStore()
|
||||
const designStore = useDesignStore()
|
||||
|
||||
const { width, height } = toRefs(chartEditStore.getEditCanvasConfig)
|
||||
const { scale, lockScale } = toRefs(chartEditStore.getEditCanvas)
|
||||
const { getLayers, getCharts, getDetails } = toRefs(chartLayoutStore)
|
||||
|
||||
const configShow = ref(true)
|
||||
|
||||
// x轴标尺开始的坐标数值
|
||||
const startX = -10
|
||||
// y轴标尺开始的坐标数值
|
||||
const startY = -10
|
||||
// 标尺的厚度
|
||||
const thick = 20
|
||||
// 初始化水平标尺上的参考线
|
||||
const lines = {
|
||||
h: [],
|
||||
v: []
|
||||
let prevMoveXValue = [0, 0]
|
||||
let prevMoveYValue = [0, 0]
|
||||
|
||||
const $app = ref()
|
||||
const sketchRuleReDraw = ref(true)
|
||||
const refSketchRuleBox = ref()
|
||||
const $container = ref()
|
||||
const isPressSpace = ref(false)
|
||||
const cursorStyle = ref('auto')
|
||||
const { width, height } = toRefs(chartEditStore.getEditCanvasConfig)
|
||||
const startX = ref(0)
|
||||
const startY = ref(0)
|
||||
const lines = reactive({ h: [], v: [] })
|
||||
|
||||
const scale = computed(() => {
|
||||
return chartEditStore.getEditCanvas.scale
|
||||
})
|
||||
|
||||
// 滚动条拖动的高度
|
||||
const containerWidth = computed(() => {
|
||||
return `${height.value * 2}px`
|
||||
})
|
||||
|
||||
// 主题
|
||||
const paletteStyle = computed(() => {
|
||||
const isDarkTheme = designStore.getDarkTheme
|
||||
return isDarkTheme
|
||||
? {
|
||||
bgColor: '#18181c',
|
||||
longfgColor: '#4d4d4d',
|
||||
shortfgColor: '#4d4d4d',
|
||||
fontColor: '#4d4d4d',
|
||||
shadowColor: '#18181c',
|
||||
borderColor: '#18181c',
|
||||
cornerActiveColor: '#18181c'
|
||||
}
|
||||
: {}
|
||||
})
|
||||
|
||||
// 颜色
|
||||
const themeColor = computed(() => {
|
||||
return designStore.getAppTheme
|
||||
})
|
||||
|
||||
// 处理鼠标拖动
|
||||
const handleWheel = (e: any) => {
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
e.preventDefault()
|
||||
let resScale = scale.value
|
||||
// 放大(200%)
|
||||
if (e.wheelDelta >= 0 && scale.value < 2) {
|
||||
resScale = scale.value + 0.05
|
||||
chartEditStore.setScale(resScale)
|
||||
return
|
||||
}
|
||||
// 缩小(10%)
|
||||
if (e.wheelDelta < 0 && scale.value > 0.1) {
|
||||
resScale = scale.value - 0.05
|
||||
chartEditStore.setScale(resScale)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 滚动条处理
|
||||
const handleScroll = () => {
|
||||
if (!$app.value) return
|
||||
const screensRect = $app.value.getBoundingClientRect()
|
||||
const canvasRect = refSketchRuleBox.value.getBoundingClientRect()
|
||||
// 标尺开始的刻度
|
||||
startX.value = (screensRect.left + thick - canvasRect.left) / scale.value
|
||||
startY.value = (screensRect.top + thick - canvasRect.top) / scale.value
|
||||
}
|
||||
|
||||
// 拖拽处理
|
||||
const dragCanvas = (e: any) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
if (e.which == 2) isPressSpace.value = true
|
||||
else if (!window.$KeyboardActive?.space) return
|
||||
// @ts-ignore
|
||||
document.activeElement?.blur()
|
||||
|
||||
const startX = e.pageX
|
||||
const startY = e.pageY
|
||||
|
||||
const listenMousemove = listen(window, 'mousemove', (e: any) => {
|
||||
const nx = e.pageX - startX
|
||||
const ny = e.pageY - startY
|
||||
|
||||
const [prevMoveX1, prevMoveX2] = prevMoveXValue
|
||||
const [prevMoveY1, prevMoveY2] = prevMoveYValue
|
||||
|
||||
prevMoveXValue = [prevMoveX2, nx]
|
||||
prevMoveYValue = [prevMoveY2, ny]
|
||||
|
||||
$app.value.scrollLeft -=
|
||||
prevMoveX2 > prevMoveX1 ? Math.abs(prevMoveX2 - prevMoveX1) : -Math.abs(prevMoveX2 - prevMoveX1)
|
||||
$app.value.scrollTop -=
|
||||
prevMoveY2 > prevMoveY1 ? Math.abs(prevMoveY2 - prevMoveY1) : -Math.abs(prevMoveY2 - prevMoveY1)
|
||||
})
|
||||
|
||||
const listenMouseup = listen(window, 'mouseup', () => {
|
||||
listenMousemove()
|
||||
listenMouseup()
|
||||
prevMoveXValue = [0, 0]
|
||||
prevMoveYValue = [0, 0]
|
||||
isPressSpace.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 计算画布大小
|
||||
const canvasBox = () => {
|
||||
const layoutDom = document.getElementById('go-chart-edit-layout')
|
||||
if (layoutDom) {
|
||||
return {
|
||||
height: layoutDom.clientHeight - 40,
|
||||
height: layoutDom.clientHeight - 25,
|
||||
width: layoutDom.clientWidth
|
||||
}
|
||||
}
|
||||
@@ -53,83 +170,109 @@ const canvasBox = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 颜色
|
||||
const themeColor = computed(() => {
|
||||
return designStore.getAppTheme
|
||||
})
|
||||
|
||||
// 处理标尺重制大小
|
||||
const ruleChangeHandle = () => {
|
||||
configShow.value = false
|
||||
// 重绘标尺
|
||||
const reDraw = () => {
|
||||
sketchRuleReDraw.value = false
|
||||
setTimeout(() => {
|
||||
configShow.value = true
|
||||
})
|
||||
sketchRuleReDraw.value = true
|
||||
}, 10)
|
||||
}
|
||||
|
||||
const ruleChangeHandleTimeOut = () => {
|
||||
if (lockScale.value) {
|
||||
setTimeout(() => {
|
||||
ruleChangeHandle()
|
||||
}, 500)
|
||||
// 滚动居中
|
||||
const canvasPosCenter = () => {
|
||||
const { width: containerWidth, height: containerHeight } = $container.value.getBoundingClientRect()
|
||||
const { width, height } = canvasBox()
|
||||
|
||||
$app.value.scrollLeft = containerWidth / 2 - width / 2
|
||||
$app.value.scrollTop = containerHeight / 2 - height / 2
|
||||
}
|
||||
|
||||
// 处理主题变化
|
||||
watch(
|
||||
() => designStore.getDarkTheme,
|
||||
() => {
|
||||
reDraw()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// // 处理标尺重制大小
|
||||
watch(
|
||||
() => scale.value,
|
||||
() => ruleChangeHandle()
|
||||
(newValue, oldValue) => {
|
||||
if (oldValue !== newValue && chartLayoutStore.getRePositionCanvas) {
|
||||
chartLayoutStore.setItemUnHandle(ChartLayoutStoreEnum.RE_POSITION_CANVAS, false)
|
||||
handleScroll()
|
||||
setTimeout(() => {
|
||||
canvasPosCenter()
|
||||
reDraw()
|
||||
}, 400)
|
||||
} else {
|
||||
throttle(reDraw, 20)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 处理鼠标样式
|
||||
watch(
|
||||
() => getLayers.value,
|
||||
() => ruleChangeHandleTimeOut()
|
||||
() => isPressSpace.value,
|
||||
newValue => {
|
||||
cursorStyle.value = newValue ? 'grab' : 'auto'
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => getCharts.value,
|
||||
() => ruleChangeHandleTimeOut()
|
||||
)
|
||||
onMounted(() => {
|
||||
if ($app.value) {
|
||||
$app.value.addEventListener('wheel', handleWheel, { passive: false })
|
||||
canvasPosCenter()
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => getDetails.value,
|
||||
() => ruleChangeHandleTimeOut()
|
||||
)
|
||||
onUnmounted(() => {
|
||||
if ($app.value) {
|
||||
$app.value.removeEventListener('wheel', handleWheel)
|
||||
}
|
||||
})
|
||||
|
||||
window.onKeySpacePressHold = (isHold: boolean) => {
|
||||
isPressSpace.value = isHold
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 使用 SCSS 会报错,直接使用最基础的 CSS 进行修改,
|
||||
此库有计划 Vue3 版本,但是开发的时候还没发布 */
|
||||
|
||||
#mb-ruler {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
/* 适配底部的工具栏不遮盖 */
|
||||
#mb-ruler .v-container {
|
||||
height: calc(100% - 65px) !important;
|
||||
}
|
||||
|
||||
/* 横线 */
|
||||
#mb-ruler .v-container .lines .line {
|
||||
/* 最大缩放 200% */
|
||||
width: 200vw !important;
|
||||
border-top: 1px dashed v-bind('themeColor') !important;
|
||||
}
|
||||
|
||||
#mb-ruler .v-container .indicator {
|
||||
border-bottom: 1px dashed v-bind('themeColor') !important;
|
||||
}
|
||||
|
||||
/* 竖线 */
|
||||
#mb-ruler .h-container .lines .line {
|
||||
/* 最大缩放 200% */
|
||||
height: 200vh !important;
|
||||
border-left: 1px dashed v-bind('themeColor') !important;
|
||||
}
|
||||
|
||||
#mb-ruler .h-container .indicator {
|
||||
border-left: 1px dashed v-bind('themeColor') !important;
|
||||
}
|
||||
|
||||
/* 坐标数值背景颜色 */
|
||||
#mb-ruler .indicator .value {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* 删除按钮 */
|
||||
#mb-ruler .line .del {
|
||||
padding: 0;
|
||||
@@ -142,3 +285,72 @@ watch(
|
||||
border-width: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go('sketch-rule') {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.edit-screens {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
user-select: none;
|
||||
padding-bottom: 0px;
|
||||
|
||||
/* firefox */
|
||||
scrollbar-color: rgba(144, 146, 152, 0.3) transparent;
|
||||
scrollbar-width: thin;
|
||||
|
||||
/* chrome */
|
||||
&::-webkit-scrollbar,
|
||||
&::-webkit-scrollbar-track-piece {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 5px;
|
||||
background-color: rgba(144, 146, 152, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.fix-edit-screens-block {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background-color: $--color-dark-bg-1;
|
||||
}
|
||||
|
||||
.edit-screen-container {
|
||||
position: absolute;
|
||||
height: v-bind('containerWidth');
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.canvas {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform-origin: 50% 0;
|
||||
transform: translateY(-50%);
|
||||
|
||||
&:hover {
|
||||
cursor: v-bind('cursorStyle');
|
||||
}
|
||||
|
||||
&:active {
|
||||
cursor: crosshair;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -93,7 +93,7 @@ watch(
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.select-border {
|
||||
@@ -107,7 +107,7 @@ watch(
|
||||
.select-background {
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
opacity: 0.03;
|
||||
opacity: 0.2;
|
||||
background-color: v-bind('themeColor');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-modal v-model:show="modelShow" :mask-closable="true" @afterLeave="closeHandle">
|
||||
<n-modal v-model:show="modelShowRef" :mask-closable="true" @afterLeave="closeHandle">
|
||||
<n-table class="model-content" :bordered="false" :single-line="false">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -19,7 +19,8 @@
|
||||
<tr v-for="(item, index) in shortcutKeyOptions" :key="index">
|
||||
<td>{{ item.label }}</td>
|
||||
<td>{{ item.win }}</td>
|
||||
<td>
|
||||
<td v-if="item.macSource">{{ item.mac }}</td>
|
||||
<td v-else>
|
||||
<n-gradient-text :size="22">{{ item.mac.substr(0, 1) }}</n-gradient-text>
|
||||
+ {{ item.mac.substr(3) }}
|
||||
</td>
|
||||
@@ -30,39 +31,37 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch, ref } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
import { WinKeyboard, MacKeyboard } from '@/enums/editPageEnum'
|
||||
|
||||
const { CloseIcon } = icon.ionicons5
|
||||
const modelShowRef = ref(false)
|
||||
|
||||
const emit = defineEmits(['update:modelShow'])
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
modelShow: Boolean
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.modelShow, (newValue) => {
|
||||
modelShowRef.value = newValue
|
||||
})
|
||||
|
||||
// 快捷键
|
||||
const shortcutKeyOptions = [
|
||||
{
|
||||
label: '向上移动',
|
||||
win: `${WinKeyboard.CTRL.toUpperCase()} + ↑ `,
|
||||
label: '拖拽画布',
|
||||
win: `${WinKeyboard.SPACE.toUpperCase()} + 🖱️ `,
|
||||
mac: `${MacKeyboard.SPACE.toUpperCase()} + 🖱️ `,
|
||||
macSource: true
|
||||
},
|
||||
{
|
||||
label: '向 上/右/下/左 移动',
|
||||
win: `${WinKeyboard.CTRL.toUpperCase()} + ↑ 或 → 或 ↓ 或 ←`,
|
||||
mac: `${MacKeyboard.CTRL.toUpperCase()} + ↑ `
|
||||
},
|
||||
{
|
||||
label: '向右移动',
|
||||
win: `${WinKeyboard.CTRL.toUpperCase()} + → `,
|
||||
mac: `${MacKeyboard.CTRL.toUpperCase()} + → `
|
||||
},
|
||||
{
|
||||
label: '向下移动',
|
||||
win: `${WinKeyboard.CTRL.toUpperCase()} + ↓ `,
|
||||
mac: `${MacKeyboard.CTRL.toUpperCase()} + ↓ `
|
||||
},
|
||||
{
|
||||
label: '向左移动',
|
||||
win: `${WinKeyboard.CTRL.toUpperCase()} + ← `,
|
||||
mac: `${MacKeyboard.CTRL.toUpperCase()} + ← `
|
||||
},
|
||||
{
|
||||
label: '锁定',
|
||||
win: `${WinKeyboard.CTRL.toUpperCase()} + L `,
|
||||
@@ -134,6 +133,7 @@ const shortcutKeyOptions = [
|
||||
mac: `${MacKeyboard.CTRL.toUpperCase()} + ${WinKeyboard.SHIFT.toUpperCase()} + G `
|
||||
}
|
||||
]
|
||||
|
||||
const closeHandle = () => {
|
||||
emit('update:modelShow', false)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ export const mousedownHandleUnStop = (e: MouseEvent, item?: CreateComponentType
|
||||
|
||||
// * 框选
|
||||
export const mousedownBoxSelect = (e: MouseEvent, item?: CreateComponentType | CreateComponentGroupType) => {
|
||||
if (e.which == 2) return
|
||||
if (window.$KeyboardActive?.space) return
|
||||
|
||||
mousedownHandleUnStop(e)
|
||||
|
||||
// 记录点击初始位置
|
||||
@@ -149,7 +152,7 @@ export const mousedownBoxSelect = (e: MouseEvent, item?: CreateComponentType | C
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 20)
|
||||
}, 30)
|
||||
|
||||
// 鼠标抬起
|
||||
const mouseup = () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<edit-rule></edit-rule>
|
||||
<!-- <edit-rule></edit-rule> -->
|
||||
<content-box
|
||||
id="go-chart-edit-layout"
|
||||
:flex="true"
|
||||
@@ -7,65 +7,68 @@
|
||||
:showBottom="true"
|
||||
:depth="1"
|
||||
:xScroll="true"
|
||||
:disabledScroll="true"
|
||||
@mousedown="mousedownHandleUnStop"
|
||||
@drop="dragHandle"
|
||||
@dragover="dragoverHandle"
|
||||
@dragenter="dragoverHandle"
|
||||
>
|
||||
<!-- 画布主体 -->
|
||||
<div id="go-chart-edit-content" @contextmenu="handleContextMenu">
|
||||
<!-- 展示 -->
|
||||
<edit-range>
|
||||
<!-- 滤镜预览 -->
|
||||
<div
|
||||
:style="{
|
||||
...getFilterStyle(chartEditStore.getEditCanvasConfig),
|
||||
...rangeStyle
|
||||
}"
|
||||
>
|
||||
<!-- 图表 -->
|
||||
<div v-for="(item, index) in chartEditStore.getComponentList" :key="item.id">
|
||||
<!-- 分组 -->
|
||||
<edit-group
|
||||
v-if="item.isGroup"
|
||||
:groupData="(item as CreateComponentGroupType)"
|
||||
:groupIndex="index"
|
||||
></edit-group>
|
||||
<edit-rule>
|
||||
<!-- 画布主体 -->
|
||||
<div id="go-chart-edit-content" @contextmenu="handleContextMenu">
|
||||
<!-- 展示 -->
|
||||
<edit-range>
|
||||
<!-- 滤镜预览 -->
|
||||
<div
|
||||
:style="{
|
||||
...getFilterStyle(chartEditStore.getEditCanvasConfig),
|
||||
...rangeStyle
|
||||
}"
|
||||
>
|
||||
<!-- 图表 -->
|
||||
<div v-for="(item, index) in chartEditStore.getComponentList" :key="item.id">
|
||||
<!-- 分组 -->
|
||||
<edit-group
|
||||
v-if="item.isGroup"
|
||||
:groupData="(item as CreateComponentGroupType)"
|
||||
:groupIndex="index"
|
||||
></edit-group>
|
||||
|
||||
<!-- 单组件 -->
|
||||
<edit-shape-box
|
||||
v-else
|
||||
:data-id="item.id"
|
||||
:index="index"
|
||||
:style="{
|
||||
<!-- 单组件 -->
|
||||
<edit-shape-box
|
||||
v-else
|
||||
:data-id="item.id"
|
||||
:index="index"
|
||||
:style="{
|
||||
...useComponentStyle(item.attr, index),
|
||||
...getBlendModeStyle(item.styles) as any
|
||||
}"
|
||||
:item="item"
|
||||
@click="mouseClickHandle($event, item)"
|
||||
@mousedown="mousedownHandle($event, item)"
|
||||
@mouseenter="mouseenterHandle($event, item)"
|
||||
@mouseleave="mouseleaveHandle($event, item)"
|
||||
@contextmenu="handleContextMenu($event, item, optionsHandle)"
|
||||
>
|
||||
<component
|
||||
class="edit-content-chart"
|
||||
:class="animationsClass(item.styles.animations)"
|
||||
:is="item.chartConfig.chartKey"
|
||||
:chartConfig="item"
|
||||
:themeSetting="themeSetting"
|
||||
:themeColor="themeColor"
|
||||
:style="{
|
||||
...useSizeStyle(item.attr),
|
||||
...getFilterStyle(item.styles),
|
||||
...getTransformStyle(item.styles)
|
||||
}"
|
||||
></component>
|
||||
</edit-shape-box>
|
||||
:item="item"
|
||||
@click="mouseClickHandle($event, item)"
|
||||
@mousedown="mousedownHandle($event, item)"
|
||||
@mouseenter="mouseenterHandle($event, item)"
|
||||
@mouseleave="mouseleaveHandle($event, item)"
|
||||
@contextmenu="handleContextMenu($event, item, optionsHandle)"
|
||||
>
|
||||
<component
|
||||
class="edit-content-chart"
|
||||
:class="animationsClass(item.styles.animations)"
|
||||
:is="item.chartConfig.chartKey"
|
||||
:chartConfig="item"
|
||||
:themeSetting="themeSetting"
|
||||
:themeColor="themeColor"
|
||||
:style="{
|
||||
...useSizeStyle(item.attr),
|
||||
...getFilterStyle(item.styles),
|
||||
...getTransformStyle(item.styles)
|
||||
}"
|
||||
></component>
|
||||
</edit-shape-box>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</edit-range>
|
||||
</div>
|
||||
</edit-range>
|
||||
</div>
|
||||
</edit-rule>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<template #aside>
|
||||
@@ -191,12 +194,13 @@ onMounted(() => {
|
||||
overflow: hidden;
|
||||
@extend .go-point-bg;
|
||||
@include background-image('background-point');
|
||||
|
||||
@include goId('chart-edit-content') {
|
||||
border-radius: 10px;
|
||||
margin: 25px;
|
||||
overflow: hidden;
|
||||
@extend .go-transition;
|
||||
@include fetch-theme('box-shadow');
|
||||
|
||||
.edit-content-chart {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -152,9 +152,9 @@ const sendHandle = async () => {
|
||||
id: fetchRouteParamsLocation(),
|
||||
// 反过来
|
||||
state: release.value ? -1 : 1,
|
||||
})) as unknown as MyResponseType
|
||||
}))
|
||||
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
modelShowHandle()
|
||||
if (!release.value) {
|
||||
copyPreviewPath('发布成功!已复制地址到剪贴板~', '发布成功!')
|
||||
|
||||
@@ -67,8 +67,8 @@ const handleBlur = async () => {
|
||||
const res = (await updateProjectApi({
|
||||
id: fetchRouteParamsLocation(),
|
||||
projectName: title.value
|
||||
})) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
}))
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
dataSyncUpdate()
|
||||
} else {
|
||||
httpErrorHandle()
|
||||
|
||||
@@ -142,7 +142,6 @@ $textSize: 10px;
|
||||
/* 选中样式 */
|
||||
&.select {
|
||||
border: 1px solid v-bind('themeColor');
|
||||
/* 需要设置最高级,覆盖 hover 的颜色 */
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
3
src/views/chart/ContentLoad/index.ts
Normal file
3
src/views/chart/ContentLoad/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import ContentLoad from './index.vue'
|
||||
|
||||
export { ContentLoad }
|
||||
40
src/views/chart/ContentLoad/index.vue
Normal file
40
src/views/chart/ContentLoad/index.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<n-modal :show="showModal" :close-on-esc="false" transform-origin="center">
|
||||
<div>
|
||||
<span> 拼命加载中... </span>
|
||||
<n-progress type="line" :color="themeColor" :percentage="percentage" style="width: 300px" />
|
||||
</div>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||
|
||||
const chartLayoutStore = useChartLayoutStore()
|
||||
const designStore = useDesignStore()
|
||||
const showModal = ref(false)
|
||||
const percentage = ref(0)
|
||||
|
||||
// 颜色
|
||||
const themeColor = computed(() => {
|
||||
return designStore.getAppTheme
|
||||
})
|
||||
|
||||
// 监听百分比
|
||||
watch(
|
||||
() => chartLayoutStore.getPercentage,
|
||||
newValue => {
|
||||
if (newValue === 0) {
|
||||
setTimeout(() => {
|
||||
percentage.value = newValue
|
||||
showModal.value = false
|
||||
}, 500);
|
||||
return
|
||||
}
|
||||
percentage.value = newValue
|
||||
showModal.value = newValue > 0
|
||||
}
|
||||
)
|
||||
</script>
|
||||
@@ -115,21 +115,33 @@ const macKeyList: Array<string> = [
|
||||
const keyRecordHandle = () => {
|
||||
// 默认赋值
|
||||
window.$KeyboardActive = {
|
||||
ctrl: false
|
||||
ctrl: false,
|
||||
space: false
|
||||
}
|
||||
|
||||
|
||||
document.onkeydown = (e: KeyboardEvent) => {
|
||||
if(e.keyCode === 17 && window.$KeyboardActive) {
|
||||
const { keyCode } = e
|
||||
if (keyCode == 32 && e.target == document.body) e.preventDefault()
|
||||
|
||||
if ([17, 32].includes(keyCode) && window.$KeyboardActive) {
|
||||
setKeyboardDressShow(e.keyCode)
|
||||
window.$KeyboardActive.ctrl = true
|
||||
switch (keyCode) {
|
||||
case 17: window.$KeyboardActive.ctrl = true; break
|
||||
case 32: window.$KeyboardActive.space = true; break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.onkeyup = (e: KeyboardEvent) => {
|
||||
if(e.keyCode === 17 && window.$KeyboardActive)
|
||||
{
|
||||
window.$KeyboardActive.ctrl = false
|
||||
const { keyCode } = e
|
||||
if (keyCode == 32 && e.target == document.body) e.preventDefault()
|
||||
|
||||
if ([17, 32].includes(keyCode) && window.$KeyboardActive) {
|
||||
setKeyboardDressShow()
|
||||
switch (keyCode) {
|
||||
case 17: window.$KeyboardActive.ctrl = false; break
|
||||
case 32: window.$KeyboardActive.space = false; break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import { EditCanvasTypeEnum, ChartEditStoreEnum, ProjectInfoEnum, ChartEditStora
|
||||
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
|
||||
import { StylesSetting } from '@/components/Pages/ChartItemSetting'
|
||||
import { useSystemStore } from '@/store/modules/systemStore/systemStore'
|
||||
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
|
||||
import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index'
|
||||
import { saveInterval } from '@/settings/designSetting'
|
||||
import throttle from 'lodash/throttle'
|
||||
@@ -98,7 +100,7 @@ export const useSync = () => {
|
||||
const chartEditStore = useChartEditStore()
|
||||
const chartHistoryStore = useChartHistoryStore()
|
||||
const systemStore = useSystemStore()
|
||||
|
||||
const chartLayoutStore = useChartLayoutStore()
|
||||
/**
|
||||
* * 组件动态注册
|
||||
* @param projectData 项目数据
|
||||
@@ -164,7 +166,13 @@ export const useSync = () => {
|
||||
for (const key in projectData) {
|
||||
// 组件
|
||||
if (key === ChartEditStoreEnum.COMPONENT_LIST) {
|
||||
let loadIndex = 0
|
||||
const listLength = projectData[key].length;
|
||||
for (const comItem of projectData[key]) {
|
||||
// 设置加载数量
|
||||
let percentage = parseInt((parseFloat(`${++loadIndex / listLength}`) * 100).toString())
|
||||
chartLayoutStore.setItemUnHandle(ChartLayoutStoreEnum.PERCENTAGE, percentage)
|
||||
// 判断类型
|
||||
if (comItem.isGroup) {
|
||||
// 创建分组
|
||||
let groupClass = new PublicGroupConfigClass()
|
||||
@@ -195,6 +203,9 @@ export const useSync = () => {
|
||||
componentMerge(chartEditStore[key], projectData[key], true)
|
||||
}
|
||||
}
|
||||
|
||||
// 清除数量
|
||||
chartLayoutStore.setItemUnHandle(ChartLayoutStoreEnum.PERCENTAGE, 0)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,10 +235,13 @@ export const useSync = () => {
|
||||
|
||||
// * 数据获取
|
||||
const dataSyncFetch = async () => {
|
||||
// FIX:重新执行dataSyncFetch需清空chartEditStore.componentList,否则会导致图层重复
|
||||
// 切换语言等操作会导致重新执行 dataSyncFetch,此时pinia中并未清空chartEditStore.componentList,导致图层重复
|
||||
chartEditStore.componentList = []
|
||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.START)
|
||||
try {
|
||||
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() }) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() })
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
if (res.data) {
|
||||
updateStoreInfo(res.data)
|
||||
// 更新全局数据
|
||||
@@ -275,9 +289,9 @@ export const useSync = () => {
|
||||
// 上传预览图
|
||||
let uploadParams = new FormData()
|
||||
uploadParams.append('object', base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`))
|
||||
const uploadRes = await uploadFile(uploadParams) as unknown as MyResponseType
|
||||
const uploadRes = await uploadFile(uploadParams)
|
||||
// 保存预览图
|
||||
if(uploadRes.code === ResultEnum.SUCCESS) {
|
||||
if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
|
||||
await updateProjectApi({
|
||||
id: fetchRouteParamsLocation(),
|
||||
indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}`
|
||||
@@ -292,9 +306,9 @@ export const useSync = () => {
|
||||
let params = new FormData()
|
||||
params.append('projectId', projectId)
|
||||
params.append('content', JSON.stringify(chartEditStore.getStorageInfo || {}))
|
||||
const res= await saveProjectApi(params) as unknown as MyResponseType
|
||||
const res= await saveProjectApi(params)
|
||||
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
// 成功状态
|
||||
setTimeout(() => {
|
||||
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.SUCCESS)
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
:on-clickoutside="onClickOutSide"
|
||||
@select="handleMenuSelect"
|
||||
></n-dropdown>
|
||||
<!-- 加载蒙层 -->
|
||||
<content-load></content-load>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -53,6 +55,7 @@ const HeaderTitle = loadAsyncComponent(() => import('./ContentHeader/headerTitle
|
||||
const ContentLayers = loadAsyncComponent(() => import('./ContentLayers/index.vue'))
|
||||
const ContentCharts = loadAsyncComponent(() => import('./ContentCharts/index.vue'))
|
||||
const ContentConfigurations = loadAsyncComponent(() => import('./ContentConfigurations/index.vue'))
|
||||
const ContentLoad = loadAsyncComponent(() => import('./ContentLoad/index.vue'))
|
||||
|
||||
// 右键
|
||||
const {
|
||||
|
||||
@@ -207,8 +207,8 @@ const handleSubmit = async (e: Event) => {
|
||||
const res = await loginApi({
|
||||
username,
|
||||
password
|
||||
}) as unknown as MyResponseType
|
||||
if(res.data) {
|
||||
})
|
||||
if(res && res.data) {
|
||||
const { tokenValue, tokenName } = res.data.token
|
||||
const { nickname, username, id } = res.data.userinfo
|
||||
|
||||
|
||||
@@ -54,5 +54,6 @@ const props = defineProps({
|
||||
<style lang="scss" scoped>
|
||||
.chart-item {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div
|
||||
class="chart-item"
|
||||
v-for="(item, index) in localStorageInfo.componentList"
|
||||
:class="animationsClass(item.styles.animations)"
|
||||
:class="[animationsClass(item.styles.animations), !item.isGroup && 'hidden']"
|
||||
:key="item.id"
|
||||
:style="{
|
||||
...getComponentAttrStyle(item.attr, index),
|
||||
@@ -47,7 +47,7 @@ import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils
|
||||
import { useLifeHandler } from '@/hooks'
|
||||
|
||||
// 初始化数据池
|
||||
const { initDataPond } = useChartDataPondFetch()
|
||||
const { initDataPond, clearMittDataPondMap } = useChartDataPondFetch()
|
||||
|
||||
const props = defineProps({
|
||||
localStorageInfo: {
|
||||
@@ -69,6 +69,7 @@ const themeColor = computed(() => {
|
||||
})
|
||||
|
||||
// 组件渲染结束初始化数据池
|
||||
clearMittDataPondMap()
|
||||
onMounted(() => {
|
||||
initDataPond(props.localStorageInfo.requestGlobalConfig)
|
||||
})
|
||||
@@ -77,5 +78,8 @@ onMounted(() => {
|
||||
<style lang="scss" scoped>
|
||||
.chart-item {
|
||||
position: absolute;
|
||||
&.hidden {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -11,15 +11,13 @@ export interface ChartEditStorageType extends ChartEditStorage {
|
||||
// 根据路由 id 获取存储数据的信息
|
||||
export const getSessionStorageInfo = async () => {
|
||||
const id = fetchRouteParamsLocation()
|
||||
const storageList: ChartEditStorageType[] = getSessionStorage(
|
||||
StorageEnum.GO_CHART_STORAGE_LIST
|
||||
)
|
||||
|
||||
const storageList: ChartEditStorageType[] = getSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST)
|
||||
|
||||
// 是否本地预览
|
||||
if (!storageList || storageList.findIndex(e => e.id === id.toString()) === -1) {
|
||||
// 接口调用
|
||||
const res = await fetchProjectApi({ projectId: id }) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
const res = await fetchProjectApi({ projectId: id })
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
const { content, state } = res.data
|
||||
if (state === -1) {
|
||||
// 跳转未发布页
|
||||
@@ -37,4 +35,4 @@ export const getSessionStorageInfo = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
import { ProjectLayoutSider } from './layout/components/ProjectLayoutSider'
|
||||
import { LayoutHeaderPro } from '@/layout/components/LayoutHeaderPro'
|
||||
import { LayoutTransitionMain } from '@/layout/components/LayoutTransitionMain/index'
|
||||
import { goDialog } from '@/utils'
|
||||
|
||||
// 提示
|
||||
goDialog({
|
||||
message: '不要在官方后端上发布任何私密数据,任何人都看得到并进行删除!!!!',
|
||||
isMaskClosable: true,
|
||||
closeNegativeText: true,
|
||||
transformOrigin: 'center',
|
||||
onPositiveCallback: () => {}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -87,6 +87,7 @@ import { renderIcon, renderLang, requireErrorImg } from '@/utils'
|
||||
import { icon } from '@/plugins'
|
||||
import { MacOsControlBtn } from '@/components/Tips/MacOsControlBtn'
|
||||
import { Chartype } from '../../index.d'
|
||||
import { log } from 'console'
|
||||
const {
|
||||
EllipsisHorizontalCircleSharpIcon,
|
||||
CopyIcon,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, reactive } from 'vue'
|
||||
import { goDialog, httpErrorHandle } from '@/utils'
|
||||
import { DialogEnum } from '@/enums/pluginEnum'
|
||||
import { projectListApi, deleteProjectApi, changeProjectReleaseApi } from '@/api/path'
|
||||
@@ -7,16 +7,15 @@ import { ResultEnum } from '@/enums/httpEnum'
|
||||
|
||||
// 数据初始化
|
||||
export const useDataListInit = () => {
|
||||
|
||||
const loading = ref(true)
|
||||
|
||||
const paginat = reactive({
|
||||
// 当前页数
|
||||
// 当前页数
|
||||
page: 1,
|
||||
// 每页值
|
||||
limit: 12,
|
||||
// 总数
|
||||
count: 10,
|
||||
count: 10
|
||||
})
|
||||
|
||||
const list = ref<ChartList>([])
|
||||
@@ -27,11 +26,11 @@ export const useDataListInit = () => {
|
||||
const res = await projectListApi({
|
||||
page: paginat.page,
|
||||
limit: paginat.limit
|
||||
}) as any
|
||||
if (res.data) {
|
||||
const { count } = res
|
||||
})
|
||||
if (res && res.data) {
|
||||
const { count } = res as any // 这里的count与data平级,不在Response结构中
|
||||
paginat.count = count
|
||||
list.value = res.data.map((e: any) => {
|
||||
list.value = res.data.map(e => {
|
||||
const { id, projectName, state, createTime, indexImage, createUserId } = e
|
||||
return {
|
||||
id: id,
|
||||
@@ -67,11 +66,14 @@ export const useDataListInit = () => {
|
||||
goDialog({
|
||||
type: DialogEnum.DELETE,
|
||||
promise: true,
|
||||
onPositiveCallback: () => new Promise(res => {
|
||||
res(deleteProjectApi({
|
||||
ids: cardData.id
|
||||
}))
|
||||
}),
|
||||
onPositiveCallback: () =>
|
||||
new Promise(res => {
|
||||
res(
|
||||
deleteProjectApi({
|
||||
ids: cardData.id
|
||||
})
|
||||
)
|
||||
}),
|
||||
promiseResCallback: (res: any) => {
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
window['$message'].success(window['$t']('global.r_delete_success'))
|
||||
@@ -90,8 +92,8 @@ export const useDataListInit = () => {
|
||||
id: id,
|
||||
// [-1未发布, 1发布]
|
||||
state: !release ? 1 : -1
|
||||
}) as unknown as MyResponseType
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
})
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
list.value = []
|
||||
fetchList()
|
||||
// 发布 -> 未发布
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<!-- model -->
|
||||
<project-items-modal-card
|
||||
v-if="modalData"
|
||||
v-model:modalShow="modalShow"
|
||||
:modalShow="modalShow"
|
||||
:cardData="modalData"
|
||||
@close="closeModal"
|
||||
@edit="editHandle"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- mask-closable 暂时是失效的,不知道为啥 -->
|
||||
<n-modal
|
||||
class="go-modal-box"
|
||||
v-model:show="modalShow"
|
||||
v-model:show="showRef"
|
||||
@afterLeave="closeHandle"
|
||||
>
|
||||
<n-card hoverable size="small">
|
||||
@@ -73,21 +73,42 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, PropType } from 'vue'
|
||||
import { ref, reactive, PropType, watch } from 'vue'
|
||||
import { renderIcon, renderLang } from '@/utils'
|
||||
import { icon } from '@/plugins'
|
||||
import { MacOsControlBtn } from '@/components/Tips/MacOsControlBtn'
|
||||
import { Chartype } from '../../index.d'
|
||||
|
||||
const { HammerIcon } = icon.ionicons5
|
||||
|
||||
const showRef = ref(false)
|
||||
const emit = defineEmits(['close', 'edit'])
|
||||
|
||||
const props = defineProps({
|
||||
modalShow: Boolean,
|
||||
cardData: Object as PropType<Chartype>
|
||||
modalShow: {
|
||||
required: true,
|
||||
type: Boolean
|
||||
},
|
||||
cardData: {
|
||||
required: true,
|
||||
type: Object
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.modalShow,
|
||||
newValue => {
|
||||
showRef.value = newValue
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
// 处理url获取
|
||||
const requireUrl = (name: string) => {
|
||||
return new URL(`../../../../../assets/images/${name}`, import.meta.url).href
|
||||
}
|
||||
|
||||
const fnBtnList = reactive([
|
||||
{
|
||||
label: renderLang('global.r_edit'),
|
||||
|
||||
2
src/views/project/items/index.d.ts
vendored
2
src/views/project/items/index.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
export type Chartype = {
|
||||
id: number | string
|
||||
title: string // 标题
|
||||
label: string // 标签
|
||||
label?: string // 标签
|
||||
time: string, // 时间
|
||||
image: string, // 预览图地址
|
||||
createId: string, // 创建者
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-modal v-model:show="show" class="go-create-modal">
|
||||
<n-modal v-model:show="showRef" class="go-create-modal" @afterLeave="closeHandle">
|
||||
<n-space size="large">
|
||||
<n-card class="card-box" hoverable>
|
||||
<template #header>
|
||||
@@ -35,7 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue'
|
||||
import { ref, watch, shallowRef } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
import { PageEnum, ChartEnum } from '@/enums/pageEnum'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
@@ -44,13 +44,14 @@ import { createProjectApi } from '@/api/path'
|
||||
|
||||
const { FishIcon, CloseIcon } = icon.ionicons5
|
||||
const { StoreIcon, ObjectStorageIcon } = icon.carbon
|
||||
const $t = window['$t']
|
||||
const showRef = ref(false)
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
const props = defineProps({
|
||||
show: Boolean
|
||||
})
|
||||
|
||||
const typeList = [
|
||||
const typeList = shallowRef([
|
||||
{
|
||||
title: renderLang('project.new_project'),
|
||||
key: ChartEnum.CHART_HOME_NAME,
|
||||
@@ -69,13 +70,10 @@ const typeList = [
|
||||
icon: StoreIcon,
|
||||
disabled: true
|
||||
}
|
||||
]
|
||||
])
|
||||
|
||||
// 解决点击模态层不会触发 @on-after-leave 的问题
|
||||
watch(props, newValue => {
|
||||
if (!newValue.show) {
|
||||
closeHandle()
|
||||
}
|
||||
watch(() => props.show, newValue => {
|
||||
showRef.value = newValue
|
||||
})
|
||||
|
||||
// 关闭对话框
|
||||
@@ -96,8 +94,8 @@ const btnHandle = async (key: string) => {
|
||||
remarks: null,
|
||||
// 图片地址
|
||||
indexImage: null,
|
||||
}) as unknown as MyResponseType
|
||||
if(res.code === ResultEnum.SUCCESS) {
|
||||
})
|
||||
if(res && res.code === ResultEnum.SUCCESS) {
|
||||
window['$message'].success(window['$t']('project.create_success'))
|
||||
|
||||
const { id } = res.data
|
||||
@@ -115,7 +113,7 @@ const btnHandle = async (key: string) => {
|
||||
<style lang="scss" scoped>
|
||||
$cardWidth: 570px;
|
||||
|
||||
@include go("create-modal") {
|
||||
@include go('create-modal') {
|
||||
position: fixed;
|
||||
top: 200px;
|
||||
left: 50%;
|
||||
@@ -126,7 +124,7 @@ $cardWidth: 570px;
|
||||
border: 1px solid rgba(0, 0, 0, 0);
|
||||
@extend .go-transition;
|
||||
&:hover {
|
||||
@include hover-border-color("hover-border-color");
|
||||
@include hover-border-color('hover-border-color');
|
||||
}
|
||||
&-tite {
|
||||
font-size: 14px;
|
||||
|
||||
9
types/global.d.ts
vendored
9
types/global.d.ts
vendored
@@ -7,15 +7,10 @@ interface Window {
|
||||
$vue: any
|
||||
// 键盘按键记录
|
||||
$KeyboardActive?: { [T: string]: boolean }
|
||||
onKeySpacePressHold?: Function
|
||||
|
||||
// 编辑 JSON 的存储对象
|
||||
opener: any
|
||||
}
|
||||
|
||||
|
||||
declare interface MyResponseType {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
declare type Recordable<T = any> = Record<string, T>
|
||||
|
||||
3
types/shims-vue.d.ts
vendored
3
types/shims-vue.d.ts
vendored
@@ -4,4 +4,5 @@ declare module '*.vue' {
|
||||
export default component
|
||||
}
|
||||
|
||||
declare module 'lodash/*'
|
||||
declare module 'lodash/*'
|
||||
declare module 'dom-helpers'
|
||||
Reference in New Issue
Block a user