Commit 7c7a6aee authored by kaitly205422@163.com's avatar kaitly205422@163.com

Merge branch 'develop' of http://git.censoft.com.cn/rongtong/rongtong-app into develop

parents 9e33fff9 bd13b279
......@@ -31,7 +31,7 @@ export default {
imgUrl: require("@/assets/tabBar/new.png"),
imgUrlActive: require("@/assets/tabBar/new-active.png"),
path: "/message-center",
text: "任务列表"
text: "消息中心"
},
{
key: "2",
......
import request from '@/utils/axios'
import { getFun, postFun,postThree } from "@/service/table.js";
/*get请求*/
// export function getFun(url,params) {
// return request({
// url: url,
// method: 'get',
// params
// })
// }
/* post请求 */
//消息信息列表
export function postMessgaelist(data,params) {
return postThree('/messageInfo/list', data,params)
}
// //消息信息列表
// export function postWarnList(data,params) {
// return postThree('warn/pushBase/list', data,params)
// }
//未读消息变为已读
export function noticeRemove(data) {
return postFun('/messageInfo/changeRead', data)
}
//清除未读消息列表
export function removeAllMessgae(data) {
return postFun("/messageInfo/changeStatus", data)
}
//删除已读消息
export function removeMessgae(data) {
return postFun("/messageInfo/remove", data)
}
//待办事项列表
export function waitList(data,params) {
return postThree("/backlogInfo/list",data,params)
}
//未读消息数
export function badgeNumber(data) {
return getFun("/backlogInfo/unReadCount", data);
}
//删除已办事项
export function removeWaitList(data) {
return postFun("/backlogInfo/remove", data)
}
// //通知公告列表
// export function notificationList(data) {
// return postFun("/noticeInfo/list", data)
// }
// //清除通知公告未读
// export function removeAllNotification(data) {
// return getFun("/noticeInfo/changeStatus", data)
// }
// //清除通知未读改为已读
// export function readNotification(data) {
// return postFun("/noticeInfo/changeRead", data)
// }
// //删除已读通知列表
// export function removeNotification(data) {
// return postFun("/noticeInfo/remove", data)
// }
\ No newline at end of file
......@@ -52,3 +52,13 @@ export function fileDownFuns(url, data) {
responseType: "blob" /*下载文件必填项*/
});
}
/* put请求 */
export function postThree(url,data,params) {
return request({
url:url,
method: 'post',
params,
data,
})
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
<div class="con">
<van-tabs v-model="activeName" color="#247df7" title-inactive-colo="#d0d1d1" title-active-color="#000000" sticky
offset-top="1.333333rem" @change="changeTab">
<van-tab title="消息提醒" name="消息提醒">
<van-tab title="消息提醒(14)" name="消息提醒">
<info-tip></info-tip>
</van-tab>
<!-- <van-tab title="预警提醒" name="预警提醒" >
......@@ -20,7 +20,7 @@
<!-- <van-tab title="SOS求救" name="SOS求救">
<Iso></Iso>
</van-tab> -->
<van-tab title="待办事项" name="待办事项">
<van-tab title="待办事项(20)" name="待办事项">
<wait-event></wait-event>
</van-tab>
</van-tabs>
......@@ -105,7 +105,7 @@ export default {
.con {
// height: calc(100% - 110px);
// height: 100%;
padding: 0 0 50px 0;
// padding: 0 0 50px 0;
background-color: #f0f1f5;
position: relative;
......
......@@ -18,40 +18,59 @@
</div>
<!-- 内容列表 -->
<div class="con-list" @touchmove="showIndex = null">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="getList()"
>
<van-cell-group
inset
v-for="(item, index) in messageList"
:key="index"
@click="touchstart(index, item)"
>
<div class="approval-title">{{ item.noticeTitle }} <span class="title-icon">待处理</span></div>
<!-- <div class="row"><span class="row-title">作业类型</span><span>{{ item.id }}</span></div> -->
<div class="row"><span class="row-title">作业类型</span><span>{{ item.jobType }}</span></div>
<div class="row"><span class="row-title">作业单号</span><span>{{ item.pid }}</span></div>
<div class="row"><span class="row-title">发送人</span><span>{{ item.createName }}</span></div>
<div class="row"><span class="row-title">消息内容</span><span>{{ item.noticeContent }}</span></div>
<div class="row"><span class="row-title">发送时间</span><span>{{ item.sendTime }}</span></div>
<van-tag
class="status"
:color="item.status == '已读' ? '#07c160' : '#ee0a24'"
plain
>
{{ item.status}}
</van-tag>
<van-overlay :show="showIndex == index">
<div class="wrapper" @click.stop="closeOverlay">
<van-button round type="info" @click="onClick(item)">
查看
</van-button>
</div>
</van-overlay>
<van-badge :dot="item.status == 0 ? true : false">
<div style="padding: 10px; min-width: calc(100vw - 1.6rem)">
<div class="messgae-title">
<span>{{ item.title }}</span>
<span>{{ item.createTime }}</span>
</div>
<div class="mse_title">
<!-- {{ item.title }} -->
</div>
<div class="message-content">
{{ item.content }}
</div>
</div>
</van-badge>
<van-overlay :show="showIndex == index">
<div class="wrapper" @click.stop="closeOverlay">
<van-button round color="#4ABD85" @click="touchstart(item)">
详情
</van-button>
</div>
</van-overlay>
</van-cell-group>
<van-image
v-if="messageList.length <= 0"
fit="contain"
:src="require('../../../assets/noMessage.png')"
/>
</van-list>
</div>
</div>
</div>
</template>
<script>
import {
notificationList,
removeAllNotification,
readNotification,
removeNotification,
postMessgaelist
} from "@/service/message";
import { getFun,postFun } from '@/service/table'
import {debounce} from '@/utils/common.js'
export default {
......@@ -77,37 +96,76 @@ export default {
category: "全部"
},
],
loading: false, // 列表滚动到底部会触发load事件
finished: false, // 列表数据全部加载完成
pageSize: 10,
pageNum: 1,
};
},
mounted() {
this.getList(this.searchVal);
},
methods: {
// 搜索事件
// 搜索事件
onSearch:debounce(function(){
if(this.searchVal){
this.getList(this.searchVal)
}else{
this.getList("")
}
this.messageList=[]
this.pageNum=1
this.finished = false
this.loading = true
if (this.activeIndex == 0) {
let formData = new FormData();
formData.append("status", 0);
formData.append("keyword", this.searchVal);
this.getList(formData);
} else if (this.activeIndex == 1) {
let formData = new FormData();
formData.append("status", 1);
formData.append("keyword", this.searchVal);
this.getList(formData);
} else if (this.activeIndex == 2) {
let formData = new FormData();
formData.append("keyword", this.searchVal);
this.getList(formData);
}
},800),
getList(val) {
getList(Data) {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
let formdata = new FormData()
formdata.append("search", val);
postFun("mobile/notice", formdata)
.then(res => {
var obj={
pageSize:this.pageSize,
pageNum:this.pageNum,
}
let formData
if (this.activeIndex == 0) {
formData = new FormData();
formData.append("status", 0);
} else if (this.activeIndex == 1) {
formData = new FormData();
formData.append("status", 1);
} else if (this.activeIndex == 2) {
formData = new FormData()
}
if(this.searchVal){
formData.append("keyword", this.searchVal);
}
postMessgaelist(Data?Data:formData,obj).then((res) => {
this.$toast.clear();
this.messageList = res.rows.filter(item => {
return item.status == "未读";
});
this.completeList = res.rows;
// this.messageList = res.rows.filter(item => {
// return item.status == "未读";
// });
this.messageList.push(...res.rows)
this.loading = false;
if (this.messageList.length >= res.total) {
this.finished = true;
}
if(!(this.pageNum*this.pageSize-res.total>=0)){
this.pageNum++;
}
})
.catch(() => {
this.$toast.clear();
......@@ -124,77 +182,19 @@ export default {
closeOverlay() {
this.showIndex = null;
},
onClick(data) {
let updateId = data.id
this.showIndex = null;
if (data.jobType == "" || data.pid == "" || data.noticeTitle == "") return;
// 进入对应的操作页面
switch (data.jobType + "-" + data.noticeTitle) {
// 作业审批的情况
case "动火作业-审批通过": case "动火作业-开始作业": case "动火作业-结束作业":
this.$router.push({
name: "detail-work",
params: {
id: data.pid
}
});
break;
case "有限空间作业-审批通过": case "有限空间作业-开始作业": case "有限空间作业-结束作业":
this.$router.push({
name: "limit-detail",
params: {
id: data.pid
}
});
break;
case "动火作业-问题上报": case "动火作业-问题处置": case "动火作业-督导提醒":
// 把 data.中的pid 改为 id 在跳转
data.id = data.proId
this.$router.push({
name: "prorec-detail",
params: {
data: data
}
});
break;
default:
break;
}
// 把未读的消息改为已读状态
if(data.status == "未读"){
let formdata = new FormData()
formdata.append("id", updateId)
postFun("mobile/updateStatus", formdata )
.then(res => {})
.catch(() => {
this.$toast.fail('状态更新失败');
});
}
},
// 点击类别
clickCategory(index, data) {
// 关闭遮罩层
this.showIndex = null;
this.activeIndex = index;
this.activeVal = this.messageCategory[index].category;
// 过滤数组
switch (this.activeVal) {
case "未读":
this.messageList = this.completeList.filter(item => {
return item.status == "未读";
});
break;
case "已读":
this.messageList = this.completeList.filter(item => {
return item.status == "已读";
});
console.log(this.messageList);
break;
default:
this.messageList = this.completeList;
break;
}
}
this.reset()
this.getList()
},
reset(){
this.messageList=[]
this.pageNum=1
this.finished = false
this.loading = true
},
}
};
</script>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment