6
6
</el-form-item >
7
7
<el-form-item label =" 公告状态" prop =" status" >
8
8
<el-select v-model =" queryParams.status" placeholder =" 公告状态" clearable >
9
- <el-option v-for =" dict in statusDictDatas" :key =" parseInt(dict.value)" :label =" dict.label" :value =" parseInt(dict.value)" />
9
+ <el-option v-for =" dict in statusDictDatas" :key =" parseInt(dict.value)" :label =" dict.label"
10
+ :value =" parseInt(dict.value)" />
10
11
</el-select >
11
12
</el-form-item >
12
13
<el-form-item >
18
19
<el-row :gutter =" 10" class =" mb8" >
19
20
<el-col :span =" 1.5" >
20
21
<el-button type =" primary" plain icon =" el-icon-plus" size =" mini" @click =" handleAdd"
21
- v-hasPermi =" ['system:notice:create']" s >新增</el-button >
22
+ v-hasPermi =" ['system:notice:create']" s >新增
23
+ </el-button >
22
24
</el-col >
23
25
<right-toolbar :showSearch.sync =" showSearch" @queryTable =" getList" ></right-toolbar >
24
26
</el-row >
25
27
26
28
<el-table v-loading =" loading" :data =" noticeList" >
27
- <el-table-column label =" 序号" align =" center" prop =" id" width =" 100" />
29
+ <el-table-column label =" 序号" align =" center" prop =" id" width =" 100" />
28
30
<el-table-column label =" 公告标题" align =" center" prop =" title" :show-overflow-tooltip =" true" />
29
31
<el-table-column label =" 公告类型" align =" center" prop =" type" width =" 100" >
30
32
<template v-slot =" scope " >
36
38
<dict-tag :type =" DICT_TYPE.COMMON_STATUS" :value =" scope.row.status" />
37
39
</template >
38
40
</el-table-column >
39
- <el-table-column label =" 创建者" align =" center" prop =" createBy" width =" 100" />
41
+ <el-table-column label =" 创建者" align =" center" prop =" createBy" width =" 100" />
40
42
<el-table-column label =" 创建时间" align =" center" prop =" createTime" width =" 100" >
41
43
<template v-slot =" scope " >
42
44
<span >{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span >
45
47
<el-table-column label =" 操作" align =" center" class-name =" small-padding fixed-width" >
46
48
<template v-slot =" scope " >
47
49
<el-button size =" mini" type =" text" icon =" el-icon-edit" @click =" handleUpdate(scope.row)"
48
- v-hasPermi =" ['system:notice:update']" >修改</el-button >
50
+ v-hasPermi =" ['system:notice:update']" >修改
51
+ </el-button >
49
52
<el-button size =" mini" type =" text" icon =" el-icon-delete" @click =" handleDelete(scope.row)"
50
- v-hasPermi =" ['system:notice:delete']" >删除</el-button >
53
+ v-hasPermi =" ['system:notice:delete']" >删除
54
+ </el-button >
55
+ <el-button size =" mini" type =" text" @click =" handlePush(scope.row.id)"
56
+ v-hasPermi =" ['system:notice:update']" >推送
57
+ </el-button >
51
58
</template >
52
59
</el-table-column >
53
60
</el-table >
61
68
<el-row >
62
69
<el-col :span =" 12" >
63
70
<el-form-item label =" 公告标题" prop =" title" >
64
- <el-input v-model =" form.title" placeholder =" 请输入公告标题" />
71
+ <el-input v-model =" form.title" placeholder =" 请输入公告标题" />
65
72
</el-form-item >
66
73
</el-col >
67
74
<el-col :span =" 12" >
83
90
v-for =" dict in statusDictDatas"
84
91
:key =" parseInt(dict.value)"
85
92
:label =" parseInt(dict.value)"
86
- >{{dict.label}}</el-radio >
93
+ >{{ dict.label }}
94
+ </el-radio >
87
95
</el-radio-group >
88
96
</el-form-item >
89
97
</el-col >
103
111
</template >
104
112
105
113
<script >
106
- import { listNotice , getNotice , delNotice , addNotice , updateNotice } from " @/api/system/notice" ;
114
+ import {addNotice , delNotice , getNotice , listNotice , pushNotice , updateNotice } from " @/api/system/notice" ;
107
115
import Editor from ' @/components/Editor' ;
108
116
109
117
import {CommonStatusEnum } from ' @/utils/constants'
110
- import { getDictDatas , DICT_TYPE } from ' @/utils/dict'
118
+ import {DICT_TYPE , getDictDatas } from ' @/utils/dict'
111
119
112
120
export default {
113
121
name: " SystemNotice" ,
@@ -140,10 +148,10 @@ export default {
140
148
// 表单校验
141
149
rules: {
142
150
title: [
143
- { required: true , message: " 公告标题不能为空" , trigger: " blur" }
151
+ {required: true , message: " 公告标题不能为空" , trigger: " blur" }
144
152
],
145
153
type: [
146
- { required: true , message: " 公告类型不能为空" , trigger: " change" }
154
+ {required: true , message: " 公告类型不能为空" , trigger: " change" }
147
155
]
148
156
},
149
157
@@ -210,7 +218,7 @@ export default {
210
218
});
211
219
},
212
220
/** 提交按钮 */
213
- submitForm : function () {
221
+ submitForm : function () {
214
222
this .$refs [" form" ].validate (valid => {
215
223
if (valid) {
216
224
if (this .form .id !== undefined ) {
@@ -232,12 +240,27 @@ export default {
232
240
/** 删除按钮操作 */
233
241
handleDelete (row ) {
234
242
const ids = row .id || this .ids
235
- this .$modal .confirm (' 是否确认删除公告编号为"' + ids + ' "的数据项?' ).then (function () {
236
- return delNotice (ids);
237
- }).then (() => {
238
- this .getList ();
239
- this .$modal .msgSuccess (" 删除成功" );
240
- }).catch (() => {});
243
+ this .$modal .confirm (' 是否确认删除公告编号为"' + ids + ' "的数据项?' ).then (function () {
244
+ return delNotice (ids);
245
+ }).then (() => {
246
+ this .getList ();
247
+ this .$modal .msgSuccess (" 删除成功" );
248
+ }).catch (() => {
249
+ });
250
+ },
251
+ /** 推送按钮操作 */
252
+ handlePush (id ) {
253
+ try {
254
+ const self = this ;
255
+ // 推送的二次确认
256
+ this .$modal .confirm (' 是否推送所选中通知?' ).then (() => {
257
+ // 发起推送
258
+ pushNotice (id).then (() => {
259
+ self .$modal .success (' 推送成功' );
260
+ })
261
+ })
262
+ } catch {
263
+ }
241
264
}
242
265
}
243
266
};
0 commit comments