优化工单消息

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

View File

@ -279,7 +279,10 @@
}, },
methods: { methods: {
getWsResult(res){ 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")); let apiMenu = tool.objCopy(tool.data.get("MENU"));
apiMenu.forEach(item=>{ apiMenu.forEach(item=>{
if(item.name == 'order'){ 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: {}, params: {},
statusList:[], statusList:[],
countParams:{} countParams:this.$store.state.msg.main_order_count
} }
}, },
mounted() { mounted() {
@ -158,7 +158,8 @@ export default {
}, },
methods: { methods: {
getWsResult(res){ 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; this.countParams = res.data.list_count_info.main_order_count;
} }
}, },