|
@@ -4,11 +4,48 @@
|
|
|
<el-dialog
|
|
|
style=""
|
|
|
top="0"
|
|
|
- title="消息"
|
|
|
+ title="消息通知"
|
|
|
:visible.sync="dialogVisible"
|
|
|
width="30%">
|
|
|
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
|
- <el-tab-pane name="first">
|
|
|
+ <el-tab-pane v-for="(msgitem,index) in msgtype" :key="index" :label="msgitem.id+''" :name="msgitem.name">
|
|
|
+ <span slot="label">
|
|
|
+ {{ msgitem.name }}
|
|
|
+ <el-badge :hidden="msgitem.unReadCount==0?true:false" :value="msgitem.unReadCount" :max="9999"></el-badge>
|
|
|
+ </span>
|
|
|
+ </el-tab-pane>
|
|
|
+ <div class="msg-box">
|
|
|
+ <div class="read-btn">
|
|
|
+
|
|
|
+ <el-button type="primary" @click="taskclicks(2)" size="mini" :plain="tasknobtn" >未读</el-button>
|
|
|
+ <el-button type="primary" @click="taskclicks(3)" size="mini" :plain="taskbtn" >已读</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="scroll-box">
|
|
|
+ <div class="news-box" v-for="(item,index) in msglist" :key="index">
|
|
|
+ <div class="news-box-list">
|
|
|
+ <div class="news-list-hade">
|
|
|
+ <div>{{item.title}}</div>
|
|
|
+ <div>所属部门: {{item.issuerDep}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="news-list-content" v-html="item.content">
|
|
|
+ </div>
|
|
|
+ <div class="news-list-posts">
|
|
|
+ <div>发布人: {{item.issuerUser}}</div>
|
|
|
+ <div>发布时间: {{item.releaseTime}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="news-list-btn" >
|
|
|
+ <el-button @click="DeleMsg(index,item)" v-if="item.isRead==0" type="primary">确认已读</el-button>
|
|
|
+ <el-button v-if="item.isRead==1" type="info">已读</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-if="count>10&&msglist.length<count" class="loadmore">
|
|
|
+ <el-button @click="loadadd" size="mini">加载更多</el-button>
|
|
|
+ </div>
|
|
|
+ <el-divider v-if="msglist.length>=count" style="">没有更多了!</el-divider>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- <el-tab-pane name="first">
|
|
|
<span slot="label">
|
|
|
任务操作通知
|
|
|
<el-badge :hidden="tasknot==0?true:false" :value="tasknot" :max="9999"></el-badge>
|
|
@@ -81,7 +118,7 @@
|
|
|
暂无通知
|
|
|
</div>
|
|
|
</div>
|
|
|
- </el-tab-pane>
|
|
|
+ </el-tab-pane> -->
|
|
|
</el-tabs>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -163,7 +200,7 @@
|
|
|
<i class="icon-shiyonggongju"></i>
|
|
|
</div>
|
|
|
<div class="message">
|
|
|
- <el-badge :value="12" class="item">
|
|
|
+ <el-badge :value="unReadCount" class="item">
|
|
|
<i class="icon-tongzhi" @click="dialogVisible= true"></i>
|
|
|
</el-badge>
|
|
|
</div>
|
|
@@ -299,7 +336,7 @@ export default {
|
|
|
dialogVisible: false ,
|
|
|
newstasklist:[],
|
|
|
newsgrouplist:[],
|
|
|
- activeName: 'first',
|
|
|
+ activeName: '',
|
|
|
tasknot:0,//任务未读条数
|
|
|
groupnot:0,//团组未读条数
|
|
|
tasknotlist:[],//任务未读
|
|
@@ -307,9 +344,17 @@ export default {
|
|
|
groupnotlist:[],//团组未读
|
|
|
groupReadlist:[],//团组以读
|
|
|
taskbtn:true,//plain任务已读
|
|
|
- tasknobtn:true,//plain任务未读
|
|
|
+ tasknobtn:false,//plain任务未读
|
|
|
groupbtn:true,//plain团组已读
|
|
|
groupnobtn:true,//plain团组未读
|
|
|
+ unReadCount:0,//未读总条数
|
|
|
+ msgtype:[],//未读总条数
|
|
|
+ pageIndex:1,//页码
|
|
|
+ pageSize:10,//条数
|
|
|
+ type:0,//类型
|
|
|
+ readStatus:2,//状态
|
|
|
+ msglist:[],//list
|
|
|
+ count:0,//list数量
|
|
|
};
|
|
|
},
|
|
|
// components: {
|
|
@@ -419,12 +464,100 @@ export default {
|
|
|
console.log('测试');
|
|
|
},
|
|
|
handleClick(tab, event) {
|
|
|
+ this.pageIndex=1;
|
|
|
+ this.pageSize=10;
|
|
|
+ this.msglist=[];
|
|
|
console.log(tab, event);
|
|
|
+ console.log(tab.label);
|
|
|
+ this.type=Number(tab.label);
|
|
|
+ this.PotsMessagePageList();
|
|
|
+ },
|
|
|
+ //已读未读切换
|
|
|
+ taskclicks(val){
|
|
|
+ if(val==2){
|
|
|
+ this.tasknobtn=false;
|
|
|
+ this.taskbtn=true;
|
|
|
+ }else{
|
|
|
+ this.tasknobtn=true;
|
|
|
+ this.taskbtn=false;
|
|
|
+ }
|
|
|
+ this.readStatus=val;
|
|
|
+ this.pageIndex=1;
|
|
|
+ this.pageSize=10;
|
|
|
+ this.msglist=[];
|
|
|
+ this.PotsMessagePageList();
|
|
|
+ },
|
|
|
+ //加载更多
|
|
|
+ loadadd(){
|
|
|
+ this.pageIndex++
|
|
|
+ this.PotsMessagePageList()
|
|
|
+ },
|
|
|
+ //消息list
|
|
|
+ PotsMessagePageList(){
|
|
|
+ console.log(this.type)
|
|
|
+ var url = "/api/System/PotsMessagePageList"
|
|
|
+ var that = this
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token
|
|
|
+ },
|
|
|
+ data:{
|
|
|
+ portType:1,
|
|
|
+ pageIndex:that.pageIndex,
|
|
|
+ pageSize:that.pageSize,
|
|
|
+ type:that.type,
|
|
|
+ userId:that.userId,
|
|
|
+ readStatus:that.readStatus
|
|
|
+ }
|
|
|
+ }).then(function (res) {
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.code==200){
|
|
|
+ var magarr=res.data.data;
|
|
|
+ that.count=res.data.count;
|
|
|
+ for(let j=0;j<magarr.length;j++){
|
|
|
+ that.msglist.push(magarr[j])
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ that.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(function (error) {
|
|
|
+ that.$message.error("获取消息列表失败!");
|
|
|
+ });
|
|
|
},
|
|
|
//任务通知切换
|
|
|
newstasklistclick(){
|
|
|
console.log(this.newstasklist)
|
|
|
-
|
|
|
+ },
|
|
|
+ //消息类型
|
|
|
+ PotsMsgTypeData(){
|
|
|
+ this.msglist=[];
|
|
|
+ var url = "/api/System/PotsMsgTypeData"
|
|
|
+ var that = this
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token
|
|
|
+ },
|
|
|
+ data:{
|
|
|
+ portType:1,
|
|
|
+ userId:that.userId
|
|
|
+ }
|
|
|
+ }).then(function (res) {
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.code==200){
|
|
|
+ that.msgtype=res.data.data;
|
|
|
+ that.activeName=that.msgtype[0].name;
|
|
|
+ that.type=that.msgtype[0].id;
|
|
|
+ that.PotsMessagePageList()
|
|
|
+ }else{
|
|
|
+ that.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(function (error) {
|
|
|
+ that.$message.error("获取消息类型失败!");
|
|
|
+ });
|
|
|
},
|
|
|
//消息列表
|
|
|
PsotMsgPageList(){
|
|
@@ -439,47 +572,14 @@ export default {
|
|
|
data:{
|
|
|
portType:1,
|
|
|
pageIndex:1,
|
|
|
- pageSize:10,
|
|
|
+ pageSize:100,
|
|
|
userId:that.userId
|
|
|
}
|
|
|
}).then(function (res) {
|
|
|
console.log(res)
|
|
|
if(res.data.code==200){
|
|
|
//初始化
|
|
|
- that.tasknotlist=[];
|
|
|
- that.taskReadlist=[];
|
|
|
- that.groupnotlist=[];
|
|
|
- that.groupReadlist=[];
|
|
|
- that.taskbtn=true;//plain任务已读
|
|
|
- that.tasknobtn=true;//plain任务未读
|
|
|
- that.groupbtn=true;//plain团组已读
|
|
|
- that.groupnobtn=true;//plain团组未读
|
|
|
- var listdata=res.data.data;
|
|
|
- // that.newstasklist=res.data.data.taskNotification.taskNotificationData;
|
|
|
- that.tasknot=res.data.data.taskNotification.unReadCount;
|
|
|
- // that.newsgrouplist=res.data.data.operationNotification.operationNotificatioData;
|
|
|
- that.groupnot=res.data.data.operationNotification.unReadCount;
|
|
|
- console.log(listdata.taskNotification.taskNotificationData)
|
|
|
- //任务
|
|
|
- for(let i=0;i<listdata.taskNotification.taskNotificationData.length;i++){
|
|
|
- if(listdata.taskNotification.taskNotificationData[i].isRead==0){
|
|
|
- that.tasknotlist.push(listdata.taskNotification.taskNotificationData[i]);
|
|
|
- }else{
|
|
|
- that.taskReadlist.push(listdata.taskNotification.taskNotificationData[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- that.newstasklist=that.tasknotlist;
|
|
|
- that.tasknobtn=false;
|
|
|
- //团组
|
|
|
- for(let j=0;j<listdata.operationNotification.operationNotificatioData.length;j++){
|
|
|
- if(listdata.operationNotification.operationNotificatioData[j].isRead==0){
|
|
|
- that.groupnotlist.push(listdata.operationNotification.operationNotificatioData[j]);
|
|
|
- }else{
|
|
|
- that.groupReadlist.push(listdata.operationNotification.operationNotificatioData[j]);
|
|
|
- }
|
|
|
- }
|
|
|
- that.newsgrouplist=that.groupnotlist;
|
|
|
- that.groupnobtn=false;
|
|
|
+
|
|
|
}else{
|
|
|
that.$message.error(res.data.msg);
|
|
|
}
|
|
@@ -489,32 +589,61 @@ export default {
|
|
|
},
|
|
|
//消息确认已读
|
|
|
DeleMsg(index,row){
|
|
|
- console.log(index,row)
|
|
|
- var url = "/api/System/DeleMsg"
|
|
|
- var that = this
|
|
|
- this.$axios({
|
|
|
- method: 'post',
|
|
|
- url: url,
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data:{
|
|
|
- portType:1,
|
|
|
- pageIndex:0,
|
|
|
- pageSize:0,
|
|
|
- msgId:row.id,
|
|
|
- userId:that.userId
|
|
|
- }
|
|
|
- }).then(function (res) {
|
|
|
- console.log(res)
|
|
|
- if(res.data.code==200){
|
|
|
-
|
|
|
- }else{
|
|
|
+ this.$confirm('此操作将认定你已知晓此通知?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ var url = "/api/System/SetMessageRead"
|
|
|
+ var that = this
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token
|
|
|
+ },
|
|
|
+ data:{
|
|
|
+ portType:1,
|
|
|
+ msgId:row.id,
|
|
|
+ userId:that.userId
|
|
|
+ }
|
|
|
+ }).then(function (res) {
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.code==200){
|
|
|
+ if(that.type==1020){
|
|
|
+ that.$router.push({ path: "/home/TaskList"});
|
|
|
+ }
|
|
|
+ that.uplocal();
|
|
|
+ that.PotsMsgTypeData();
|
|
|
+ that.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.msg
|
|
|
+ });
|
|
|
+ }else{
|
|
|
that.$message.error(res.data.msg);
|
|
|
- }
|
|
|
- }).catch(function (error) {
|
|
|
- that.$message.error("确认已读失败!");
|
|
|
+ }
|
|
|
+ }).catch(function (error) {
|
|
|
+ that.$message.error("确认已读失败!");
|
|
|
+ });
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消确认已读'
|
|
|
+ });
|
|
|
});
|
|
|
+ console.log(index,row)
|
|
|
+ console.log(this.type)
|
|
|
+
|
|
|
+ },
|
|
|
+ //修改未读条数
|
|
|
+ uplocal(){
|
|
|
+ console.log(this.msgtype.unReadCount);
|
|
|
+ window.localStorage.removeItem('unReadCount');
|
|
|
+ this.unReadCount--;
|
|
|
+ this.msgtype.unReadCount--;
|
|
|
+ console.log(this.msgtype.unReadCount);
|
|
|
+ localStorage.setItem('unReadCount', JSON.stringify(this.unReadCount));
|
|
|
},
|
|
|
//任务切换
|
|
|
taskclick(text){
|
|
@@ -604,11 +733,15 @@ export default {
|
|
|
mounted() {
|
|
|
this.userId=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
|
|
|
this.token=JSON.parse(localStorage.getItem('userinif')).token;
|
|
|
+ this.unReadCount=JSON.parse(localStorage.getItem('unReadCount'));
|
|
|
this.removal();
|
|
|
this.radioChange(false);
|
|
|
this.ifIndexValue();
|
|
|
this.getmenu();
|
|
|
this.PsotMsgPageList();
|
|
|
+ this.PotsMsgTypeData();
|
|
|
+ // setTimeout(this.PotsMessagePageList(),500)
|
|
|
+
|
|
|
setInterval(this.PsotMsgPageList, 300000);
|
|
|
// setInterval(this.PsotMsgPageList, 3000);
|
|
|
// this.chatHub();
|
|
@@ -1052,7 +1185,13 @@ i.icon-tongzhi {
|
|
|
.home-dialog .el-dialog__header{
|
|
|
padding: 10px 20px;
|
|
|
}
|
|
|
-
|
|
|
+.news-list-content{
|
|
|
+ line-height: 20px;
|
|
|
+}
|
|
|
+.loadmore{
|
|
|
+ margin-top: 20px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
|
|
|
|
|
|
|