|
|
@@ -7,13 +7,16 @@
|
|
|
<template v-slot:title>
|
|
|
<uni-section title="待办" type="line" titleFontSize="1.3rem">
|
|
|
<template v-slot:right>
|
|
|
- <uni-badge :text="unProcessNum" style="margin-left: -10px;" v-if="unProcessNum>0"></uni-badge>
|
|
|
+ <uni-badge :text="unProcessNum" style="margin-left: -10px;"
|
|
|
+ v-if="unProcessNum>0"></uni-badge>
|
|
|
</template>
|
|
|
</uni-section>
|
|
|
</template>
|
|
|
<view class="process_container">
|
|
|
<view class="process_list">
|
|
|
- <process-list :list="processes" @clickSegment="getProcessData" @clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="0" :pSize="5" :pageNo="1" contentHeight="69.5vh"></process-list>
|
|
|
+ <process-list :list="processes" @clickSegment="getProcessData"
|
|
|
+ @clickItem="handleToProcessDetail" @scrollToBottom="getProcessPage" :current="0" :pSize="5"
|
|
|
+ :pageNo="1" contentHeight="69.5vh"></process-list>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-collapse-item>
|
|
|
@@ -25,9 +28,10 @@
|
|
|
title="公告"></message-list>
|
|
|
|
|
|
<!-- 消息列表 -->
|
|
|
- <message-list :unReadNum="unReadNum" :list="messages" @clickSegment="getMessageData" @clickItem="handleToMessageDetail"
|
|
|
- @scrollToBottom="getMessagePage" :defaultCurrent="1" :pSize="5" :pageNo="1" :anime="true" :open="true"
|
|
|
- :segments="{ '全部': '', '未读': '0', '已读': '1' }" title="消息"></message-list>
|
|
|
+ <message-list @readMsg="setMsgRead" :unReadNum="unReadNum" :list="messages" @clickSegment="getMessageData"
|
|
|
+ @clickItem="handleToMessageDetail" @scrollToBottom="getMessagePage" :defaultCurrent="1" :pSize="5"
|
|
|
+ :pageNo="1" :anime="true" :open="true" :segments="{ '全部': '', '未读': '0', '已读': '1' }"
|
|
|
+ title="消息"></message-list>
|
|
|
|
|
|
<!-- AI咨询按钮 -->
|
|
|
<view class="fab_button">
|
|
|
@@ -41,8 +45,8 @@
|
|
|
<script setup lang="ts">
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
- import { getMessageList, getNoticeList ,getUnReadMessageNum} from '@/api/message.js';
|
|
|
- import { getUserProcess,getUnProcessNum } from '@/api/process';
|
|
|
+ import { getMessageList, getNoticeList, getUnReadMessageNum, setMsgIsRead } from '@/api/message.js';
|
|
|
+ import { getUserProcess, getUnProcessNum } from '@/api/process';
|
|
|
import $tab from '@/plugins/tab.js';
|
|
|
import $modal from '@/plugins/modal.js';
|
|
|
import processList from '@/components/ygoa/processList.vue'
|
|
|
@@ -54,7 +58,7 @@
|
|
|
// 是否跳转打卡页
|
|
|
if (options.to == 'clockIn') toClockIn()
|
|
|
})
|
|
|
- onMounted(()=>{
|
|
|
+ onMounted(() => {
|
|
|
showTarBarBadge();
|
|
|
})
|
|
|
// 跳转打卡页
|
|
|
@@ -65,6 +69,32 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ //所有未读消息的ids
|
|
|
+ const unReadMsgIds = ref('')
|
|
|
+ //设置消息已读
|
|
|
+ function setMsgRead() {
|
|
|
+ setMsgIsRead(unReadMsgIds.value).then((res) => {
|
|
|
+ if (Number.isInteger(res)) {
|
|
|
+ switch (res) {
|
|
|
+ case -1:
|
|
|
+ $modal.msgError('操作失败')
|
|
|
+ break
|
|
|
+ case -2:
|
|
|
+ $modal.msg('不存在未读消息')
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ $modal.msgSuccess('操作成功')
|
|
|
+ //刷新页面
|
|
|
+ setTimeout(() => {
|
|
|
+ $tab.reLaunch('/pages/message/index')
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $modal.msgError('jssesionid失效,请重新登录')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
// 待办列表
|
|
|
const processes = ref([])
|
|
|
// 获取待办消息列表数据
|
|
|
@@ -81,7 +111,7 @@
|
|
|
processes.value = []
|
|
|
return
|
|
|
}
|
|
|
- processes.value = returnParams.list
|
|
|
+ processes.value = returnParams.list;
|
|
|
callback(returnParams.list, returnParams.total, pageNo)
|
|
|
});
|
|
|
}
|
|
|
@@ -142,55 +172,56 @@
|
|
|
$tab.navigateTo('/pages/message/detail/index?noticeId=' + notice.id)
|
|
|
}
|
|
|
|
|
|
-// 消息列表
|
|
|
-const messages = ref([])
|
|
|
-// 获取消息列表数据
|
|
|
-function getMessageData({ pSize, pageNo, type, segmentValue }, callback) {
|
|
|
- const params = {
|
|
|
- currentUser: userStore.user.useId,
|
|
|
- isRead: segmentValue,
|
|
|
- pSize: pSize,
|
|
|
- type: type,
|
|
|
- p: pageNo,
|
|
|
- }
|
|
|
- getMessageList(params).then(({ returnParams }) => {
|
|
|
- returnParams.list.forEach(item => {
|
|
|
- if('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
|
|
|
- item.title = '(流程提醒)' + item.title.slice(12)
|
|
|
- }
|
|
|
- // return item
|
|
|
+ // 消息列表
|
|
|
+ const messages = ref([])
|
|
|
+ // 获取消息列表数据
|
|
|
+ function getMessageData({ pSize, pageNo, type, segmentValue }, callback) {
|
|
|
+ const params = {
|
|
|
+ currentUser: userStore.user.useId,
|
|
|
+ isRead: segmentValue,
|
|
|
+ pSize: pSize,
|
|
|
+ type: type,
|
|
|
+ p: pageNo,
|
|
|
+ }
|
|
|
+ getMessageList(params).then(({ returnParams }) => {
|
|
|
+ returnParams.list.forEach(item => {
|
|
|
+ if ('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
|
|
|
+ item.title = '(流程提醒)' + item.title.slice(12)
|
|
|
+ }
|
|
|
+ // return item
|
|
|
+ })
|
|
|
+ messages.value = returnParams.list;
|
|
|
+ unReadMsgIds.value = returnParams.ids === "" ? "" : returnParams.ids + ",";
|
|
|
+ // 通知子组件加载完成
|
|
|
+ callback(returnParams.list, returnParams.total, pageNo)
|
|
|
})
|
|
|
- messages.value = returnParams.list;
|
|
|
- // 通知子组件加载完成
|
|
|
- callback(returnParams.list, returnParams.total, pageNo)
|
|
|
- })
|
|
|
-}
|
|
|
-// 分页获取消息数据
|
|
|
-function getMessagePage({ pSize, pageNo, type, segmentValue }, callback) {
|
|
|
- const params = {
|
|
|
- currentUser: userStore.user.useId,
|
|
|
- isRead: segmentValue,
|
|
|
- pSize: pSize,
|
|
|
- type: type,
|
|
|
- p: pageNo,
|
|
|
}
|
|
|
- getMessageList(params).then(({ returnParams }) => {
|
|
|
- returnParams.list.forEach(item => {
|
|
|
- if('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
|
|
|
- item.title = '(流程提醒)' + item.title.slice(12)
|
|
|
- }
|
|
|
- // return item
|
|
|
+ // 分页获取消息数据
|
|
|
+ function getMessagePage({ pSize, pageNo, type, segmentValue }, callback) {
|
|
|
+ const params = {
|
|
|
+ currentUser: userStore.user.useId,
|
|
|
+ isRead: segmentValue,
|
|
|
+ pSize: pSize,
|
|
|
+ type: type,
|
|
|
+ p: pageNo,
|
|
|
+ }
|
|
|
+ getMessageList(params).then(({ returnParams }) => {
|
|
|
+ returnParams.list.forEach(item => {
|
|
|
+ if ('(流程提醒)您有一个流程' == item.title.substring(0, 12)) {
|
|
|
+ item.title = '(流程提醒)' + item.title.slice(12)
|
|
|
+ }
|
|
|
+ // return item
|
|
|
+ })
|
|
|
+ // 更新数据
|
|
|
+ messages.value.push(...returnParams.list)
|
|
|
+ // 通知子组件加载完成
|
|
|
+ callback(returnParams.list, returnParams.total, pageNo)
|
|
|
})
|
|
|
- // 更新数据
|
|
|
- messages.value.push(...returnParams.list)
|
|
|
- // 通知子组件加载完成
|
|
|
- callback(returnParams.list, returnParams.total, pageNo)
|
|
|
- })
|
|
|
-}
|
|
|
-// 点击消息列表项
|
|
|
-function handleToMessageDetail({ messageid, universalid}) {
|
|
|
- $tab.navigateTo('/pages/message/detail/index?messageId=' + messageid + '&universalId=' + universalid)
|
|
|
-}
|
|
|
+ }
|
|
|
+ // 点击消息列表项
|
|
|
+ function handleToMessageDetail({ messageid, universalid }) {
|
|
|
+ $tab.navigateTo('/pages/message/detail/index?messageId=' + messageid + '&universalId=' + universalid)
|
|
|
+ }
|
|
|
|
|
|
// AI咨询按钮
|
|
|
function clickFabButton() {
|
|
|
@@ -200,28 +231,33 @@ function handleToMessageDetail({ messageid, universalid}) {
|
|
|
//待办流程数
|
|
|
const unProcessNum = ref(0)
|
|
|
//未读消息数
|
|
|
- const unReadNum=ref(0)
|
|
|
+ const unReadNum = ref(0)
|
|
|
//待阅消息数+待办流程数(用于tarbar导航栏)
|
|
|
- const unReadMsgNum=ref(0)
|
|
|
- function showTarBarBadge(){
|
|
|
- getUnProcessNum(userStore.user.useId,"").then(res=>{
|
|
|
- unProcessNum.value=parseInt(res.returnParams.total, 10);
|
|
|
- getUnReadMessageNum(userStore.user.useId).then(res=>{
|
|
|
- unReadNum.value=parseInt(res.returnParams, 10);
|
|
|
- unReadMsgNum.value=unReadNum.value+unProcessNum.value;
|
|
|
- if(unReadMsgNum.value==0){
|
|
|
+ const unReadMsgNum = ref(0)
|
|
|
+ function showTarBarBadge() {
|
|
|
+ getUnProcessNum(userStore.user.useId, "").then(res => {
|
|
|
+ if ("failed" == res.returnMsg) {
|
|
|
+ $modal.msgError('待办流程数获取失败')
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ unProcessNum.value = parseInt(res.returnParams.total, 10);
|
|
|
+ }
|
|
|
+ getUnReadMessageNum(userStore.user.useId).then(res => {
|
|
|
+ unReadNum.value = parseInt(res.returnParams, 10);
|
|
|
+ unReadMsgNum.value = unReadNum.value + unProcessNum.value;
|
|
|
+ if (unReadMsgNum.value == 0) {
|
|
|
uni.removeTabBarBadge({
|
|
|
- index:0
|
|
|
+ index: 0
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
uni.setTabBarBadge({
|
|
|
- index: 0,
|
|
|
- text: unReadMsgNum.value>99?'99+':String(unReadMsgNum.value)
|
|
|
+ index: 0,
|
|
|
+ text: unReadMsgNum.value > 99 ? '99+' : String(unReadMsgNum.value)
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
|