Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upd: 移动端增加单据无权限相关提示 #1226

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions frontend/weixin/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ export default defineComponent({
duration: duration || 3000
})
})
emitter.on('showPermissionDialog', async (payload) => {
const { isDisplayProcessor, ticketId, stepId } = payload
let message = '无单据相关权限'

if (isDisplayProcessor) {
const res = await this.$store.dispatch('ticket/getTicketProcessDetail', { ticketId, stepId })
message = `单据已由 ${res.data.processed_user} 处理,您无需操作`
}

this.$dialog.alert({
message,
confirmButtonText: '回到首页',
confirmButtonColor: '#3a84ff',
beforeClose: () => {
const route = this.$router.resolve({ name: 'homeDefault' })
window.location.href = route.fullPath
return true
}
})
})
this.$store.dispatch('getServiceConfig')
}
})
Expand Down
12 changes: 11 additions & 1 deletion frontend/weixin/src/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,18 @@ axiosInstance.interceptors.response.use(
return response.data
},
(error) => {
if (error.response.status === 499) {
const { url, params } = error.response.config
const matched = location.hash.match(/(^|&)step_id=(\d+)\w?/)
const stepId = matched ? matched[2] : ''
if (url.match(/ticket\/receipts\/[0-9]+\//) && stepId) {
emitter.emit('showPermissionDialog', { isDisplayProcessor: true, ticketId: params.id, stepId })
} else {
emitter.emit('showPermissionDialog', { isDisplayProcessor: false })
}
return Promise.reject(error)
}
emitter.emit('notify', { type: 'danger', message: '接口返回异常', duration: 5000 })
console.error(error)
return Promise.reject(error)
}
)
Expand Down
4 changes: 4 additions & 0 deletions frontend/weixin/src/store/modules/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ const ticket = {
},
getServiceDetail(content:any, id: number): Promise<IResponse> {
return $api.get(`service/projects/${id}/`)
},
getTicketProcessDetail(content: any, payload: any): Promise<IResponse> {
const { ticketId, stepId } = payload
return $api.get(`ticket/receipts/${ticketId}/get_step_process_info/`, { params: { step_id: stepId } })
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/weixin/src/views/ticket/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ export default defineComponent({
if (nodeListTimer.value) {
clearTimeout(nodeListTimer.value)
}
ticketPage.value.removeEventListener('scroll', handleStepsFixed, false)
if (ticketPage.value) {
ticketPage.value.removeEventListener('scroll', handleStepsFixed, false)
}
})

initData()
Expand Down