zsysview 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +3 -1
  2. package/assets/default_avatar.png +0 -0
  3. package/assets/default_logo.png +0 -0
  4. package/assets/default_logo_40.png +0 -0
  5. package/assets/login_bg.jpg +0 -0
  6. package/components/export/export_dialog.vue +150 -0
  7. package/components/export/export_progress.vue +62 -0
  8. package/components/list/zsyslist.vue +2 -2
  9. package/components/list/zsyslist_header.vue +1 -1
  10. package/components/zsys_delbutton.vue +60 -0
  11. package/core/app.ts +21 -2
  12. package/core/common/common.ts +29 -0
  13. package/core/common/zsys_eventBus.ts +45 -0
  14. package/core/common/zsys_time.ts +26 -0
  15. package/core/httpapi/http_api_return_data.ts +43 -0
  16. package/core/httpapi/http_api_v1.ts +151 -0
  17. package/core/httpapi/http_axios.ts +54 -0
  18. package/core/router copy.ts +148 -0
  19. package/core/router.ts +149 -0
  20. package/core/runtime.ts +14 -0
  21. package/core/user_token.ts +17 -0
  22. package/css/common.css +16 -0
  23. package/package.json +9 -2
  24. package/view/app.vue +0 -1
  25. package/view/backup/backup.vue +308 -0
  26. package/view/building.vue +22 -0
  27. package/view/department/department.vue +111 -0
  28. package/view/department/department_edit_dialog.vue +267 -0
  29. package/view/desktop/desktop.vue +11 -0
  30. package/view/log/log.vue +60 -0
  31. package/view/log/log_setting.vue +41 -0
  32. package/view/login.vue +5 -5
  33. package/view/main/breadcrumb.vue +41 -0
  34. package/view/main/main.vue +60 -0
  35. package/view/main/userHeader.vue +73 -0
  36. package/view/main/userMenu.vue +132 -0
  37. package/view/main/userMenuItem.vue +49 -0
  38. package/view/position/position.vue +58 -0
  39. package/view/position/position_edit_dialog.vue +203 -0
  40. package/view/role/role.vue +72 -0
  41. package/view/role/role_edit_dialog.vue +271 -0
  42. package/view/self/change_password.vue +97 -0
  43. package/view/self/self.vue +62 -0
  44. package/view/sys/sys.vue +19 -0
  45. package/view/user/change_user_password_dialog.vue +155 -0
  46. package/view/user/user.vue +110 -0
  47. package/view/user/user_edit_dialog.vue +283 -0
