|
@@ -21,18 +21,12 @@
|
21
|
21
|
style="width: 150px"
|
22
|
22
|
/>
|
23
|
23
|
</div>
|
24
|
|
- <Button type="primary" class="primary_btn" @click="toAdd()">新建</Button>
|
25
|
24
|
</div>
|
26
|
25
|
<div class="table_wrap">
|
27
|
26
|
<Table :columns="columns" :data="searchForm.list">
|
28
|
|
- <template slot-scope="{ row }" slot="noticeTypeSlot">
|
29
|
|
- <div>{{ row.noticeType === 1 ? "所有区域" : "自定义区域" }}</div>
|
30
|
|
- </template>
|
31
|
27
|
<template slot-scope="{ row }" slot="actionSlot">
|
32
|
28
|
<div class="action_list">
|
33
|
29
|
<div @click="toView(row)">查看</div>
|
34
|
|
- <div @click="toEdit(row)">编辑</div>
|
35
|
|
- <div class="action_del" @click="toDel(row)">删除</div>
|
36
|
30
|
</div>
|
37
|
31
|
</template>
|
38
|
32
|
</Table>
|
|
@@ -50,60 +44,6 @@
|
50
|
44
|
show-sizer
|
51
|
45
|
></Page>
|
52
|
46
|
</div>
|
53
|
|
- <!-- 新建/编辑 -->
|
54
|
|
- <Modal
|
55
|
|
- class="modal1"
|
56
|
|
- :mask-closable="false"
|
57
|
|
- v-model="noticeInfo.show"
|
58
|
|
- :title="noticeInfo.noticeid ? '编辑' : '新建'"
|
59
|
|
- >
|
60
|
|
- <Form
|
61
|
|
- v-if="noticeInfo.show"
|
62
|
|
- ref="addForm"
|
63
|
|
- :model="noticeInfo"
|
64
|
|
- :rules="rules"
|
65
|
|
- :label-width="60"
|
66
|
|
- >
|
67
|
|
- <FormItem label="标题" prop="noticeTitle">
|
68
|
|
- <Input
|
69
|
|
- v-model="noticeInfo.noticeTitle"
|
70
|
|
- placeholder="请输入标题"
|
71
|
|
- ></Input>
|
72
|
|
- </FormItem>
|
73
|
|
- <FormItem label="内容" prop="noticeContent">
|
74
|
|
- <MyCkeditor
|
75
|
|
- editor_ref="noticeEditor"
|
76
|
|
- :height="240"
|
77
|
|
- savefolder="/notice"
|
78
|
|
- @change="getNoticeContent"
|
79
|
|
- :content="noticeInfo.noticeContent"
|
80
|
|
- ></MyCkeditor>
|
81
|
|
- </FormItem>
|
82
|
|
- <FormItem label="接收" prop="noticeType">
|
83
|
|
- <RadioGroup
|
84
|
|
- v-model="noticeInfo.noticeType"
|
85
|
|
- @on-change="noticeInfo.regionids = []"
|
86
|
|
- >
|
87
|
|
- <Radio :label="1" font="16">所有区域</Radio>
|
88
|
|
- <Radio :label="2" font="16">自定义区域</Radio>
|
89
|
|
- </RadioGroup>
|
90
|
|
- <div v-if="noticeInfo.noticeType === 2">
|
91
|
|
- <CheckboxGroup v-model="noticeInfo.regionids">
|
92
|
|
- <Checkbox
|
93
|
|
- :label="regionItem.regionid"
|
94
|
|
- v-for="regionItem in noticeInfo.regionList"
|
95
|
|
- :key="regionItem.regionid"
|
96
|
|
- >{{ regionItem.regionName }}</Checkbox
|
97
|
|
- >
|
98
|
|
- </CheckboxGroup>
|
99
|
|
- </div>
|
100
|
|
- </FormItem>
|
101
|
|
- </Form>
|
102
|
|
- <div slot="footer">
|
103
|
|
- <Button @click="noticeInfo.show = false">取消</Button>
|
104
|
|
- <Button @click="saveAddInfo()" type="primary">保存</Button>
|
105
|
|
- </div>
|
106
|
|
- </Modal>
|
107
|
47
|
<!-- 查看 -->
|
108
|
48
|
<Modal
|
109
|
49
|
class="modal1"
|
|
@@ -117,11 +57,6 @@
|
117
|
57
|
<div>{{ viewInfo.updatetime }}</div>
|
118
|
58
|
</div>
|
119
|
59
|
<div class="notice_content" v-html="viewInfo.noticeContent"></div>
|
120
|
|
- <div v-if="viewInfo.noticeType === 2" class="notice_regions">
|
121
|
|
- <div v-for="regionItem in viewInfo.regions" :key="regionItem.regionid">
|
122
|
|
- {{ regionItem.regionName }}
|
123
|
|
- </div>
|
124
|
|
- </div>
|
125
|
60
|
<div slot="footer" style="text-align: center">
|
126
|
61
|
<Button @click="viewInfo.show = false">关闭</Button>
|
127
|
62
|
</div>
|
|
@@ -130,29 +65,10 @@
|
130
|
65
|
</template>
|
131
|
66
|
|
132
|
67
|
<script>
|
133
|
|
-import { region_list_sel_pt } from "@/api/region";
|
134
|
|
-import {
|
135
|
|
- notice_list,
|
136
|
|
- notice_delete,
|
137
|
|
- notice_add,
|
138
|
|
- notice_edit,
|
139
|
|
- notice_detail
|
140
|
|
-} from "@/api/notice";
|
141
|
|
-import { dateFormat, htmlHasContent } from "@/utils";
|
142
|
|
-import MyCkeditor from "@/components/Editor/MyCkeditor";
|
|
68
|
+import { notice_list_region, notice_detail_region } from "@/api/notice";
|
|
69
|
+import { dateFormat } from "@/utils";
|
143
|
70
|
export default {
|
144
|
|
- components: {
|
145
|
|
- MyCkeditor
|
146
|
|
- },
|
147
|
71
|
data() {
|
148
|
|
- // 通知内容验证
|
149
|
|
- const noticeContentCheck = (rule, value, callback) => {
|
150
|
|
- if (htmlHasContent(this.noticeInfo.noticeContent)) {
|
151
|
|
- callback();
|
152
|
|
- } else {
|
153
|
|
- callback(new Error("请输入内容"));
|
154
|
|
- }
|
155
|
|
- };
|
156
|
72
|
return {
|
157
|
73
|
searchForm: {
|
158
|
74
|
title: "",
|
|
@@ -162,19 +78,6 @@ export default {
|
162
|
78
|
list: [],
|
163
|
79
|
total: 0
|
164
|
80
|
},
|
165
|
|
- // 新建/编辑
|
166
|
|
- noticeInfo: {
|
167
|
|
- show: false,
|
168
|
|
- noticeid: null,
|
169
|
|
- rversion: null,
|
170
|
|
- noticeTitle: "",
|
171
|
|
- noticeContent: "",
|
172
|
|
- noticeTxt: "",
|
173
|
|
- // 1所有区域2自定义区域
|
174
|
|
- noticeType: 1,
|
175
|
|
- regionList: [],
|
176
|
|
- regionids: []
|
177
|
|
- },
|
178
|
81
|
// 查看信息
|
179
|
82
|
viewInfo: {
|
180
|
83
|
show: false,
|
|
@@ -185,30 +88,6 @@ export default {
|
185
|
88
|
noticeType: null,
|
186
|
89
|
regions: []
|
187
|
90
|
},
|
188
|
|
- rules: {
|
189
|
|
- noticeTitle: [
|
190
|
|
- {
|
191
|
|
- required: true,
|
192
|
|
- message: "请输入标题",
|
193
|
|
- trigger: "blur"
|
194
|
|
- }
|
195
|
|
- ],
|
196
|
|
- noticeContent: [
|
197
|
|
- {
|
198
|
|
- required: true,
|
199
|
|
- validator: noticeContentCheck,
|
200
|
|
- trigger: "change"
|
201
|
|
- }
|
202
|
|
- ],
|
203
|
|
- noticeType: [
|
204
|
|
- {
|
205
|
|
- required: true,
|
206
|
|
- type: "number",
|
207
|
|
- message: "请选择接收区域",
|
208
|
|
- trigger: "change"
|
209
|
|
- }
|
210
|
|
- ]
|
211
|
|
- },
|
212
|
91
|
columns: [
|
213
|
92
|
{
|
214
|
93
|
title: "序号",
|
|
@@ -228,12 +107,6 @@ export default {
|
228
|
107
|
key: "noticeTitle",
|
229
|
108
|
align: "center"
|
230
|
109
|
},
|
231
|
|
- {
|
232
|
|
- title: "接收区域",
|
233
|
|
- slot: "noticeTypeSlot",
|
234
|
|
- width: 120,
|
235
|
|
- align: "center"
|
236
|
|
- },
|
237
|
110
|
{
|
238
|
111
|
title: "发布人",
|
239
|
112
|
key: "createname",
|
|
@@ -241,7 +114,7 @@ export default {
|
241
|
114
|
align: "center"
|
242
|
115
|
},
|
243
|
116
|
{
|
244
|
|
- title: "更新时间",
|
|
117
|
+ title: "时间",
|
245
|
118
|
key: "updatetime",
|
246
|
119
|
width: 190,
|
247
|
120
|
align: "center"
|
|
@@ -249,7 +122,7 @@ export default {
|
249
|
122
|
{
|
250
|
123
|
title: "操作",
|
251
|
124
|
slot: "actionSlot",
|
252
|
|
- width: 180,
|
|
125
|
+ width: 90,
|
253
|
126
|
align: "center"
|
254
|
127
|
}
|
255
|
128
|
]
|
|
@@ -281,7 +154,7 @@ export default {
|
281
|
154
|
_begindate = _begindate ? dateFormat(_begindate, "yyyy-MM-dd") : null;
|
282
|
155
|
let _enddate = this.searchForm.dataRange[1];
|
283
|
156
|
_enddate = _enddate ? dateFormat(_enddate, "yyyy-MM-dd") : null;
|
284
|
|
- notice_list({
|
|
157
|
+ notice_list_region({
|
285
|
158
|
page: this.searchForm.page,
|
286
|
159
|
size: this.searchForm.size,
|
287
|
160
|
title: this.searchForm.title,
|
|
@@ -296,80 +169,9 @@ export default {
|
296
|
169
|
}
|
297
|
170
|
});
|
298
|
171
|
},
|
299
|
|
- // 新建
|
300
|
|
- toAdd() {
|
301
|
|
- this.noticeInfo = {
|
302
|
|
- show: true,
|
303
|
|
- noticeid: null,
|
304
|
|
- rversion: null,
|
305
|
|
- noticeTitle: "",
|
306
|
|
- noticeContent: "",
|
307
|
|
- noticeTxt: "",
|
308
|
|
- // 1所有区域2自定义区域
|
309
|
|
- noticeType: 1,
|
310
|
|
- regionList: [],
|
311
|
|
- regionids: []
|
312
|
|
- };
|
313
|
|
- this.getRegionList().then((list) => {
|
314
|
|
- this.noticeInfo.regionList = list;
|
315
|
|
- });
|
316
|
|
- },
|
317
|
|
- // 获取搜索区域列表
|
318
|
|
- getRegionList() {
|
319
|
|
- return new Promise((resolve) => {
|
320
|
|
- region_list_sel_pt({}).then((data) => {
|
321
|
|
- if (data.code === 0) {
|
322
|
|
- resolve(data.obj);
|
323
|
|
- } else {
|
324
|
|
- resolve([]);
|
325
|
|
- this.$Message.error(data.msg);
|
326
|
|
- }
|
327
|
|
- });
|
328
|
|
- });
|
329
|
|
- },
|
330
|
|
- getNoticeContent(html, text = "") {
|
331
|
|
- this.noticeInfo.noticeContent = html;
|
332
|
|
- this.noticeInfo.noticeTxt = text.replace("\n", "");
|
333
|
|
- },
|
334
|
|
- saveAddInfo() {
|
335
|
|
- this.$refs.addForm.validate((valid) => {
|
336
|
|
- if (valid) {
|
337
|
|
- if (
|
338
|
|
- this.noticeInfo.noticeType === 2 &&
|
339
|
|
- this.noticeInfo.regionids === 0
|
340
|
|
- ) {
|
341
|
|
- return;
|
342
|
|
- }
|
343
|
|
- this.noticeInfo.show = false;
|
344
|
|
- let form = {
|
345
|
|
- noticeTitle: this.noticeInfo.noticeTitle,
|
346
|
|
- noticeContent: this.noticeInfo.noticeContent,
|
347
|
|
- noticeTxt: this.noticeInfo.noticeTxt,
|
348
|
|
- noticeType: this.noticeInfo.noticeType,
|
349
|
|
- regionids: this.noticeInfo.regionids
|
350
|
|
- };
|
351
|
|
- if (this.noticeInfo.noticeid && this.noticeInfo.rversion) {
|
352
|
|
- form.noticeid = this.noticeInfo.noticeid;
|
353
|
|
- form.rversion = this.noticeInfo.rversion;
|
354
|
|
- }
|
355
|
|
- let api =
|
356
|
|
- this.noticeInfo.noticeid && this.noticeInfo.rversion
|
357
|
|
- ? notice_edit
|
358
|
|
- : notice_add;
|
359
|
|
- api(form).then((data) => {
|
360
|
|
- if (data.code === 0) {
|
361
|
|
- this.searchList();
|
362
|
|
- this.$Message.success(data.msg);
|
363
|
|
- } else {
|
364
|
|
- this.$Message.error(data.msg);
|
365
|
|
- }
|
366
|
|
- });
|
367
|
|
- }
|
368
|
|
- });
|
369
|
|
- },
|
370
|
172
|
// 查看
|
371
|
173
|
toView(row) {
|
372
|
|
- notice_detail({
|
|
174
|
+ notice_detail_region({
|
373
|
175
|
noticeid: row.noticeid
|
374
|
176
|
}).then((data) => {
|
375
|
177
|
if (data.code === 0) {
|
|
@@ -386,56 +188,6 @@ export default {
|
386
|
188
|
this.$Message.error(data.msg);
|
387
|
189
|
}
|
388
|
190
|
});
|
389
|
|
- },
|
390
|
|
- // 编辑
|
391
|
|
- toEdit(row) {
|
392
|
|
- notice_detail({
|
393
|
|
- noticeid: row.noticeid
|
394
|
|
- }).then((data) => {
|
395
|
|
- if (data.code === 0) {
|
396
|
|
- this.noticeInfo = {
|
397
|
|
- show: true,
|
398
|
|
- noticeid: data.obj.noticeid,
|
399
|
|
- rversion: data.obj.rversion,
|
400
|
|
- noticeTitle: data.obj.noticeTitle,
|
401
|
|
- noticeContent: data.obj.noticeContent,
|
402
|
|
- noticeTxt: data.obj.noticeTxt,
|
403
|
|
- // 1所有区域2自定义区域
|
404
|
|
- noticeType: data.obj.noticeType,
|
405
|
|
- regionList: [],
|
406
|
|
- regionids:
|
407
|
|
- data.obj.noticeType === 1
|
408
|
|
- ? []
|
409
|
|
- : data.obj.regions.map((item) => item.regionid)
|
410
|
|
- };
|
411
|
|
- this.getRegionList().then((list) => {
|
412
|
|
- this.noticeInfo.regionList = list;
|
413
|
|
- });
|
414
|
|
- } else {
|
415
|
|
- this.$Message.error(data.msg);
|
416
|
|
- }
|
417
|
|
- });
|
418
|
|
- },
|
419
|
|
- // 删除
|
420
|
|
- toDel(row) {
|
421
|
|
- this.$Modal.confirm({
|
422
|
|
- title: "提示",
|
423
|
|
- content: "您确定删除选中数据吗?",
|
424
|
|
- onOk: () => {
|
425
|
|
- notice_delete({
|
426
|
|
- noticeid: row.noticeid,
|
427
|
|
- rversion: row.rversion
|
428
|
|
- }).then((data) => {
|
429
|
|
- if (data.code === 0) {
|
430
|
|
- this.searchList();
|
431
|
|
- this.$Message.success(data.msg);
|
432
|
|
- } else {
|
433
|
|
- this.$Message.error(data.msg);
|
434
|
|
- }
|
435
|
|
- });
|
436
|
|
- },
|
437
|
|
- onCancel: () => {}
|
438
|
|
- });
|
439
|
191
|
}
|
440
|
192
|
}
|
441
|
193
|
};
|