e7566d89 by 蔡俊立

通知完善

1 parent ddae0b3c
......@@ -10,6 +10,15 @@ export function addSysNotice (data) {
})
}
//编辑系统通知
export function updateSysNotice (data) {
return request({
url: SERVER.SERVERAPI + '/rest/system/sysNotice/updateSysNotice',
method: 'post',
data
})
}
// 获取通知列表
export function getSysNoticeList (data) {
return request({
......
......@@ -22,7 +22,7 @@
<ul>
<li v-for="(item, index) in noticeList" :key="index" @click="handleNotice(item)" class="flexst pointer">
<p class="list-title">{{ item.noticeTitle }}</p>
<p class="marginZL15">{{ item.createtime.substring(0, 10) }}</p>
<p class="marginZL15">{{ item.noticePublishTime.substring(0, 10) }}</p>
<p v-if="item.userBrowse == '1'" style="color:red">未读</p>
<p v-else>已读</p>
</li>
......@@ -192,7 +192,7 @@ export default {
if (res.result) {
this.noticeList = res.result.noticeList
this.noticeList.forEach(item => {
item.createtime = this._timedate(item.createtime)
item.noticePublishTime = this._timedate(item.noticePublishTime)
})
this.policyList = res.result.policyList
}
......
<template>
<dialogBox title="新增系统通知" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%"
@closeDialog="closeDialog" v-model="value">
<dialogBox :title="title" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%"
@closeDialog="closeDialog" v-model="value" :isButton="isButtonFlag">
<el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules">
<el-row>
<el-col :span="24">
......@@ -23,7 +23,7 @@
@change="onEditorChange($event)" @ready="onEditorReady($event)"></quill-editor>
</el-form-item>
</el-row>
<el-row>
<!-- <el-row>
<el-col :span="8">
<el-form-item label="附件:" prop="noticeFileUrl">
<el-upload action multiple :auto-upload="false" :limit="1" :on-change="handleChange"
......@@ -33,7 +33,8 @@
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<!-- 隐藏上传按钮 用于代替触发富文本上传事件 -->
<div v-show="false">
<el-upload action multiple :auto-upload="false" :on-change="RichTexthandleChange" :before-upload="beforeUpload"
class="richUpload">
......@@ -46,12 +47,14 @@
</template>
<script>
import { addSysNotice } from "@/api/notice.js";
import { addSysNotice,updateSysNotice } from "@/api/notice.js";
import { upload } from "@/api/system.js";
import { quillEditor } from "vue-quill-editor";
export default {
props: {
value: { type: Boolean, default: false }
value: { type: Boolean, default: false },
isButtonFlag: { type: Boolean, default: true },
title: {type:String, default: '新增系统通知'}
},
components: { quillEditor },
data () {
......@@ -142,22 +145,17 @@ export default {
}
}
},
mounted () { },
mounted () {},
methods: {
submitForm () {
let that = this;
that.$refs.ruleForm.validate(valid => {
if (valid) {
addSysNotice(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success("保存成功");
this.$emit("input", false);
this.resetRuleForm();
this.$parent.queryClick();
} else {
this.$message.error(res.message);
}
});
if(that.ruleForm.bsmNotice){
that.editNotice();
}else{
that.addNotice();
}
} else {
// console.log('error submit!!');
return false;
......@@ -169,10 +167,42 @@ export default {
this.$emit("input", false);
this.resetRuleForm();
},
//
//新增通知
addNotice(){
addSysNotice(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success("保存成功");
this.$emit("input", false);
this.resetRuleForm();
this.$parent.queryClick();
} else {
this.$message.error(res.message);
}
});
},
//编辑通知
editNotice(){
updateSysNotice(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success("编辑成功");
this.$emit("input", false);
this.resetRuleForm();
this.$parent.queryClick();
} else {
this.$message.error(res.message);
}
});
},
//重置表单
resetRuleForm () {
this.$refs["ruleForm"].resetFields();
this.ruleForm.noticeType = "1";
this.ruleForm = {
noticeTitle: "",
noticeContent: "",
noticeFileUrl: "",
noticeSource: "",
noticeType: "1"
}
this.isButtonFlag = true;
},
beforeUpload (file) {
return true;
......@@ -193,6 +223,9 @@ export default {
clipboardPictureChange (file) {
this.uploadPicture(file)
},
getDetailInfo(item){
this.ruleForm = item
},
uploadPicture (file) {
let that = this;
var formdata = new FormData();
......
<template>
<div>
<el-row :gutter="8">
<el-col :span="16">
通知标题:
<el-input v-model="formData.item.noticeTitle"></el-input>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24" class="margin-top-middle">
通知内容:
<quill-editor class="ql-editor" v-model="formData.item.noticeContent" ref="myQuillEditor"
:options="editorOption">
</quill-editor>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24" class="margin-top-middle">
附件:
<div @click="handleView(formData.item.noticeFileUrl)" class="pointer">{{ formData.item.noticeFileName }}</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { quillEditor } from "vue-quill-editor";
export default {
components: { quillEditor },
data () {
return {
// 富文本编辑器配置
editorOption: {
theme: "snow", // or 'bubble'
placeholder: "请输入正文",
},
};
},
components: {},
props: {
formData: {
type: Object,
default: () => { }
},
},
created () {
console.log(this.formData);
},
computed: {
},
methods: {
},
};
</script>
<style scoped lang='scss'>
.margin-top-middle {
margin-top: 10px
}
/deep/.ql-editor {
padding: 0px;
}
</style>
\ No newline at end of file
......@@ -33,7 +33,7 @@
:data="tableData.data">
</lb-table>
</div>
<addDialog ref="addDialog" v-model="isDialog" />
<addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle"/>
</div>
</template>
<script>
......@@ -52,8 +52,8 @@ export default {
data () {
return {
isDialog: false,
viewDialog: false,
isButtonFlag: true,
dialogTitle: '',
ruleForm: {
noticeTitle: '',
noticeStatus: ''
......@@ -84,7 +84,17 @@ export default {
})
},
//打开新增弹窗
openDialog () {
openDialog (item) {
if (item) {
this.$nextTick(() => {
this.isButtonFlag = false;
this.$refs.addDialog.getDetailInfo(item);
this.dialogTitle = '系统通知详情'
})
}else{
this.isButtonFlag = true;
this.dialogTitle = '新增系统通知'
}
this.isDialog = true;
},
//删除
......@@ -153,16 +163,18 @@ export default {
});
});
},
//编辑通知
editNotice(item) {
this.$nextTick(() => {
this.isButtonFlag = true;
this.$refs.addDialog.getDetailInfo(item);
this.dialogTitle = '编辑系统通知'
this.isDialog = true;
})
},
downloadFile (item) {
const href = item.noticeFileUrl
window.open(href, '_blank');
},
viewDetail (e) {
this.$popup("错误日志", "system/xttz/components/viewDialog", {
formData: {
item: e
}
})
}
},
};
......
......@@ -26,6 +26,10 @@ class data extends filter {
label: "通知标题",
},
{
prop: "noticeSource",
label: "通知来源",
},
{
label: "通知内容",
render: (h, scope) => {
return <div class="item-cwnr" domPropsInnerHTML={scope.row.noticeContent}></div>
......@@ -51,6 +55,10 @@ class data extends filter {
}
},
{
prop: "noticePublishTime",
label: "发布时间",
},
{
prop: "creater",
width: '120',
label: "创建人",
......@@ -67,13 +75,14 @@ class data extends filter {
switch (scope.row.noticeStatus) {
case '1':
return <div>
<el-button type="text" icon="el-icon-view" onClick={() => { vm.openDialog(scope.row) }}>查看</el-button>
<el-button type="text" icon="el-icon-edit" onClick={() => { vm.editNotice(scope.row) }}>编辑</el-button>
<el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.toPublish(scope.row) }}>发布</el-button>
<el-button type="text" onClick={() => { vm.viewDetail(scope.row) }}>查看</el-button>
<el-button type="text" icon="el-icon-delete" onClick={() => { vm.delNotice(scope.row) }}>删除</el-button>
</div>
case '2':
return <div>
<el-button type="text" onClick={() => { vm.viewDetail(scope.row) }}>查看</el-button>
<el-button type="text" icon="el-icon-view" onClick={() => { vm.openDialog(scope.row) }}>查看</el-button>
<el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.toUnPublish(scope.row) }}>撤销通知</el-button>
</div>
}
......