From e606f5acf262f5b7996f1f0fe04dd32598733305 Mon Sep 17 00:00:00 2001 From: weizong song Date: Thu, 18 Jun 2026 10:53:24 +0800 Subject: [PATCH] up --- src/api/flow/index.js | 14 +++++++++++--- src/utils/request.js | 13 ++++++++----- src/views/flow/components/assign.vue | 7 ++++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/api/flow/index.js b/src/api/flow/index.js index 58c64ce..febe10f 100644 --- a/src/api/flow/index.js +++ b/src/api/flow/index.js @@ -1,6 +1,8 @@ import request from '@/utils/request' import { MessageBox } from 'element-ui' import qs from 'qs' + +const FLOW_WRITE_TIMEOUT = 60000 export function flow(isLoading=false) { return request({ method: 'get', @@ -29,7 +31,9 @@ export function create(custom_model_id, data) { return request({ method: 'post', url: `/api/oa/flow/create/${custom_model_id}`, - data + data, + timeout: FLOW_WRITE_TIMEOUT, + silentTimeout: true // data: qs.stringify(data, { arrayFormat: 'brackets' }), // headers: { // 'Content-Type': 'application/x-www-form-urlencoded' @@ -49,7 +53,9 @@ export function deal(flow_id,data) { return request({ method: 'post', url: `/api/oa/flow/deal/${flow_id}`, - data + data, + timeout: FLOW_WRITE_TIMEOUT, + silentTimeout: true }) } // 编辑 @@ -135,7 +141,9 @@ export function assign(flow_id, data) { return request({ method: 'post', url: `/api/oa/flow/assign/${flow_id}`, - data + data, + timeout: FLOW_WRITE_TIMEOUT, + silentTimeout: true }) } diff --git a/src/utils/request.js b/src/utils/request.js index efbe920..76b2562 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -102,11 +102,14 @@ service.interceptors.response.use( error => { loadingInstance?.close() console.error('err' + error) // for debug - Message({ - message: /Network Error/g.test(error) ? "网络错误" : (/timeout/g.test(error) ? "网络超时" : "系统错误"), - type: 'error', - duration: 5 * 1000 - }) + const isTimeout = /timeout/g.test(error) || error.code === 'ECONNABORTED' + if (!(error.config?.silentTimeout && isTimeout)) { + Message({ + message: /Network Error/g.test(error) ? "网络错误" : (isTimeout ? "网络超时" : "系统错误"), + type: 'error', + duration: 5 * 1000 + }) + } if (top && typeof top._addError === 'function') { top._addError(error.toString(), `axios-request ${error.config?.url}`, error.config?.params || error.config?.data) } diff --git a/src/views/flow/components/assign.vue b/src/views/flow/components/assign.vue index 3b05377..1d6ffc7 100644 --- a/src/views/flow/components/assign.vue +++ b/src/views/flow/components/assign.vue @@ -106,7 +106,7 @@ - {{ isLastNode ? '结束流程' : '确 定'}} @@ -164,6 +164,7 @@ export default { shareConfig: {}, ccIsIndeterminate: false, ccCheckAll: false, + submitting: false, }; }, methods: { @@ -253,7 +254,9 @@ export default { }, async submit() { + if (this.submitting) return console.log(this.form) + this.submitting = true try { if(this.isLastNode) { if (this.multiple) { @@ -286,6 +289,8 @@ export default { this.$emit('refresh') } catch(err) { console.error(err) + } finally { + this.submitting = false } } },