1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
<!-- 弹出框表单 -->
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="接收消息的用户的唯一标识符" prop="userId" v-model="form.userId" placeholder="请输入接收消息的用户的唯一标识符"/>
<Field label="消息的标题" prop="title" v-model="form.title" type="textarea" placeholder="请输入消息的标题"/>
<Field label="消息的内容"><editor v-model="form.content" :min-height="256"/></Field>
<Field label="是否已读 " prop="read" v-model="form.read" type="radio" :enumData="dict.read" />
<Field label="消息的优先级,越高表示越紧急,不为空" prop="priority" v-model="form.priority" placeholder="请输入消息的优先级,越高表示越紧急,不为空"/>
<Field label="消息的过期时间,超过此时间则自动标记为已读" prop="expireTime" v-model="form.expireTime" type="date" />
<Field label="消息的来源类型,例如“系统”、“好友”等,可以为空" prop="sourceType" v-model="form.sourceType" placeholder="请输入消息的来源类型,例如“系统”、“好友”等,可以为空"/>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import form from "@/assets/mixins/formdialog";
import dialogShow from "./dialogshow";
import Editor from '@/components/Editor';
export default {
mixins: [form],
components: {
dialogShow ,
Editor,
},
data() {
return {
// 遮罩层
loading: true,
// 弹出层标题
title: "用户消息",
// 是否显示弹出层
open: false,
toString:[
],
// 表单校验
rules: {
title: [
{required: true,message: "请输入消息的标题", trigger: "blur" },
{max: 255,message: "最多只能录入255个字符",trigger: "blur",},
],
content: [
{required: true,message: "请输入消息的内容", trigger: "blur" },
{max: 1024,message: "最多只能录入1024个字符",trigger: "blur",},
],
priority: [
{required: true,message: "请输入消息的优先级,越高表示越紧急,不为空", trigger: "blur" },
],
sourceType: [
{required: true,message: "请输入消息的来源类型,例如“系统”、“好友”等,可以为空", trigger: "blur" },
{max: 64,message: "最多只能录入64个字符",trigger: "blur",},
],
}
};
},
methods: {
/** 编辑 */
edit(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="notice/edit";
this.getData();
this.pageInfo.type="edit"
this.title = "修改用户消息";
},
/** 新增 */
add(row) {
this.reset()
this.urls.currUrl = "notice/add";
this.getData();
this.pageInfo.type="add"
this.title = "新增用户消息";
},
/** 查看*/
view(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="notice/view";
this.getData();
this.pageInfo.type="view"
this.title = "用户消息详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
},
// 表单重置
reset() {
this.form = {
userId : null,
title : "",
content : "",
read : null,
priority : 0,
expireTime : null,
sourceType : "",
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>