From 4570c70a1d9591941e882d2f01091a992c113b21 Mon Sep 17 00:00:00 2001
From: liugongyu <290219706@qq.com>
Date: Wed, 7 Jan 2026 10:37:43 +0800
Subject: [PATCH] 消息中心
---
api/user.js | 4 ++--
pages-sub/daily/quick-order/add-order.vue | 1 +
pages-sub/daily/quick-order/index.vue | 2 +-
pages-sub/daily/quick-order/order-detail.vue | 17 ++++++++++++++++-
pages-sub/msg/index.vue | 57 +++++++++++++++++++++++++++++++++++++--------------------
pages-sub/problem/work-order-manage/index.vue | 16 +++++++++++++---
pages-sub/problem/work-order-manage/order-detail.vue | 69 +++++++++++++++++++++++++++++++--------------------------------------
pages/index/index.vue | 92 ++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------
pages/workbench/index.vue | 8 ++++----
9 files changed, 147 insertions(+), 119 deletions(-)
diff --git a/api/user.js b/api/user.js
index d62cd33..53fd788 100644
--- a/api/user.js
+++ b/api/user.js
@@ -55,8 +55,8 @@ export const refreshToken = (params) => {
* 获得当前用户的未读站内信数量
* @returns {Promise}
*/
-export const getMsg = () => {
- return get('/app-api/system/notify-message/my-page')
+export const getMsg = (params) => {
+ return get('/app-api/system/notify-message/my-page',params)
}
/**
diff --git a/pages-sub/daily/quick-order/add-order.vue b/pages-sub/daily/quick-order/add-order.vue
index 2e3cbe9..fa166d5 100644
--- a/pages-sub/daily/quick-order/add-order.vue
+++ b/pages-sub/daily/quick-order/add-order.vue
@@ -149,6 +149,7 @@
diff --git a/pages-sub/daily/quick-order/index.vue b/pages-sub/daily/quick-order/index.vue
index 76da1d5..5e1313f 100644
--- a/pages-sub/daily/quick-order/index.vue
+++ b/pages-sub/daily/quick-order/index.vue
@@ -60,7 +60,7 @@
工单位置:
- {{ item.roadName || '-' }}
+ {{ item.lonLatAddress || '-' }}
diff --git a/pages-sub/daily/quick-order/order-detail.vue b/pages-sub/daily/quick-order/order-detail.vue
index 2dfb0f7..38e9e64 100644
--- a/pages-sub/daily/quick-order/order-detail.vue
+++ b/pages-sub/daily/quick-order/order-detail.vue
@@ -30,12 +30,27 @@
align="middle"
>
- 工单位置
+ 工单道路
{{orderDetail.roadName || '--'}}
+
+
+
+
+
+
+ 工单位置
+
+
+ {{orderDetail.lonLatAddress || '--'}}
+
+ lonLatAddress
+
diff --git a/pages-sub/msg/index.vue b/pages-sub/msg/index.vue
index e5f1f66..35549c7 100644
--- a/pages-sub/msg/index.vue
+++ b/pages-sub/msg/index.vue
@@ -1,9 +1,19 @@
+
+
+
+
@@ -11,17 +21,18 @@
- {{ item.orderName || '无' }}
+ {{ item.templateCode || '无' }}
{{ timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
- {{ item.remark || '无' }}
+ {{ item.templateContent || '无' }}
+
@@ -35,25 +46,31 @@ const userStore = useUserStore()
import { timeFormat } from '@/uni_modules/uview-plus';
// 计算属性获取用户信息(响应式)
const userInfo = computed(() => userStore.userInfo.user || {})
-const orderList = ref([
- {
- orderNo:'123',
- orderName:'阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检',
- remark:'阜成门内大街周期计划即将到期,请及时处理。阜成门内大街周期计划即将到期,请及时处理。阜成门内大街周期计划即将到期,请及时处理。阜成门内大街周期计划即将到期,请及时处理。',
- createTime:'1736160000000'
- },
- {
- orderNo:'1223',
- orderName:'阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检阜成门内大街巡检',
- remark:'阜成门内大街周期计划即将到期,请及时处理。阜成门内大街周期计划即将到期,请及时处理。阜成门内大街周期计划即将到期,请及时处理。阜成门内大街周期计划即将到期,请及时处理。',
- createTime:'1736160000000'
+
+const paging = ref(null);
+const dataList = ref([]);
+// 分页查询列表
+const queryList = async (pageNo, pageSize) => {
+ try {
+ const apiParams = {
+ readStatus: false,
+ pageNo,
+ pageSize,
+ };
+ const res = await getMsg(apiParams)
+ // 适配z-paging分页
+ paging.value.complete(res.list, res.total);
+ } catch (error) {
+ console.error('加载工单失败:', error);
+ paging.value?.complete(false);
+ uni.showToast({title: res.msg||'加载失败,请重试', icon: 'none'});
}
-])
+};
-// 页面显示时检查登录状态
-onShow( async () => {
- const res = await getMsg()
-})
+// // 页面显示时检查登录状态
+// onShow( async () => {
+// const res = await getMsg()
+// })
diff --git a/pages-sub/problem/work-order-manage/index.vue b/pages-sub/problem/work-order-manage/index.vue
index 0fddf0c..70a1155 100644
--- a/pages-sub/problem/work-order-manage/index.vue
+++ b/pages-sub/problem/work-order-manage/index.vue
@@ -391,6 +391,16 @@ const handleSearch = (val) => {
searchValue.value = val;
paging.value?.reload(); // 搜索刷新列表
};
+// const isRefreshing = ref(false);
+// const refreshList = () => {
+// if (isRefreshing.value) return;
+// isRefreshing.value = true;
+// paging.value?.reload().finally(() => {
+// setTimeout(() => {
+// isRefreshing.value = false;
+// }, 500);
+// });
+// };
// 工单详情
const handleDetail = (item) => {
// 0-待办 1我发起的- 2-已办
@@ -513,7 +523,7 @@ const handleProcess = async (item) => {
}
} catch (error) {
console.error('处理工单失败:', error);
- uni.showToast({title: '处理失败,请重试', icon: 'none'});
+ uni.showToast({title: error.msg||'处理失败,请重试', icon: 'none'});
}
};
@@ -574,7 +584,7 @@ const confirmReject = async () => {
paging.value?.reload(); // 刷新列表
} catch (error) {
console.error('回退工单失败:', error);
- uni.showToast({title: '网络异常,回退失败', icon: 'none', duration: 1000});
+ uni.showToast({title: error.msg||'回退失败', icon: 'none', duration: 1000});
} finally {
// 隐藏加载中
uni.hideLoading();
@@ -641,7 +651,7 @@ const handleAcceptModalConfirm = async () => {
} catch (error) {
// 5. 操作失败处理
console.error('验收失败:', error);
- uni.showToast({title: '验收提交失败,请重试', icon: 'none', duration: 1000});
+ uni.showToast({title: error.msg||'验收提交失败,请重试', icon: 'none', duration: 1000});
}
};
diff --git a/pages-sub/problem/work-order-manage/order-detail.vue b/pages-sub/problem/work-order-manage/order-detail.vue
index 0efeea8..fff5c60 100644
--- a/pages-sub/problem/work-order-manage/order-detail.vue
+++ b/pages-sub/problem/work-order-manage/order-detail.vue
@@ -63,7 +63,6 @@
-
@@ -101,10 +100,6 @@
-
-
-
-
@@ -114,7 +109,6 @@
:urls="orderDetail.problemsImgs.slice(0, 3)"
:singleSize="70"
:multipleSize="70"
-
:preview-full-image="true"
>
暂无问题照片
@@ -204,16 +198,10 @@
{{ item.name }}
-
-
-
-
-
-
处理人:
{{ item.tasks?.map(itemName => itemName.assigneeUser?.nickname).filter(Boolean).join(',') }}
@@ -242,7 +230,6 @@
:urls="item.tasks[0].attattmentUrls.slice(0, 3)"
:singleSize="70"
:multipleSize="70"
-
:preview-full-image="true"
class="step-album"
>
@@ -251,7 +238,6 @@
-
@@ -280,7 +266,6 @@
nextStepMap[orderDetail.taskKey].btnText
}}
-
@@ -369,7 +354,6 @@
-
@@ -469,6 +453,9 @@ const orderDetail = ref({
materialImgs: []
});
+// ========== 新增:声明eventChannel变量 ==========
+const eventChannel = ref(null);
+
/**
* 当前激活的图片列表(无需函数调用,直接访问)
*/
@@ -591,7 +578,6 @@ const rejectImgs = useUploadImgs({
fieldName: 'rejectImgs'
})
-
// ========== 验收弹窗相关状态(新增图片上传实例) ==========
const acceptModalShow = ref(false); // 验收弹窗显示开关
const acceptRadioValue = ref('0'); // 单选框值,默认0(通过)
@@ -606,7 +592,6 @@ const acceptImgs = useUploadImgs({
fieldName: 'acceptImgs'
})
-
// ========== 生成临时key ==========
const generateTempKey = () => {
return 'renew_order_' + Date.now() + '_' + Math.floor(Math.random() * 10000);
@@ -691,11 +676,12 @@ const confirmReject = async () => {
uni.showToast({title: '回退成功', icon: 'success', duration: 1000});
rejectModalShow.value = false;
- // 重新获取工单详情,刷新页面
- // await DetailQuery(taskId.value);
- uni.reLaunch({
- url: `/pages-sub/problem/work-order-manage/index`
- });
+ // 修复:正确使用eventChannel通知列表页刷新
+ if (eventChannel.value) {
+ eventChannel.value.emit('needRefresh');
+ }
+ // 返回列表页
+ uni.navigateBack({delta: 1});
} catch (error) {
console.error('回退工单失败:', error);
uni.showToast({title: '网络异常,回退失败', icon: 'none', duration: 1000});
@@ -711,7 +697,7 @@ const handleProcess = async (item: any) => {
try {
if (nextStepMap[item.taskKey]?.name == '养护组长分配') {
uni.navigateTo({
- url: `/pages-sub/problem/work-order-manage/distribution-order?taskId=${item.taskId}&orderNo=${item.orderNo}&id=${item.id}`
+ url: `/pages-sub/problem/work-order-manage/distribution-order?taskId=${item.taskId}&orderNo=${item.orderNo}&id=${item.id}&busiLine=${item.busiLine}`
})
}
if (nextStepMap[item.taskKey]?.name == '养护员待实施') {
@@ -770,8 +756,12 @@ const handleProcess = async (item: any) => {
// 调用回退工单接口
const res = await universalApproval(requestData);
uni.showToast({title: '结束成功', icon: 'success', duration: 1000});
- // 重新获取工单详情,刷新页面
- await DetailQuery(taskId.value);
+
+ // 通知列表页刷新
+ if (eventChannel.value) {
+ eventChannel.value.emit('needRefresh');
+ }
+ uni.navigateBack({delta: 1});
} else if (res.cancel) {
console.log("用户点击取消");
}
@@ -780,7 +770,7 @@ const handleProcess = async (item: any) => {
}
} catch (error) {
console.error('处理工单失败:', error);
- uni.showToast({title: '处理失败,请重试', icon: 'none'});
+ uni.showToast({title: error.msg||'处理失败,请重试', icon: 'none'});
}
};
@@ -830,22 +820,21 @@ const handleAcceptModalConfirm = async () => {
}
}
const acceptRes = await universalApproval(postData);
- // 4. 操作成功处理
handleAcceptModalCancel(); // 清空状态
- // 重新获取工单详情,刷新页面
- // await DetailQuery(taskId.value);
- // uni.reLaunch({
- // url: `/pages-sub/problem/work-order-manage/index`
- // });
- eventChannel.emit('needRefresh');
- // 4. 返回列表页
+
+ // 通知列表页刷新
+ if (eventChannel.value) {
+ eventChannel.value.emit('needRefresh');
+ }
+ // 返回列表页
uni.navigateBack({delta: 1});
+
uni.showToast({title: '提交成功', icon: 'success', duration: 1000});
} catch (error) {
// 5. 操作失败处理
console.error('验收失败:', error);
- uni.showToast({title: '验收提交失败,请重试', icon: 'none', duration: 1000});
+ uni.showToast({title: error.msg||'验收提交失败,请重试', icon: 'none', duration: 1000});
}
};
@@ -856,6 +845,12 @@ onLoad((options: any) => {
taskId.value = taskIdOpt || '';
activeTab.value = activeTabOpt || '0';
processInstanceId.value = processInstanceIdOpt;
+
+ // 初始化eventChannel
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ eventChannel.value = currentPage.getOpenerEventChannel();
+
DetailQuery(taskId.value);
});
@@ -1062,6 +1057,4 @@ onShow(() => {
width: 70px !important; // 与多图保持一致
height: 70px !important;
}
-
-
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index f8dedd8..f9e3a27 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -18,7 +18,7 @@
- 任务完成情况(K线图)
+ 任务完成情况
@@ -35,7 +35,7 @@
-
+