@@ -0,0 +1,54 @@
1
+ import axios from 'axios'
2
+ import {useTokenStore} from '../user_token'
3
+ import type { HttpApiReturnData } from './http_api_return_data'
4
+ import JSONbig from 'json-bigint';
5
+
6
+ const store=useTokenStore()
7
+
8
+ // let http_axios=axios
9
+ let http_axios=axios.create({
10
+ transformResponse: [data => {
11
+ try {
12
+ // 使用 json-bigint 解析 JSON,它会自动处理大数字
13
+ return JSONbig.parse(data);
14
+ } catch (error) {
15
+ console.error('JSON parse error:', error);
16
+ throw error;
17
+ }
18
+ }],
19
+ transformRequest: [data => {
20
+ return JSONbig.stringify(data)
21
+ }],
22
+ // transformRequest: [(data) => {
23
+ // return JSON.stringify(data, (_, value) => {
24
+ // if (typeof value === 'bigint') {
25
+ // return value.toString(); // 自动转换 BigInt
26
+ // }
27
+ // return value;
28
+ // });
29
+ // }],
30
+ })
31
+ // http_axios.defaults.baseURL='http://localhost:1788/'
32
+
33
+ http_axios.interceptors.request.use(config=>{
34
+ console.log(store.token.value);
35
+ config.headers["authorization"]='Bearer '+store.token.value
36
+ return config
37
+ })
38
+
39
+ http_axios.interceptors.response.use(res=>{
40
+ //登录信息错误,要求重新登录
41
+ let data=res.data as HttpApiReturnData
42
+ if(data.error_code==100){
43
+ store.saveToken('none')
44
+ }
45
+ //有token,保存
46
+ if (typeof res.headers["authorization"] !== 'undefined'){
47
+ store.saveToken(res.headers["authorization"])
48
+ }
49
+ return res
50
+ },err=>{
51
+ return Promise.reject(err)
52
+ })
53
+
54
+ export default http_axios
@@ -0,0 +1,148 @@
1
+ import { createRouter, createWebHistory } from 'vue-router/dist/vue-router.ts'//"vue-router"
2
+ import { useTokenStore } from "./user_token"
3
+
4
+ const routes = [
5
+ {
6
+ path: "/", //"/main"
7
+ redirect: '/main'
8
+ // component: () => import("../views/zsys_main/main.vue"),
9
+ // meta:{ requiresAuth: true},
10
+ },
11
+ {
12
+ path: "/test", //"/main"
13
+ component: () => import("../views/desktop/desktop.vue"),
14
+ },
15
+ {
16
+ path: "/main", //"/main"
17
+ component: () => import("../views/zsys_main/main.vue"),
18
+ meta: { requiresAuth: true, title: '主界面' },
19
+ children: [{
20
+ path: "/desktop",//首页
21
+ meta: { title: '首页' },
22
+ component: () => import("../views/desktop/desktop.vue"),
23
+ }, {
24
+ path: "/self",//个人中心
25
+ meta: { title: '个人中心' },
26
+ component: () => import("../views/zsys_main/zsys_self/self.vue"),
27
+ },
28
+ {
29
+ path: "/password",//修改密码
30
+ meta: { title: '修改密码' },
31
+ component: () => import("../views/zsys_main/zsys_self/change_password.vue"),
32
+ },
33
+ {
34
+ path: "/chart",
35
+ meta: { title: '数据看板' },
36
+ component: () => import("@/views/chart/chart.vue"),
37
+ }, {
38
+ path: "/eventgroup/event",
39
+ meta: { title: '事件' },
40
+ component: () => import("../views/event/event.vue"),
41
+ }, {
42
+ path: "/eventgroup/event_detail",
43
+ meta: { title: '事件详情' },
44
+ component: () => import("../views/event/event_detail.vue"),
45
+ },
46
+ {
47
+ path: "/eventgroup",
48
+ meta: { title: '事件管理' },
49
+ children: [{
50
+ path: "/user1",
51
+ meta: { title: '数据看板' },
52
+ component: () => import("@/views/chart/chart.vue"),
53
+ },
54
+ {
55
+ path: "/eventgroup/event",
56
+ meta: { title: '事件' },
57
+ component: () => import("../views/event/event.vue"),
58
+ }, {
59
+ path: "/eventgroup/event_detail",
60
+ meta: { title: '事件详情' },
61
+ component: () => import("../views/event/event_detail.vue"),
62
+ },]
63
+ },
64
+ {
65
+ path: "/engine",
66
+ meta: { title: '行为分析引擎' },
67
+ component: () => import("../views/engine/engine.vue"),
68
+ },
69
+ {
70
+ path: "/equipment",
71
+ meta: { title: '设备管理' },
72
+ component: () => import("../views/equipment/equipment.vue"),
73
+ },
74
+ {
75
+ path: "/area",
76
+ meta: { title: '区域管理' },
77
+ component: () => import("../views/area/area.vue"),
78
+ },
79
+ {
80
+ path: "/sys",//系统管理
81
+ meta: { title: '系统管理' },
82
+ //component: () => import("../views/zsys_main/zsys_self/self.vue"),
83
+ children: [{
84
+ path: "/user",
85
+ meta: { title: '用户管理' },
86
+ component: () => import("../views/zsys_main/zsys/user/user.vue"),
87
+ },
88
+ {
89
+ path: "/department",
90
+ meta: { title: '组织架构' },
91
+ component: () => import("@/views/zsys_main/zsys/department/department.vue"),
92
+ },
93
+ {
94
+ path: "/position",
95
+ meta: { title: '职务' },
96
+ component: () => import("../views/zsys_main/zsys/position/position.vue"),
97
+ },
98
+ {
99
+ path: "/role",
100
+ meta: { title: '角色权限' },
101
+ component: () => import("../views/zsys_main/zsys/role/role.vue"),
102
+ },
103
+ {
104
+ path: "/log",
105
+ meta: { title: '日志' },
106
+ component: () => import("../views/zsys_main/zsys/log/log.vue"),
107
+ },
108
+ {
109
+ path: "/backup",
110
+ meta: { title: '备份' },
111
+ component: () => import("../views/zsys_main/zsys/backup/backup.vue"),
112
+ },
113
+ {
114
+ path: "/maintenance",
115
+ meta: { title: '维护' },
116
+ component: () => import("@/views/zsys_main/zsys/maintenance/maintenance.vue"),
117
+ }]
118
+ }
119
+ ]
120
+ },
121
+ {
122
+ path: "/login",
123
+ name: 'login',
124
+ component: () => import("../view/login.vue")
125
+ }
126
+ ]
127
+
128
+ const router = createRouter({
129
+ history: createWebHistory(),
130
+ routes
131
+ })
132
+
133
+ router.beforeEach((to, _, next) => {
134
+ console.log('to', to.fullPath);
135
+ if (to.matched.some(r => r.meta?.requiresAuth)) {
136
+ let store = useTokenStore()
137
+ console.log('store.token.value', store.token.value);
138
+ if (!store.token.value || store.token.value == '') {
139
+ next({ name: 'login', query: { redirect: to.fullPath } })
140
+ } else {
141
+ next()
142
+ }
143
+ } else {
144
+ next()
145
+ }
146
+ })
147
+
148
+ export default router
package/core/router.ts ADDED
@@ -0,0 +1,149 @@
1
+ import { createRouter, createWebHistory, type Router,type RouteRecordRaw } from "vue-router"
2
+ import { useTokenStore } from "./user_token"
3
+
4
+ const routes = [
5
+ {
6
+ path: "/", //"/main"
7
+ redirect: '/main'
8
+ // component: () => import("../views/zsys_main/main.vue"),
9
+ // meta:{ requiresAuth: true},
10
+ },
11
+ {
12
+ path: "/main", //"/main"
13
+ component: () => import("../view/main/main.vue"),
14
+ meta: { requiresAuth: true, title: '主界面' },
15
+ children: [
16
+ {
17
+ path: "/desktop",
18
+ meta: { title: '首页' },
19
+ component: () => import("../view/desktop/desktop.vue"),
20
+ },
21
+ {
22
+ path: "/self",//个人中心
23
+ meta: { title: '个人中心' },
24
+ component: () => import("../view/self/self.vue"),
25
+ },
26
+ {
27
+ path: "/password",//修改密码
28
+ meta: { title: '修改密码' },
29
+ component: () => import("../view/self/change_password.vue"),
30
+ },
31
+ {
32
+ path: "/sys",//系统管理
33
+ meta: { title: '系统管理' },
34
+ //component: () => import("../views/zsys_main/zsys_self/self.vue"),
35
+ children: [{
36
+ path: "/user",
37
+ meta: { title: '用户管理' },
38
+ component: () => import("../view/user/user.vue"),
39
+ },
40
+ {
41
+ path: "/department",
42
+ meta: { title: '组织架构' },
43
+ component: () => import("../view/department/department.vue"),
44
+ },
45
+ {
46
+ path: "/position",
47
+ meta: { title: '职务' },
48
+ component: () => import("../view/position/position.vue"),
49
+ },
50
+ {
51
+ path: "/role",
52
+ meta: { title: '角色权限' },
53
+ component: () => import("../view/role/role.vue"),
54
+ },
55
+ {
56
+ path: "/log",
57
+ meta: { title: '日志' },
58
+ component: () => import("../view/log/log.vue"),
59
+ },
60
+ {
61
+ path: "/backup",
62
+ meta: { title: '备份' },
63
+ component: () => import("../view/backup/backup.vue"),
64
+ },
65
+ {
66
+ path: "/sys",
67
+ meta: { title: '系统' },
68
+ component: () => import("../view/sys/sys.vue"),
69
+ }]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ path: "/login",
75
+ name: 'login',
76
+ component: () => import("../view/login.vue")
77
+ }
78
+ ] as RouteRecordRaw[]
79
+
80
+ const router = createRouter({
81
+ history: createWebHistory(),
82
+ routes
83
+ })
84
+
85
+ function addFrameRouter(r: RouteRecordRaw) {
86
+ try {
87
+ // 查找path为"/main"的路由
88
+ const mainRoute = routes.find(route => route.path === "/main");
89
+
90
+ if (!mainRoute) {
91
+ console.error('未找到path为"/main"的路由');
92
+ return
93
+ }
94
+
95
+ // 确保mainRoute有children数组
96
+ if (!mainRoute.children) {
97
+ mainRoute.children = [];
98
+ }
99
+
100
+ // 检查是否已存在相同path的路由
101
+ const existingRouteIndex = mainRoute.children.findIndex(
102
+ child => child.path === r.path
103
+ );
104
+
105
+ if (existingRouteIndex !== -1) {
106
+ // 如果已存在,替换该路由
107
+ mainRoute.children[existingRouteIndex] = r;
108
+ console.log(`已更新路由: ${r.path}`);
109
+ } else {
110
+ // 如果不存在,添加新路由
111
+ mainRoute.children.push(r);
112
+ console.log(`已添加新路由: ${r.path}`);
113
+ }
114
+
115
+ // 重新创建router实例以确保路由更新生效
116
+ // 注意:在实际项目中可能需要更复杂的路由更新逻辑
117
+ // router.addRoute('main', r as RouteRecordRaw);
118
+
119
+ return 1;
120
+ } catch (error) {
121
+ console.error('添加路由失败:', error);
122
+ return 0;
123
+ }
124
+ }
125
+
126
+ function initRouter(): Router {
127
+ return createRouter({
128
+ history: createWebHistory(),
129
+ routes
130
+ })
131
+ }
132
+
133
+ router.beforeEach((to, _, next) => {
134
+ console.log('to', to.fullPath);
135
+ if (to.matched.some(r => r.meta?.requiresAuth)) {
136
+ let store = useTokenStore()
137
+ console.log('store.token.value', store.token.value);
138
+ if (!store.token.value || store.token.value == '') {
139
+ next({ name: 'login', query: { redirect: to.fullPath } })
140
+ } else {
141
+ next()
142
+ }
143
+ } else {
144
+ next()
145
+ }
146
+ })
147
+
148
+ // export default router
149
+ export { initRouter, addFrameRouter }
@@ -0,0 +1,14 @@
1
+ import type { App } from "vue";
2
+ import { HttpApiV1 as http } from "./httpapi/http_api_v1";
3
+
4
+ async function GetPublish(app:App){
5
+ let res=await http.Post(http.url_system_publish,{})
6
+ if(res.IsSuccess){
7
+ let data=res.data as {
8
+ app_name:string
9
+ }
10
+ app.config.globalProperties.$appName=data.app_name
11
+ }
12
+ }
13
+
14
+ export {GetPublish}
@@ -0,0 +1,17 @@
1
+ import { computed, ref } from "vue";
2
+ import { defineStore } from "pinia";
3
+
4
+ export const useTokenStore=defineStore("UseToken",()=>{
5
+ const token_data=ref("")
6
+ const token=computed(()=>{
7
+ return token_data
8
+ })
9
+ function saveToken(data:string){
10
+ token_data.value=data
11
+ }
12
+
13
+ return {token_data,token,saveToken}
14
+ },{
15
+ // 启用持久化
16
+ persist: true,
17
+ })
package/css/common.css ADDED
@@ -0,0 +1,16 @@
1
+ #app {
2
+ height: 100%; width: 100%;position: absolute;
3
+ }
4
+
5
+ body{
6
+ padding: 0px; margin: 0px;
7
+ /* background-image: url("/src/assets/zsys/login/bg.jpg"); */
8
+ /* background-size: 100% 100%;
9
+ background-position: revert; */
10
+ /* !!!background-size: cover; */
11
+ /* background-repeat: no-repeat; */
12
+ }
13
+
14
+ .main_btn{
15
+ width: 100px;
16
+ }
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "zsysview",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "zsystem view",
5
5
  "author": {
6
6
  "name": "liuhaomiao"
7
7
  },
8
8
  "private": false,
9
9
  "dependencies": {
10
- "element-plus": "^2.11.2"
10
+ "axios": "^1.12.2",
11
+ "element-plus": "^2.11.2",
12
+ "json-bigint": "^1.0.0",
13
+ "ts-md5": "^2.0.1",
14
+ "vue": "^3.5.18",
15
+ "vue-router": "^4.5.1",
16
+ "pinia": "^3.0.2",
17
+ "pinia-plugin-persistedstate": "^4.3.0"
11
18
  }
12
19
  }
package/view/app.vue CHANGED
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- // import HelloWorld from './components/HelloWorld.vue'
3
2
  </script>
4
3
 
5
4
  <template>