Skip to content

Commit f92a77d

Browse files
committed
站内信开发
1 parent ecea771 commit f92a77d

File tree

7 files changed

+716
-0
lines changed

7 files changed

+716
-0
lines changed

src/api/system/notify/myNotify.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import request from '@/utils/request'
2+
3+
4+
// 获得我的站内信分页
5+
export function getNotifyMessagePage(query) {
6+
return request({
7+
url: '/system/notify-message/page',
8+
method: 'get',
9+
params: query
10+
})
11+
}
12+
13+
// 获得单条我的站内信
14+
export function getNotifyMessage(query) {
15+
return request({
16+
url: '/system/notify-message/get',
17+
method: 'get',
18+
params: query
19+
})
20+
}
21+
22+
// 批量标记已读
23+
export function updateNotifyMessageListRead(data) {
24+
return request({
25+
url: '/system/notify-message/update-list-read',
26+
method: 'put',
27+
data: data
28+
})
29+
}
30+
31+
// 所有未读消息标记已读
32+
export function updateNotifyMessageAllRead(data) {
33+
return request({
34+
url: '/system/notify-message/update-all-read',
35+
method: 'put',
36+
data: data
37+
})
38+
}

src/api/system/notify/notifyLog.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import request from '@/utils/request'
2+
3+
4+
// 获得我的站内信分页
5+
export function getNotifyLogPage(query) {
6+
return request({
7+
url: '/system/notify-log/page',
8+
method: 'get',
9+
params: query
10+
})
11+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import request from '@/utils/request'
2+
3+
// 创建站内信模板
4+
export function createNotifyTemplate(data) {
5+
return request({
6+
url: '/system/notify-template/create',
7+
method: 'post',
8+
data: data
9+
})
10+
}
11+
12+
// 更新站内信模板
13+
export function updateNotifyTemplate(data) {
14+
return request({
15+
url: '/system/notify-template/update',
16+
method: 'put',
17+
data: data
18+
})
19+
}
20+
21+
// 删除站内信模板
22+
export function deleteNotifyTemplate(id) {
23+
return request({
24+
url: '/system/notify-template/delete?id=' + id,
25+
method: 'delete'
26+
})
27+
}
28+
29+
// 获得站内信模板
30+
export function getNotifyTemplate(id) {
31+
return request({
32+
url: '/system/notify-template/get?id=' + id,
33+
method: 'get'
34+
})
35+
}
36+
37+
// 获得站内信模板分页
38+
export function getNotifyTemplatePage(query) {
39+
return request({
40+
url: '/system/notify-template/page',
41+
method: 'get',
42+
params: query
43+
})
44+
}
45+
46+
// 创建站内信模板
47+
export function sendNotify(data) {
48+
return request({
49+
url: '/system/notify-template/send-notify',
50+
method: 'post',
51+
data: data
52+
})
53+
}
54+
55+
// 导出站内信模板 Excel
56+
export function exportNotifyTemplateExcel(query) {
57+
return request({
58+
url: '/system/notify-template/export-excel',
59+
method: 'get',
60+
params: query,
61+
responseType: 'blob'
62+
})
63+
}
64+

src/utils/dict.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const DICT_TYPE = {
2424
SYSTEM_SMS_RECEIVE_STATUS: 'system_sms_receive_status',
2525
SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type',
2626
SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type',
27+
SYSTEM_NOTIFY_READ_STATUS: "system_notify_read_status",
2728

2829
// ========== INFRA 模块 ==========
2930
INFRA_BOOLEAN_STRING: 'infra_boolean_string',

src/views/system/notify/myNotify.vue

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<template>
2+
<div class="app-container">
3+
<!-- 搜索工作栏 -->
4+
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px">
5+
<el-form-item label="模板标题" prop="title">
6+
<el-input v-model="queryParams.title" placeholder="请输入模板标题" clearable @keyup.enter.native="handleQuery"/>
7+
</el-form-item>
8+
<el-form-item label="读取状态" prop="readStatus">
9+
<el-select v-model="queryParams.readStatus" placeholder="请选择状态" clearable>
10+
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS)"
11+
:key="dict.value" :label="dict.label" :value="dict.value"/>
12+
</el-select>
13+
</el-form-item>
14+
<el-form-item label="创建时间" prop="createTime">
15+
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
16+
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
17+
</el-form-item>
18+
<el-form-item>
19+
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
20+
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
21+
</el-form-item>
22+
</el-form>
23+
24+
<!-- 操作工具栏 -->
25+
<el-row :gutter="10" class="mb8">
26+
<el-col :span="1.5">
27+
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUpdateList">标记已读</el-button>
28+
</el-col>
29+
<el-col :span="1.5">
30+
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUpdateAll">全部已读</el-button>
31+
</el-col>
32+
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
33+
</el-row>
34+
35+
<!-- 列表 -->
36+
<el-table v-loading="loading" ref="tables" :data="list">
37+
<el-table-column type="selection" width="55" />
38+
<el-table-column label="模板标题" align="center" prop="title" />
39+
<el-table-column label="模板内容" align="center" prop="content" width="300" />
40+
<el-table-column label="发送人" align="center" prop="sendUserName" />
41+
<el-table-column label="发送时间" align="center" prop="sendTime" width="180">
42+
<template slot-scope="scope">
43+
<span>{{ parseTime(scope.row.sendTime) }}</span>
44+
</template>
45+
</el-table-column>
46+
<el-table-column label="读取状态" align="center" prop="readStatus">
47+
<template slot-scope="scope">
48+
<dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS" :value="scope.row.readStatus"/>
49+
</template>
50+
</el-table-column>
51+
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
52+
<template slot-scope="scope">
53+
<el-button v-show="!scope.row.readStatus" size="mini" type="text" icon="el-icon-check" @click="handleUpdateSingle(scope.row)">已读</el-button>
54+
</template>
55+
</el-table-column>
56+
</el-table>
57+
<!-- 分页组件 -->
58+
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
59+
@pagination="getList"/>
60+
61+
</div>
62+
</template>
63+
64+
<script>
65+
import { getNotifyMessagePage, updateNotifyMessageListRead, updateNotifyMessageAllRead} from "@/api/system/notify/myNotify";
66+
67+
export default {
68+
name: "myNotify",
69+
data() {
70+
return {
71+
// 遮罩层
72+
loading: true,
73+
// 导出遮罩层
74+
exportLoading: false,
75+
// 显示搜索条件
76+
showSearch: true,
77+
// 总条数
78+
total: 0,
79+
// 我的站内信列表
80+
list: [],
81+
// 弹出层标题
82+
title: "",
83+
// 是否显示弹出层
84+
open: false,
85+
// 查询参数
86+
queryParams: {
87+
pageNo: 1,
88+
pageSize: 10,
89+
readStatus: null,
90+
code: null,
91+
title: null,
92+
createTime: []
93+
},
94+
};
95+
},
96+
created() {
97+
this.getList();
98+
},
99+
methods: {
100+
/** 查询列表 */
101+
getList() {
102+
this.loading = true;
103+
// 执行查询
104+
getNotifyMessagePage(this.queryParams).then(response => {
105+
this.list = response.data.list;
106+
this.total = response.data.total;
107+
this.loading = false;
108+
});
109+
},
110+
/** 搜索按钮操作 */
111+
handleQuery() {
112+
this.queryParams.pageNo = 1;
113+
this.getList();
114+
},
115+
/** 重置按钮操作 */
116+
resetQuery() {
117+
this.resetForm("queryForm");
118+
this.handleQuery();
119+
},
120+
handleUpdateList(){
121+
let list = this.$refs["tables"].selection;
122+
if(list.length != 0){
123+
this.handleUpdate(list.map(v=>v.id))
124+
}
125+
},
126+
handleUpdateSingle(row){
127+
this.handleUpdate([row.id])
128+
},
129+
handleUpdate(ids){
130+
updateNotifyMessageListRead(ids).then(response => {
131+
this.$modal.msgSuccess("修改成功");
132+
this.getList();
133+
});
134+
},
135+
handleUpdateAll(){
136+
updateNotifyMessageAllRead().then(response => {
137+
this.$modal.msgSuccess("修改成功");
138+
this.getList();
139+
});
140+
}
141+
}
142+
}
143+
</script>

src/views/system/notify/notifyLog.vue

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<template>
2+
<div class="app-container">
3+
<!-- 搜索工作栏 -->
4+
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px">
5+
<el-form-item label="模板编码" prop="templateCode">
6+
<el-input v-model="queryParams.templateCode" placeholder="请输入模板编码" clearable @keyup.enter.native="handleQuery"/>
7+
</el-form-item>
8+
<el-form-item label="模板标题" prop="title">
9+
<el-input v-model="queryParams.title" placeholder="请输入模板标题" clearable @keyup.enter.native="handleQuery"/>
10+
</el-form-item>
11+
<el-form-item label="发送时间" prop="sendTime">
12+
<el-date-picker v-model="queryParams.sendTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
13+
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
14+
</el-form-item>
15+
<el-form-item>
16+
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
17+
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
18+
</el-form-item>
19+
</el-form>
20+
21+
<!-- 操作工具栏 -->
22+
<!-- <el-row :gutter="10" class="mb8">
23+
<el-col :span="1.5">
24+
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
25+
v-hasPermi="['system:notify-log:export']">导出</el-button>
26+
</el-col>
27+
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
28+
</el-row> -->
29+
30+
<!-- 列表 -->
31+
<el-table v-loading="loading" :data="list">
32+
<el-table-column label="模板编码" align="center" prop="templateCode" />
33+
<el-table-column label="模板标题" align="center" prop="title" />
34+
<el-table-column label="模板内容" align="center" prop="content" width="300" />
35+
<el-table-column label="阅读状态" align="center" prop="readStatus">
36+
<template slot-scope="scope">
37+
<dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS" :value="scope.row.readStatus"/>
38+
</template>
39+
</el-table-column>
40+
<el-table-column label="接收人" align="center" prop="receiveUserName" />
41+
<el-table-column label="发送时间" align="center" prop="sendTime" width="180">
42+
<template slot-scope="scope">
43+
<span>{{ parseTime(scope.row.sendTime) }}</span>
44+
</template>
45+
</el-table-column>
46+
<el-table-column label="阅读时间" align="center" prop="createTime" width="180">
47+
<template slot-scope="scope">
48+
<span>{{ parseTime(scope.row.readTime) }}</span>
49+
</template>
50+
</el-table-column>
51+
</el-table>
52+
<!-- 分页组件 -->
53+
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
54+
@pagination="getList"/>
55+
56+
</div>
57+
</template>
58+
59+
<script>
60+
import { getNotifyLogPage} from "@/api/system/notify/notifyLog";
61+
62+
export default {
63+
name: "notifyLog",
64+
data() {
65+
return {
66+
// 遮罩层
67+
loading: true,
68+
// 导出遮罩层
69+
exportLoading: false,
70+
// 显示搜索条件
71+
showSearch: true,
72+
// 总条数
73+
total: 0,
74+
// 我的站内信列表
75+
list: [],
76+
// 弹出层标题
77+
title: "",
78+
// 是否显示弹出层
79+
open: false,
80+
// 查询参数
81+
queryParams: {
82+
pageNo: 1,
83+
pageSize: 10,
84+
templateCode: null,
85+
title: null,
86+
sendTime: []
87+
},
88+
};
89+
},
90+
created() {
91+
this.getList();
92+
},
93+
methods: {
94+
/** 查询列表 */
95+
getList() {
96+
this.loading = true;
97+
// 执行查询
98+
getNotifyLogPage(this.queryParams).then(response => {
99+
this.list = response.data.list;
100+
this.total = response.data.total;
101+
this.loading = false;
102+
});
103+
},
104+
/** 搜索按钮操作 */
105+
handleQuery() {
106+
this.queryParams.pageNo = 1;
107+
this.getList();
108+
},
109+
/** 重置按钮操作 */
110+
resetQuery() {
111+
this.resetForm("queryForm");
112+
this.handleQuery();
113+
},
114+
}
115+
}
116+
</script>
117+
118+
<style>
119+
120+
</style>

0 commit comments

Comments
 (0)