优化系统消息

This commit is contained in:
龙运模 2024-10-14 22:17:14 +08:00
parent ea060b235e
commit ffd4ad1549
14 changed files with 158 additions and 74 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@ -118,7 +118,7 @@ export default {
},
},
read:{
url: `${config.API_URL}/messages.todo.read`,
url: `${config.API_URL}/user.read.message`,
name: "消息已读",
post: async function (params) {
return await http.post(this.url, params);

View File

@ -0,0 +1,16 @@
<template>
<svg width="24" height="30" viewBox="0 0 24 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22.245 21.9991C21.872 21.2519 21.2984 20.6233 20.5884 20.1835C19.8785 19.7438 19.0601 19.5103 18.225 19.5091H17.625L14.46 11.4691C15.7107 10.9049 16.7302 9.92895 17.3486 8.70409C17.967 7.47924 18.1469 6.07943 17.8583 4.73802C17.5697 3.39661 16.83 2.19463 15.7627 1.33246C14.6953 0.470284 13.3646 0 11.9925 0C10.6204 0 9.28974 0.470284 8.22235 1.33246C7.15495 2.19463 6.41531 3.39661 6.12672 4.73802C5.83812 6.07943 6.01801 7.47924 6.63639 8.70409C7.25478 9.92895 8.27429 10.9049 9.525 11.4691L6.375 19.5091H5.775C4.93987 19.5103 4.12154 19.7438 3.41158 20.1835C2.70161 20.6233 2.12802 21.2519 1.755 21.9991L0 25.5091H24L22.245 21.9991ZM0 27.0091H24V30.0091H0V27.0091Z" fill="#F56C6C"/>
</svg>
</template>
<script>
export default {
name: "MsgReview"
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,16 @@
<template>
<svg width="24" height="23" viewBox="0 0 24 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22.2354 10.3307C23.955 8.58441 24.4749 5.98495 23.5418 3.71876L20.3425 6.91809C19.4093 7.79791 17.9563 7.74459 17.0765 6.81145C16.2366 5.9183 16.2366 4.54525 17.0765 3.6521L20.2758 0.452765C18.0096 -0.467044 15.4101 0.0395172 13.6505 1.74583C11.9175 3.47881 11.411 6.0916 12.3574 8.34446L10.1446 10.5573L4.54573 4.9585L4.93231 4.15866L1.90627 2.09243L0 4.01203L1.99959 6.99808L2.90606 6.54484L8.5449 12.1437L1.99959 18.689C1.58634 19.1022 1.57301 19.7688 1.98626 20.182L1.99959 20.1953L3.99917 22.2083C4.41242 22.6215 5.09228 22.6215 5.50553 22.2083L12.0508 15.6763L12.984 16.6094L12.7307 16.8627C12.3708 17.116 12.2775 17.6092 12.5307 17.9825C12.5574 18.0225 12.5841 18.0625 12.6241 18.0891L17.0631 22.5149C17.4364 22.9015 18.0496 22.9414 18.4762 22.5948L20.5424 20.5286C20.9157 20.102 20.9157 19.4755 20.5424 19.0622L16.1033 14.6365C15.7434 14.2632 15.1969 14.4232 14.8103 14.8098L14.6236 14.9964L13.6905 14.0766L16.01 11.7438C18.1829 12.4903 20.5957 11.9437 22.2354 10.3307Z" fill="#FF8447"/>
</svg>
</template>
<script>
export default {
name: "MsgSetup"
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,15 @@
<template>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.9 20.925H7.8C7.65 20.925 7.725 21.075 7.875 21.375C8.1 21.675 8.4 22.05 8.775 22.425C9.15 22.8 9.675 23.175 10.2 23.475C10.725 23.775 11.325 23.925 11.925 23.925H12.075C12.675 23.925 13.275 23.775 13.8 23.475C14.325 23.175 14.775 22.8 15.225 22.425C15.6 22.05 15.9 21.675 16.125 21.375C16.35 21.075 16.35 20.925 16.2 20.925H15.9ZM23.775 18.3C23.4 17.775 22.95 17.1 22.5 16.35C22.05 15.6 21.6 14.775 21.15 13.875C20.7 12.975 20.325 12 20.025 11.025C19.725 9.975 19.575 9 19.575 7.95C19.575 6.9 19.425 6 19.125 5.175C18.825 4.35 18.45 3.6 18 2.925C17.55 2.25 17.025 1.725 16.35 1.275C15.75 0.825 15.075 0.525 14.4 0.3C13.65 0.075 12.825 0 12 0H11.925H11.85C11.025 0 10.2 0.15 9.45 0.3C8.775 0.525 8.1 0.825 7.5 1.275C6.975 1.725 6.375 2.25 5.925 2.85C5.475 3.525 5.1 4.2 4.8 5.1C4.575 5.925 4.425 6.9 4.425 7.875C4.425 8.925 4.275 9.975 3.975 10.95C3.675 11.925 3.3 12.9 2.85 13.8C2.4 14.7 1.95 15.525 1.5 16.275C1.05 17.025 0.6 17.7 0.225 18.225C0.075 18.45 0 18.6 0 18.825C0 18.975 0.075 19.125 0.15 19.275C0.225 19.425 0.3 19.5 0.45 19.575C0.525 19.65 0.6 19.65 0.675 19.65H23.325C23.4 19.65 23.475 19.65 23.55 19.575C23.7 19.5 23.775 19.425 23.85 19.275C23.925 19.125 24 18.975 24 18.825C24 18.6 23.925 18.45 23.775 18.3Z" fill="#1367c5"/>
</svg>
</template>
<script>
export default {
name: "SmallBell"
}
</script>
<style scoped>
</style>

View File

@ -41,7 +41,9 @@ export { default as Folder } from './Folder.vue'
export { default as User } from './User.vue'
export { default as AccountNumber } from './AccountNumber.vue'
export { default as ClearCache } from './ClearCache.vue'
export { default as Right } from './Right.vue'
export { default as MsgSetup } from './MsgSetup.vue'
export { default as MsgReview } from './MsgReview.vue'
export { default as SmallBell } from './SmallBell.vue'
export { default as File7z } from './file/7z.vue'
export { default as FileBmp } from './file/Bmp.vue'

View File

@ -8,14 +8,14 @@
<!-- <el-icon v-if="navMenu.meta & &navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>-->
<template #title>
<span>{{navMenu.meta.title}}</span>
<span v-if="navMenu.meta.tag" class="menu-tag">{{navMenu.meta.tag}}</span>
<span v-if="navMenu.meta.tag" class="menu-tag">{{navMenu.meta.tag>99?'99+':navMenu.meta.tag}}</span>
</template>
</el-menu-item>
<el-sub-menu v-else :index="navMenu.path">
<template #title>
<el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
<span>{{navMenu.meta.title}}</span>
<span v-if="navMenu.meta.tag" class="menu-tag">{{navMenu.meta.tag}}</span>
<span v-if="navMenu.meta.tag" class="menu-tag">{{navMenu.meta.tag>99?'99+':navMenu.meta.tag}}</span>
</template>
<NavMenu :navMenus="navMenu.children"></NavMenu>
</el-sub-menu>

View File

@ -24,19 +24,19 @@
<el-main class="nopadding">
<el-scrollbar>
<ul class="msg-list">
<li v-for="item in msgList" v-bind:key="item.id">
<li v-for="item in msgList" v-bind:key="item.id" @click.stop="msgClick(item)">
<a :href="item.link" target="_blank">
<div class="msg-list__icon">
<el-badge is-dot type="danger">
<el-avatar :size="40" :src="item.avatar"></el-avatar>
<el-badge :is-dot="item.read_status?false:true" type="danger">
<el-avatar :size="40" icon="sc-icon-SmallBell"></el-avatar>
</el-badge>
</div>
<div class="msg-list__main">
<h2>{{item.title}}</h2>
<p>{{item.describe}}</p>
<p>{{item.content}}</p>
</div>
<div class="msg-list__time">
<p>{{item.time}}</p>
<p>{{item.created_at}}</p>
</div>
</a>
</li>
@ -102,6 +102,7 @@
<script>
import search from './search.vue'
import tasks from './tasks.vue'
import {eventBus} from "@/utils/eventBus";
export default {
components: {
@ -116,35 +117,7 @@
searchVisible: false,
tasksVisible: false,
msg: false,
msgList: [
{
id: 1,
type: 'user',
avatar: "img/avatar.jpg",
title: "dragon",
describe: "如果喜欢就点个星星支持一下哦",
link: "",
time: "5分钟前"
},
{
id: 2,
type: 'user',
avatar: "img/avatar2.gif",
title: "ykxiao",
describe: "点进去Gitee获取最新开源版本",
link: "",
time: "14分钟前"
},
{
id: 3,
type: 'system',
avatar: "img/logo1.png",
title: "感谢登录象玮云科",
describe: "后台管理系统。",
link: "",
time: "2024年7月24日"
}
]
msgList: []
}
},
created() {
@ -164,6 +137,13 @@
this.avatar = this.$store.state.global.login_avatar;
this.userId = userInfo.id;
},
mounted() {
//
eventBus.$on('sockBack', this.getWsResult);
},
unmounted() {
eventBus.$off('sockBack', this.getWsResult);
},
methods: {
//
handleUser(command) {
@ -217,9 +197,29 @@
showMsg() {
this.msg = true
},
getWsResult(res){
if(res.data && res.data.type == 22){
this.msgList = res.data.list_backlog_info;
}
},
async msgClick(em) {
if (em.read_status) {
return
}
let params = {
message_id: em.id,
is_read:true
}
await this.$API.user.messages.read.post(params);
this.msgList.forEach(item => {
if (item.id == em.id) {
item.is_read = true;
}
})
},
//
markRead() {
this.msgList = []
this.msgList = [];
},
//
search() {

View File

@ -205,6 +205,8 @@
import setting from './components/setting.vue';
import iframeView from './components/iframeView.vue';
import autoExit from './other/autoExit.js';
import {eventBus} from "@/utils/eventBus"
import tool from "@/utils/tool";
export default {
name: 'index',
@ -254,6 +256,7 @@
this.$socketApi.createWebSocket(global_callback);
//
eventBus.$on('sockBack', this.getWsResult);
// this.$socketApi.getSock(this.getWsResult);
}
},
@ -269,6 +272,31 @@
}
},
methods: {
getWsResult(res){
if(res.data.type == 21){
let apiMenu = tool.objCopy(tool.data.get("MENU"));
apiMenu.forEach(item=>{
if(item.name == 'order'){
item.meta.tag = null;
if(item.children && item.children.length>0){
item.children.forEach(em=>{
if(em.name == "orderList"){
em.meta.tag = 0;
if(res.data.list_count_info && res.data.list_count_info.main_order_count && res.data.list_count_info.main_order_count.length>0){
res.data.list_count_info.main_order_count.forEach(li=>{
em.meta.tag += li.value;
})
}
item.meta.tag = em.meta.tag;
}
})
}
}
})
console.log(apiMenu)
tool.data.set('MENU',apiMenu);
}
},
openSetting(){
this.settingDialog = true;
},

View File

@ -69,7 +69,7 @@ a,button,input,textarea{-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing: bo
.adminui-side-bottom:hover {color: var(--el-color-primary);}
.aminui-side.isCollapse {width: 65px;}
.el-menu .menu-tag {position: absolute;height: 18px;line-height: 18px;background: var(--el-color-danger);font-size: 12px;color: #fff;right: 20px;border-radius:18px;padding:0 6px;}
.el-menu .el-sub-menu__title .menu-tag {right: 40px;}
.el-menu .el-sub-menu__title .menu-tag {right: 35px;top: 5px;}
.el-menu--horizontal > li .menu-tag {display: none;}
/* 右侧内容 */
@ -87,7 +87,7 @@ a,button,input,textarea{-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing: bo
.adminui-tags ul {display: flex;overflow: hidden;}
.adminui-tags li {cursor: pointer;display: inline-block;float: left;height:34px;line-height: 34px;position: relative;flex-shrink: 0;}
.adminui-tags li::after {content: " ";width:1px;height:100%;position: absolute;right:0;background-image: linear-gradient(#fff, #e6e6e6);}
.adminui-tags li a {display: inline-block;padding:0 10px;width:100%;height:100%;color: #999;text-decoration:none;display: flex;align-items: center;}
.adminui-tags li a {padding:0 10px;width:100%;height:100%;color: #999;text-decoration:none;display: flex;align-items: center;}
.adminui-tags li i {margin-left:10px;border-radius: 50%;width:15px;height:15px;display: flex;align-items: center;justify-content: center;}
.adminui-tags li i:hover {background: var(--el-color-danger);color: #fff;}
.adminui-tags li:hover {background: #ecf5ff;}
@ -106,5 +106,15 @@ a,button,input,textarea{-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing: bo
.main-maximize-exit i {font-size: 14px;margin-top: 22px;color: #fff;}
.main-maximize-exit:hover {background: rgba(0,0,0,0.4);}
/*表格合计*/
.countView{
display: flex;align-items: center;flex-wrap: wrap;
.countItem{
margin-right: 10px;
.name{
margin-right: 4px;
}
}
}
/*定宽页面*/
.sc-page {width: 1230px;margin: 0 auto;}

View File

@ -324,7 +324,6 @@ tool.isBinaryFile = function (file) {
tool.authPermissions = function (list){
let arr = [];
if(list && list.length>0){
console.log(list,233)
list.forEach(item=>{
for(let i in item){
if(item[i] && item[i].length>0){

View File

@ -154,8 +154,9 @@ function webSocketOnMessage(msg) {
handleError('系统退出', result.msg);
}
}
if(result && result.data){
eventBus.$emit('sockBack',result);
}
if(result.data && result.data.type == 1){
if(showNot && showNot.close){
showNot.close();

View File

@ -13,18 +13,10 @@
</el-col>
<el-col class="middleCol" :span="10" :md="10" :sm="24" :xs="24">
<div class="cardBox">
<div class="cardTitle">待办消息</div>
<div class="cardTitle">占位</div>
<div class="cardBody">
<el-scrollbar>
<div class="newBell">
<div class="item" v-for="(item,index) in newList" :key="index">
<div class="title text">
<text class="status" v-if="item.status">{{item.status}}</text>
{{item.title}}
</div>
<div class="com text">{{item.content}}</div>
</div>
</div>
</el-scrollbar>
</div>
</div>
@ -128,19 +120,6 @@ export default {
{num:3553,name:'个人中心',icon:'sc-icon-HomeUser'},
{num:253,name:'个人中心',icon:'sc-icon-HomeChart'},
],
newList:[
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审',status:'紧急'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审在今晚九点之前一定操作配合财务打款。',status:'紧急'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审 在今晚九点之前一定操作,配合财务打款。',status:'紧急'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
{title:'委派维修单审核',content:'单号:#SO20240112180910 单号审'},
],
}
},
mounted() {
@ -156,16 +135,13 @@ export default {
if(res.data && (res.data.type == 21 || res.data.type == 22)){
if(res.data.type == 21){
this.briefing.forEach(item=>{
res.data.list_count_info.forEach(em=>{
res.data.list_count_info && res.data.list_count_info.main_order_count.forEach(em=>{
if(item.name == em.title){
item.num = em.value
}
})
})
}
if(res.data.type == 22){
this.newList = res.data.list_backlog_info
}
}
}
}

View File

@ -35,7 +35,7 @@
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
</div>
</div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size" highlightCurrentRow @selection-change="selectionChange">
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size" highlightCurrentRow :hideTotal="false" @selection-change="selectionChange">
<el-table-column type="selection" align="center" width="40"></el-table-column>
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
<template #business_status="scope">
@ -76,6 +76,15 @@
</el-dropdown>
</template>
</el-table-column>
<template #total>
<div class="countView">
<div class="countItem" v-for="(item,index) in countParams" :key="index">
<span class="name">{{item.title}}:</span>
<span class="num">{{item.value}}</span>
</div>
</div>
</template>
</scTable>
</el-main>
</el-container>
@ -135,12 +144,24 @@ export default {
],
params: {},
statusList:[],
countParams:{}
}
},
mounted() {
//
eventBus.$on('sockBack', this.getWsResult);
this.getStatusList();
},
unmounted() {
eventBus.$off('sockBack', this.getWsResult);
},
methods: {
getWsResult(res){
if(res.data.type == 21){
this.countParams = res.data.list_count_info.main_order_count;
}
},
searchShowClick(){
this.searchShow = !this.searchShow;
this.searchList.forEach(item=>{