vue3-admin-gpt 1.0.0
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.
- package/.env.development +14 -0
- package/.env.production +14 -0
- package/LICENSE +21 -0
- package/README.en.md +106 -0
- package/README.md +104 -0
- package/build-zip.cjs +53 -0
- package/cli.js +110 -0
- package/jsconfig.json +9 -0
- package/package.json +92 -0
- package/public/index.html +20 -0
- package/public/robots.txt +2 -0
- package/rspack.config.js +282 -0
- package/rspack.js +162 -0
- package/src/App.vue +9 -0
- package/src/api/icon.js +9 -0
- package/src/api/router.js +9 -0
- package/src/api/table.js +25 -0
- package/src/api/tree.js +9 -0
- package/src/api/user.js +34 -0
- package/src/assets/error_images/401.png +0 -0
- package/src/assets/error_images/404.png +0 -0
- package/src/assets/error_images/cloud.png +0 -0
- package/src/assets/login_images/background.jpg +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/qr_logo/lqr_logo.png +0 -0
- package/src/assets/vuejs-fill.svg +4 -0
- package/src/components/VabPageHeader/index.vue +133 -0
- package/src/config/index.js +7 -0
- package/src/config/net.config.js +20 -0
- package/src/config/permission.js +136 -0
- package/src/config/setting.config.js +62 -0
- package/src/config/settings.js +6 -0
- package/src/config/theme.config.js +14 -0
- package/src/layouts/EmptyLayout.vue +3 -0
- package/src/layouts/components/VabAppMain/index.vue +109 -0
- package/src/layouts/components/VabAvatar/index.vue +255 -0
- package/src/layouts/components/VabBreadcrumb/index.vue +61 -0
- package/src/layouts/components/VabFullScreen/index.vue +61 -0
- package/src/layouts/components/VabLogo/index.vue +94 -0
- package/src/layouts/components/VabNav/index.vue +176 -0
- package/src/layouts/components/VabSide/components/VabMenuItem.vue +80 -0
- package/src/layouts/components/VabSide/components/VabSideItem.vue +100 -0
- package/src/layouts/components/VabSide/components/VabSubmenu.vue +56 -0
- package/src/layouts/components/VabSide/index.vue +123 -0
- package/src/layouts/components/VabTabs/index.vue +500 -0
- package/src/layouts/components/VabTheme/index.vue +603 -0
- package/src/layouts/components/VabTop/index.vue +286 -0
- package/src/layouts/export.js +29 -0
- package/src/layouts/index.vue +339 -0
- package/src/main.js +40 -0
- package/src/plugins/echarts.js +4 -0
- package/src/plugins/index.js +44 -0
- package/src/plugins/support.js +16 -0
- package/src/router/index.js +400 -0
- package/src/store/index.js +26 -0
- package/src/store/modules/errorLog.js +27 -0
- package/src/store/modules/routes.js +60 -0
- package/src/store/modules/settings.js +73 -0
- package/src/store/modules/table.js +22 -0
- package/src/store/modules/tabsBar.js +109 -0
- package/src/store/modules/user.js +131 -0
- package/src/styles/element-variables.scss +13 -0
- package/src/styles/loading.scss +345 -0
- package/src/styles/nav-icons.scss +52 -0
- package/src/styles/normalize.scss +353 -0
- package/src/styles/spinner/dots.css +68 -0
- package/src/styles/spinner/gauge.css +104 -0
- package/src/styles/spinner/inner-circles.css +51 -0
- package/src/styles/spinner/plus.css +341 -0
- package/src/styles/themes/default.scss +1 -0
- package/src/styles/transition.scss +18 -0
- package/src/styles/vab.scss +476 -0
- package/src/styles/variables.scss +69 -0
- package/src/utils/accessToken.js +56 -0
- package/src/utils/eventBus.js +8 -0
- package/src/utils/handleRoutes.js +100 -0
- package/src/utils/index.js +231 -0
- package/src/utils/message.js +67 -0
- package/src/utils/pageTitle.js +11 -0
- package/src/utils/password.js +43 -0
- package/src/utils/permission.js +19 -0
- package/src/utils/request.js +187 -0
- package/src/utils/static.js +81 -0
- package/src/utils/vab.js +218 -0
- package/src/utils/validate.js +48 -0
- package/src/views/401.vue +302 -0
- package/src/views/404.vue +302 -0
- package/src/views/demo/index.vue +591 -0
- package/src/views/index/index.vue +1489 -0
- package/src/views/login/index.vue +456 -0
- package/src/views/register/index.vue +524 -0
- package/src/views/vab/calendar.vue +488 -0
- package/src/views/vab/campaign.vue +1006 -0
- package/src/views/vab/chart.vue +189 -0
- package/src/views/vab/customer.vue +666 -0
- package/src/views/vab/editor.vue +84 -0
- package/src/views/vab/form.vue +151 -0
- package/src/views/vab/help.vue +390 -0
- package/src/views/vab/icon.vue +113 -0
- package/src/views/vab/knowledge.vue +820 -0
- package/src/views/vab/nested/menu1/menu2/menu3.vue +29 -0
- package/src/views/vab/nested/menu1/menu2.vue +33 -0
- package/src/views/vab/nested/menu1.vue +33 -0
- package/src/views/vab/nested.vue +97 -0
- package/src/views/vab/notification.vue +416 -0
- package/src/views/vab/order.vue +507 -0
- package/src/views/vab/permissions.vue +214 -0
- package/src/views/vab/product.vue +724 -0
- package/src/views/vab/project.vue +559 -0
- package/src/views/vab/settings.vue +319 -0
- package/src/views/vab/statistics.vue +431 -0
- package/src/views/vab/table.vue +110 -0
- package/src/views/vab/task.vue +613 -0
- package/src/views/vab/team.vue +662 -0
- package/src/views/vab/tree.vue +44 -0
- package/src/views/vab/upload.vue +180 -0
- package/src/views/vab/vue3Demo/index.vue +103 -0
- package/src/views/vab/workflow.vue +863 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="menu3-container">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<el-alert
|
|
5
|
+
title="嵌套路由 - 三级菜单"
|
|
6
|
+
type="error"
|
|
7
|
+
description="您当前在 /vab/nested/menu1/menu2/menu3 路径下,这是最深层的嵌套路由"
|
|
8
|
+
/>
|
|
9
|
+
|
|
10
|
+
<div style="margin-top: 20px">
|
|
11
|
+
<el-button type="primary" @click="$router.push('/vab/nested')">
|
|
12
|
+
返回顶层
|
|
13
|
+
</el-button>
|
|
14
|
+
</div>
|
|
15
|
+
</el-card>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
export default {
|
|
21
|
+
name: "Menu3"
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style lang="scss" scoped>
|
|
26
|
+
.menu3-container {
|
|
27
|
+
padding: 20px 0;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="menu2-container">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<el-alert
|
|
5
|
+
title="嵌套路由 - 二级菜单"
|
|
6
|
+
type="warning"
|
|
7
|
+
description="您当前在 /vab/nested/menu1/menu2 路径下"
|
|
8
|
+
/>
|
|
9
|
+
|
|
10
|
+
<div style="margin-top: 20px">
|
|
11
|
+
<el-button type="primary" @click="$router.push('/vab/nested/menu1/menu2/menu3')">
|
|
12
|
+
进入三级菜单
|
|
13
|
+
</el-button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div style="margin-top: 20px">
|
|
17
|
+
<router-view />
|
|
18
|
+
</div>
|
|
19
|
+
</el-card>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: "Menu2"
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" scoped>
|
|
30
|
+
.menu2-container {
|
|
31
|
+
padding: 20px 0;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="menu1-container">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<el-alert
|
|
5
|
+
title="嵌套路由 - 一级菜单"
|
|
6
|
+
type="info"
|
|
7
|
+
description="您当前在 /vab/nested/menu1 路径下"
|
|
8
|
+
/>
|
|
9
|
+
|
|
10
|
+
<div style="margin-top: 20px">
|
|
11
|
+
<el-button type="primary" @click="$router.push('/vab/nested/menu1/menu2')">
|
|
12
|
+
进入二级菜单
|
|
13
|
+
</el-button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div style="margin-top: 20px">
|
|
17
|
+
<router-view />
|
|
18
|
+
</div>
|
|
19
|
+
</el-card>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: "Menu1"
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" scoped>
|
|
30
|
+
.menu1-container {
|
|
31
|
+
padding: 20px 0;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="nested-container">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<el-alert
|
|
5
|
+
title="嵌套路由示例"
|
|
6
|
+
type="success"
|
|
7
|
+
description="这是一个嵌套路由的示例页面,展示了如何在Vue中实现多级路由"
|
|
8
|
+
show-icon
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<el-row :gutter="20" style="margin-top: 20px">
|
|
12
|
+
<el-col :span="8">
|
|
13
|
+
<el-card class="nested-card" shadow="hover">
|
|
14
|
+
<div class="card-content">
|
|
15
|
+
<el-icon class="card-icon"><Folder /></el-icon>
|
|
16
|
+
<h3>一级菜单</h3>
|
|
17
|
+
<p>这是嵌套路由的一级菜单</p>
|
|
18
|
+
<el-button type="primary" @click="$router.push('/vab/nested/menu1')">
|
|
19
|
+
进入一级菜单
|
|
20
|
+
</el-button>
|
|
21
|
+
</div>
|
|
22
|
+
</el-card>
|
|
23
|
+
</el-col>
|
|
24
|
+
|
|
25
|
+
<el-col :span="8">
|
|
26
|
+
<el-card class="nested-card" shadow="hover">
|
|
27
|
+
<div class="card-content">
|
|
28
|
+
<el-icon class="card-icon"><Document /></el-icon>
|
|
29
|
+
<h3>二级菜单</h3>
|
|
30
|
+
<p>这是嵌套路由的二级菜单</p>
|
|
31
|
+
<el-button type="primary" @click="$router.push('/vab/nested/menu1/menu2')">
|
|
32
|
+
进入二级菜单
|
|
33
|
+
</el-button>
|
|
34
|
+
</div>
|
|
35
|
+
</el-card>
|
|
36
|
+
</el-col>
|
|
37
|
+
|
|
38
|
+
<el-col :span="8">
|
|
39
|
+
<el-card class="nested-card" shadow="hover">
|
|
40
|
+
<div class="card-content">
|
|
41
|
+
<el-icon class="card-icon"><Setting /></el-icon>
|
|
42
|
+
<h3>三级菜单</h3>
|
|
43
|
+
<p>这是嵌套路由的三级菜单</p>
|
|
44
|
+
<el-button type="primary" @click="$router.push('/vab/nested/menu1/menu2/menu3')">
|
|
45
|
+
进入三级菜单
|
|
46
|
+
</el-button>
|
|
47
|
+
</div>
|
|
48
|
+
</el-card>
|
|
49
|
+
</el-col>
|
|
50
|
+
</el-row>
|
|
51
|
+
|
|
52
|
+
<div style="margin-top: 20px">
|
|
53
|
+
<router-view />
|
|
54
|
+
</div>
|
|
55
|
+
</el-card>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
import { Folder, Document, Setting } from "@element-plus/icons-vue";
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
name: "Nested",
|
|
64
|
+
components: {
|
|
65
|
+
Folder,
|
|
66
|
+
Document,
|
|
67
|
+
Setting,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style lang="scss" scoped>
|
|
73
|
+
.nested-container {
|
|
74
|
+
padding: 20px;
|
|
75
|
+
|
|
76
|
+
.nested-card {
|
|
77
|
+
text-align: center;
|
|
78
|
+
|
|
79
|
+
.card-content {
|
|
80
|
+
.card-icon {
|
|
81
|
+
font-size: 48px;
|
|
82
|
+
color: #409eff;
|
|
83
|
+
margin-bottom: 15px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
h3 {
|
|
87
|
+
margin-bottom: 10px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
p {
|
|
91
|
+
color: #666;
|
|
92
|
+
margin-bottom: 15px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="notification-container">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<template #header>
|
|
5
|
+
<div class="card-header">
|
|
6
|
+
<span>通知中心</span>
|
|
7
|
+
<el-button
|
|
8
|
+
type="primary"
|
|
9
|
+
@click="showCreateDialog"
|
|
10
|
+
style="float: right; margin-left: 10px;"
|
|
11
|
+
>
|
|
12
|
+
发送通知
|
|
13
|
+
</el-button>
|
|
14
|
+
<el-button
|
|
15
|
+
@click="refreshNotifications"
|
|
16
|
+
style="float: right;"
|
|
17
|
+
>
|
|
18
|
+
刷新
|
|
19
|
+
</el-button>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
|
24
|
+
<el-tab-pane label="全部通知" name="all">
|
|
25
|
+
<el-table
|
|
26
|
+
:data="filteredNotifications"
|
|
27
|
+
style="width: 100%"
|
|
28
|
+
v-loading="loading"
|
|
29
|
+
>
|
|
30
|
+
<el-table-column prop="title" label="标题" width="200">
|
|
31
|
+
<template #default="{ row }">
|
|
32
|
+
<el-badge
|
|
33
|
+
v-if="!row.read"
|
|
34
|
+
is-dot
|
|
35
|
+
class="item"
|
|
36
|
+
>
|
|
37
|
+
{{ row.title }}
|
|
38
|
+
</el-badge>
|
|
39
|
+
<span v-else>{{ row.title }}</span>
|
|
40
|
+
</template>
|
|
41
|
+
</el-table-column>
|
|
42
|
+
<el-table-column prop="content" label="内容">
|
|
43
|
+
<template #default="{ row }">
|
|
44
|
+
<div class="notification-content">{{ row.content }}</div>
|
|
45
|
+
</template>
|
|
46
|
+
</el-table-column>
|
|
47
|
+
<el-table-column prop="sender" label="发送者" width="120" />
|
|
48
|
+
<el-table-column prop="date" label="时间" width="180" />
|
|
49
|
+
<el-table-column label="操作" width="200">
|
|
50
|
+
<template #default="{ row }">
|
|
51
|
+
<el-button
|
|
52
|
+
v-if="!row.read"
|
|
53
|
+
type="primary"
|
|
54
|
+
size="small"
|
|
55
|
+
@click="markAsRead(row)"
|
|
56
|
+
>
|
|
57
|
+
标为已读
|
|
58
|
+
</el-button>
|
|
59
|
+
<el-button
|
|
60
|
+
type="danger"
|
|
61
|
+
size="small"
|
|
62
|
+
@click="deleteNotification(row)"
|
|
63
|
+
>
|
|
64
|
+
删除
|
|
65
|
+
</el-button>
|
|
66
|
+
</template>
|
|
67
|
+
</el-table-column>
|
|
68
|
+
</el-table>
|
|
69
|
+
</el-tab-pane>
|
|
70
|
+
|
|
71
|
+
<el-tab-pane label="未读通知" name="unread">
|
|
72
|
+
<el-table
|
|
73
|
+
:data="unreadNotifications"
|
|
74
|
+
style="width: 100%"
|
|
75
|
+
v-loading="loading"
|
|
76
|
+
>
|
|
77
|
+
<el-table-column prop="title" label="标题" width="200">
|
|
78
|
+
<template #default="{ row }">
|
|
79
|
+
<el-badge is-dot class="item">
|
|
80
|
+
{{ row.title }}
|
|
81
|
+
</el-badge>
|
|
82
|
+
</template>
|
|
83
|
+
</el-table-column>
|
|
84
|
+
<el-table-column prop="content" label="内容">
|
|
85
|
+
<template #default="{ row }">
|
|
86
|
+
<div class="notification-content">{{ row.content }}</div>
|
|
87
|
+
</template>
|
|
88
|
+
</el-table-column>
|
|
89
|
+
<el-table-column prop="sender" label="发送者" width="120" />
|
|
90
|
+
<el-table-column prop="date" label="时间" width="180" />
|
|
91
|
+
<el-table-column label="操作" width="200">
|
|
92
|
+
<template #default="{ row }">
|
|
93
|
+
<el-button
|
|
94
|
+
type="primary"
|
|
95
|
+
size="small"
|
|
96
|
+
@click="markAsRead(row)"
|
|
97
|
+
>
|
|
98
|
+
标为已读
|
|
99
|
+
</el-button>
|
|
100
|
+
<el-button
|
|
101
|
+
type="danger"
|
|
102
|
+
size="small"
|
|
103
|
+
@click="deleteNotification(row)"
|
|
104
|
+
>
|
|
105
|
+
删除
|
|
106
|
+
</el-button>
|
|
107
|
+
</template>
|
|
108
|
+
</el-table-column>
|
|
109
|
+
</el-table>
|
|
110
|
+
</el-tab-pane>
|
|
111
|
+
|
|
112
|
+
<el-tab-pane label="已读通知" name="read">
|
|
113
|
+
<el-table
|
|
114
|
+
:data="readNotifications"
|
|
115
|
+
style="width: 100%"
|
|
116
|
+
v-loading="loading"
|
|
117
|
+
>
|
|
118
|
+
<el-table-column prop="title" label="标题" width="200" />
|
|
119
|
+
<el-table-column prop="content" label="内容">
|
|
120
|
+
<template #default="{ row }">
|
|
121
|
+
<div class="notification-content">{{ row.content }}</div>
|
|
122
|
+
</template>
|
|
123
|
+
</el-table-column>
|
|
124
|
+
<el-table-column prop="sender" label="发送者" width="120" />
|
|
125
|
+
<el-table-column prop="date" label="时间" width="180" />
|
|
126
|
+
<el-table-column label="操作" width="120">
|
|
127
|
+
<template #default="{ row }">
|
|
128
|
+
<el-button
|
|
129
|
+
type="danger"
|
|
130
|
+
size="small"
|
|
131
|
+
@click="deleteNotification(row)"
|
|
132
|
+
>
|
|
133
|
+
删除
|
|
134
|
+
</el-button>
|
|
135
|
+
</template>
|
|
136
|
+
</el-table-column>
|
|
137
|
+
</el-table>
|
|
138
|
+
</el-tab-pane>
|
|
139
|
+
</el-tabs>
|
|
140
|
+
|
|
141
|
+
<div class="pagination-container">
|
|
142
|
+
<el-pagination
|
|
143
|
+
v-model:current-page="currentPage"
|
|
144
|
+
v-model:page-size="pageSize"
|
|
145
|
+
:page-sizes="[10, 20, 50, 100]"
|
|
146
|
+
:total="totalNotifications"
|
|
147
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
148
|
+
@size-change="handleSizeChange"
|
|
149
|
+
@current-change="handleCurrentChange"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</el-card>
|
|
153
|
+
|
|
154
|
+
<!-- 发送通知对话框 -->
|
|
155
|
+
<el-dialog
|
|
156
|
+
v-model="dialogVisible"
|
|
157
|
+
title="发送通知"
|
|
158
|
+
width="600px"
|
|
159
|
+
>
|
|
160
|
+
<el-form
|
|
161
|
+
ref="notificationFormRef"
|
|
162
|
+
:model="notificationForm"
|
|
163
|
+
:rules="notificationRules"
|
|
164
|
+
label-width="80px"
|
|
165
|
+
>
|
|
166
|
+
<el-form-item label="标题" prop="title">
|
|
167
|
+
<el-input v-model="notificationForm.title" />
|
|
168
|
+
</el-form-item>
|
|
169
|
+
|
|
170
|
+
<el-form-item label="内容" prop="content">
|
|
171
|
+
<el-input
|
|
172
|
+
v-model="notificationForm.content"
|
|
173
|
+
type="textarea"
|
|
174
|
+
:rows="4"
|
|
175
|
+
/>
|
|
176
|
+
</el-form-item>
|
|
177
|
+
|
|
178
|
+
<el-form-item label="接收者" prop="recipients">
|
|
179
|
+
<el-select
|
|
180
|
+
v-model="notificationForm.recipients"
|
|
181
|
+
multiple
|
|
182
|
+
placeholder="请选择接收者"
|
|
183
|
+
style="width: 100%"
|
|
184
|
+
>
|
|
185
|
+
<el-option
|
|
186
|
+
v-for="user in users"
|
|
187
|
+
:key="user.id"
|
|
188
|
+
:label="user.name"
|
|
189
|
+
:value="user.id"
|
|
190
|
+
/>
|
|
191
|
+
</el-select>
|
|
192
|
+
</el-form-item>
|
|
193
|
+
|
|
194
|
+
<el-form-item label="紧急程度">
|
|
195
|
+
<el-radio-group v-model="notificationForm.priority">
|
|
196
|
+
<el-radio :label="1">普通</el-radio>
|
|
197
|
+
<el-radio :label="2">重要</el-radio>
|
|
198
|
+
<el-radio :label="3">紧急</el-radio>
|
|
199
|
+
</el-radio-group>
|
|
200
|
+
</el-form-item>
|
|
201
|
+
</el-form>
|
|
202
|
+
|
|
203
|
+
<template #footer>
|
|
204
|
+
<span class="dialog-footer">
|
|
205
|
+
<el-button @click="dialogVisible = false">取消</el-button>
|
|
206
|
+
<el-button
|
|
207
|
+
type="primary"
|
|
208
|
+
@click="sendNotification"
|
|
209
|
+
:loading="sending"
|
|
210
|
+
>
|
|
211
|
+
发送
|
|
212
|
+
</el-button>
|
|
213
|
+
</span>
|
|
214
|
+
</template>
|
|
215
|
+
</el-dialog>
|
|
216
|
+
</div>
|
|
217
|
+
</template>
|
|
218
|
+
|
|
219
|
+
<script>
|
|
220
|
+
export default {
|
|
221
|
+
name: "Notification",
|
|
222
|
+
data() {
|
|
223
|
+
return {
|
|
224
|
+
activeTab: "all",
|
|
225
|
+
currentPage: 1,
|
|
226
|
+
pageSize: 10,
|
|
227
|
+
totalNotifications: 0,
|
|
228
|
+
loading: false,
|
|
229
|
+
sending: false,
|
|
230
|
+
dialogVisible: false,
|
|
231
|
+
notifications: [
|
|
232
|
+
{
|
|
233
|
+
id: 1,
|
|
234
|
+
title: "系统维护通知",
|
|
235
|
+
content: "系统将于今晚00:00-02:00进行例行维护,请提前做好相关准备。",
|
|
236
|
+
sender: "系统管理员",
|
|
237
|
+
date: "2023-05-15 14:30",
|
|
238
|
+
read: false,
|
|
239
|
+
priority: 3
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: 2,
|
|
243
|
+
title: "新功能上线",
|
|
244
|
+
content: "我们新增了数据可视化功能,欢迎体验使用。",
|
|
245
|
+
sender: "产品团队",
|
|
246
|
+
date: "2023-05-14 09:15",
|
|
247
|
+
read: true,
|
|
248
|
+
priority: 1
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: 3,
|
|
252
|
+
title: "安全更新提醒",
|
|
253
|
+
content: "检测到您的密码强度较弱,请及时修改以确保账户安全。",
|
|
254
|
+
sender: "安全团队",
|
|
255
|
+
date: "2023-05-12 16:45",
|
|
256
|
+
read: false,
|
|
257
|
+
priority: 2
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: 4,
|
|
261
|
+
title: "会议通知",
|
|
262
|
+
content: "本周五下午3点将召开全体成员会议,请准时参加。",
|
|
263
|
+
sender: "人事部",
|
|
264
|
+
date: "2023-05-10 11:20",
|
|
265
|
+
read: true,
|
|
266
|
+
priority: 2
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: 5,
|
|
270
|
+
title: "系统升级完成",
|
|
271
|
+
content: "系统v2.0版本已升级完成,新增多项功能和优化。",
|
|
272
|
+
sender: "技术部",
|
|
273
|
+
date: "2023-05-08 18:00",
|
|
274
|
+
read: true,
|
|
275
|
+
priority: 1
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
notificationForm: {
|
|
279
|
+
title: "",
|
|
280
|
+
content: "",
|
|
281
|
+
recipients: [],
|
|
282
|
+
priority: 1
|
|
283
|
+
},
|
|
284
|
+
notificationRules: {
|
|
285
|
+
title: [
|
|
286
|
+
{ required: true, message: "请输入通知标题", trigger: "blur" }
|
|
287
|
+
],
|
|
288
|
+
content: [
|
|
289
|
+
{ required: true, message: "请输入通知内容", trigger: "blur" }
|
|
290
|
+
],
|
|
291
|
+
recipients: [
|
|
292
|
+
{ required: true, message: "请选择接收者", trigger: "change" }
|
|
293
|
+
]
|
|
294
|
+
},
|
|
295
|
+
users: [
|
|
296
|
+
{ id: 1, name: "张三" },
|
|
297
|
+
{ id: 2, name: "李四" },
|
|
298
|
+
{ id: 3, name: "王五" },
|
|
299
|
+
{ id: 4, name: "赵六" },
|
|
300
|
+
{ id: 5, name: "钱七" }
|
|
301
|
+
]
|
|
302
|
+
};
|
|
303
|
+
},
|
|
304
|
+
computed: {
|
|
305
|
+
filteredNotifications() {
|
|
306
|
+
// 分页处理
|
|
307
|
+
const start = (this.currentPage - 1) * this.pageSize;
|
|
308
|
+
const end = start + this.pageSize;
|
|
309
|
+
return this.notifications.slice(start, end);
|
|
310
|
+
},
|
|
311
|
+
unreadNotifications() {
|
|
312
|
+
return this.notifications.filter(n => !n.read);
|
|
313
|
+
},
|
|
314
|
+
readNotifications() {
|
|
315
|
+
return this.notifications.filter(n => n.read);
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
methods: {
|
|
319
|
+
handleTabChange(tab) {
|
|
320
|
+
this.activeTab = tab;
|
|
321
|
+
this.currentPage = 1;
|
|
322
|
+
},
|
|
323
|
+
handleSizeChange(val) {
|
|
324
|
+
this.pageSize = val;
|
|
325
|
+
this.currentPage = 1;
|
|
326
|
+
},
|
|
327
|
+
handleCurrentChange(val) {
|
|
328
|
+
this.currentPage = val;
|
|
329
|
+
},
|
|
330
|
+
markAsRead(notification) {
|
|
331
|
+
const index = this.notifications.findIndex(n => n.id === notification.id);
|
|
332
|
+
if (index !== -1) {
|
|
333
|
+
this.notifications[index].read = true;
|
|
334
|
+
this.$message.success("已标记为已读");
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
deleteNotification(notification) {
|
|
338
|
+
this.$confirm(`确定要删除通知"${notification.title}"吗?`, "提示", {
|
|
339
|
+
confirmButtonText: "确定",
|
|
340
|
+
cancelButtonText: "取消",
|
|
341
|
+
type: "warning"
|
|
342
|
+
}).then(() => {
|
|
343
|
+
const index = this.notifications.findIndex(n => n.id === notification.id);
|
|
344
|
+
if (index !== -1) {
|
|
345
|
+
this.notifications.splice(index, 1);
|
|
346
|
+
this.totalNotifications = this.notifications.length;
|
|
347
|
+
this.$message.success("删除成功");
|
|
348
|
+
}
|
|
349
|
+
}).catch(() => {
|
|
350
|
+
this.$message.info("已取消删除");
|
|
351
|
+
});
|
|
352
|
+
},
|
|
353
|
+
showCreateDialog() {
|
|
354
|
+
this.dialogVisible = true;
|
|
355
|
+
this.$nextTick(() => {
|
|
356
|
+
this.$refs.notificationFormRef.resetFields();
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
sendNotification() {
|
|
360
|
+
this.$refs.notificationFormRef.validate((valid) => {
|
|
361
|
+
if (valid) {
|
|
362
|
+
this.sending = true;
|
|
363
|
+
|
|
364
|
+
// 模拟发送过程
|
|
365
|
+
setTimeout(() => {
|
|
366
|
+
const newNotification = {
|
|
367
|
+
id: this.notifications.length + 1,
|
|
368
|
+
...this.notificationForm,
|
|
369
|
+
sender: "当前用户",
|
|
370
|
+
date: new Date().toLocaleString(),
|
|
371
|
+
read: false
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
this.notifications.unshift(newNotification);
|
|
375
|
+
this.totalNotifications = this.notifications.length;
|
|
376
|
+
this.dialogVisible = false;
|
|
377
|
+
this.sending = false;
|
|
378
|
+
this.$message.success("通知发送成功");
|
|
379
|
+
}, 1000);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
refreshNotifications() {
|
|
384
|
+
this.loading = true;
|
|
385
|
+
// 模拟刷新过程
|
|
386
|
+
setTimeout(() => {
|
|
387
|
+
this.loading = false;
|
|
388
|
+
this.$message.success("刷新成功");
|
|
389
|
+
}, 500);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
</script>
|
|
394
|
+
|
|
395
|
+
<style lang="scss" scoped>
|
|
396
|
+
.notification-container {
|
|
397
|
+
padding: 20px;
|
|
398
|
+
|
|
399
|
+
.card-header {
|
|
400
|
+
font-weight: bold;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.notification-content {
|
|
404
|
+
display: -webkit-box;
|
|
405
|
+
-webkit-box-orient: vertical;
|
|
406
|
+
-webkit-line-clamp: 2;
|
|
407
|
+
overflow: hidden;
|
|
408
|
+
text-overflow: ellipsis;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.pagination-container {
|
|
412
|
+
margin-top: 20px;
|
|
413
|
+
text-align: right;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
</style>
|