e7566d89 by 蔡俊立

通知完善

1 parent ddae0b3c
...@@ -10,6 +10,15 @@ export function addSysNotice (data) { ...@@ -10,6 +10,15 @@ export function addSysNotice (data) {
10 }) 10 })
11 } 11 }
12 12
13 //编辑系统通知
14 export function updateSysNotice (data) {
15 return request({
16 url: SERVER.SERVERAPI + '/rest/system/sysNotice/updateSysNotice',
17 method: 'post',
18 data
19 })
20 }
21
13 // 获取通知列表 22 // 获取通知列表
14 export function getSysNoticeList (data) { 23 export function getSysNoticeList (data) {
15 return request({ 24 return request({
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 <ul> 22 <ul>
23 <li v-for="(item, index) in noticeList" :key="index" @click="handleNotice(item)" class="flexst pointer"> 23 <li v-for="(item, index) in noticeList" :key="index" @click="handleNotice(item)" class="flexst pointer">
24 <p class="list-title">{{ item.noticeTitle }}</p> 24 <p class="list-title">{{ item.noticeTitle }}</p>
25 <p class="marginZL15">{{ item.createtime.substring(0, 10) }}</p> 25 <p class="marginZL15">{{ item.noticePublishTime.substring(0, 10) }}</p>
26 <p v-if="item.userBrowse == '1'" style="color:red">未读</p> 26 <p v-if="item.userBrowse == '1'" style="color:red">未读</p>
27 <p v-else>已读</p> 27 <p v-else>已读</p>
28 </li> 28 </li>
...@@ -192,7 +192,7 @@ export default { ...@@ -192,7 +192,7 @@ export default {
192 if (res.result) { 192 if (res.result) {
193 this.noticeList = res.result.noticeList 193 this.noticeList = res.result.noticeList
194 this.noticeList.forEach(item => { 194 this.noticeList.forEach(item => {
195 item.createtime = this._timedate(item.createtime) 195 item.noticePublishTime = this._timedate(item.noticePublishTime)
196 }) 196 })
197 this.policyList = res.result.policyList 197 this.policyList = res.result.policyList
198 } 198 }
......
1 <template> 1 <template>
2 <dialogBox title="新增系统通知" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%" 2 <dialogBox :title="title" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%"
3 @closeDialog="closeDialog" v-model="value"> 3 @closeDialog="closeDialog" v-model="value" :isButton="isButtonFlag">
4 <el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules"> 4 <el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules">
5 <el-row> 5 <el-row>
6 <el-col :span="24"> 6 <el-col :span="24">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 @change="onEditorChange($event)" @ready="onEditorReady($event)"></quill-editor> 23 @change="onEditorChange($event)" @ready="onEditorReady($event)"></quill-editor>
24 </el-form-item> 24 </el-form-item>
25 </el-row> 25 </el-row>
26 <el-row> 26 <!-- <el-row>
27 <el-col :span="8"> 27 <el-col :span="8">
28 <el-form-item label="附件:" prop="noticeFileUrl"> 28 <el-form-item label="附件:" prop="noticeFileUrl">
29 <el-upload action multiple :auto-upload="false" :limit="1" :on-change="handleChange" 29 <el-upload action multiple :auto-upload="false" :limit="1" :on-change="handleChange"
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
33 </el-upload> 33 </el-upload>
34 </el-form-item> 34 </el-form-item>
35 </el-col> 35 </el-col>
36 </el-row> 36 </el-row> -->
37 <!-- 隐藏上传按钮 用于代替触发富文本上传事件 -->
37 <div v-show="false"> 38 <div v-show="false">
38 <el-upload action multiple :auto-upload="false" :on-change="RichTexthandleChange" :before-upload="beforeUpload" 39 <el-upload action multiple :auto-upload="false" :on-change="RichTexthandleChange" :before-upload="beforeUpload"
39 class="richUpload"> 40 class="richUpload">
...@@ -46,12 +47,14 @@ ...@@ -46,12 +47,14 @@
46 </template> 47 </template>
47 48
48 <script> 49 <script>
49 import { addSysNotice } from "@/api/notice.js"; 50 import { addSysNotice,updateSysNotice } from "@/api/notice.js";
50 import { upload } from "@/api/system.js"; 51 import { upload } from "@/api/system.js";
51 import { quillEditor } from "vue-quill-editor"; 52 import { quillEditor } from "vue-quill-editor";
52 export default { 53 export default {
53 props: { 54 props: {
54 value: { type: Boolean, default: false } 55 value: { type: Boolean, default: false },
56 isButtonFlag: { type: Boolean, default: true },
57 title: {type:String, default: '新增系统通知'}
55 }, 58 },
56 components: { quillEditor }, 59 components: { quillEditor },
57 data () { 60 data () {
...@@ -142,22 +145,17 @@ export default { ...@@ -142,22 +145,17 @@ export default {
142 } 145 }
143 } 146 }
144 }, 147 },
145 mounted () { }, 148 mounted () {},
146 methods: { 149 methods: {
147 submitForm () { 150 submitForm () {
148 let that = this; 151 let that = this;
149 that.$refs.ruleForm.validate(valid => { 152 that.$refs.ruleForm.validate(valid => {
150 if (valid) { 153 if (valid) {
151 addSysNotice(this.ruleForm).then(res => { 154 if(that.ruleForm.bsmNotice){
152 if (res.code == 200) { 155 that.editNotice();
153 this.$message.success("保存成功"); 156 }else{
154 this.$emit("input", false); 157 that.addNotice();
155 this.resetRuleForm(); 158 }
156 this.$parent.queryClick();
157 } else {
158 this.$message.error(res.message);
159 }
160 });
161 } else { 159 } else {
162 // console.log('error submit!!'); 160 // console.log('error submit!!');
163 return false; 161 return false;
...@@ -169,10 +167,42 @@ export default { ...@@ -169,10 +167,42 @@ export default {
169 this.$emit("input", false); 167 this.$emit("input", false);
170 this.resetRuleForm(); 168 this.resetRuleForm();
171 }, 169 },
172 // 170 //新增通知
171 addNotice(){
172 addSysNotice(this.ruleForm).then(res => {
173 if (res.code == 200) {
174 this.$message.success("保存成功");
175 this.$emit("input", false);
176 this.resetRuleForm();
177 this.$parent.queryClick();
178 } else {
179 this.$message.error(res.message);
180 }
181 });
182 },
183 //编辑通知
184 editNotice(){
185 updateSysNotice(this.ruleForm).then(res => {
186 if (res.code == 200) {
187 this.$message.success("编辑成功");
188 this.$emit("input", false);
189 this.resetRuleForm();
190 this.$parent.queryClick();
191 } else {
192 this.$message.error(res.message);
193 }
194 });
195 },
196 //重置表单
173 resetRuleForm () { 197 resetRuleForm () {
174 this.$refs["ruleForm"].resetFields(); 198 this.ruleForm = {
175 this.ruleForm.noticeType = "1"; 199 noticeTitle: "",
200 noticeContent: "",
201 noticeFileUrl: "",
202 noticeSource: "",
203 noticeType: "1"
204 }
205 this.isButtonFlag = true;
176 }, 206 },
177 beforeUpload (file) { 207 beforeUpload (file) {
178 return true; 208 return true;
...@@ -193,6 +223,9 @@ export default { ...@@ -193,6 +223,9 @@ export default {
193 clipboardPictureChange (file) { 223 clipboardPictureChange (file) {
194 this.uploadPicture(file) 224 this.uploadPicture(file)
195 }, 225 },
226 getDetailInfo(item){
227 this.ruleForm = item
228 },
196 uploadPicture (file) { 229 uploadPicture (file) {
197 let that = this; 230 let that = this;
198 var formdata = new FormData(); 231 var formdata = new FormData();
......
1 <template>
2 <div>
3 <el-row :gutter="8">
4 <el-col :span="16">
5 通知标题:
6 <el-input v-model="formData.item.noticeTitle"></el-input>
7 </el-col>
8 </el-row>
9 <el-row :gutter="8">
10 <el-col :span="24" class="margin-top-middle">
11 通知内容:
12 <quill-editor class="ql-editor" v-model="formData.item.noticeContent" ref="myQuillEditor"
13 :options="editorOption">
14 </quill-editor>
15 </el-col>
16 </el-row>
17 <el-row :gutter="8">
18 <el-col :span="24" class="margin-top-middle">
19 附件:
20 <div @click="handleView(formData.item.noticeFileUrl)" class="pointer">{{ formData.item.noticeFileName }}</div>
21 </el-col>
22 </el-row>
23 </div>
24 </template>
25 <script>
26 import { quillEditor } from "vue-quill-editor";
27 export default {
28 components: { quillEditor },
29 data () {
30 return {
31 // 富文本编辑器配置
32 editorOption: {
33 theme: "snow", // or 'bubble'
34 placeholder: "请输入正文",
35 },
36 };
37 },
38 components: {},
39 props: {
40 formData: {
41 type: Object,
42 default: () => { }
43 },
44 },
45 created () {
46 console.log(this.formData);
47 },
48 computed: {
49
50 },
51
52 methods: {
53
54 },
55 };
56 </script>
57 <style scoped lang='scss'>
58 .margin-top-middle {
59 margin-top: 10px
60 }
61
62 /deep/.ql-editor {
63 padding: 0px;
64 }
65 </style>
...\ No newline at end of file ...\ No newline at end of file
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
33 :data="tableData.data"> 33 :data="tableData.data">
34 </lb-table> 34 </lb-table>
35 </div> 35 </div>
36 <addDialog ref="addDialog" v-model="isDialog" /> 36 <addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle"/>
37 </div> 37 </div>
38 </template> 38 </template>
39 <script> 39 <script>
...@@ -52,8 +52,8 @@ export default { ...@@ -52,8 +52,8 @@ export default {
52 data () { 52 data () {
53 return { 53 return {
54 isDialog: false, 54 isDialog: false,
55 viewDialog: false, 55 isButtonFlag: true,
56 56 dialogTitle: '',
57 ruleForm: { 57 ruleForm: {
58 noticeTitle: '', 58 noticeTitle: '',
59 noticeStatus: '' 59 noticeStatus: ''
...@@ -84,7 +84,17 @@ export default { ...@@ -84,7 +84,17 @@ export default {
84 }) 84 })
85 }, 85 },
86 //打开新增弹窗 86 //打开新增弹窗
87 openDialog () { 87 openDialog (item) {
88 if (item) {
89 this.$nextTick(() => {
90 this.isButtonFlag = false;
91 this.$refs.addDialog.getDetailInfo(item);
92 this.dialogTitle = '系统通知详情'
93 })
94 }else{
95 this.isButtonFlag = true;
96 this.dialogTitle = '新增系统通知'
97 }
88 this.isDialog = true; 98 this.isDialog = true;
89 }, 99 },
90 //删除 100 //删除
...@@ -153,16 +163,18 @@ export default { ...@@ -153,16 +163,18 @@ export default {
153 }); 163 });
154 }); 164 });
155 }, 165 },
166 //编辑通知
167 editNotice(item) {
168 this.$nextTick(() => {
169 this.isButtonFlag = true;
170 this.$refs.addDialog.getDetailInfo(item);
171 this.dialogTitle = '编辑系统通知'
172 this.isDialog = true;
173 })
174 },
156 downloadFile (item) { 175 downloadFile (item) {
157 const href = item.noticeFileUrl 176 const href = item.noticeFileUrl
158 window.open(href, '_blank'); 177 window.open(href, '_blank');
159 },
160 viewDetail (e) {
161 this.$popup("错误日志", "system/xttz/components/viewDialog", {
162 formData: {
163 item: e
164 }
165 })
166 } 178 }
167 }, 179 },
168 }; 180 };
......
...@@ -26,6 +26,10 @@ class data extends filter { ...@@ -26,6 +26,10 @@ class data extends filter {
26 label: "通知标题", 26 label: "通知标题",
27 }, 27 },
28 { 28 {
29 prop: "noticeSource",
30 label: "通知来源",
31 },
32 {
29 label: "通知内容", 33 label: "通知内容",
30 render: (h, scope) => { 34 render: (h, scope) => {
31 return <div class="item-cwnr" domPropsInnerHTML={scope.row.noticeContent}></div> 35 return <div class="item-cwnr" domPropsInnerHTML={scope.row.noticeContent}></div>
...@@ -51,6 +55,10 @@ class data extends filter { ...@@ -51,6 +55,10 @@ class data extends filter {
51 } 55 }
52 }, 56 },
53 { 57 {
58 prop: "noticePublishTime",
59 label: "发布时间",
60 },
61 {
54 prop: "creater", 62 prop: "creater",
55 width: '120', 63 width: '120',
56 label: "创建人", 64 label: "创建人",
...@@ -67,13 +75,14 @@ class data extends filter { ...@@ -67,13 +75,14 @@ class data extends filter {
67 switch (scope.row.noticeStatus) { 75 switch (scope.row.noticeStatus) {
68 case '1': 76 case '1':
69 return <div> 77 return <div>
78 <el-button type="text" icon="el-icon-view" onClick={() => { vm.openDialog(scope.row) }}>查看</el-button>
79 <el-button type="text" icon="el-icon-edit" onClick={() => { vm.editNotice(scope.row) }}>编辑</el-button>
70 <el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.toPublish(scope.row) }}>发布</el-button> 80 <el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.toPublish(scope.row) }}>发布</el-button>
71 <el-button type="text" onClick={() => { vm.viewDetail(scope.row) }}>查看</el-button>
72 <el-button type="text" icon="el-icon-delete" onClick={() => { vm.delNotice(scope.row) }}>删除</el-button> 81 <el-button type="text" icon="el-icon-delete" onClick={() => { vm.delNotice(scope.row) }}>删除</el-button>
73 </div> 82 </div>
74 case '2': 83 case '2':
75 return <div> 84 return <div>
76 <el-button type="text" onClick={() => { vm.viewDetail(scope.row) }}>查看</el-button> 85 <el-button type="text" icon="el-icon-view" onClick={() => { vm.openDialog(scope.row) }}>查看</el-button>
77 <el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.toUnPublish(scope.row) }}>撤销通知</el-button> 86 <el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.toUnPublish(scope.row) }}>撤销通知</el-button>
78 </div> 87 </div>
79 } 88 }
......