813788fb by renchao@pashanhoo.com

style:系统通知

1 parent 6f68f042
1 <template> 1 <template>
2 <dialogBox :title="title" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%"
3 @closeDialog="closeDialog" v-model="value" :isButton="isButtonFlag">
4 <el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules"> 2 <el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules">
5 <el-row> 3 <el-row>
6 <el-col :span="24"> 4 <el-col :span="24">
...@@ -42,8 +40,11 @@ ...@@ -42,8 +40,11 @@
42 <div slot="tip" class="el-upload__tip">文件大小不超过20MB</div> 40 <div slot="tip" class="el-upload__tip">文件大小不超过20MB</div>
43 </el-upload> 41 </el-upload>
44 </div> 42 </div>
43 <el-form-item v-if="formData.isButtonFlag" class="text-center">
44 <el-button @click="closeDialog">取消</el-button>
45 <el-button type="primary" @click="submitForm" plain>确定</el-button>
46 </el-form-item>
45 </el-form> 47 </el-form>
46 </dialogBox>
47 </template> 48 </template>
48 <script> 49 <script>
49 import { addSysNotice, updateSysNotice } from "@/api/system.js"; 50 import { addSysNotice, updateSysNotice } from "@/api/system.js";
...@@ -51,9 +52,10 @@ import { upload } from "@/api/system.js"; ...@@ -51,9 +52,10 @@ 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 formData: {
55 isButtonFlag: { type: Boolean, default: true }, 56 type: Object,
56 title: { type: String, default: '新增系统通知' } 57 default: () => { }
58 }
57 }, 59 },
58 components: { quillEditor }, 60 components: { quillEditor },
59 data () { 61 data () {
...@@ -113,10 +115,7 @@ export default { ...@@ -113,10 +115,7 @@ export default {
113 } 115 }
114 }; 116 };
115 }, 117 },
116 watch: { 118 mounted () {
117 value (val) {
118 if (val) {
119 let that = this
120 this.$nextTick(() => { 119 this.$nextTick(() => {
121 //创建富文本粘贴事件监听 120 //创建富文本粘贴事件监听
122 let quill = this.$refs.myQuillEditor.quill; 121 let quill = this.$refs.myQuillEditor.quill;
...@@ -139,12 +138,12 @@ export default { ...@@ -139,12 +138,12 @@ export default {
139 } 138 }
140 }, 139 },
141 false 140 false
142 ); 141 )
143 }); 142 })
144 } 143 if (this.formData) {
144 this.getDetailInfo(this.formData)
145 } 145 }
146 }, 146 },
147 mounted () { },
148 methods: { 147 methods: {
149 submitForm () { 148 submitForm () {
150 let that = this; 149 let that = this;
...@@ -156,14 +155,13 @@ export default { ...@@ -156,14 +155,13 @@ export default {
156 that.addNotice(); 155 that.addNotice();
157 } 156 }
158 } else { 157 } else {
159 // console.log('error submit!!');
160 return false; 158 return false;
161 } 159 }
162 }); 160 });
163 }, 161 },
164 //关闭窗口 162 //关闭窗口
165 closeDialog () { 163 closeDialog () {
166 this.$emit("input", false); 164 this.$popupCacel()
167 this.resetRuleForm(); 165 this.resetRuleForm();
168 }, 166 },
169 //新增通知 167 //新增通知
...@@ -171,7 +169,7 @@ export default { ...@@ -171,7 +169,7 @@ export default {
171 addSysNotice(this.ruleForm).then(res => { 169 addSysNotice(this.ruleForm).then(res => {
172 if (res.code == 200) { 170 if (res.code == 200) {
173 this.$message.success("保存成功"); 171 this.$message.success("保存成功");
174 this.$emit("input", false); 172 this.$popupCacel()
175 this.resetRuleForm(); 173 this.resetRuleForm();
176 this.$parent.queryClick(); 174 this.$parent.queryClick();
177 } else { 175 } else {
...@@ -184,7 +182,7 @@ export default { ...@@ -184,7 +182,7 @@ export default {
184 updateSysNotice(this.ruleForm).then(res => { 182 updateSysNotice(this.ruleForm).then(res => {
185 if (res.code == 200) { 183 if (res.code == 200) {
186 this.$message.success("编辑成功"); 184 this.$message.success("编辑成功");
187 this.$emit("input", false); 185 this.$popupCacel()
188 this.resetRuleForm(); 186 this.resetRuleForm();
189 this.$parent.queryClick(); 187 this.$parent.queryClick();
190 } else { 188 } else {
...@@ -201,7 +199,6 @@ export default { ...@@ -201,7 +199,6 @@ export default {
201 noticeSource: "", 199 noticeSource: "",
202 noticeType: "1" 200 noticeType: "1"
203 } 201 }
204 this.isButtonFlag = true;
205 }, 202 },
206 beforeUpload (file) { 203 beforeUpload (file) {
207 return true; 204 return true;
...@@ -239,7 +236,6 @@ export default { ...@@ -239,7 +236,6 @@ export default {
239 quill.insertEmbed(length, "image", res.message); 236 quill.insertEmbed(length, "image", res.message);
240 // 调整光标到最后 237 // 调整光标到最后
241 quill.setSelection(length + 1); 238 quill.setSelection(length + 1);
242 //that.quillUpdateImg = false;
243 }); 239 });
244 }, 240 },
245 onSubmit () { 241 onSubmit () {
...@@ -267,6 +263,7 @@ export default { ...@@ -267,6 +263,7 @@ export default {
267 </script> 263 </script>
268 <style scoped lang="scss"> 264 <style scoped lang="scss">
269 @import "~@/styles/dialogBoxheader.scss"; 265 @import "~@/styles/dialogBoxheader.scss";
266
270 .quill-editor { 267 .quill-editor {
271 padding: 0; 268 padding: 0;
272 } 269 }
......
...@@ -86,16 +86,10 @@ export default { ...@@ -86,16 +86,10 @@ export default {
86 //打开新增弹窗 86 //打开新增弹窗
87 openDialog (item) { 87 openDialog (item) {
88 if (item) { 88 if (item) {
89 this.$nextTick(() => { 89 this.$popupDialog("系统通知详情", "system/xttz/components/addDialog", { ...item, "isButtonFlag": false }, "50%")
90 this.isButtonFlag = false;
91 this.$refs.addDialog.getDetailInfo(item);
92 this.dialogTitle = '系统通知详情'
93 })
94 } else { 90 } else {
95 this.isButtonFlag = true; 91 this.$popupDialog("新增系统通知", "system/xttz/components/addDialog", { "isButtonFlag": true }, "50%")
96 this.dialogTitle = '新增系统通知'
97 } 92 }
98 this.isDialog = true;
99 }, 93 },
100 //删除 94 //删除
101 delNotice (item) { 95 delNotice (item) {
......