fix:修改仪表盘工单
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user