zsysview 0.0.7 → 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.
Binary file
Binary file
package/core/app.ts CHANGED
@@ -8,17 +8,25 @@ import ElementPlus from 'element-plus' //导入 ElementPlus 组件库的所有
8
8
  import 'element-plus/dist/index.css' //导入 ElementPlus 组件库所需的全局 CSS 样式
9
9
  import zhCn from 'element-plus/es/locale/lang/zh-cn'
10
10
 
11
+
11
12
  //路由
12
- import router from './router.ts' //导入路由模块
13
+ import {initRouter,addFrameRouter} from './router.ts' //导入路由模块
14
+
13
15
 
14
16
  const zsysapp=createApp(app)
15
17
 
16
18
  const pinia=createPinia()
17
19
  pinia.use(piniaPluginPersistedstate)
18
20
 
19
- zsysapp.use(router) //将 Vue Router 插件注册到 Vue 应用中
21
+ addFrameRouter({path:'/desktop',component:()=>import('../../test_view/test_desktop.vue')})
22
+
23
+ zsysapp.use(initRouter()) //将 Vue Router 插件注册到 Vue 应用中
20
24
  zsysapp.use(ElementPlus,{locale: zhCn}) //将 ElementPlus 插件注册到 Vue 应用中
21
25
  zsysapp.use(pinia)
26
+ //从后台获取全局信息
27
+ // import {GetPublish}from '../core/runtime.ts'
28
+ // GetPublish(zsysapp)
22
29
  zsysapp.mount('#app')
23
30
 
31
+
24
32
  export default {zsysapp}
@@ -57,6 +57,8 @@ export class HttpApiV1 {
57
57
  //导出
58
58
  static url_export_detail: string = 'api/export_detail'
59
59
  static url_export_file: string = 'api/export_file'
60
+ // 系统
61
+ static url_system_publish: string = 'api/system_publish'
60
62
 
61
63
  //应用级接口==========================
62
64
  //桌面
package/core/router.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createRouter, createWebHistory } from "vue-router"
1
+ import { createRouter, createWebHistory, type Router,type RouteRecordRaw } from "vue-router"
2
2
  import { useTokenStore } from "./user_token"
3
3
 
4
4
  const routes = [
@@ -14,55 +14,60 @@ const routes = [
14
14
  meta: { requiresAuth: true, title: '主界面' },
15
15
  children: [
16
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"),
17
+ path: "/desktop",
18
+ meta: { title: '首页' },
19
+ component: () => import("../view/desktop/desktop.vue"),
39
20
  },
40
21
  {
41
- path: "/department",
42
- meta: { title: '组织架构' },
43
- component: () => import("../view/department/department.vue"),
22
+ path: "/self",//个人中心
23
+ meta: { title: '个人中心' },
24
+ component: () => import("../view/self/self.vue"),
44
25
  },
45
26
  {
46
- path: "/position",
47
- meta: { title: '职务' },
48
- component: () => import("../view/position/position.vue"),
27
+ path: "/password",//修改密码
28
+ meta: { title: '修改密码' },
29
+ component: () => import("../view/self/change_password.vue"),
49
30
  },
50
31
  {
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
- }
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
+ }
66
71
  ]
67
72
  },
68
73
  {
@@ -70,13 +75,61 @@ const routes = [
70
75
  name: 'login',
71
76
  component: () => import("../view/login.vue")
72
77
  }
73
- ]
78
+ ] as RouteRecordRaw[]
74
79
 
75
80
  const router = createRouter({
76
81
  history: createWebHistory(),
77
82
  routes
78
83
  })
79
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
+
80
133
  router.beforeEach((to, _, next) => {
81
134
  console.log('to', to.fullPath);
82
135
  if (to.matched.some(r => r.meta?.requiresAuth)) {
@@ -92,4 +145,5 @@ router.beforeEach((to, _, next) => {
92
145
  }
93
146
  })
94
147
 
95
- export default router
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zsysview",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "zsystem view",
5
5
  "author": {
6
6
  "name": "liuhaomiao"
@@ -11,6 +11,9 @@
11
11
  "element-plus": "^2.11.2",
12
12
  "json-bigint": "^1.0.0",
13
13
  "ts-md5": "^2.0.1",
14
- "vue": "^3.5.18"
14
+ "vue": "^3.5.18",
15
+ "vue-router": "^4.5.1",
16
+ "pinia": "^3.0.2",
17
+ "pinia-plugin-persistedstate": "^4.3.0"
15
18
  }
16
19
  }
package/view/log/log.vue CHANGED
@@ -6,7 +6,7 @@
6
6
  <zsyslist :config="listconfig">
7
7
  <template #content>
8
8
  <el-table-column prop="log_id" label="日志ID" width="180" />
9
- <el-table-column prop="from_ip" label="IP" width="120" />
9
+ <el-table-column prop="from_ip" label="IP" width="160" />
10
10
  <el-table-column prop="c_time" label="时间" width="180">
11
11
  <template #default="{row}">
12
12
  {{ dataformat(row.c_time) }}
@@ -3,11 +3,11 @@
3
3
  <div style="padding-left: 20px; padding-right: 20px; ">
4
4
  <div
5
5
  style="height:60px; margin-right: 10px; float: left; display: flex; align-items: center; justify-content: center;">
6
- <el-image style="height: 40px; " />
6
+ <el-image style="height: 40px; " src="../../assets/default_logo_40.png" />
7
7
  <!-- :src="logoUrl" -->
8
8
  </div>
9
9
 
10
- <div style="float: left; line-height: 60px;">岗位行为识别系统</div>
10
+ <div style="float: left; line-height: 60px;">{{app.zsysapp.config.globalProperties.$appName}}岗位行为识别系统</div>
11
11
  <!-- 右上角 -->
12
12
  <el-dropdown trigger="click" class="user_operate">
13
13
  <span class="el-dropdown-link">
@@ -37,6 +37,7 @@ import { ArrowDown } from '@element-plus/icons-vue'
37
37
  // import logoUrl from '../../assets/logo_40.png';
38
38
  import { HttpApiV1 as http } from '../../core/httpapi/http_api_v1';
39
39
  import { reactive } from 'vue';
40
+ import app from '../../core/app';
40
41
  const r = useRouter()
41
42
 
42
43
  const user = reactive({
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <breadcrumb />
3
+ <div style="padding: 0px 20px; margin-top: 20px">
4
+ <el-tabs v-model="tab">
5
+ <el-tab-pane label="基础" name="base">
6
+
7
+
8
+ </el-tab-pane>
9
+ </el-tabs>
10
+
11
+ </div>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { ref } from 'vue';
16
+ const tab = ref('base')
17
+ </script>
18
+
19
+ <style scoped></style>