Browse Source

feat: 点位数据增加并发请求

main
betaqi 3 weeks ago
parent
commit
425518ffef
  1. 1
      global.types/auto-imports.d.ts
  2. 145
      package-lock.json
  3. 1
      package.json
  4. 9
      src/api/module/transfer/index.ts
  5. 2
      src/views/stationData/component/pointCheckbox.vue
  6. 5
      src/views/stationData/transfer/components/PointGroupTree.vue
  7. 252
      src/views/stationData/transfer/components/deviceDrawer.vue
  8. 112
      src/views/stationData/transfer/components/useFetcher.ts

1
global.types/auto-imports.d.ts vendored

@ -8,6 +8,7 @@ export {} @@ -8,6 +8,7 @@ export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const ElLoading: typeof import('element-plus/es')['ElLoading']
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']

145
package-lock.json generated

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
"name": "vue-project",
"version": "0.0.0",
"dependencies": {
"@antv/g": "^6.1.28",
"@antv/g-svg": "^2.0.42",
"@antv/g6": "^5.0.49",
"@types/qs": "^6.9.18",
@ -20,6 +21,7 @@ @@ -20,6 +21,7 @@
"g6-extension-vue": "^0.1.0",
"jszmq": "^0.1.2",
"lodash-es": "^4.17.21",
"p-limit": "^7.2.0",
"pinia": "^3.0.1",
"qs": "^6.14.0",
"uuid": "^11.1.0",
@ -358,6 +360,7 @@ @@ -358,6 +360,7 @@
"resolved": "https://registry.npmjs.org/@antv/g6/-/g6-5.0.49.tgz",
"integrity": "sha512-GRmK8oTVEgxjKbbhThIhnPOV1NcySLcSIGEod9RX/tbX4ME8txESb0zP0fDkuum26GLqvXgmIIIxRBE3m8VYPw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@antv/algorithm": "^0.1.26",
"@antv/component": "^2.1.3",
@ -509,6 +512,7 @@ @@ -509,6 +512,7 @@
"integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.27.1",
@ -1486,7 +1490,6 @@ @@ -1486,7 +1490,6 @@
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",
"integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25"
@ -2342,7 +2345,6 @@ @@ -2342,7 +2345,6 @@
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "*",
"@types/json-schema": "*"
@ -2353,7 +2355,6 @@ @@ -2353,7 +2355,6 @@
"resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz",
"integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/eslint": "*",
"@types/estree": "*"
@ -2375,8 +2376,7 @@ @@ -2375,8 +2376,7 @@
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@types/lodash": {
"version": "4.17.20",
@ -2389,6 +2389,7 @@ @@ -2389,6 +2389,7 @@
"resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz",
"integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/lodash": "*"
}
@ -3043,6 +3044,7 @@ @@ -3043,6 +3044,7 @@
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.18.tgz",
"integrity": "sha512-5aBjvGqsWs+MoxswZPoTB9nSDb3dhd1x30xrrltKujlCxo48j8HGDNj3QPhF4VIS0VQDUrA1xUfp2hEa+FNyXA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/parser": "^7.28.0",
"@vue/compiler-core": "3.5.18",
@ -3192,6 +3194,7 @@ @@ -3192,6 +3194,7 @@
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.18.tgz",
"integrity": "sha512-DUpHa1HpeOQEt6+3nheUfqVXRog2kivkXHUhoqJiKR33SO4x+a5uNOMkV487WPerQkL0vUuRvq/7JhRgLW3S+w==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/reactivity": "3.5.18",
"@vue/shared": "3.5.18"
@ -3340,7 +3343,6 @@ @@ -3340,7 +3343,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz",
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/helper-numbers": "1.13.2",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
@ -3350,29 +3352,25 @@ @@ -3350,29 +3352,25 @@
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-api-error": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-buffer": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz",
"integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-numbers": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz",
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
"@webassemblyjs/helper-api-error": "1.13.2",
@ -3383,15 +3381,13 @@ @@ -3383,15 +3381,13 @@
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-wasm-section": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz",
"integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@ -3404,7 +3400,6 @@ @@ -3404,7 +3400,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz",
"integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@xtuc/ieee754": "^1.2.0"
}
@ -3414,7 +3409,6 @@ @@ -3414,7 +3409,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz",
"integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==",
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@xtuc/long": "4.2.2"
}
@ -3423,15 +3417,13 @@ @@ -3423,15 +3417,13 @@
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz",
"integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/wasm-edit": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz",
"integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@ -3448,7 +3440,6 @@ @@ -3448,7 +3440,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz",
"integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
@ -3462,7 +3453,6 @@ @@ -3462,7 +3453,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz",
"integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@ -3475,7 +3465,6 @@ @@ -3475,7 +3465,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz",
"integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-api-error": "1.13.2",
@ -3490,7 +3479,6 @@ @@ -3490,7 +3479,6 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz",
"integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@xtuc/long": "4.2.2"
@ -3500,21 +3488,20 @@ @@ -3500,21 +3488,20 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
"license": "BSD-3-Clause",
"peer": true
"license": "BSD-3-Clause"
},
"node_modules/@xtuc/long": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"license": "Apache-2.0",
"peer": true
"license": "Apache-2.0"
},
"node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -3527,7 +3514,6 @@ @@ -3527,7 +3514,6 @@
"resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
"integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.13.0"
},
@ -3557,7 +3543,6 @@ @@ -3557,7 +3543,6 @@
"resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
"integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
"license": "MIT",
"peer": true,
"dependencies": {
"ajv": "^8.0.0"
},
@ -3575,7 +3560,6 @@ @@ -3575,7 +3560,6 @@
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
"integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
"license": "MIT",
"peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.3"
},
@ -3700,7 +3684,6 @@ @@ -3700,7 +3684,6 @@
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": "*"
}
@ -3769,6 +3752,7 @@ @@ -3769,6 +3752,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001733",
"electron-to-chromium": "^1.5.199",
@ -3816,8 +3800,7 @@ @@ -3816,8 +3800,7 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/bundle-name": {
"version": "4.1.0",
@ -3933,7 +3916,6 @@ @@ -3933,7 +3916,6 @@
"resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz",
"integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.0"
}
@ -4608,7 +4590,6 @@ @@ -4608,7 +4590,6 @@
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">= 4"
}
@ -4618,7 +4599,6 @@ @@ -4618,7 +4599,6 @@
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz",
"integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==",
"license": "MIT",
"peer": true,
"dependencies": {
"graceful-fs": "^4.2.4",
"tapable": "^2.2.0"
@ -4671,8 +4651,7 @@ @@ -4671,8 +4651,7 @@
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
"integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
@ -4776,7 +4755,6 @@ @@ -4776,7 +4755,6 @@
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
@ -4790,7 +4768,6 @@ @@ -4790,7 +4768,6 @@
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"estraverse": "^5.2.0"
},
@ -4803,7 +4780,6 @@ @@ -4803,7 +4780,6 @@
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"license": "BSD-2-Clause",
"peer": true,
"engines": {
"node": ">=4.0"
}
@ -4813,7 +4789,6 @@ @@ -4813,7 +4789,6 @@
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"license": "BSD-2-Clause",
"peer": true,
"engines": {
"node": ">=4.0"
}
@ -4893,8 +4868,7 @@ @@ -4893,8 +4868,7 @@
"url": "https://opencollective.com/fastify"
}
],
"license": "BSD-3-Clause",
"peer": true
"license": "BSD-3-Clause"
},
"node_modules/fecha": {
"version": "4.2.3",
@ -5148,8 +5122,7 @@ @@ -5148,8 +5122,7 @@
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
"integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
"license": "BSD-2-Clause",
"peer": true
"license": "BSD-2-Clause"
},
"node_modules/globals": {
"version": "15.15.0",
@ -5212,7 +5185,6 @@ @@ -5212,7 +5185,6 @@
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@ -5627,7 +5599,6 @@ @@ -5627,7 +5599,6 @@
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",
"integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/node": "*",
"merge-stream": "^2.0.0",
@ -5681,8 +5652,7 @@ @@ -5681,8 +5652,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/json5": {
"version": "2.2.3",
@ -5736,7 +5706,6 @@ @@ -5736,7 +5706,6 @@
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
"integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.11.5"
}
@ -5746,7 +5715,6 @@ @@ -5746,7 +5715,6 @@
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
"license": "MIT",
"peer": true,
"dependencies": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
@ -5778,13 +5746,15 @@ @@ -5778,13 +5746,15 @@
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT"
"license": "MIT",
"peer": true
},
"node_modules/lodash-es": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
"license": "MIT"
"license": "MIT",
"peer": true
},
"node_modules/lodash-unified": {
"version": "1.0.3",
@ -5851,8 +5821,7 @@ @@ -5851,8 +5821,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/micromatch": {
"version": "4.0.8",
@ -6036,8 +6005,7 @@ @@ -6036,8 +6005,7 @@
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/node-addon-api": {
"version": "7.1.1",
@ -6231,6 +6199,21 @@ @@ -6231,6 +6199,21 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-limit": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.2.0.tgz",
"integrity": "sha512-ATHLtwoTNDloHRFFxFJdHnG6n2WUeFjaR8XQMFdKIv0xkXjrER8/iG9iu265jOM95zXHAfv9oTkqhrfbIzosrQ==",
"license": "MIT",
"dependencies": {
"yocto-queue": "^1.2.1"
},
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/package-manager-detector": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.3.0.tgz",
@ -6455,7 +6438,6 @@ @@ -6455,7 +6438,6 @@
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"safe-buffer": "^5.1.0"
}
@ -6502,7 +6484,6 @@ @@ -6502,7 +6484,6 @@
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -6519,6 +6500,7 @@ @@ -6519,6 +6500,7 @@
"integrity": "sha512-WMmLFI+Boh6xbop+OAGo9cQ3OgX9MIg7xOQjn+pTCwOkk+FNDAeAemXkJ3HzDJrVXleLOFVa1ipuc1AmEx1Dwg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "1.0.8"
},
@ -6590,8 +6572,7 @@ @@ -6590,8 +6572,7 @@
"url": "https://feross.org/support"
}
],
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/safe-regex-test": {
"version": "1.1.0",
@ -6622,6 +6603,7 @@ @@ -6622,6 +6603,7 @@
"integrity": "sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"chokidar": "^4.0.0",
"immutable": "^5.0.2",
@ -6642,7 +6624,6 @@ @@ -6642,7 +6624,6 @@
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz",
"integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"ajv": "^8.9.0",
@ -6679,7 +6660,6 @@ @@ -6679,7 +6660,6 @@
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"license": "BSD-3-Clause",
"peer": true,
"dependencies": {
"randombytes": "^2.1.0"
}
@ -6857,7 +6837,6 @@ @@ -6857,7 +6837,6 @@
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"license": "BSD-3-Clause",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -6876,7 +6855,6 @@ @@ -6876,7 +6855,6 @@
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"license": "MIT",
"peer": true,
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
@ -6941,7 +6919,6 @@ @@ -6941,7 +6919,6 @@
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"has-flag": "^4.0.0"
},
@ -6963,7 +6940,6 @@ @@ -6963,7 +6940,6 @@
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz",
"integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6"
}
@ -6973,7 +6949,6 @@ @@ -6973,7 +6949,6 @@
"resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz",
"integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==",
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.14.0",
@ -6992,7 +6967,6 @@ @@ -6992,7 +6967,6 @@
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz",
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
"license": "MIT",
"peer": true,
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.25",
"jest-worker": "^27.4.5",
@ -7026,8 +7000,7 @@ @@ -7026,8 +7000,7 @@
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/tinyexec": {
"version": "1.0.1",
@ -7077,6 +7050,7 @@ @@ -7077,6 +7050,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -7119,6 +7093,7 @@ @@ -7119,6 +7093,7 @@
"integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@ -7610,6 +7585,7 @@ @@ -7610,6 +7585,7 @@
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
@ -7801,6 +7777,7 @@ @@ -7801,6 +7777,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -7820,6 +7797,7 @@ @@ -7820,6 +7797,7 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.18.tgz",
"integrity": "sha512-7W4Y4ZbMiQ3SEo+m9lnoNpV9xG7QVMLa+/0RFwwiAVkeYoyGXqWE85jabU4pllJNUzqfLShJ5YLptewhCWUgNA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.18",
"@vue/compiler-sfc": "3.5.18",
@ -7931,7 +7909,6 @@ @@ -7931,7 +7909,6 @@
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz",
"integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==",
"license": "MIT",
"peer": true,
"dependencies": {
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.1.2"
@ -7945,7 +7922,6 @@ @@ -7945,7 +7922,6 @@
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.2.tgz",
"integrity": "sha512-4JLXU0tD6OZNVqlwzm3HGEhAHufSiyv+skb7q0d2367VDMzrU1Q/ZeepvkcHH0rZie6uqEtTQQe0OEOOluH3Mg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/eslint-scope": "^3.7.7",
"@types/estree": "^1.0.8",
@ -7994,7 +7970,6 @@ @@ -7994,7 +7970,6 @@
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz",
"integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.13.0"
}
@ -8010,8 +7985,7 @@ @@ -8010,8 +7985,7 @@
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/which": {
"version": "5.0.0",
@ -8068,6 +8042,7 @@ @@ -8068,6 +8042,7 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8.3.0"
},
@ -8107,6 +8082,18 @@ @@ -8107,6 +8082,18 @@
"dev": true,
"license": "ISC"
},
"node_modules/yocto-queue": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz",
"integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==",
"license": "MIT",
"engines": {
"node": ">=12.20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yoctocolors": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.1.tgz",

1
package.json

@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
"g6-extension-vue": "^0.1.0",
"jszmq": "^0.1.2",
"lodash-es": "^4.17.21",
"p-limit": "^7.2.0",
"pinia": "^3.0.1",
"qs": "^6.14.0",
"uuid": "^11.1.0",

9
src/api/module/transfer/index.ts

@ -9,15 +9,18 @@ export interface IGetDeviceDataParams { @@ -9,15 +9,18 @@ export interface IGetDeviceDataParams {
name: string
site_id?: string, // 云端必传
device_id?: string,// 云端必传
endTime: string
startTime: string
}
export const getDeviceDetails = (params: IGetDeviceDataParams) =>
globalServer({
export const getDeviceDetails = (params: IGetDeviceDataParams, abort?: AbortController) =>
globalServer<{ total: number; results: any[] }>({
url: `/api/query`,
method: 'POST',
data: params,
timeout: 1000 * 50,
signal: abort?.signal,
timeout: 0,
})
export interface ISite {

2
src/views/stationData/component/pointCheckbox.vue

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
</template>
<el-scrollbar class="scroll" v-else>
<el-checkbox-group v-model="checkPointList" class="point-checks" @change="changePoints">
<template v-for="(item, index) in pointList" :key="index">
<template v-for="(item, index) in pointList" :key="item">
<el-checkbox :label="item.label" :value="item"/>
</template>
</el-checkbox-group>

5
src/views/stationData/transfer/components/PointGroupTree.vue

@ -54,12 +54,7 @@ const treeRef = ref<InstanceType<typeof ElTree>>() @@ -54,12 +54,7 @@ const treeRef = ref<InstanceType<typeof ElTree>>()
const checkDefault = ref<string[]>([])
const handleNodeClick = (data: IPointGroupOV) => {
PointCheckboxRef.value?.clearCheck()
emit('device-select', data)
nextTick(() => {
changePoints()
})
}
const defaultProps = {

252
src/views/stationData/transfer/components/deviceDrawer.vue

@ -21,24 +21,40 @@ @@ -21,24 +21,40 @@
<div class="flex-1 p-4 h-full overflow-hidden relative" v-loading="loading"
element-loading-text="数据加载中请耐心等待..."
>
<div class="absolute w-full h-full bg-[#ffffffe5] z-99" v-if="loadingChart">
<div class="w-full h-full flex flex-col justify-center items-center">
<div
class="absolute inset-0 z-[99] flex items-center justify-center bg-white/80 backdrop-blur-sm"
v-if="isFetching"
>
<div class="w-full max-w-[600px] space-y-10 p-6">
<div
v-for="deviceInfo in pointInfoData"
:key="deviceInfo.id"
class="space-y-3 text-center bg-white/90 p-5 rounded-xl shadow"
>
<div class="font-semibold text-gray-700 text-lg">
{{ chartGroupMap?.get(deviceInfo.id)?.cnName }} 数据加载中
</div>
<el-progress
style="width: 70%"
:text-inside="true"
:stroke-width="18"
:percentage="progress"
status="success"
:stroke-width="20"
:percentage="deviceInfo.progress"
/>
<div class="text-center text-gray-700 text-lg leading-relaxed">
正在加载数据请稍等<br>
当前已查询
<span class="font-semibold text-green-600">{{ reqPointCount }}</span> /
<span class="font-semibold text-blue-600">{{ pointCount }}</span> 个点位剩余
<span class="font-semibold text-red-500">{{ remainingPointCount }}</span> 个点位
<div class="text-gray-600 text-base">已查询
<span class="text-green-600 font-semibold">
{{ deviceInfo.fetchLimit }}
</span>/<span class="text-blue-600 font-semibold">{{
deviceInfo.total
}}</span>剩余<span
class="text-red-500 font-semibold">{{
deviceInfo.total - deviceInfo.fetchLimit
}}</span>
</div>
</div>
</div>
</div>
<div class="flex w-full items-center gap-16">
<div class="w-400px">
<el-date-picker
@ -52,7 +68,7 @@ @@ -52,7 +68,7 @@
:disabled-date="disabledDate"
/>
</div>
<el-button type="primary" @click="loadChardData">查询数据</el-button>
<el-button type="primary" @click="loadChardData2">查询数据</el-button>
查询最近
<el-input-number :key="refreshKey" v-model="num" :min="1" :max="diffHours"
@input="handleInput"/>
@ -82,10 +98,18 @@ import { @@ -82,10 +98,18 @@ import {
} from '@/api/module/transfer'
import { useMessage } from '@/composables/useMessage'
import dayjs from 'dayjs'
import { nextTick } from "vue";
import EdfsWrap from "@/components/Edfs-wrap.vue";
import { bms_cellRewriteName } from "@/views/stationData/utils";
import { debounce } from 'lodash-es'
import {
type DeviceFetchInfo,
useFetcher
} from "@/views/stationData/transfer/components/useFetcher";
type ChartParamsMap = {
name: string
columns: IMyPoint[]
}
const time = ref<[string, string]>()
@ -107,9 +131,11 @@ const handleInput = debounce(async (val: number) => { @@ -107,9 +131,11 @@ const handleInput = debounce(async (val: number) => {
} else {
num.value = val
}
const device = curDevice.value as IOfflineDevice
const endTime =
curDevice.value!.end_time ?
dayjs(curDevice.value!.end_time).valueOf() : dayjs().valueOf()
device.end_time ?
dayjs(device.end_time).valueOf() : dayjs().valueOf()
const startTime = dayjs(endTime).subtract(num.value, 'hour').valueOf()
time.value = [dayjs(startTime).format('YYYY-MM-DD HH:mm:ss'), dayjs(endTime).format('YYYY-MM-DD HH:mm:ss')]
@ -161,15 +187,14 @@ async function open(device: IOfflineDevice | IOnlineDevice) { @@ -161,15 +187,14 @@ async function open(device: IOfflineDevice | IOnlineDevice) {
const loadingPoints = ref(false)
const columParams = computed(() => ['ts', ...checkPointList.value.map(i => i.addr)])
async function loadPoints() {
if (!curGroup.value) {
if (!curGroup.value?.type) {
message.error('请先选择点位组')
return
}
const params: IPointsParams = {
type: curGroup.value,
type: curGroup.value.type,
}
if (props.isTransfer) {
const onlineDevice = curDevice.value as IOnlineDevice
@ -189,6 +214,7 @@ async function loadPoints() { @@ -189,6 +214,7 @@ async function loadPoints() {
label: i.cnName,
addr: i.addr,
unit: i.unit || '',
parentName: curGroupName.value,
}))
}
loadingPoints.value = false
@ -199,15 +225,10 @@ async function loadDeviceDetails() { @@ -199,15 +225,10 @@ async function loadDeviceDetails() {
if (!fullscreenLoading.value) {
openFullScreen()
}
chartData.clear()
axisData.clear()
legends.value = []
const pointsRes = await loadPoints()
if (!pointsRes || pointsRes.code !== 0) {
message.error('获取点位数据失败')
pointList.value = []
chartData.clear()
axisData.clear()
fullscreenLoading.value?.close()
return
}
@ -222,146 +243,115 @@ const legends = ref<{ addr: string; label: string, unit: string }[]>([]) @@ -222,146 +243,115 @@ const legends = ref<{ addr: string; label: string, unit: string }[]>([])
const loadingChart = ref(false)
const loading = ref(false)
const chartAllTotal = ref(0)
const chartLimit = ref(1000)
const chartOffset = ref(0)
const progress = ref(0)
const pointCount = computed(() => chartAllTotal.value * checkPointList.value.length)
const reqPointCount = ref(0)
//
const remainingPointCount = computed(() => pointCount.value - reqPointCount.value)
async function loadPointChartData(params: IGetDeviceDataParams, abort?: AbortController) {
return await getDeviceDetails(params, abort)
}
async function loadChardData() {
if (!time.value || time.value.length !== 2) {
message.error('请选择时间范围')
return
function buildOptions(groupId: string): Omit<IGetDeviceDataParams, 'limit' | 'offset'> {
const timeArr = time.value as [string, string]
const currentGroup = chartParamsMap.get(groupId)
if (!currentGroup) {
return {} as Omit<IGetDeviceDataParams, 'limit' | 'offset'>
}
if (!columParams.value.filter(i => i !== 'ts').length) {
message.error('请选择点位')
return
}
clearData()
const limit = chartLimit.value
const offset = chartOffset.value
const options: any = {
columns: columParams.value,
const options: Omit<IGetDeviceDataParams, 'limit' | 'offset'> = {
columns: ['ts', ...currentGroup.columns.map(column => column.addr)],
name: groupId,
startTime: timeArr[0],
endTime: timeArr[1],
isLocal: !props.isTransfer,
host: props.isTransfer ? (curDevice.value as IOnlineDevice).clientIp : '',
name: curGroupName.value as string,
startTime: time.value[0],
endTime: time.value[1],
}
if (env.VITE_APP_ENV !== 'local' || !props.isTransfer) {
options.site_id = props.siteInfo!.name || ''
options.device_id = curDevice.value?.sn || ''
}
return options
}
const params: IGetDeviceDataParams = {
...options,
limit,
offset
}
const pointInfoData = ref<DeviceFetchInfo[]>([])
const { devices, isFetching, startFetching, abortAll } = useFetcher(loadPointChartData)
loading.value = true
isShowChart.value = false
const res = await getDeviceDetails(params)
watch(devices, (newValue) => {
if (!newValue) return
pointInfoData.value = newValue
loading.value = false
loadingChart.value = true
if (res.code !== 0) {
resetChartStatus()
message.error('获取设备数据失败')
return
}
}, { deep: true })
chartAllTotal.value = res?.data?.total ?? 0
if (chartAllTotal.value === 0) {
resetChartStatus()
message.info('暂无数据')
return
}
const pointData = Array.isArray(res.data.results) ? res.data.results : []
setChartData(pointData)
const pageCount = Math.ceil(chartAllTotal.value / Number(limit))
if (pageCount <= 1) {
progress.value = 100
setTimeout(() => {
resetChartStatus()
})
async function loadChardData2() {
loading.value = true
clearData()
const groupIds = Array.from(chartParamsMap.keys())
if (!groupIds.length) {
loading.value = false
message.error('请先选择点位')
return
}
for (let i = 1; i < pageCount; i++) {
const params: IGetDeviceDataParams = {
...options,
limit,
offset: i * Number(limit)
}
const res = await getDeviceDetails(params)
if (res.code !== 0) {
await startFetching(groupIds, buildOptions, 1000)
if (!devices.value || !devices.value.length) {
loading.value = false
clearData()
resetChartStatus()
message.error('获取设备数据失败')
return
}
reqPointCount.value += res?.data?.results?.length || 0
const pointData = Array.isArray(res.data.results) ? res.data.results : []
setChartData(pointData)
progress.value = Math.min(100, Math.floor(((i + 1) / pageCount) * 100)) - 1
for (const device of devices.value) {
setChartData2(device.id, device.data)
}
resetChartStatus()
}
function setChartData(pointData: any[]) {
for (const addr of columParams.value.filter(i => i !== 'ts')) {
const label = pointList.value.find(i => i.addr === addr)?.label || addr
const find = legends.value.find(i => i.addr === addr)
const unit = pointList.value.find(i => i.addr === addr)?.unit || ''
if (!find) {
legends.value.push({ addr, label, unit })
}
function setChartData2(groupName: string, data: any[]) {
const chartParams = chartParamsMap.get(groupName)
if (!chartParams) return
for (const column of chartParams.columns) {
const groupInfo = chartGroupMap.get(groupName)
if (!groupInfo) continue
legends.value.push({
addr: `${groupName}-${column.addr}`,
label: `${groupInfo.cnName}-${column.label}`,
unit: column.unit || ''
})
}
pointData.forEach((data: any[]) => {
data.forEach((data: any[]) => {
const [ts, val, addr] = data
if (checkPointList.value.some(i => i.addr === addr) && !!val) {
const time = dayjs(Number(ts)).format('YYYY-MM-DD HH:mm:ss.SSS')
if (addr) {
const colData = chartData.get(addr)
const colData = chartData.get(`${groupName}-${addr}`)
const value = Number(Number(val).toFixed(5))
if (colData) {
colData.push([time, value])
} else {
chartData.set(addr, [[time, value]])
}
}
if (ts) {
axisData.add(time)
chartData.set(`${groupName}-${addr}`, [[time, value]])
}
}
})
}
function handleBeforeClose(done: () => void) {
ElMessageBox.confirm('你确定要关闭吗?')
.then(() => {
if (isFetching) {
abortAll()
}
time.value = undefined
isShowDrawer.value = false
clearData()
fullscreenLoading.value = null
chartParamsMap.clear()
chartGroupMap.clear()
done()
})
.catch(() => {
})
}
function clearData() {
chartLimit.value = 1000
chartOffset.value = 0
chartAllTotal.value = 0
progress.value = 0
legends.value = []
pointInfoData.value = []
chartData.clear()
axisData.clear()
reqPointCount.value = 0
}
function resetChartStatus() {
@ -390,7 +380,7 @@ const openFullScreen = () => { @@ -390,7 +380,7 @@ const openFullScreen = () => {
}
const pointGroup = ref<IPointGroupOV[]>([])
const curGroup = ref<string>()
const curGroup = ref<IPointGroupOV>()
const curGroupName = ref<string>()
async function loadPointGroup() {
@ -408,7 +398,7 @@ async function loadPointGroup() { @@ -408,7 +398,7 @@ async function loadPointGroup() {
const res = await getPointGroup(params)
if (res.code === 0) {
curGroup.value = res.data[0]?.type
curGroup.value = res.data[0]
curGroupName.value = res.data[0]?.name
pointGroup.value = Array.isArray(res?.data) ? bms_cellRewriteName(res.data) : []
return Promise.resolve()
@ -420,22 +410,34 @@ async function loadPointGroup() { @@ -420,22 +410,34 @@ async function loadPointGroup() {
const groupChangeLoading = ref<boolean>(false)
function onGroupChange(item: IPointGroupOV) {
console.log(item)
if (!item?.type) {
return
}
groupChangeLoading.value = true
curGroup.value = item.type
curGroup.value = item
curGroupName.value = item.name
loadDeviceDetails()
}
const checkPointList = ref<IMyPoint[]>([])
const chartParamsMap = new Map<string, ChartParamsMap>()
const chartGroupMap = new Map<string, IPointGroupOV>()
function onchangePoints(checkPoints: IMyPoint[]) {
checkPointList.value = []
checkPointList.value = checkPoints
if (!curGroup?.value || !curGroupName?.value) return message.error('请选择设备')
const currentCheckPoints = checkPoints.filter((r: any) => r.parentName === curGroupName.value)
chartParamsMap.set(curGroupName.value, {
name: curGroupName.value,
columns: currentCheckPoints
})
chartGroupMap.set(curGroupName.value, curGroup.value)
if (!currentCheckPoints.length) {
chartParamsMap.delete(curGroupName.value)
chartGroupMap.delete(curGroupName.value)
}
}
const disabledDate = (time: any) => {

112
src/views/stationData/transfer/components/useFetcher.ts

@ -0,0 +1,112 @@ @@ -0,0 +1,112 @@
import type { IGetDeviceDataParams } from "@/api/module/transfer";
import type { Result } from '@/api/basic/httpTypes.ts'
import pLimit from 'p-limit'
export interface DeviceFetchInfo {
progress: number // 当前进度百分比
fetchedChunks: number // 已完成分片数
totalChunks: number // 总分片数
total: number // 数据总量
limit: number // 每片数量
finished: boolean // 是否完成获取
fetchLimit: number // 已经获取的数据数量
data: any[] // 已获取的数据
id: string
abortController: AbortController | null
aborted: boolean
}
type FetchDeviceFn = (
params: IGetDeviceDataParams,
abort?: AbortController
) => Promise<Result<{ total: number, results: any[] }>>
export function useFetcher(fetchFn: FetchDeviceFn) {
const devices = ref<DeviceFetchInfo[]>()
const isFetching = ref(false)
async function startFetching(deviceList: string[], buildOptions: any, limit = 1000, concurrency = 3) {
if (isFetching.value) return
isFetching.value = true
devices.value = deviceList.map((id: string) => ({
id,
progress: 0,
fetchedChunks: 0,
totalChunks: 0,
limit,
fetchLimit: 0,
total: 0,
data: [],
finished: false,
abortController: new AbortController(),
aborted: false,
}))
const limiter = pLimit(concurrency)
const tasks = deviceList.map(deviceId =>
limiter(async () => {
const device = devices.value!.find(d => d.id === deviceId)!
const options = buildOptions(deviceId)
const controller = device.abortController!
try {
const first = await fetchFn({ ...options, offset: 0, limit }, controller)
const total = first.data.total ?? 0
device.total = total * (options.columns.length - 1)
device.totalChunks = Math.ceil(total / limit)
device.data.push(...first.data.results)
device.fetchLimit += first.data.results.length
device.fetchedChunks = 1
device.progress = Math.floor((device.fetchLimit / device.total) * 100)
for (let i = 1; i < device.totalChunks; i++) {
const res = await fetchFn({ ...options, offset: i * limit, limit }, controller)
const total = res.data.total ?? 0
device.total = total * (options.columns.length - 1)
device.data.push(...res.data.results)
device.fetchedChunks++
device.fetchLimit += res.data.results.length
device.progress = Math.floor((device.fetchLimit / device.total) * 100)
}
device.finished = true
device.progress = 100
return device
} catch (error: any) {
if (error.name === "AbortError") {
device.aborted = true
device.finished = true
device.progress = 0
return
}
throw error
}
})
)
await Promise.allSettled(tasks)
isFetching.value = false
}
function abortDevice(id: string) {
devices.value?.find(d => d.id === id)?.abortController?.abort()
}
function abortAll() {
devices.value?.forEach(d => d.abortController?.abort())
}
return {
devices,
isFetching,
abortAll,
startFetching,
}
}
Loading…
Cancel
Save