优化工单消息

This commit is contained in:
龙运模 2024-10-14 23:48:41 +08:00
parent 1e61cae6e8
commit 1346b83ba3
4 changed files with 24 additions and 4 deletions

View File

@ -21,7 +21,7 @@
</el-badge>
<el-drawer title="新消息" v-model="msg" :size="400" append-to-body destroy-on-close>
<el-container>
<el-main class="nopadding">
<el-main class="nopadding" v-loading="msgLoading" element-loading-text="加载中...">
<el-scrollbar>
<ul class="msg-list">
<li v-for="item in msgList" v-bind:key="item.id" @click.stop="msgClick(item)">
@ -117,6 +117,7 @@
searchVisible: false,
tasksVisible: false,
msg: false,
msgLoading:false,
msgList: [],
unreadMsgNum:[]
}
@ -214,7 +215,9 @@
message_id: em.id,
is_read:true
}
this.msgLoading = true;
await this.$API.user.messages.read.post(params);
this.msgLoading = false;
this.msgList.forEach(item => {
if (item.id == em.id) {
item.is_read = true;

View File

@ -279,7 +279,10 @@
},
methods: {
getWsResult(res){
if(res.data.type == 21){
if(res.data && res.data.type == 21){
if(res.data.list_count_info && res.data.list_count_info.main_order_count.length>0){
this.$store.commit("set_list_count_info", res.data.list_count_info.main_order_count);
}
let apiMenu = tool.objCopy(tool.data.get("MENU"));
apiMenu.forEach(item=>{
if(item.name == 'order'){

13
src/store/modules/msg.js Normal file
View File

@ -0,0 +1,13 @@
export default {
state: {
main_order_count:[]
},
mutations: {
set_list_count_info(state, list){
state.main_order_count = list;
},
},
actions: {
}
}

View File

@ -145,7 +145,7 @@ export default {
params: {},
statusList:[],
countParams:{}
countParams:this.$store.state.msg.main_order_count
}
},
mounted() {
@ -158,7 +158,8 @@ export default {
},
methods: {
getWsResult(res){
if(res.data.type == 21){
if(res.data && res.data.type == 21){
this.$store.commit('set_list_count_info',res.data.list_count_info.main_order_count);
this.countParams = res.data.list_count_info.main_order_count;
}
},