Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
jackhoo_98 2023-01-29 11:51:37 +08:00
commit 3c5a2ef320
42 changed files with 6948 additions and 4757 deletions

165
package-lock.json generated
View File

@ -10,7 +10,6 @@
"dependencies": {
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@vuemap/vue-amap": "^1.1.20",
"@vueuse/core": "^9.10.0",
"ant-design-vue": "^3.2.15",
"axios": "^1.2.1",
"echarts": "^5.4.1",
@ -1485,7 +1484,7 @@
},
"node_modules/@types/linkify-it": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz",
"resolved": "https://registry.npmmirror.com/@types/linkify-it/-/linkify-it-3.0.2.tgz",
"integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==",
"peer": true
},
@ -1506,7 +1505,7 @@
},
"node_modules/@types/markdown-it": {
"version": "12.2.3",
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz",
"resolved": "https://registry.npmmirror.com/@types/markdown-it/-/markdown-it-12.2.3.tgz",
"integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==",
"peer": true,
"dependencies": {
@ -1516,7 +1515,7 @@
},
"node_modules/@types/mdurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz",
"resolved": "https://registry.npmmirror.com/@types/mdurl/-/mdurl-1.0.2.tgz",
"integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==",
"peer": true
},
@ -1556,11 +1555,6 @@
"@types/webxr": "*"
}
},
"node_modules/@types/web-bluetooth": {
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz",
"integrity": "sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ=="
},
"node_modules/@types/webxr": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.0.tgz",
@ -1852,39 +1846,6 @@
"vue": "^3.2.0"
}
},
"node_modules/@vueuse/core": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-9.10.0.tgz",
"integrity": "sha512-CxMewME07qeuzuT/AOIQGv0EhhDoojniqU6pC3F8m5VC76L47UT18DcX88kWlP3I7d3qMJ4u/PD8iSRsy3bmNA==",
"dependencies": {
"@types/web-bluetooth": "^0.0.16",
"@vueuse/metadata": "9.10.0",
"@vueuse/shared": "9.10.0",
"vue-demi": "*"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/metadata": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-9.10.0.tgz",
"integrity": "sha512-G5VZhgTCapzU9rv0Iq2HBrVOSGzOKb+OE668NxhXNcTjUjwYxULkEhAw70FtRLMZc+hxcFAzDZlKYA0xcwNMuw==",
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/shared": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-9.10.0.tgz",
"integrity": "sha512-vakHJ2ZRklAzqmcVBL38RS7BxdBA4+5poG9NsSyqJxrt9kz0zX3P5CXMy0Hm6LFbZXUgvKdqAS3pUH1zX/5qTQ==",
"dependencies": {
"vue-demi": "*"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/3d-tiles-renderer": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/3d-tiles-renderer/-/3d-tiles-renderer-0.3.16.tgz",
@ -3946,7 +3907,7 @@
},
"node_modules/highlight.js": {
"version": "11.7.0",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.7.0.tgz",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.7.0.tgz",
"integrity": "sha512-1rRqesRFhMO/PRF+G86evnyJkCgaZFOI+Z6kdj15TA18funfoqJXvgPCLSf0SWq3SRfg1j3HlDs8o4s3EGq1oQ==",
"engines": {
"node": ">=12.0.0"
@ -5536,7 +5497,7 @@
},
"node_modules/linkify-it": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
"resolved": "https://registry.npmmirror.com/linkify-it/-/linkify-it-3.0.3.tgz",
"integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
"dependencies": {
"uc.micro": "^1.0.1"
@ -5820,7 +5781,7 @@
},
"node_modules/lodash.flow": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz",
"resolved": "https://registry.npmmirror.com/lodash.flow/-/lodash.flow-3.5.0.tgz",
"integrity": "sha512-ff3BX/tSioo+XojX4MOsOMhJw0nZoUEF011LX8g8d3gvjVbxd89cCio4BCXronjxcTUIJUoqKEUA+n4CqvvRPw=="
},
"node_modules/lodash.isfunction": {
@ -6036,7 +5997,7 @@
},
"node_modules/markdown-it": {
"version": "12.3.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it/-/markdown-it-12.3.2.tgz",
"integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==",
"dependencies": {
"argparse": "^2.0.1",
@ -6051,12 +6012,12 @@
},
"node_modules/markdown-it-abbr": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz",
"integrity": "sha512-ZeA4Z4SaBbYysZap5iZcxKmlPL6bYA8grqhzJIHB1ikn7njnzaP8uwbtuXc4YXD5LicI4/2Xmc0VwmSiFV04gg=="
},
"node_modules/markdown-it-anchor": {
"version": "8.6.6",
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz",
"integrity": "sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA==",
"peerDependencies": {
"@types/markdown-it": "*",
@ -6065,22 +6026,22 @@
},
"node_modules/markdown-it-deflist": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/markdown-it-deflist/-/markdown-it-deflist-2.1.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-deflist/-/markdown-it-deflist-2.1.0.tgz",
"integrity": "sha512-3OuqoRUlSxJiuQYu0cWTLHNhhq2xtoSFqsZK8plANg91+RJQU1ziQ6lA2LzmFAEes18uPBsHZpcX6We5l76Nzg=="
},
"node_modules/markdown-it-emoji": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/markdown-it-emoji/-/markdown-it-emoji-2.0.2.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-emoji/-/markdown-it-emoji-2.0.2.tgz",
"integrity": "sha512-zLftSaNrKuYl0kR5zm4gxXjHaOI3FAOEaloKmRA5hijmJZvSjmxcokOLlzycb/HXlUFWzXqpIEoyEMCE4i9MvQ=="
},
"node_modules/markdown-it-footnote": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz",
"integrity": "sha512-YZMSuCGVZAjzKMn+xqIco9d1cLGxbELHZ9do/TSYVzraooV8ypsppKNmUJ0fVH5ljkCInQAtFpm8Rb3eXSrt5w=="
},
"node_modules/markdown-it-highlightjs": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/markdown-it-highlightjs/-/markdown-it-highlightjs-3.6.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-highlightjs/-/markdown-it-highlightjs-3.6.0.tgz",
"integrity": "sha512-ex+Lq3cVkprh0GpGwFyc53A/rqY6GGzopPCG1xMsf8Ya3XtGC8Uw9tChN1rWbpyDae7tBBhVHVcMM29h4Btamw==",
"dependencies": {
"highlight.js": "^11.3.1",
@ -6089,45 +6050,42 @@
},
"node_modules/markdown-it-ins": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/markdown-it-ins/-/markdown-it-ins-3.0.1.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-ins/-/markdown-it-ins-3.0.1.tgz",
"integrity": "sha512-32SSfZqSzqyAmmQ4SHvhxbFqSzPDqsZgMHDwxqPzp+v+t8RsmqsBZRG+RfRQskJko9PfKC2/oxyOs4Yg/CfiRw=="
},
"node_modules/markdown-it-mark": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/markdown-it-mark/-/markdown-it-mark-3.0.1.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-mark/-/markdown-it-mark-3.0.1.tgz",
"integrity": "sha512-HyxjAu6BRsdt6Xcv6TKVQnkz/E70TdGXEFHRYBGLncRE9lBFwDNLVtFojKxjJWgJ+5XxUwLaHXy+2sGBbDn+4A=="
},
"node_modules/markdown-it-sub": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz",
"integrity": "sha512-z2Rm/LzEE1wzwTSDrI+FlPEveAAbgdAdPhdWarq/ZGJrGW/uCQbKAnhoCsE4hAbc3SEym26+W2z/VQB0cQiA9Q=="
},
"node_modules/markdown-it-sup": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz",
"integrity": "sha512-E32m0nV9iyhRR7CrhnzL5msqic7rL1juWre6TQNxsnApg7Uf+F97JOKxUijg5YwXz86lZ0mqfOnutoryyNdntQ=="
},
"node_modules/markdown-it-task-lists": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz",
"integrity": "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA=="
},
"node_modules/markdown-it-toc-done-right": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/markdown-it-toc-done-right/-/markdown-it-toc-done-right-4.2.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-toc-done-right/-/markdown-it-toc-done-right-4.2.0.tgz",
"integrity": "sha512-UB/IbzjWazwTlNAX0pvWNlJS8NKsOQ4syrXZQ/C72j+jirrsjVRT627lCaylrKJFBQWfRsPmIVQie8x38DEhAQ=="
},
"node_modules/markdown-it/node_modules/entities": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==",
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
"resolved": "https://registry.npmmirror.com/entities/-/entities-2.1.0.tgz",
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
},
"node_modules/mdurl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"resolved": "https://registry.npmmirror.com/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
"node_modules/meow": {
@ -8123,7 +8081,7 @@
},
"node_modules/uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"resolved": "https://registry.npmmirror.com/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
},
"node_modules/ufo": {
@ -8684,7 +8642,7 @@
},
"node_modules/vue3-markdown-it": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/vue3-markdown-it/-/vue3-markdown-it-1.0.10.tgz",
"resolved": "https://registry.npmmirror.com/vue3-markdown-it/-/vue3-markdown-it-1.0.10.tgz",
"integrity": "sha512-mTvHu0zl7jrh7ojgaZ+tTpCLiS4CVg4bTgTu4KGhw/cRRY5YgIG8QgFAPu6kCzSW6Znc9a52Beb6hFvF4hSMkQ==",
"dependencies": {
"markdown-it": "^12.3.2",
@ -9971,7 +9929,7 @@
},
"@types/linkify-it": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz",
"resolved": "https://registry.npmmirror.com/@types/linkify-it/-/linkify-it-3.0.2.tgz",
"integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==",
"peer": true
},
@ -9992,7 +9950,7 @@
},
"@types/markdown-it": {
"version": "12.2.3",
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz",
"resolved": "https://registry.npmmirror.com/@types/markdown-it/-/markdown-it-12.2.3.tgz",
"integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==",
"peer": true,
"requires": {
@ -10002,7 +9960,7 @@
},
"@types/mdurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz",
"resolved": "https://registry.npmmirror.com/@types/mdurl/-/mdurl-1.0.2.tgz",
"integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==",
"peer": true
},
@ -10041,11 +9999,6 @@
"@types/webxr": "*"
}
},
"@types/web-bluetooth": {
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz",
"integrity": "sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ=="
},
"@types/webxr": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.0.tgz",
@ -10307,30 +10260,6 @@
"uppercamelcase": "^1.1.0"
}
},
"@vueuse/core": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-9.10.0.tgz",
"integrity": "sha512-CxMewME07qeuzuT/AOIQGv0EhhDoojniqU6pC3F8m5VC76L47UT18DcX88kWlP3I7d3qMJ4u/PD8iSRsy3bmNA==",
"requires": {
"@types/web-bluetooth": "^0.0.16",
"@vueuse/metadata": "9.10.0",
"@vueuse/shared": "9.10.0",
"vue-demi": "*"
}
},
"@vueuse/metadata": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-9.10.0.tgz",
"integrity": "sha512-G5VZhgTCapzU9rv0Iq2HBrVOSGzOKb+OE668NxhXNcTjUjwYxULkEhAw70FtRLMZc+hxcFAzDZlKYA0xcwNMuw=="
},
"@vueuse/shared": {
"version": "9.10.0",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-9.10.0.tgz",
"integrity": "sha512-vakHJ2ZRklAzqmcVBL38RS7BxdBA4+5poG9NsSyqJxrt9kz0zX3P5CXMy0Hm6LFbZXUgvKdqAS3pUH1zX/5qTQ==",
"requires": {
"vue-demi": "*"
}
},
"3d-tiles-renderer": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/3d-tiles-renderer/-/3d-tiles-renderer-0.3.16.tgz",
@ -11997,7 +11926,7 @@
},
"highlight.js": {
"version": "11.7.0",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.7.0.tgz",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.7.0.tgz",
"integrity": "sha512-1rRqesRFhMO/PRF+G86evnyJkCgaZFOI+Z6kdj15TA18funfoqJXvgPCLSf0SWq3SRfg1j3HlDs8o4s3EGq1oQ=="
},
"homedir-polyfill": {
@ -13236,7 +13165,7 @@
},
"linkify-it": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
"resolved": "https://registry.npmmirror.com/linkify-it/-/linkify-it-3.0.3.tgz",
"integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
"requires": {
"uc.micro": "^1.0.1"
@ -13451,7 +13380,7 @@
},
"lodash.flow": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz",
"resolved": "https://registry.npmmirror.com/lodash.flow/-/lodash.flow-3.5.0.tgz",
"integrity": "sha512-ff3BX/tSioo+XojX4MOsOMhJw0nZoUEF011LX8g8d3gvjVbxd89cCio4BCXronjxcTUIJUoqKEUA+n4CqvvRPw=="
},
"lodash.isfunction": {
@ -13636,7 +13565,7 @@
},
"markdown-it": {
"version": "12.3.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it/-/markdown-it-12.3.2.tgz",
"integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==",
"requires": {
"argparse": "^2.0.1",
@ -13648,40 +13577,40 @@
"dependencies": {
"entities": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
"resolved": "https://registry.npmmirror.com/entities/-/entities-2.1.0.tgz",
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
}
}
},
"markdown-it-abbr": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz",
"integrity": "sha512-ZeA4Z4SaBbYysZap5iZcxKmlPL6bYA8grqhzJIHB1ikn7njnzaP8uwbtuXc4YXD5LicI4/2Xmc0VwmSiFV04gg=="
},
"markdown-it-anchor": {
"version": "8.6.6",
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz",
"integrity": "sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA==",
"requires": {}
},
"markdown-it-deflist": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/markdown-it-deflist/-/markdown-it-deflist-2.1.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-deflist/-/markdown-it-deflist-2.1.0.tgz",
"integrity": "sha512-3OuqoRUlSxJiuQYu0cWTLHNhhq2xtoSFqsZK8plANg91+RJQU1ziQ6lA2LzmFAEes18uPBsHZpcX6We5l76Nzg=="
},
"markdown-it-emoji": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/markdown-it-emoji/-/markdown-it-emoji-2.0.2.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-emoji/-/markdown-it-emoji-2.0.2.tgz",
"integrity": "sha512-zLftSaNrKuYl0kR5zm4gxXjHaOI3FAOEaloKmRA5hijmJZvSjmxcokOLlzycb/HXlUFWzXqpIEoyEMCE4i9MvQ=="
},
"markdown-it-footnote": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz",
"integrity": "sha512-YZMSuCGVZAjzKMn+xqIco9d1cLGxbELHZ9do/TSYVzraooV8ypsppKNmUJ0fVH5ljkCInQAtFpm8Rb3eXSrt5w=="
},
"markdown-it-highlightjs": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/markdown-it-highlightjs/-/markdown-it-highlightjs-3.6.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-highlightjs/-/markdown-it-highlightjs-3.6.0.tgz",
"integrity": "sha512-ex+Lq3cVkprh0GpGwFyc53A/rqY6GGzopPCG1xMsf8Ya3XtGC8Uw9tChN1rWbpyDae7tBBhVHVcMM29h4Btamw==",
"requires": {
"highlight.js": "^11.3.1",
@ -13690,37 +13619,37 @@
},
"markdown-it-ins": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/markdown-it-ins/-/markdown-it-ins-3.0.1.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-ins/-/markdown-it-ins-3.0.1.tgz",
"integrity": "sha512-32SSfZqSzqyAmmQ4SHvhxbFqSzPDqsZgMHDwxqPzp+v+t8RsmqsBZRG+RfRQskJko9PfKC2/oxyOs4Yg/CfiRw=="
},
"markdown-it-mark": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/markdown-it-mark/-/markdown-it-mark-3.0.1.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-mark/-/markdown-it-mark-3.0.1.tgz",
"integrity": "sha512-HyxjAu6BRsdt6Xcv6TKVQnkz/E70TdGXEFHRYBGLncRE9lBFwDNLVtFojKxjJWgJ+5XxUwLaHXy+2sGBbDn+4A=="
},
"markdown-it-sub": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz",
"integrity": "sha512-z2Rm/LzEE1wzwTSDrI+FlPEveAAbgdAdPhdWarq/ZGJrGW/uCQbKAnhoCsE4hAbc3SEym26+W2z/VQB0cQiA9Q=="
},
"markdown-it-sup": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz",
"integrity": "sha512-E32m0nV9iyhRR7CrhnzL5msqic7rL1juWre6TQNxsnApg7Uf+F97JOKxUijg5YwXz86lZ0mqfOnutoryyNdntQ=="
},
"markdown-it-task-lists": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz",
"integrity": "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA=="
},
"markdown-it-toc-done-right": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/markdown-it-toc-done-right/-/markdown-it-toc-done-right-4.2.0.tgz",
"resolved": "https://registry.npmmirror.com/markdown-it-toc-done-right/-/markdown-it-toc-done-right-4.2.0.tgz",
"integrity": "sha512-UB/IbzjWazwTlNAX0pvWNlJS8NKsOQ4syrXZQ/C72j+jirrsjVRT627lCaylrKJFBQWfRsPmIVQie8x38DEhAQ=="
},
"mdurl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"resolved": "https://registry.npmmirror.com/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
"meow": {
@ -15296,7 +15225,7 @@
},
"uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"resolved": "https://registry.npmmirror.com/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
},
"ufo": {
@ -15718,7 +15647,7 @@
},
"vue3-markdown-it": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/vue3-markdown-it/-/vue3-markdown-it-1.0.10.tgz",
"resolved": "https://registry.npmmirror.com/vue3-markdown-it/-/vue3-markdown-it-1.0.10.tgz",
"integrity": "sha512-mTvHu0zl7jrh7ojgaZ+tTpCLiS4CVg4bTgTu4KGhw/cRRY5YgIG8QgFAPu6kCzSW6Znc9a52Beb6hFvF4hSMkQ==",
"requires": {
"markdown-it": "^12.3.2",

View File

@ -0,0 +1,25 @@
// 产品分类
import server from '@/utils/request'
import { CategoryItem } from '@/views/device/Category/typings'
/**
*
*/
export const queryTree = (params?: Record<string, any>) => server.post<CategoryItem>('/device/category/_tree', params)
/**
*
*/
export const saveTree = (data: any) =>server.post('/device/category', data)
/**
* Id修改
*/
export const updateTree = (data: any, id:string) => server.put(`/device/category/${id}`, data)
/**
* Id删除数据
*/
export const deleteTree = (id:string) => server.remove(`/device/category/${id}`)

View File

@ -1,8 +0,0 @@
import server from '@/utils/request';
// 设备数量
export const getDeviceCount_api = () => server.get(`/device/instance/_count`);
// 产品数量
export const getProductCount_api = (data) => server.post(`/device-product/_count`, data);
// 查询产品列表
export const getProductList_api = (data) => server.get(`/device/product/_query/no-paging?paging=false`, data);

15
src/api/home.ts Normal file
View File

@ -0,0 +1,15 @@
import server from '@/utils/request';
// 当前登录用户权限信息
export const getMe_api = () => server.get(`/authorize/me`);
// 设置登录用户选择的页面
export const setView_api = (data:object) => server.patch(`/user/settings/view/user`, data);
// 当前登录用户选择的页面
export const getView_api = () => server.get(`/user/settings/view/user`);
// 设备数量
export const getDeviceCount_api = () => server.get(`/device/instance/_count`);
// 产品数量
export const getProductCount_api = (data:object) => server.post(`/device-product/_count`, data);
// 查询产品列表
export const getProductList_api = (data:object) => server.get(`/device/product/_query/no-paging?paging=false`, data);

View File

@ -1,17 +0,0 @@
import server from '@/utils/request'
export const config = () => server.get(`/authorize/captcha/config`)
export const code = () => server.get(`/authorize/captcha/image?width=130&height=30`)
export const authLogin = (data) => server.post(`/authorize/login`, data)
export const getInitSet = () => server.get(`/user/settings/init`)
export const postInitSet = (data) => server.post(`/user/settings/init`, data)
export const systemVersion = () => server.get(`/system/version`)
export const bindInfo = () => server.get(`/application/sso/_all`)
export const settingDetail = (scopes) => server.get(`/system/config/${scopes}`)

49
src/api/login.ts Normal file
View File

@ -0,0 +1,49 @@
import server from '@/utils/request'
/**
*
* @returns
*/
export const config = () => server.get(`/authorize/captcha/config`)
/**
*
* @returns
*/
export const code = () => server.get(`/authorize/captcha/image?width=130&height=30`)
/**
*
* @returns
*/
export const authLogin = (data: any) => server.post(`/authorize/login`, data)
/**
*
* @returns
*/
export const getInitSet = () => server.get(`/user/settings/init`)
/**
*
* @returns
*/
export const postInitSet = (data: any) => server.post(`/user/settings/init`, data)
/**
*
* @returns
*/
export const systemVersion = () => server.get(`/system/version`)
/**
* SSO的应用
* @returns
*/
export const bindInfo = () => server.get(`/application/sso/_all`)
/**
*
* @returns
*/
export const settingDetail = (scopes: string) => server.get(`/system/config/${scopes}`)

View File

@ -1,4 +1,4 @@
import { patch, post, get } from '@/utils/request'
import { patch, post, get, remove } from '@/utils/request'
export default {
// 列表
@ -8,5 +8,30 @@ export default {
// 新增
save: (data: any) => post(`/notifier/config`, data),
// 修改
update: (data: any) => patch(`/notifier/config`, data)
update: (data: any) => patch(`/notifier/config`, data),
del: (id: string) => remove(`/notifier/config/${id}`),
getTemplate: (data: any, id: string) => post(`/notifier/template/${id}/_query`, data),
getTemplateDetail: (id: string) => get(`/notifier/template/${id}/detail`),
debug: (data: any, configId: string, templateId: string) => post(`/notifier/${configId}/${templateId}/_send`, data),
getHistory: (data: any, id: string) => post(`/notify/history/config/${id}/_query`, data),
// 获取所有平台用户
getPlatformUsers: () => post(`/user/_query/no-paging`, { paging: false }),
// 钉钉部门
dingTalkDept: (id: string) => get(`/notifier/dingtalk/corp/${id}/departments/tree`),
// 钉钉部门人员
getDingTalkUsers: (configId: string, deptId: string) => get(`/notifier/dingtalk/corp/${configId}/${deptId}/users`),
// 钉钉已经绑定的人员
getDingTalkBindUsers: (id: string) => get(`/user/third-party/dingTalk_dingTalkMessage/${id}`),
// 钉钉绑定用户
dingTalkBindUser: (data: any, id: string) => patch(`/user/third-party/dingTalk_dingTalkMessage/${id}`, data),
// 微信部门
weChatDept: (id: string) => get(`/notifier/wechat/corp/${id}/departments`),
// 微信部门人员
getWeChatUsers: (configId: string, deptId: string) => get(`/notifier/wechat/corp/${configId}/${deptId}/users`),
// 微信已经绑定的人员
getWeChatBindUsers: (id: string) => get(`/user/third-party/weixin_corpMessage/${id}`),
// 微信绑定用户
weChatBindUser: (data: any, id: string) => patch(`/user/third-party/weixin_corpMessage/${id}`, data),
// 解绑
unBindUser: (data: any, id: string) => post(`/user/third-party/${id}/_unbind`, data)
}

View File

@ -1,4 +1,5 @@
import { patch, post, get } from '@/utils/request'
import { patch, post, get, remove } from '@/utils/request'
import { BindConfig } from '@/views/notice/Template/types'
export default {
// 列表
@ -8,5 +9,19 @@ export default {
// 新增
save: (data: any) => post(`/notifier/template`, data),
// 修改
update: (data: any) => patch(`/notifier/template`, data)
update: (data: any) => patch(`/notifier/template`, data),
del: (id: any) => remove(`/notifier/template/${id}`),
getConfig: (data: any) => post<BindConfig>(`/notifier/config/_query/no-paging?paging=false`, data),
getTemplateDetail: (id: string) => get(`/notifier/template/${id}/detail`),
debug: (data: any, configId: string, templateId: string) => post(`/notifier/${configId}/${templateId}/_send`, data),
getHistory: (data: any, id: string) => post(`/notify/history/template/${id}/_query`, data),
// 钉钉/微信, 根据配置获取部门和用户
getDept: (type: string, id: string) => get<any>(`/notifier/${type}/corp/${id}/departments`),
getUser: (type: string, id: string) => get<any>(`/notifier/${type}/corp/${id}/users`),
// 微信获取标签推送
getTags: (id: string) => get<any>(`/notifier/wechat/corp/${id}/tags`),
// 语音/短信获取阿里云模板
getAliTemplate: (id: any) => get(`/notifier/sms/aliyun/${id}/templates`),
// 短信获取签名
getSigns: (id: any) => get(`/notifier/sms/aliyun/${id}/signs`)
}

View File

@ -0,0 +1,6 @@
import server from '@/utils/request';
// 获取权限列表
export const getPermission_api = (data:object) => server.post(`/permission/_query/`,data);
// 修改权限信息
export const editPermission_api = (data:object) => server.patch(`/permission`,data);

View File

@ -6,11 +6,15 @@ export const getRoleList_api = (data: any): Promise<any> => server.post(`/role/_
export const delRole_api = (id: string): Promise<any> => server.remove(`/role/${id}`);
// 保存角色
export const saveRole_api = (data: any): Promise<any> => server.post(`/role`, data);
// 获取角色详细信息
export const getRoleDetails_api = (id: string): Promise<any> => server.get(`/role/${id}`);
// 获取角色对应的权限树
export const getPrimissTree_api = (id: string): Promise<any> => server.get(`/menu/role/${id}/_grant/tree`);
// 获取用户列表
export const getUserByRole_api = (data: any): Promise<any> => server.post(`/user/_query/`, data);
// 将用户与该角色进行绑定
export const bindUser_api = (roleId:string, data: string[]): Promise<any> => server.post(`/role/${roleId}/users/_bind`, data);
// 将用户与角色绑定
export const bindUser_api = (roleId:string, data: string[]): Promise<any> => server.post(`/role/${roleId}/users/_bind`, data);
// 将用户与角色解绑
export const unbindUser_api = (roleId:string, data: string[]): Promise<any> => server.post(`/role/${roleId}/users/_unbind`, data);

View File

@ -26,7 +26,9 @@ const iconKeys = [
'ExportOutlined',
'SyncOutlined',
'ExclamationCircleOutlined',
'UploadOutlined'
'UploadOutlined',
'PlusCircleOutlined',
'QuestionCircleOutlined'
]
const Icon = (props: {type: string}) => {

View File

@ -25,6 +25,7 @@ interface IOption {
type Emits = {
(e: 'update:modelValue', data: string): void;
(e: 'change') :void
};
const emit = defineEmits<Emits>();
@ -41,7 +42,10 @@ const props = defineProps({
const myValue = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
set: (val) => {
emit('update:modelValue', val)
emit('change')
},
});
</script>

View File

@ -109,6 +109,10 @@ export default [
path:'/system/Role/detail/:id',
component: ()=>import('@/views/system/Role/Detail/index.vue')
},
{
path:'/system/Permission',
component: ()=>import('@/views/system/Permission/index.vue')
},
// 初始化
{
path: '/init-home',
@ -116,9 +120,13 @@ export default [
},
// 物联卡 iot-card
{
path: '/iot-card/home',
path: '/iot-card/Home',
component: () => import('@/views/iot-card/Home/index.vue')
},
{
path: '/iot-card/Dashboard',
component: () => import('@/views/iot-card/Dashboard/index.vue')
},
// 北向输出
{
path: '/northbound/DuerOS',
@ -128,4 +136,10 @@ export default [
path: '/northbound/AliCloud',
component: () => import('@/views/northbound/AliCloud/index.vue')
},
// 产品分类
{
path: '/iot/device/Category',
component: () => import('@/views/device/Category/index.vue')
}
]

View File

@ -1,6 +1,7 @@
import moment from "moment";
import { LocalStore } from "./comm";
import { TOKEN_KEY } from "./variable";
import {SystemConst} from './consts';
/**
* JSON
@ -52,4 +53,6 @@ export const downloadObject = (record: Record<string, any>, fileName: string, fo
document.body.appendChild(formElement);
formElement.submit();
document.body.removeChild(formElement);
};
};
// 是否不是community版本
export const isNoCommunity = !(localStorage.getItem(SystemConst.VERSION_CODE) === 'community');

View File

@ -0,0 +1,203 @@
<!-- 新增编辑弹窗 -->
<template>
<a-modal
:title="props.title"
:maskClosable="false"
destroy-on-close
v-model:visible="visible"
@ok="submitData"
@cancel="close"
okText="确定"
cancelText="取消"
v-bind="layout"
>
<a-form
layout="vertical"
v-model="formModel"
:rules="rules"
ref="formRef"
>
<a-form-item label="名称" name="name" v-bind="validateInfos.name">
<a-input v-model:value="formModel.name" :maxlength="64" />
</a-form-item>
<a-form-item
label="排序"
name="sortIndex"
v-bind="validateInfos.sortIndex"
>
<a-input-number
style="width: 100%"
id="inputNumber"
v-model:value="formModel.sortIndex"
:min="1"
/>
</a-form-item>
<a-form-item label="说明">
<a-textarea
v-model:value="formModel.description"
show-count
:maxlength="200"
/>
</a-form-item>
</a-form>
</a-modal>
</template>
<script setup lang="ts" name="modifyModal">
import { PropType } from 'vue';
import { Form } from 'ant-design-vue';
import { queryTree } from '@/api/device/category';
import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
import { list } from '@/api/iot-card/home';
const emits = defineEmits(['refresh']);
const formRef = ref();
const useForm = Form.useForm;
const props = defineProps({
formData: {
type: Object as PropType<Record<string, any>>,
default: () => {},
},
title: {
type: String,
defult: '',
},
isAdd: {
type: Number,
default: 0,
},
isChild: {
type: Boolean,
default: false,
},
});
interface formState {
name: string;
sortIndex: number;
description: string;
}
const listData = ref([]);
/**
* 表单数据
*/
const formModel = ref<formState>({
name: '',
sortIndex: 1,
description: '',
});
const rules = ref({
name: [{ required: true, message: '请输入名称' }],
sortIndex: [{ required: true, message: '请输入排序' }],
});
const visible = ref(false);
const { resetFields, validate, validateInfos } = useForm(
formModel.value,
rules.value,
);
/**
* 提交数据
*/
const submitData = async () => {
validate()
.then(async () => {})
.catch((error: ValidateErrorEntity<formState>) => {});
};
/**
* 显示弹窗
*/
const show = (row: any) => {
if (props.isAdd === 0) {
//
if (props.isChild) {
//
if (row.children && row.children.length > 0) {
let childArr = [];
childArr = row.children.sort(compare('sortIndex'));
formModel.value = {
name: '',
sortIndex: childArr[childArr.length - 1].sortIndex + 1,
description: '',
};
} else {
formModel.value = {
name: '',
sortIndex: 1,
description: '',
};
}
} else {
let arr = [];
arr = listData.value.sort(compare('sortIndex'));
if (arr.length > 0) {
formModel.value = {
name: '',
sortIndex: arr[arr.length - 1].sortIndex + 1,
description: '',
};
} else {
formModel.value = {
name: '',
sortIndex: 1,
description: '',
};
}
}
visible.value = true;
} else if (props.isAdd === 2) {
//
formModel.value = {
name: row.name,
sortIndex: row.sortIndex,
description: row.description,
};
visible.value = true;
}
};
/**
* 判断是新增还是编辑
*/
const judgeIsAdd = () => {};
/**
* 排序
*/
const compare = (property: any) => {
return function (obj1: any, obj2: any) {
var value1 = obj1[property];
var value2 = obj2[property];
return value1 - value2; //
};
},
/**
* 获取列表数据
*/
getTableData = async () => {
const params = {
paging: false,
sorts: [
{ name: 'sortIndex', order: 'asc' },
{
name: 'createTime',
order: 'desc',
},
],
};
const res = await queryTree(params);
if (res.status === 200) {
listData.value = res.result;
console.log(listData.value, 'listData.value');
}
};
/**
* 关闭弹窗
*/
const close = () => {
visible.value = false;
resetFields();
};
getTableData();
//ID
watch([() => props.isAdd], () => {}, { immediate: false, deep: true });
defineExpose({
show: show,
});
</script>
<style></style>

View File

@ -0,0 +1,221 @@
<!--产品分类 -->
<template>
<a-card class="product-category">
<Search :columns="query.columns" target="category" />
<JTable
ref="tableRef"
:columns="table.columns"
:request="queryTree"
model="TABLE"
:params="query.params"
>
<template #headerTitle>
<a-button type="primary" @click="add"
><plus-outlined />新增</a-button
>
</template>
<template #action="slotProps">
<a-space :size="16">
<a-tooltip
v-for="i in getActions(slotProps, 'table')"
:key="i.key"
v-bind="i.tooltip"
>
<a-popconfirm
v-if="i.popConfirm"
v-bind="i.popConfirm"
:disabled="i.disabled"
>
<a-button
:disabled="i.disabled"
style="padding: 0"
type="link"
><AIcon :type="i.icon"
/></a-button>
</a-popconfirm>
<a-button
style="padding: 0"
type="link"
v-else
@click="i.onClick && i.onClick(slotProps)"
>
<a-button
:disabled="i.disabled"
style="padding: 0"
type="link"
><AIcon :type="i.icon"
/></a-button>
</a-button>
</a-tooltip>
</a-space>
</template>
</JTable>
<!-- 新增和编辑弹窗 -->
<ModifyModal
ref="modifyRef"
:formData="currentForm"
:title="title"
:isAdd="isAdd"
:isChild="isChild"
@refresh="() => modifyRef.value?.reload()"
/>
</a-card>
</template>
<script lang="ts" name="Category" setup>
import { queryTree, deleteTree } from '@/api/device/category';
import type { ActionsType } from '@/components/Table/index.vue';
import ModifyModal from './components/modifyModal/index.vue';
import type { TableColumnType, TableProps } from 'ant-design-vue';
import { message } from 'ant-design-vue';
const tableRef = ref<Record<string, any>>({});
const modifyRef = ref();
const dataSource = ref([]);
const currentForm = ref({});
const title = ref('');
const isAdd = ref(0);
const isChild = ref(false);
//
const query = reactive({
columns: [
{
title: '名称',
dataIndex: 'name',
ellipsis: true,
},
{
title: '排序',
dataIndex: 'sortIndex',
valueType: 'digit',
sorter: true,
},
{
title: '描述',
key: 'description',
ellipsis: true,
dataIndex: 'description',
filters: true,
onFilter: true,
},
{
title: '操作',
valueType: 'option',
width: 200,
fixed: 'right',
},
],
params: {
paging: false,
sorts: [
{ name: 'sortIndex', order: 'asc' },
{
name: 'createTime',
order: 'desc',
},
],
},
});
/**
* 操作栏按钮
*/
const getActions = (
data: Partial<Record<string, any>>,
type: 'table',
): ActionsType[] => {
if (!data) return [];
const actions = [
{
key: 'edit',
text: '编辑',
tooltip: {
title: '编辑',
},
icon: 'EditOutlined',
onClick: async () => {
title.value = '编辑分类';
isAdd.value = 2;
currentForm.value = data;
nextTick(() => {
modifyRef.value.show(data);
});
},
},
{
key: 'add',
text: '添加子分类',
tooltip: {
title: '添加子分类',
},
icon: 'PlusCircleOutlined',
onClick: () => {
title.value = '新增子分类';
isAdd.value = 0;
isChild.value = true;
currentForm.value = {};
nextTick(() => {
modifyRef.value.show(data);
});
},
},
{
key: 'delete',
text: '删除',
popConfirm: {
title: '确认删除?',
okText: ' 确定',
cancelText: '取消',
onConfirm: async () => {
const resp = await deleteTree(data.id);
if (resp.status === 200) {
message.success('操作成功!');
tableRef.value?.reload();
} else {
message.error('操作失败!');
}
},
},
icon: 'DeleteOutlined',
},
];
return actions;
};
const table = reactive({
columns: [
{ title: '名称', dataIndex: 'name', key: 'name' },
{
title: '排序',
dataIndex: 'sortIndex',
key: 'sortIndex',
},
{
title: '说明',
dataIndex: 'describe',
key: 'describe',
},
{
title: '操作',
key: 'action',
fixed: 'right',
width: 250,
scopedSlots: true,
},
],
/**
* 添加产品分类
*/
add: async () => {
title.value = '新增分类';
isAdd.value = 0;
isChild.value = false;
nextTick(() => {
modifyRef.value.show(currentForm.value);
});
},
});
const { add, columns } = toRefs(table);
/**
* 初始化
*/
</script>
<style scoped lang="less"></style>

10
src/views/device/Category/typings.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export type CategoryItem = {
id: string;
name: string;
level: number;
key: string;
parentId: string;
path: string;
sortIndex: number;
children?: Category[];
};

View File

@ -7,37 +7,47 @@
<a-col
:span="8"
class="select-item"
:class="{ selected: selectId === '1' }"
@click="selectId = '1'"
:class="{ selected: selectValue === 'device' }"
@click="selectValue = 'device'"
>
<img src="/images/home/device.png" alt="" />
</a-col>
<a-col
:span="8"
class="select-item"
:class="{ selected: selectId === '2' }"
@click="selectId = '2'"
:class="{ selected: selectValue === 'ops' }"
@click="selectValue = 'ops'"
>
<img src="/images/home/ops.png" alt="" />
</a-col>
<a-col
:span="8"
class="select-item"
:class="{ selected: selectId === '3' }"
@click="selectId = '3'"
:class="{ selected: selectValue === 'comprehensive' }"
@click="selectValue = 'comprehensive'"
>
<img src="/images/home/comprehensive.png" alt="" />
</a-col>
</a-row>
<a-button type="primary" class="btn" @click="confirm">确定</a-button>
<a-button type="primary" class="btn" @click="confirm"
>确定</a-button
>
</div>
</div>
</template>
<script lang="ts" setup>
const selectId = ref('1');
import { setView_api } from '@/api/home';
const confirm = ()=>{}
const emits = defineEmits(['refresh']);
const selectValue = ref('device');
const confirm = () => {
setView_api({
name: 'view',
content: selectValue.value,
}).then(() => emits('refresh'));
};
</script>
<style lang="less" scoped>

View File

@ -2,11 +2,11 @@
<div class="container">
<div class="header"></div>
<div class="left"></div>
<div class="content iot-home-container">
<!-- <InitHome /> -->
<!-- <DeviceHome /> -->
<!-- <DevOpsHome /> -->
<ComprehensiveHome />
<div class="content iot-home-container" v-loading="loading">
<InitHome v-if="currentView === 'init'" @refresh="setCurrentView" />
<DeviceHome v-else-if="currentView === 'device'" />
<DevOpsHome v-else-if="currentView === 'ops'" />
<ComprehensiveHome v-else-if="currentView === 'comprehensive'" />
</div>
</div>
</template>
@ -17,6 +17,39 @@ import DeviceHome from './components/DeviceHome/index.vue';
import DevOpsHome from './components/DevOpsHome/index.vue';
import ComprehensiveHome from './components/ComprehensiveHome/index.vue';
import { isNoCommunity } from '@/utils/utils';
import { getMe_api, getView_api } from '@/api/home';
const router = useRouter();
const currentView = ref<string>('');
const loading = ref<boolean>(true);
//
const setCurrentView = () => {
getView_api().then((resp: any) => {
if (resp.status === 200) {
if (resp.result) currentView.value = resp.result?.content;
else if (resp.result.username === 'admin') {
currentView.value = 'comprehensive';
} else currentView.value = 'init';
}
});
};
if (isNoCommunity) {
// api
getMe_api().then((resp: any) => {
if (resp && resp.status === 200) {
const isApiUser = resp.result.dimensions.find(
(item: any) =>
item.type === 'api-client' || item.type.id === 'api-client',
);
isApiUser ? router.push('/system/api') : setCurrentView();
}
});
}else setCurrentView()
</script>
<style lang="less" scoped>

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,6 @@ export interface formState {
basePath: string; // 系统后台访问的URL
logo: string; // 系统logo
icon: string; // 浏览器页签
rulesFrom: Record<string, Rule[]>;
}
/**

View File

@ -18,15 +18,15 @@
</template>
<a-form
layout="vertical"
ref="formBasicRef"
:rules="rulesFrom"
:model="form"
ref="formBasicRef"
>
<a-row :span="24" :gutter="24">
<a-col :span="10">
<a-form-item
label="系统名称"
name="title"
v-bind="validateInfos.title"
>
<a-input
v-model:value="form.title"
@ -37,6 +37,9 @@
<a-form-item
label="主题色"
name="headerTheme"
v-bind="
validateInfos.headerTheme
"
>
<a-select
v-model:value="
@ -74,7 +77,10 @@
placeholder="请输入高德API Key"
/>
</a-form-item>
<a-form-item>
<a-form-item
name="basePath"
v-bind="validateInfos.basePath"
>
<template #label>
<span>base-path</span>
<a-tooltip
@ -111,7 +117,7 @@
<a-upload
name="file"
:action="
action
FILE_UPLOAD
"
:headers="
headers
@ -253,7 +259,7 @@
<a-upload
name="file"
:action="
action
FILE_UPLOAD
"
:headers="
headers
@ -348,7 +354,9 @@
>
<a-upload
name="file"
:action="action"
:action="
FILE_UPLOAD
"
:headers="headers"
:beforeUpload="
beforeBackUpload
@ -721,7 +729,11 @@
type="primary"
class="btn-style"
@click="submitData"
:loading="isSucessBasic || isSucessInit || isSucessRole"
:loading="
isSucessBasic === 2 ||
isSucessInit === 2 ||
isSucessRole === 2
"
>确定</a-button
>
</div>
@ -742,7 +754,6 @@ import type {
FormInstance,
UploadChangeParam,
UploadProps,
Form,
} from 'ant-design-vue';
import { modalState, formState, logoState } from './data/interface';
import BaseMenu from './data/baseMenu';
@ -761,48 +772,57 @@ import {
saveDevice,
changeDeploy,
deployDevice,
saveInit,
} from '@/api/initHome';
import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
import { FILE_UPLOAD } from '@/api/comm';
import { LocalStore } from '@/utils/comm';
import { message } from 'ant-design-vue';
import { Form } from 'ant-design-vue';
import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
const formRef = ref();
const menuRef = ref();
const formBasicRef = ref();
const useForm = Form.useForm;
/**
* 表单数据
*/
const form = reactive<formState>({
const form = ref<formState>({
title: '',
headerTheme: 'light',
apikey: '',
basePath: `${window.location.origin}/api`,
logo: '',
icon: '',
rulesFrom: {
title: [
{
required: true,
message: '请选择本地地址',
trigger: 'blur',
},
],
headerTheme: [
{
required: true,
message: '请选择主题色',
trigger: 'blur',
},
],
basePath: [
{
required: true,
message: '请输入base-path',
trigger: 'blur',
},
],
},
});
const { rulesFrom } = toRefs(form);
const rulesFrom = ref({
title: [
{
required: true,
message: '请输入系统名称',
trigger: 'blur',
},
],
headerTheme: [
{
required: true,
message: '请选择主题色',
trigger: 'blur',
},
],
basePath: [
{
required: true,
message: '请输入base-path',
trigger: 'blur',
},
],
});
const { resetFields, validate, validateInfos } = useForm(
form.value,
rulesFrom.value,
);
/**
* 校验官网地址
*/
@ -871,6 +891,10 @@ const rulesModle = ref({
],
});
// const { resetFields, validate, validateInfos } = useForm(
// modalForm.value,
// rulesModle.value,
// );
/**
* 默认打开第一个初始菜单
*/
@ -878,7 +902,7 @@ const activeKey = ref<string>('1');
const spinning = ref<boolean>(false);
const visible = ref<boolean>(false);
const flag = ref<boolean>(false);
const action = ref<string>(`${BASE_API_PATH}/file/static`);
// const action = ref<string>(`${BASE_API_PATH}/file/static`);
const headers = ref({ [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) });
/**
* 角色勾选数据
@ -928,7 +952,7 @@ const logoData = reactive<logoState>({
* logo格式校验
*/
beforeLogoUpload: (file) => {
const isType = logoData.imageTypes.includes(file.type);
const isType: any = logoData.imageTypes.includes(file.type);
if (!isType) {
message.error(`请上传.jpg.png.jfif.pjp.pjpeg.jpeg格式的图片`);
return false;
@ -1033,58 +1057,58 @@ const {
* 提交基础表单
*/
const basicData = reactive({
isSucessBasic: false,
isSucessBasic: 0,
/**
* 提交基础表单数据
*/
saveBasicInfo: async () => {
// return new Promise(async (resolve) => {
const vaild = await formBasicRef.value.validate();
console.log(vaild, 'vaild ');
if (vaild) {
const item = [
{
scope: 'front',
properties: {
...form,
apikey: '',
'base-path': '',
validate()
.then(async () => {
const item = [
{
scope: 'front',
properties: {
...form,
apikey: '',
'base-path': '',
},
},
},
{
scope: 'amap',
properties: {
api: form.apikey,
{
scope: 'amap',
properties: {
api: form.apikey,
},
},
},
{
scope: 'paths',
properties: {
'base-path': form.basePath,
{
scope: 'paths',
properties: {
'base-path': form.basePath,
},
},
},
];
const res = await save(item);
if (res.status === 200) {
const ico: any = document.querySelector('link[rel="icon"]');
if (ico !== null) {
ico.href = form.icon;
];
const res = await save(item);
if (res.status === 200) {
const ico: any = document.querySelector('link[rel="icon"]');
if (ico !== null) {
ico.href = form.icon;
}
basicData.isSucessBasic = 3;
} else {
basicData.isSucessBasic = 2;
}
} else {
basicData.isSucessBasic = true;
}
} else {
basicData.isSucessBasic = true;
}
// });
})
.catch((error: ValidateErrorEntity<formState>) => {
basicData.isSucessBasic = 2;
});
},
});
const { isSucessBasic } = toRefs(basicData);
/**
* 提交角色数据
*/
const roleData = reactive({
isSucessRole: false,
isSucessRole: 0,
/**
* 根据菜单找角色
*/
@ -1158,7 +1182,7 @@ const roleData = reactive({
}
} else if (index === keys.value.length - 1) {
resolve(Count === keys.value.length);
roleData.isSucessRole = true;
roleData.isSucessRole = 2;
}
});
});
@ -1222,7 +1246,7 @@ const { count } = toRefs(menuDatas);
* 提交初始化数据
*/
const initialization = reactive({
isSucessInit: false,
isSucessInit: 0,
optionPorts: [],
/**
* 查询端口数据
@ -1244,74 +1268,74 @@ const initialization = reactive({
*/
saveCurrentData: async () => {
// return new Promise(async (resolve) => {
const valid = await formRef.value.validate();
console.log(valid, 'valid');
// if (valid) {
// try {
// //
// const network = await saveNetwork({
// type: 'MQTT_SERVER',
// shareCluster: true,
// name: 'MQTT',
// configuration: {
// host: '0.0.0.0',
// secure: false,
// port: modalForm.port,
// publicHost: modalForm.publicHost,
// publicPort: modalForm.publicPort,
// },
// });
// //
// const protocol = await saveProtocol();
// let protocolItem: any = undefined;
// if (protocol.status === 200) {
// const proid = await getProtocol();
// if (proid.status === 200) {
// protocolItem = (proid?.result || []).find(
// (it: any) => it.name === 'JetLinks',
// );
// }
// }
// //
// const accessConfig = await saveAccessConfig({
// name: 'MQTT',
// provider: 'mqtt-server-gateway',
// protocol: protocolItem?.id,
// transport: 'MQTT',
// channel: 'network',
// channelId: network?.result?.id,
// });
// //
// const product = await saveProduct({
// name: 'MQTT',
// messageProtocol: protocolItem?.id,
// protocolName: protocolItem?.name,
// transportProtocol: 'MQTT',
// deviceType: 'device',
// accessId: accessConfig.result?.id,
// accessName: accessConfig.result?.name,
// accessProvider: 'mqtt-server-gateway',
// });
// //
// const device = await saveDevice({
// name: 'MQTT',
// productId: product?.result?.id,
// productName: product?.result?.name,
// });
// if (device.status === 200) {
// changeDeploy(product.result.id);
// deployDevice(device.result.id);
// }
// flag.value = true;
// visible.value = false;
// } catch (e) {
// initialization.isSucessInit = true;
// // resolve(false);
// }
// }
initialization.isSucessInit = true;
formRef.value
.validate()
.then(async () => {
try {
//
const network = await saveNetwork({
type: 'MQTT_SERVER',
shareCluster: true,
name: 'MQTT网络组件',
configuration: {
host: '0.0.0.0',
secure: false,
port: modalForm.port,
publicHost: modalForm.publicHost,
publicPort: modalForm.publicPort,
},
});
//
const protocol = await saveProtocol();
let protocolItem: any = undefined;
if (protocol.status === 200) {
const proid = await getProtocol();
if (proid.status === 200) {
protocolItem = (proid?.result || []).find(
(it: any) => it.name === 'JetLinks官方协议',
);
}
}
//
const accessConfig = await saveAccessConfig({
name: 'MQTT类型设备接入网关',
provider: 'mqtt-server-gateway',
protocol: protocolItem?.id,
transport: 'MQTT',
channel: 'network',
channelId: network?.result?.id,
});
//
const product = await saveProduct({
name: 'MQTT产品',
messageProtocol: protocolItem?.id,
protocolName: protocolItem?.name,
transportProtocol: 'MQTT',
deviceType: 'device',
accessId: accessConfig.result?.id,
accessName: accessConfig.result?.name,
accessProvider: 'mqtt-server-gateway',
});
//
const device = await saveDevice({
name: 'MQTT设备',
productId: product?.result?.id,
productName: product?.result?.name,
});
if (device.status === 200) {
await changeDeploy(product.result.id);
await deployDevice(device.result.id);
}
flag.value = true;
visible.value = false;
initialization.isSucessInit = 3;
} catch (e) {
initialization.isSucessInit = 2;
}
})
.catch((error: ValidateErrorEntity<modalState>) => {
initialization.isSucessInit = 2;
});
},
});
const { optionPorts, saveCurrentData, isSucessInit } = toRefs(initialization);
@ -1321,13 +1345,33 @@ const { optionPorts, saveCurrentData, isSucessInit } = toRefs(initialization);
*/
menuDatas.getSystemPermissionData();
initialization.getCurrentPort();
/**
* 跳转首页
*/
const jump = () => {
window.location.href = '/';
};
/**
* 提交所有数据
*/
const submitData = () => {
initialization.saveCurrentData();
roleData.addRoleData();
const submitData = async () => {
if (keys.value.length > 0) {
roleData.addRoleData();
}
basicData.saveBasicInfo();
//
if (
basicData.isSucessBasic === 3 &&
roleData.isSucessRole === 3 &&
initialization.isSucessInit === 3
) {
message.success('保存成功');
//
const res = await saveInit();
if (res.status === 200) {
jump();
}
}
};
</script>
<style scoped lang="less">

View File

@ -0,0 +1,323 @@
<!-- 物联卡-仪表盘 -->
<template>
<div class="page-container">
<a-card>
<a-row :gutter="20" :style="{ marginBottom: '20px' }">
<a-col :span="24"><Guide title="数据统计" /></a-col>
<a-col :span="8">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="label">昨日流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
<span>{{ dayTotal }} M</span>
</template>
<div class="value">
{{ dayTotal }}
<span class="unit">M</span>
</div>
</a-tooltip>
</div>
<LineChart color="#FBA500" :chartData="dayOptions" />
</div>
</a-col>
<a-col :span="8">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="label">当月流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
<span>{{ monthTotal }} M</span>
</template>
<div class="value">
{{ monthTotal }}
<span class="unit">M</span>
</div>
</a-tooltip>
</div>
<LineChart :chartData="monthOptions" />
</div>
</a-col>
<a-col :span="8">
<div class="data-statistics-item">
<div class="info" style="width: 100%">
<div class="label">本年流量消耗</div>
<a-tooltip placement="bottomLeft">
<template #title>
<span>{{ yearTotal }} M</span>
</template>
<div class="value">
{{ yearTotal }}
<span class="unit">M</span>
</div>
</a-tooltip>
</div>
<LineChart color="#58E1D3" :chartData="yearOptions" />
</div>
</a-col>
</a-row>
<a-row :gutter="20">
<a-col :span="16">
<Guide title="流量统计">
<template #extra></template>
</Guide>
<LineChart
:showX="true"
:showY="true"
style="min-height: 450px"
:chartData="yearOptions"
/>
</a-col>
<a-col :span="8">
<Guide title="流量使用TOP10">
<template #extra></template>
</Guide>
<div class="rankingList" style="height: 400px">
<div
v-for="(item, index) in topList"
:key="item.cardNum"
class="rankItem"
>
<div
class="number"
:class="`number-item-${index + 1}`"
>
{{ index + 1 }}
</div>
<div class="cardNum">{{ item.cardNum }}</div>
<div class="progress">
<a-progress
:strokeColor="'#ADC6FF'"
:trailColor="'#E0E4E8'"
:strokeLinecap="'butt'"
:showInfo="false"
:percent="
Math.ceil((item.value / topTotal) * 100)
"
></a-progress>
</div>
<div class="total">
{{ item?.value?.toFixed(2) }} M
</div>
</div>
</div>
</a-col>
</a-row>
</a-card>
</div>
</template>
<script setup lang="ts">
import Guide from '../components/Guide.vue';
import LineChart from '../components/LineChart.vue';
import moment from 'moment';
import { queryFlow } from '@/api/iot-card/home';
const dayTotal = ref(0);
const monthTotal = ref(0);
const yearTotal = ref(0);
const dayOptions = ref<any[]>([]);
const monthOptions = ref<any[]>([]);
const yearOptions = ref<any[]>([]);
const flowData = ref<any[]>([]);
const topList = ref<any[]>([]);
const topTotal = ref(0);
const getData = (
start: number,
end: number,
): Promise<{ sortArray: any[]; data: any[] }> => {
return new Promise((resolve) => {
queryFlow(start, end, {
orderBy: 'date',
}).then((resp: any) => {
if (resp.status === 200) {
const sortArray = resp.result.sort(
(a: any, b: any) =>
new Date(a.date).getTime() - new Date(b.date).getTime(),
);
resolve({
sortArray,
data: sortArray.map(
(item: any) => item.value && item.value.toFixed(2),
),
});
}
});
});
};
/**
* 查询今日当月本年数据
*/
const getDataTotal = () => {
const dTime = [
moment(new Date()).startOf('day').valueOf(),
moment(new Date()).endOf('day').valueOf(),
];
const mTime = [
moment().startOf('month').valueOf(),
moment().endOf('month').valueOf(),
];
const yTime = [
moment().startOf('year').valueOf(),
moment().endOf('year').valueOf(),
];
getData(dTime[0], dTime[1]).then((resp) => {
dayTotal.value = resp.data
.reduce((r, n) => r + Number(n), 0)
.toFixed(2);
dayOptions.value = resp.sortArray;
});
getData(mTime[0], mTime[1]).then((resp) => {
monthTotal.value = resp.data
.reduce((r, n) => r + Number(n), 0)
.toFixed(2);
monthOptions.value = resp.sortArray;
});
getData(yTime[0], yTime[1]).then((resp) => {
yearTotal.value = resp.data
.reduce((r, n) => r + Number(n), 0)
.toFixed(2);
yearOptions.value = resp.sortArray;
});
};
/**
* 流量统计
* @param data
*/
const getEcharts = (data: any) => {
console.log(data);
let startTime = data.time.start;
let endTime = data.time.end;
if (data.time.type === 'week' || data.time.type === 'month') {
startTime = moment(data.time.start).startOf('days').valueOf();
endTime = moment(data.time.end).startOf('days').valueOf();
}
getData(startTime, endTime).then((resp) => {
flowData.value = resp.sortArray;
});
};
/**
* 流量使用TOP10
* @param star 开始时间
* @param end 结束时间
*/
const getTopRang = (star: number, end: number) => {
queryFlow(star, end, { orderBy: 'usage' }).then((resp: any) => {
if (resp.status === 200) {
const arr = resp.result
.slice(0, 10)
.sort((a: any, b: any) => b.value - a.value);
topTotal.value = arr.length ? arr[0].value : 0;
topList.value = arr;
}
});
};
getDataTotal();
// getEcharts(data);
const dTime = [
moment().subtract(6, 'days').startOf('day').valueOf(),
moment().endOf('day').valueOf(),
];
getTopRang(dTime[0], dTime[1]);
</script>
<style scoped lang="less">
.page-container {
.data-statistics-item {
height: 140px;
background: #fcfcfc;
border: 1px solid #e0e4e8;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
.info {
// width: 180px;
width: 28%;
.label {
font-size: 14px;
color: rgba(0, 0, 0, 0.64);
}
.value {
font-size: 32px;
font-weight: bold;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.unit {
font-size: 20px;
font-weight: normal;
}
}
}
}
.rankingList {
padding: 0;
overflow-y: auto;
list-style: none;
.rankItem {
display: flex;
justify-content: space-between;
min-width: 0;
padding: 12px 0;
}
.number {
flex: 0 0 24px;
height: 24px;
color: #fff;
font-weight: bold;
line-height: 24px;
text-align: center;
background-color: #d1d1d1;
}
.number-item-1 {
color: #e50012;
background-color: rgba(#e50012, 0.1);
}
.number-item-2 {
color: #fba500;
background-color: rgba(#fba500, 0.1);
}
.number-item-3 {
color: #597ef7;
background-color: rgba(#597ef7, 0.1);
}
.cardNum {
flex: 0 0 100px;
margin-left: 16px;
}
.progress {
flex: 1 1 auto;
margin: 0 8px;
:deep(.ant-progress-inner) {
border-radius: 0px;
}
:deep(.ant-progress-bg) {
border-radius: 0px;
}
}
.total {
flex: 0 0 80px;
color: #999;
text-align: right;
}
}
}
</style>

View File

@ -0,0 +1,136 @@
<template>
<div class="chart" ref="chart"></div>
</template>
<script setup lang="ts">
import * as echarts from 'echarts';
const { proxy } = <any>getCurrentInstance();
const props = defineProps({
//
color: {
type: String,
default: '#498BEF',
},
// x
showX: {
type: Boolean,
default: false,
},
// y
showY: {
type: Boolean,
default: false,
},
//
chartData: {
type: Array,
default: () => [],
},
});
/**
* 绘制图表
*/
const createChart = () => {
nextTick(() => {
const myChart = echarts.init(proxy.$refs.chart);
const options = {
grid: {
left: '7%',
right: '5%',
top: '5%',
bottom: '5%',
},
tooltip: {
trigger: 'axis',
// formatter: '{a}<br>{b}: {c}',
axisPointer: {
type: 'shadow',
},
},
xAxis: [
{
show: props.showX,
boundaryGap: false,
data: props.chartData.map((m: any) => m.date),
},
],
yAxis: [
{
show: props.showY,
axisTick: {
show: false,
},
axisLine: {
show: false,
},
splitLine: {
lineStyle: {
type: 'dotted',
},
},
},
],
series: [
{
name: '流量消耗',
type: 'line',
symbol: 'circle',
showSymbol: false,
smooth: true,
itemStyle: {
normal: {
color: props.color,
lineStyle: {
color: props.color,
width: 1,
},
areaStyle: {
color: new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 0.1,
color: '#fff',
},
{
offset: 1,
color: props.color,
},
],
),
},
},
},
data: props.chartData.map(
(m: any) => m.value && m.value.toFixed(2),
),
},
],
};
myChart.setOption(options);
window.addEventListener('resize', function () {
myChart.resize();
});
});
};
watch(
() => props.chartData,
() => createChart(),
{ immediate: true, deep: true },
);
</script>
<style scoped lang="less">
.chart {
width: 100%;
height: 100%;
}
</style>

View File

@ -1,4 +1,4 @@
<!-- webhook请求头可编辑表格 -->
<!-- 附件信息 -->
<template>
<div class="attachment-wrapper">
<div
@ -15,13 +15,16 @@
[TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}"
:showUploadList="false"
@change="handleChange"
@change="(e) => handleChange(e, item.id)"
>
<upload-outlined />
</a-upload>
</template>
</a-input>
<delete-outlined @click="handleDelete" style="cursor: pointer" />
<delete-outlined
@click="handleDelete(item.id)"
style="cursor: pointer"
/>
</div>
<a-button
@ -62,35 +65,65 @@ const props = defineProps({
},
});
const handleChange = (info: UploadChangeParam) => {
if (info.file.status === 'done') {
const result = info.file.response?.result;
console.log('result: ', result);
}
};
// const fileList = computed({
// get: () => props.attachments.map((m) => ({ id: fileId(), ...m })),
// set: (val) =>
// emit(
// 'update:attachments',
// val.map(({ name, location }) => ({ name, location })),
// ),
// });
const fileList = ref<IAttachments[]>([]);
watch(
() => props.attachments,
(val) => {
fileList.value = val;
fileList.value = val.map((m) => ({
id: fileId(),
...m,
}));
},
{ deep: true },
);
const handleDelete = (id: number) => {
const idx = fileList.value.findIndex((f) => f.id === id);
fileList.value.splice(idx, 1);
emit('update:attachments', fileList.value);
const handleChange = (info: UploadChangeParam, id: string | undefined) => {
if (info.file.status === 'done') {
const targetFileIdx = fileList.value.findIndex((f) => f.id === id);
fileList.value[targetFileIdx].name = info.file.name;
fileList.value[targetFileIdx].location = info.file.response?.result;
emit(
'update:attachments',
fileList.value.map(({ name, location }) => ({ name, location })),
);
}
};
/**
* 删除附件
* @param id
*/
const handleDelete = (id: string | undefined) => {
const idx = fileList.value.findIndex((f) => f.id === id);
fileList.value.splice(idx, 1);
};
/**
* 添加附件
*/
const handleAdd = () => {
fileList.value.push({
id: fileList.value.length,
id: fileId(),
name: '',
location: '',
});
emit('update:attachments', fileList.value);
};
/**
* 附件标识
*/
const fileId = () => String(new Date().getTime() + Math.random() * 9);
</script>
<style lang="less" scoped>

View File

@ -0,0 +1,46 @@
<template>
<a-select
:options="options"
@change="change"
placeholder="请选择收信部门"
style="width: 100%"
:allowClear="true"
/>
</template>
<script setup lang="ts">
import templateApi from '@/api/notice/template';
type Emits = {
(e: 'update:toParty', data: string): void;
};
const emit = defineEmits<Emits>();
const props = defineProps({
type: { type: String, default: '' },
configId: { type: String, default: '' },
});
const options = ref([]);
const queryData = async () => {
const { result } = await templateApi.getDept(props.type, props.configId);
options.value = result.map((item: any) => ({
label: item.name,
value: item.id,
}));
};
queryData();
const change = (e: any) => {
emit('update:toParty', e);
};
watch(
() => props.configId,
() => {
queryData();
},
);
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,46 @@
<template>
<a-select
:options="options"
@change="change"
placeholder="请选择标签推送,多个标签用,号分隔"
style="width: 100%"
:allowClear="true"
/>
</template>
<script setup lang="ts">
import templateApi from '@/api/notice/template';
type Emits = {
(e: 'update:toTag', data: string): void;
};
const emit = defineEmits<Emits>();
const props = defineProps({
type: { type: String, default: '' },
configId: { type: String, default: '' },
});
const options = ref([]);
const queryData = async () => {
const { result } = await templateApi.getTags(props.configId);
options.value = result.map((item: any) => ({
label: item.name,
value: item.id,
}));
};
queryData();
const change = (e: any) => {
emit('update:toTag', e);
};
watch(
() => props.configId,
() => {
queryData();
},
);
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,46 @@
<template>
<a-select
:options="options"
@change="change"
placeholder="请选择收信人"
style="width: 100%"
:allowClear="true"
/>
</template>
<script setup lang="ts">
import templateApi from '@/api/notice/template';
type Emits = {
(e: 'update:toUser', data: string): void;
};
const emit = defineEmits<Emits>();
const props = defineProps({
type: { type: String, default: '' },
configId: { type: String, default: '' },
});
const options = ref([]);
const queryData = async () => {
const { result } = await templateApi.getUser(props.type, props.configId);
options.value = result.map((item: any) => ({
label: item.name,
value: item.id,
}));
};
queryData();
const change = (e: any) => {
emit('update:toUser', e);
};
watch(
() => props.configId,
() => {
queryData();
},
);
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,136 @@
<!-- 模板内容-变量列表 -->
<template>
<div class="table-wrapper">
<a-table
:columns="columns"
:data-source="dataSource"
bordered
:pagination="false"
>
<template #bodyCell="{ column, text, record }">
<span v-if="column.dataIndex === 'id'">
{{ record[column.dataIndex] }}
</span>
<a-input
v-if="column.dataIndex === 'name'"
v-model:value="record.name"
/>
<a-select
v-if="column.dataIndex === 'type'"
v-model:value="record.type"
@change="handleTypeChange(record)"
>
<a-select-option value="string">字符串</a-select-option>
<a-select-option value="date">时间</a-select-option>
<a-select-option value="double">数字</a-select-option>
</a-select>
<template v-if="column.dataIndex === 'format'">
<span v-if="record.type === 'string'">
{{ record.format }}
</span>
<a-select
v-if="record.type === 'date'"
v-model:value="record.format"
>
<a-select-option value="timestamp">
timestamp
</a-select-option>
<a-select-option value="yyyy-MM-dd">
yyyy-MM-dd
</a-select-option>
<a-select-option value="yyyy-MM-dd HH:mm:ss">
yyyy-MM-dd HH:mm:ss
</a-select-option>
</a-select>
<a-input
v-if="record.type === 'double'"
v-model:value="record.format"
>
<template #suffix>
<a-tooltip
title="格式为:%.xf x代表数字保留的小数位数。当x=0时,代表格式为整数"
>
<AIcon type="QuestionCircleOutlined" />
</a-tooltip>
</template>
</a-input>
</template>
</template>
</a-table>
</div>
</template>
<script setup lang="ts">
import { PropType } from 'vue';
interface IVariable {
id: string;
name: string;
type: string;
format: string;
}
type Emits = {
(e: 'update:variableDefinitions', data: IVariable[]): void;
};
const emit = defineEmits<Emits>();
const props = defineProps({
variableDefinitions: {
type: Array as PropType<IVariable[]>,
default: () => [],
},
});
const columns = [
{
title: '变量',
dataIndex: 'id',
width: 80,
},
{
title: '名称',
dataIndex: 'name',
// width: 160,
},
{
title: '类型',
dataIndex: 'type',
// width: 160,
},
{
title: '格式',
dataIndex: 'format',
width: 150,
},
];
const dataSource = computed({
get: () => props.variableDefinitions,
set: (val) => emit('update:variableDefinitions', val),
});
watch(
() => dataSource.value,
(val) => {
emit('update:variableDefinitions', val);
},
{ deep: true },
);
const handleTypeChange = (record: IVariable) => {
switch (record.type) {
case 'string':
record.format = '%s';
break;
case 'date':
record.format = 'timestamp';
break;
case 'double':
record.format = '%.0f';
break;
}
};
</script>
<style lang="less" scoped></style>

View File

@ -39,6 +39,7 @@
<RadioCard
:options="msgType"
v-model="formData.provider"
@change="getConfigList"
/>
</a-form-item>
<a-form-item
@ -49,13 +50,14 @@
<a-select
v-model:value="formData.configId"
placeholder="请选择绑定配置"
@change="handleConfigChange"
>
<a-select-option
v-for="(item, index) in ROBOT_MSG_TYPE"
v-for="(item, index) in configList"
:key="index"
:value="item.value"
:value="item.id"
>
{{ item.label }}
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
@ -120,8 +122,7 @@
>
<!-- <a-input
v-model:value="
formData.template.markdown
?.title
formData.template.markdown?.title
"
placeholder="请输入标题"
/> -->
@ -179,58 +180,33 @@
<a-row :gutter="10">
<a-col :span="12">
<a-form-item label="收信人">
<a-select
v-model:value="
<ToUser
v-model:to-user="
formData.template.toUser
"
placeholder="请选择收信人"
>
<a-select-option
v-for="(
item, index
) in ROBOT_MSG_TYPE"
:key="index"
:value="item.value"
>
{{ item.label }}
</a-select-option>
</a-select>
:type="formData.type"
:config-id="formData.configId"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="收信部门">
<a-select
v-model:value="
<ToOrg
v-model:to-user="
formData.template.toParty
"
placeholder="请选择收信部门"
>
<a-select-option
v-for="(
item, index
) in ROBOT_MSG_TYPE"
:key="index"
:value="item.value"
>
{{ item.label }}
</a-select-option>
</a-select>
:type="formData.type"
:config-id="formData.configId"
/>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="标签推送">
<a-select
v-model:value="formData.template.toTag"
placeholder="请选择标签推送"
>
<a-select-option
v-for="(item, index) in ROBOT_MSG_TYPE"
:key="index"
:value="item.value"
>
{{ item.label }}
</a-select-option>
</a-select>
<ToTag
v-model:to-user="formData.template.toTag"
:type="formData.type"
:config-id="formData.configId"
/>
</a-form-item>
</template>
<!-- 邮件 -->
@ -246,17 +222,11 @@
</a-form-item>
<a-form-item label="收件人">
<a-select
mode="tags"
:options="[]"
v-model:value="formData.template.sendTo"
placeholder="请选择收件人"
>
<a-select-option
v-for="(item, index) in ROBOT_MSG_TYPE"
:key="index"
:value="item.value"
>
{{ item.label }}
</a-select-option>
</a-select>
/>
</a-form-item>
<a-form-item label="附件信息">
<Attachments
@ -331,11 +301,11 @@
/>
</a-form-item>
<a-form-item
label="模内容"
label="模内容"
v-if="formData.template.templateType === 'tts'"
>
<a-textarea
v-model:value="formData.template.ttsCode"
v-model:value="formData.template.message"
show-count
:rows="5"
placeholder="内容中的变量将用于阿里云语音验证码"
@ -359,11 +329,11 @@
<a-select-option
v-for="(
item, index
) in ROBOT_MSG_TYPE"
) in templateList"
:key="index"
:value="item.value"
:value="item.templateCode"
>
{{ item.label }}
{{ item.templateName }}
</a-select-option>
</a-select>
</a-form-item>
@ -383,10 +353,18 @@
label="签名"
v-bind="validateInfos['template.signName']"
>
<a-input
<a-select
v-model:value="formData.template.signName"
placeholder="请输入签名"
/>
placeholder="请选择签名"
>
<a-select-option
v-for="(item, index) in signsList"
:key="index"
:value="item.signName"
>
{{ item.signName }}
</a-select-option>
</a-select>
</a-form-item>
</template>
<!-- webhook -->
@ -418,6 +396,35 @@
</div>
</a-form-item>
</template>
<a-form-item
label="模版内容"
v-if="
formData.type !== 'sms' &&
formData.type !== 'webhook' &&
formData.type !== 'voice'
"
>
<a-textarea
v-model:value="formData.template.message"
:maxlength="200"
:rows="5"
placeholder="变量格式:${name};
示例:尊敬的${name},${time}有设备触发告警,请注意处理"
/>
</a-form-item>
<a-form-item
label="变量列表"
v-if="
formData.variableDefinitions &&
formData.variableDefinitions.length
"
>
<VariableDefinitions
v-model:variableDefinitions="
formData.variableDefinitions
"
/>
</a-form-item>
<a-form-item label="说明">
<a-textarea
v-model:value="formData.description"
@ -462,7 +469,11 @@ import {
import templateApi from '@/api/notice/template';
import Doc from './doc/index';
import MonacoEditor from '@/components/MonacoEditor/index.vue';
import Attachments from './components/Attachments.vue'
import Attachments from './components/Attachments.vue';
import VariableDefinitions from './components/VariableDefinitions.vue';
import ToUser from './components/ToUser.vue';
import ToOrg from './components/ToOrg.vue';
import ToTag from './components/ToTag.vue';
const router = useRouter();
const route = useRoute();
@ -500,12 +511,14 @@ watch(
msgType.value = MSG_TYPE[val];
formData.value.provider = msgType.value[0].value;
console.log('formData.value.template: ', formData.value.template);
// console.log('formData.value.template: ', formData.value.template);
getConfigList();
},
);
computed(() => {
console.log('formData.value.type: ', formData.value.type);
// console.log('formData.value.type: ', formData.value.type);
Object.assign(
formData.value.template,
TEMPLATE_FIELD_MAP[formData.value.type][formData.value.provider],
@ -547,11 +560,42 @@ const { resetFields, validate, validateInfos, clearValidate } = useForm(
watch(
() => formData.value.type,
() => {
formData.value.variableDefinitions = [];
clearValidate();
},
{ deep: true },
);
watch(
() => formData.value.template.message,
(val) => {
if (!val) return;
//
const oldKey = formData.value.variableDefinitions?.map((m) => m.id);
// ${}
const pattern = /(?<=\$\{).*?(?=\})/g;
const titleList = val.match(pattern)?.filter((f) => f);
const newKey = [...new Set(titleList)];
const result = newKey?.map((m) =>
oldKey.includes(m)
? formData.value.variableDefinitions.find(
(item) => item.id === m,
)
: {
id: m,
name: '',
type: 'string',
format: '%s',
},
);
formData.value.variableDefinitions = result;
},
{ deep: true },
);
/**
* 获取详情
*/
const getDetail = async () => {
const res = await templateApi.detail(route.params.id as string);
// console.log('res: ', res);
@ -560,6 +604,50 @@ const getDetail = async () => {
};
// getDetail();
/**
* 获取绑定配置
*/
const configList = ref();
const getConfigList = async () => {
const terms = [
{ column: 'type$IN', value: formData.value.type },
{ column: 'provider', value: formData.value.provider },
];
const { result } = await templateApi.getConfig({ terms });
configList.value = result;
};
getConfigList();
/**
* 配置选择改变
*/
const handleConfigChange = () => {
getTemplateList();
getSignsList();
};
/**
* 获取阿里模板
*/
const templateList = ref();
const getTemplateList = async () => {
const { result } = await templateApi.getAliTemplate(
formData.value.configId,
);
templateList.value = result;
};
getTemplateList();
/**
* 获取签名
*/
const signsList = ref();
const getSignsList = async () => {
const { result } = await templateApi.getSigns(formData.value.configId);
signsList.value = result;
};
getSignsList();
/**
* 表单提交
*/
@ -567,25 +655,37 @@ const btnLoading = ref<boolean>(false);
const handleSubmit = () => {
validate()
.then(async () => {
console.log('formData.value: ', formData.value);
// console.log('formData.value: ', formData.value);
formData.value.template.ttsCode =
formData.value.template.templateCode;
btnLoading.value = true;
// let res;
// if (!formData.value.id) {
// res = await templateApi.save(formData.value);
// } else {
// res = await templateApi.update(formData.value);
// }
// // console.log('res: ', res);
// if (res?.success) {
// message.success('');
// router.back();
// }
btnLoading.value = false;
let res;
if (!formData.value.id) {
res = await templateApi.save(formData.value);
} else {
res = await templateApi.update(formData.value);
}
// console.log('res: ', res);
if (res?.success) {
message.success('保存成功');
router.back();
}
})
.catch((err) => {
console.log('err: ', err);
btnLoading.value = false;
});
};
// test
watch(
() => formData.value,
(val) => {
console.log('formData.value: ', val);
},
{ deep: true },
);
// test
</script>
<style lang="less" scoped>

View File

@ -7,7 +7,7 @@ export interface IHeaders {
interface IAttachments {
location: string;
name: string;
id?: number;
id?: string;
}
interface IVariableDefinitions {
id: string;
@ -16,6 +16,17 @@ interface IVariableDefinitions {
format: string;
}
interface IMarkDown {
text: string;
title: string;
}
interface ILink {
title: string;
picUrl: string;
messageUrl: string;
text: string;
}
export type TemplateFormData = {
template: {
// 钉钉消息
@ -23,16 +34,8 @@ export type TemplateFormData = {
message?: string;
// 钉钉机器人
messageType?: string;
markdown?: {
text: string;
title: string;
};
link?: {
title: string;
picUrl: string;
messageUrl: string;
text: string;
};
markdown?: IMarkDown;
link?: ILink;
// 微信
// agentId?: string;
// message?: string;
@ -71,4 +74,24 @@ export type TemplateFormData = {
creatorId?: string;
createTime?: number;
configId?: string;
};
};
// 绑定配置类型
export type config = {
host: string;
password: string;
port: number;
sender: string;
ssl: boolean;
username: string;
}
export type BindConfig = {
configuration: config;
createTime: number
creatorId: string;
id: string;
maxRetryTimes: number;
name: string;
provider: string;
type: string
}

View File

@ -0,0 +1,234 @@
<template>
<a-modal
v-model:visible="dialog.visible"
:title="dialog.title"
width="1000px"
@ok="dialog.handleOk"
class="edit-dialog-container"
>
<a-form ref="formRef" :model="form.data" layout="vertical">
<a-form-item
name="id"
:rules="[{ required: true, message: '请输入标识' }]"
class="question-item"
>
<template #label>
<span>标识</span>
<span class="required-icon">*</span>
<a-tooltip placement="top">
<template #title>
<span>标识ID需与代码中的标识ID一致</span>
</template>
<question-circle-outlined style="color: #00000073" />
</a-tooltip>
</template>
<a-input
v-model:value="form.data.id"
placeholder="请输入标识(ID)"
:maxlength="64"
:disabled="dialog.title === '编辑'"
/>
</a-form-item>
<a-form-item
name="name"
label="名称"
:rules="[{ required: true, message: '请输入名称' }]"
>
<a-input
v-model:value="form.data.name"
placeholder="请输入名称"
:maxlength="64"
/>
</a-form-item>
</a-form>
<a-table
:columns="table.columns"
:data-source="actionTableData"
:pagination="false"
>
<template #bodyCell="{ column, record, index }">
<template v-if="column.key === 'index'">
{{
`#${
(pager.current - 1) * pager.pageSize + (index + 1)
}.`
}}
</template>
<template
v-else-if="column.key !== 'index' && column.key !== 'act'"
>
<a-input v-model:value="record[column.key]" />
</template>
<template v-else-if="column.key === 'act'">
<a-button
style="padding: 0"
type="link"
@click="table.clickRemove(index)"
>
<delete-outlined />
</a-button>
</template>
</template>
</a-table>
<div class="pager">
<a-pagination
v-model:current="pager.current"
:page-size="pager.pageSize"
:total="pager.total"
/>
<a-select v-model:value="pager.current" style="width: 60px">
<a-select-option v-for="(val,i) in pageArr" :value="i + 1">{{
i + 1
}}</a-select-option>
</a-select>
</div>
<a-button type="dashed" style="width: 100%" @click="table.clickAdd">
<plus-outlined /> 添加
</a-button>
<template #footer>
<a-button key="back" @click="dialog.visible = false">取消</a-button>
<a-button
key="submit"
type="primary"
:loading="form.loading"
@click="dialog.handleOk"
>确定</a-button
>
</template>
</a-modal>
</template>
<script setup lang="ts">
import { FormInstance, message } from 'ant-design-vue';
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue';
import { QuestionCircleOutlined } from '@ant-design/icons-vue';
const defaultAction = [
{ action: 'query', name: '查询', describe: '查询' },
{ action: 'save', name: '保存', describe: '保存' },
{ action: 'delete', name: '删除', describe: '删除' },
];
//
const dialog = reactive({
title: '',
visible: false,
handleOk: () => {
formRef.value?.validate().then(() => console.log('success'));
},
//
changeVisible: (status: boolean, defaultForm: any = {}) => {
form.data = { name: '', description: '', ...defaultForm };
dialog.title = defaultForm.id ? '编辑' : '新增';
table.data = defaultForm.id ? defaultForm.actions : [...defaultAction];
pager.total = table.data.length;
pager.current = 1;
dialog.visible = status;
},
});
//
const formRef = ref<FormInstance>();
const form = reactive({
loading: false,
data: {
name: '',
id: '',
},
});
const table = reactive({
columns: [
{
title: '-',
dataIndex: 'index',
key: 'index',
},
{
title: '操作类型',
dataIndex: 'action',
key: 'action',
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
},
{
title: '说明',
dataIndex: 'describe',
key: 'describe',
},
{
title: '操作',
dataIndex: 'act',
key: 'act',
},
],
data: <any>[],
clickRemove: (index: number) => {
pager.total -= 1;
table.data.splice(index, 1);
//
if (pager.current > 1 && pager.total % pager.pageSize === 0)
pager.current -= 1;
},
clickAdd: () => {
table.data.push({});
pager.total += 1;
//
if (pager.total % pager.pageSize === 1) {
pager.current = Math.ceil(pager.total / pager.pageSize);
}
},
});
const pager = reactive({
current: 1,
pageSize: 10,
total: 0,
});
const pageArr = computed(() => {
const maxPageNum = Math.ceil(pager.total / pager.pageSize);
return new Array(maxPageNum).fill(1);
});
const actionTableData = computed(() => {
const startIndex = (pager.current - 1) * pager.pageSize;
const endIndex = Math.min(
pager.current * pager.pageSize,
table.data.length,
);
console.log(startIndex, endIndex);
return table.data.slice(startIndex, endIndex);
});
//
defineExpose({
openDialog: dialog.changeVisible,
});
</script>
<style lang="less" scoped>
.edit-dialog-container {
.question-item {
:deep(.ant-form-item-required) {
&::before {
display: none;
}
.required-icon {
display: inline-block;
margin-right: 4px;
margin-left: 2px;
color: #ff4d4f;
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
}
}
}
}
</style>

View File

@ -0,0 +1,29 @@
<template>
<span class="status-label-container">
<i
class="circle"
:style="{ background: props.statusValue ? '#52c41a' : '#ff4d4f' }"
></i>
<span>{{ props.statusValue ? '启用' : '禁用' }}</span>
</span>
</template>
<script setup lang="ts">
const props = defineProps<{
statusValue: number;
}>();
</script>
<style lang="less" scoped>
.status-label-container {
display: flex;
align-items: center;
.circle {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
margin-right: 8px;
}
}
</style>

View File

@ -0,0 +1,197 @@
<template>
<div class="permission-container">
<Search :columns="query.columns" />
<JTable
ref="tableRef"
:columns="table.columns"
:request="getPermission_api"
model="TABLE"
:params="query.params"
:defaultParams="{ sorts: [{ name: 'id', order: 'asc' }] }"
>
<template #headerTitle>
<a-button type="primary" @click="table.openDialog(undefined)"
><plus-outlined />新增</a-button
>
</template>
<template #status="slotProps">
<StatusLabel :status-value="slotProps.status" />
</template>
<template #action="slotProps">
<a-space :size="16">
<a-tooltip>
<template #title>编辑</template>
<a-button
style="padding: 0"
type="link"
@click="table.openDialog(slotProps)"
>
<edit-outlined />
</a-button>
</a-tooltip>
<a-popconfirm
:title="`确定要${
slotProps.status ? '禁用' : '启用'
}`"
ok-text="确定"
cancel-text="取消"
@confirm="table.changeStatus(slotProps)"
>
<a-tooltip>
<template #title>{{
slotProps.status ? '禁用' : '启用'
}}</template>
<a-button style="padding: 0" type="link">
<stop-outlined v-if="slotProps.status" />
<play-circle-outlined v-else />
</a-button>
</a-tooltip>
</a-popconfirm>
<a-popconfirm
title="确定要删除吗?"
ok-text="确定"
cancel-text="取消"
@confirm="table.clickDel(slotProps)"
:disabled="slotProps.status"
>
<a-tooltip>
<template #title>删除</template>
<a-button
style="padding: 0"
type="link"
:disabled="slotProps.status"
>
<delete-outlined />
</a-button>
</a-tooltip>
</a-popconfirm>
</a-space>
</template>
</JTable>
<div class="dialogs">
<EditDialog ref="editDialogRef" />
</div>
</div>
</template>
<script setup lang="ts">
import EditDialog from './components/EditDialog.vue';
import StatusLabel from './components/StatusLabel.vue';
import { message } from 'ant-design-vue';
import {
EditOutlined,
DeleteOutlined,
PlusOutlined,
StopOutlined,
PlayCircleOutlined,
} from '@ant-design/icons-vue';
import { getPermission_api, editPermission_api } from '@/api/system/permission';
const editDialogRef = ref(); //
const tableRef = ref<Record<string, any>>({}); //
//
const query = reactive({
columns: [
{
title: '标识',
dataIndex: 'id',
key: 'id',
ellipsis: true,
fixed: 'left',
search: {
type: 'string',
},
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
ellipsis: true,
search: {
type: 'string',
},
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
ellipsis: true,
search: {
rename: 'status',
type: 'select',
options: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
},
},
],
params: {},
});
//
const table = reactive({
columns: [
{
title: '标识',
dataIndex: 'id',
key: 'id',
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
scopedSlots: true,
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
scopedSlots: true,
},
],
tableData: [],
openDialog: (row: object | undefined = {}) => {
editDialogRef.value.openDialog(true, row);
},
changeStatus: (row: any) => {
const params = {
...row,
status: row.status ? 0 : 1,
};
editPermission_api(params).then(() => {
message.success('操作成功');
tableRef.value.reload();
});
},
clickDel: (row: any) => {
// delRole_api(row.id).then((resp: any) => {
// if (resp.status === 200) {
// tableRef.value?.reload();
// message.success('!');
// }
// });
},
refresh: () => {
tableRef.value.reload();
},
});
</script>
<style lang="less" scoped></style>

View File

@ -1,6 +1,6 @@
<template>
<div class="role-permiss-container">
<a-card>
<a-card style="max-width: 60%">
<h5>基本信息</h5>
<a-form ref="formRef" :model="form.data" layout="vertical">
<a-form-item
@ -11,7 +11,6 @@
<a-input
v-model:value="form.data.name"
placeholder="请输入角色名称"
allow-clear
:maxlength="64"
/>
</a-form-item>
@ -19,7 +18,6 @@
<a-textarea
v-model:value="form.data.description"
placeholder="请输入说明"
allow-clear
:maxlength="200"
/>
</a-form-item>
@ -30,14 +28,24 @@
<h5>权限分配</h5>
<PermissTree />
<a-button type="primary" :disabled="form.loading" @click="form.clickSave">保存</a-button>
<a-button
type="primary"
:disabled="form.loading"
@click="form.clickSave"
>保存</a-button
>
</a-card>
</div>
</template>
<script setup lang="ts" name="RolePermiss">
import { FormInstance } from 'ant-design-vue';
import PermissTree from '../components/PermissTree.vue'
import PermissTree from '../components/PermissTree.vue';
import { getRoleDetails_api } from '@/api/system/role';
const route = useRoute();
const roleId = route.params.id as string;
//
const formRef = ref<FormInstance>();
@ -47,9 +55,17 @@ const form = reactive({
name: '',
description: '',
},
getForm: ()=>{},
clickSave: ()=>{}
getForm: () => {
getRoleDetails_api(roleId).then((resp) => {
if (resp.status) {
form.data = resp.result;
}
});
},
clickSave: () => {},
});
form.getForm();
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,23 @@
type columnsType = {
title: string,
dataIndex: string,
key: string,
scopedSlots?:boolean
}
export type queryType = {
columns: columnsType[],
params?: object
}
export type tableType = {
columns: columnsType[],
tableData: any[],
refresh: Function,
clickAdd: Function,
clickUnBind: Function,
unbind: Function,
_selectedRowKeys?: string[],
onSelectChange?: Function,
cancelSelect?: Function
}

View File

@ -7,7 +7,12 @@
:columns="table.columns"
:request="getUserByRole_api"
model="TABLE"
:params="query.params"
:defaultParams="query.params"
:rowSelection="{
selectedRowKeys: table._selectedRowKeys,
onChange: table.onSelectChange,
}"
@cancelSelect="table.cancelSelect"
>
<template #headerTitle>
<a-button type="primary" @click="table.clickAdd"
@ -16,7 +21,21 @@
</template>
<template #action="slotProps">
<a-space :size="16"> </a-space>
<a-space :size="16">
<a-popconfirm
title="确认解绑"
ok-text="确定"
cancel-text="取消"
@confirm="table.clickUnBind(slotProps)"
>
<a-tooltip>
<template #title>解绑</template>
<a-button style="padding: 0" type="link">
<disconnect-outlined />
</a-button>
</a-tooltip>
</a-popconfirm>
</a-space>
</template>
</JTable>
@ -27,11 +46,15 @@
</template>
<script setup lang="ts" name="RoleUser">
import { PlusOutlined, DisconnectOutlined } from '@ant-design/icons-vue';
import AddUserDialog from '../components/AddUserDialog.vue';
import { getUserByRole_api } from '@/api/system/role';
import { getUserByRole_api, unbindUser_api } from '@/api/system/role';
import { message } from 'ant-design-vue';
import userType from './index';
const route = useRoute()
const query = reactive({
const route = useRoute();
const roleId = route.params.id as string;
const query = reactive<userType.queryType>({
columns: [
{
title: '姓名',
@ -69,7 +92,7 @@ const query = reactive({
});
const tableRef = ref<Record<string, any>>({});
const table = reactive({
const table = reactive<userType.tableType>({
columns: [
{
title: '姓名',
@ -99,12 +122,35 @@ const table = reactive({
},
],
tableData: [],
//
clickAdd: () => {
dialog.openAdd += 1;
},
refresh: ()=>{
tableRef.value.reload()
}
//
clickUnBind: (row: any) => {
table.unbind([row.id]);
},
//
unbind: (ids: string[] = []) => {
unbindUser_api(roleId, ids).then((resp) => {
if (resp.status === 200) {
message.success('操作成功');
table.refresh();
}
});
},
//
refresh: () => {
tableRef.value.reload();
},
//
_selectedRowKeys: [] as string[],
onSelectChange: (keys: string[]) => {
table._selectedRowKeys = [...keys];
},
cancelSelect: () => {
table._selectedRowKeys = [];
},
});
//

View File

@ -1,6 +1,5 @@
<template>
<div class="details-container">
{{ route.params.id }}
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="权限分配"><Permiss /></a-tab-pane>
<a-tab-pane key="2" tab="用户管理"><User /></a-tab-pane>

View File

@ -44,10 +44,7 @@
<script setup lang="ts">
import { FormInstance, message } from 'ant-design-vue';
import { saveRole_api } from '@/api/system/role';
const router = useRouter()
const props = defineProps({
open: Number,
});
const router = useRouter();
//
const dialog = reactive({
visible: false,
@ -59,10 +56,15 @@ const dialog = reactive({
if (resp.status === 200) {
message.success('操作成功');
dialog.visible = false;
router.push(`/system/Role/detail/${resp.result.id}`)
router.push(`/system/Role/detail/${resp.result.id}`);
}
});
},
//
changeVisible: (status: boolean, defaultForm: object={}) => {
dialog.visible = status;
form.data = { name: '', description: '', ...defaultForm };
},
});
//
const formRef = ref<FormInstance>();
@ -74,18 +76,12 @@ const form = reactive({
},
});
watch(
() => props.open,
() => {
//
form.data = {
name: '',
description: '',
};
formRef.value?.resetFields();
dialog.visible = true;
},
);
//
defineExpose({
openDialog: dialog.changeVisible
})
</script>
<style scoped></style>

View File

@ -45,7 +45,7 @@
</JTable>
<div class="dialogs">
<AddDialog :open="dialog.openAdd" />
<AddDialog ref="addDialogRef" />
</div>
</a-card>
</template>
@ -59,8 +59,8 @@ import {
import AddDialog from './components/AddDialog.vue';
import { getRoleList_api, delRole_api } from '@/api/system/role';
import { message } from 'ant-design-vue';
const router = useRouter()
const addDialogRef = ref(); //
const router = useRouter();
//
const query = reactive({
columns: [
@ -122,24 +122,21 @@ const table = reactive({
],
tableData: [],
clickAdd: () => {
dialog.openAdd += 1;
addDialogRef.value.openDialog(true, {})
},
clickDel: (row: any) => {
delRole_api(row.id).then((resp:any)=>{
if(resp.status === 200){
tableRef.value?.reload()
message.success('操作成功!')
delRole_api(row.id).then((resp: any) => {
if (resp.status === 200) {
tableRef.value?.reload();
message.success('操作成功!');
}
})
});
},
clickEdit: (row: any) => {
router.push(`/system/Role/detail/${row.id}`)
router.push(`/system/Role/detail/${row.id}`);
},
});
//
const dialog = reactive({
openAdd: 0,
});
</script>
<style lang="less" scoped></style>

View File

@ -83,19 +83,20 @@
]"
>
<a-input
class="login-code-input"
v-model:value="form.verifyCode"
autocomplete="off"
:maxlength="64"
placeholder="请输入验证码"
></a-input>
<div class="login-code">
<img
:src="codeUrl"
@click="getCode()"
class="login-code-img"
/>
</div>
>
<template #addonAfter>
<div>
<img
:src="codeUrl"
@click="getCode()"
/>
</div>
</template>
</a-input>
</a-form-item>
<a-form-item
name="remember"
@ -103,7 +104,14 @@
>
<a-checkbox
v-model:checked="form.remember"
>记住密码</a-checkbox
@change="
() =>
(form.expires =
form.remember
? -1
: 3600000)
"
>记住我</a-checkbox
>
</a-form-item>
<a-form-item>
@ -180,7 +188,6 @@ import {
bindInfo,
settingDetail,
} from '@/api/login';
import Cookies from 'js-cookie';
import { useUserInfo } from '@/store/userInfo';
import { LocalStore } from '@/utils/comm';
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
@ -220,34 +227,24 @@ iconMap.set('dingtalk-ent-app', getImage('/bind/dingtalk.png'));
iconMap.set('wechat-webapp', getImage('/bind/wechat-webapp.png'));
const onFinish = async () => {
form.remember
? Cookies.set('user', encodeURIComponent(JSON.stringify(form)), {
expires: 7,
})
: Cookies.remove('user');
Cookies.set('username', form.username, { expires: 30 });
try {
loading.value = true;
const res: any = await authLogin(form);
loading.value = false;
if (res.success) {
store.$patch({
...res.result,
username: form.username,
});
LocalStore.set(TOKEN_KEY, res?.result.token);
// if (res.result.username === 'admin') {
// const resp: any = await getInitSet();
// if (resp.status === 200 && !resp.result.length) {
// window.location.href = '/#/init-home';
// return;
// }
// }
// window.location.href = '/';
const resp: any = await getInitSet();
if (resp.success) {
router.push('/demo');
if (res.result.username === 'admin') {
const resp: any = await getInitSet();
if (resp.status === 200 && !resp.result.length) {
window.location.href = '/#/init-home';
return;
}
}
window.location.href = '/';
}
} catch (error) {
form.verifyCode = '';
@ -269,14 +266,6 @@ const getCode = async () => {
}
};
const getCookie = () => {
// form.username = Cookies.get('username');
if (!Cookies.get('user')) return;
const user = JSON.parse(decodeURIComponent(Cookies.get('user')));
form.username = user.username;
form.password = user.password;
form.remember = user.remember || false;
};
const getOpen = () => {
LocalStore.removeAll();
@ -292,7 +281,7 @@ const getOpen = () => {
}
}
});
settingDetail('front').then((res) => {
settingDetail('front').then((res: any) => {
if (res.status === 200) {
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = res.result.ico;
@ -337,7 +326,6 @@ watch(
getOpen();
getCode();
getCookie();
screenRotation(screenWidth.value, screenHeight.value);
</script>
@ -470,23 +458,9 @@ screenRotation(screenWidth.value, screenHeight.value);
}
.verifyCode {
.login-code-input {
width: 70%;
float: left;
}
.login-code {
width: 30%;
height: 32px;
float: left;
background-color: #e4e6e7;
img {
cursor: pointer;
vertical-align: middle;
}
.login-code-img {
width: 100%;
height: 100%;
}
img {
cursor: pointer;
// vertical-align: middle;
}
}
}

7963
yarn.lock

File diff suppressed because it is too large Load Diff