fix:修改仪表盘工单

This commit is contained in:
2026-01-23 13:20:49 +08:00
parent 7992ee9902
commit 9105503850
2 changed files with 15 additions and 106 deletions
+8 -6
View File
@@ -347,7 +347,8 @@ const messagesEqual = (oldMessages, newMessages) => {
// 获取工单详情
const fetchTicketDetail = async (showLoading = true) => {
const workId = route.query.id
// 兼容 id 和 work_id 两种参数名
const workId = route.query.id || route.query.work_id
if (!workId) {
// 没有ID时静默跳转到列表页
router.replace('/ticket/list')
@@ -418,7 +419,7 @@ const fetchTicketDetail = async (showLoading = true) => {
const sendMessage = async () => {
if ((!messageInput.value.trim() && selectedImages.value.length === 0) || isSending.value) return
const workId = route.query.id
const workId = route.query.id || route.query.work_id
const content = messageInput.value.trim() || 'empty'
try {
@@ -526,7 +527,7 @@ const handleStatusChange = async (newStatus) => {
try {
const formData = new FormData()
formData.append('work_id', route.query.id)
formData.append('work_id', route.query.id || route.query.work_id)
formData.append('Status', statusMap[newStatus])
const res = await updateTicketInfo(formData)
@@ -553,7 +554,7 @@ const handleComplete = () => {
type: 'warning'
}).then(async () => {
try {
const res = await closeTicket(route.query.id)
const res = await closeTicket(route.query.id || route.query.work_id)
if (res.code === 200) {
ElMessage.success('工单已成功结束')
ticketInfo.value.status = 'completed'
@@ -893,7 +894,8 @@ const goToUserDetail = () => {
const startAutoRefresh = () => {
refreshTimer.value = setInterval(() => {
// 只有当前路由仍在工单详情页且工单未完成时才刷新
if (route.path === '/ticket/detail' && route.query.id && ticketInfo.value?.status !== 'completed') {
const workId = route.query.id || route.query.work_id
if (route.path === '/ticket/detail' && workId && ticketInfo.value?.status !== 'completed') {
fetchTicketDetail(false) // 定时刷新时不显示 loading
}
}, 10000)
@@ -908,7 +910,7 @@ const stopAutoRefresh = () => {
// 监听路由query变化,重新加载数据
watch(
() => route.query.id,
() => route.query.id || route.query.work_id,
(newId) => {
if (newId) {
fetchTicketDetail()
+7 -100
View File
@@ -1,108 +1,15 @@
✅已完成、⚠️部分完成、❌未完成这样显示
-----------------------------------------------------------------------------------------------需要解决
以下是请求用户详情信息的接口响应数据:
{
"code": 200,
"message": "Success",
"data": {
"UserId": 1680,
"UserName": "testuser111",
"Password": "$2a$10$iOH6CYfaOsVxvRsUotcDNeAyH19Fot3Bou7chuoB8tUqg6cTyxuKG",
"UserGroup": {
"Id": 1,
"HigherLevelId": 0,
"Name": "Lv1",
"Auth": "1",
"FloorPrice": 0,
"Fixed": false,
"UserGroupDiscount": null,
"IsDeleted": false,
"CreatedAt": "2024-11-05T05:15:33+08:00",
"UpdatedAt": "2024-11-05T05:15:35+08:00",
"omitempty": null
},
"UserGroupId": 1,
"AdminGroup": {
"id": 0,
"name": "",
"auth": "",
"note": "",
"CreatedAt": "0001-01-01T00:00:00Z",
"UpdatedAt": "0001-01-01T00:00:00Z",
"omitempty": null
},
"AdminGroupId": null,
"Cover": {
"id": 3,
"realName": "7EE71869106645BA1C2BA93D298C8C5B.png",
"saveName": "173073670020",
"savePath": "static/files/2024-11-04/173073670020",
"size": 72075,
"type": "work_order",
"content": "",
"userId": 20,
"openDow": false,
"CreatedAt": "2024-11-05T00:11:40.628+08:00",
"UpdatedAt": "2024-11-05T00:11:40.628+08:00",
"omitempty": null
},
"CoverID": 3,
"IsDeleted": false,
"Sex": true,
"Age": 15,
"Phone": "13888888888",
"Email": "q21234043@gmail.com",
"IdcAgent": {
"Id": 0,
"UserId": 0,
"AgentLevent": 0,
"AgentLevelName": "",
"Uid": "",
"IdcCreatedAt": 0,
"CreatedAt": "0001-01-01T00:00:00Z",
"UpdatedAt": "0001-01-01T00:00:00Z",
"omitempty": null
},
"RealName": {
"Id": 0,
"UserId": 0,
"Name": "",
"IdCard": "",
"Status": 0,
"Type": 0,
"CreatedAt": "0001-01-01T00:00:00Z",
"UpdatedAt": "0001-01-01T00:00:00Z",
"omitempty": null
},
"EnterpriseInfo": {
"Id": 0,
"UserId": 0,
"Name": "",
"BusinessNumber": "",
"CreatedAt": "0001-01-01T00:00:00Z",
"UpdatedAt": "0001-01-01T00:00:00Z",
"omitempty": null
},
"RecommendUserId": 1679,
"CreatedAt": "2025-12-31T16:48:31.85729+08:00",
"UpdatedAt": "2026-01-23T11:01:01.384933+08:00",
"omitempty": null
}
}
1.用户列表点击修改用户组弹出弹窗用户组id使用组件UserGroupSelector.vue文件进行选择,并且使用选择样式需要符合整体选择框样式
1.点击仪表盘的最近工单中的其中一项跳转到工单详情需要请求对应接口数据进行赋值/api/v1/admin/work_order/detail这个接口,传递work_id参数,在src/api/ticket.js文件下的getTicketDetail函数
### TODO List
- [x]导入UserGroupSelector组件
- [x]修改用户组弹窗使用选择器组件
- [x]显示当前用户组名称
- [x]点击选择用户组打开选择器弹窗
- [x]选择后显示用户组名称和ID
- [x]添加清除功能
- [x] ✅ 样式与推介人选择器保持一致
- [x]TicketDetail.vue兼容work_id参数(原来只支持id参数)
- [x]fetchTicketDetail函数使用 route.query.id || route.query.work_id
- [x]sendMessage函数使用 route.query.id || route.query.work_id
- [x]handleStatusChange函数使用 route.query.id || route.query.work_id
- [x]handleComplete函数使用 route.query.id || route.query.work_id
- [x]定时刷新和watch监听兼容work_id参数
-----------------------------------------------------------------------------------------------需要解决