From d22fe4777dd68d42b7ca9402d0abe619758ce3cd Mon Sep 17 00:00:00 2001 From: b2894lxlx <517289602@qq.com> Date: Sun, 4 Oct 2026 20:48:03 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E8=BF=87=E7=A8=8B=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8E=E5=B8=B8=E7=94=A8=E7=BA=BF=E8=B7=AF=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=8F=AA=E4=BC=A0=E5=8D=95=E4=B8=AAdeptId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多组织账号默认搜索不再拼接逗号分隔 ID,避免列表接口 Long 转换失败。 Co-authored-by: Cursor --- src/views/business/common-route.vue | 35 +++++++++++----- src/views/business/process-config.vue | 58 ++++++++++++++++++--------- 2 files changed, 64 insertions(+), 29 deletions(-) diff --git a/src/views/business/common-route.vue b/src/views/business/common-route.vue index 9840ca8..b1c7b14 100644 --- a/src/views/business/common-route.vue +++ b/src/views/business/common-route.vue @@ -436,7 +436,25 @@ export default { return result; }, defaultDeptId() { - return (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || ''; + const raw = (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || ''; + return ( + String(raw) + .split(',') + .map(item => item.trim()) + .filter(Boolean)[0] || '' + ); + }, + normalizeListQuery(params = {}) { + const query = { ...params, ...this.query }; + const rawDeptId = query.deptId ?? query.searchDeptId; + delete query.searchDeptId; + if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') { + query.deptId = String(rawDeptId).split(',')[0].trim(); + } else { + delete query.deptId; + } + query.allDept = this.isAdmin ? 1 : 0; + return query; }, applyDefaultDeptSearch() { const deptId = this.defaultDeptId(); @@ -999,9 +1017,9 @@ export default { this.onLoad(this.page, this.query); }, searchChange(params, done) { - this.query = params; + this.query = this.normalizeListQuery(params); this.page.currentPage = 1; - this.onLoad(this.page, params); + this.onLoad(this.page, this.query); done(); }, selectionChange(list) { @@ -1024,12 +1042,10 @@ export default { }, onLoad(page, params = {}) { this.loading = true; + const query = this.normalizeListQuery(params); + this.query = query; api - .getList(page.currentPage, page.pageSize, { - ...params, - ...this.query, - allDept: this.isAdmin ? 1 : 0, - }) + .getList(page.currentPage, page.pageSize, query) .then(res => { const result = res.data.data; this.page.total = result.total; @@ -1042,8 +1058,7 @@ export default { }, buildExportParams() { return { - ...this.query, - allDept: this.isAdmin ? 1 : 0, + ...this.normalizeListQuery(this.query), ids: this.ids, [this.website.tokenHeader]: getToken(), }; diff --git a/src/views/business/process-config.vue b/src/views/business/process-config.vue index 05ef0be..4495ce5 100644 --- a/src/views/business/process-config.vue +++ b/src/views/business/process-config.vue @@ -565,7 +565,13 @@ export default { }); }, defaultDeptId() { - return (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || ''; + const raw = (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || ''; + return ( + String(raw) + .split(',') + .map(item => item.trim()) + .filter(Boolean)[0] || '' + ); }, applyDefaultDeptSearch() { const deptId = this.defaultDeptId(); @@ -580,15 +586,32 @@ export default { }); }, flattenDept(tree, level = 0) { - return tree.flatMap(item => [ - { - label: `${' '.repeat(level)}${item.title || item.deptName || item.name}`, - value: item.id, - }, - ...(item.children && item.children.length - ? this.flattenDept(item.children, level + 1) - : []), - ]); + return tree.flatMap(item => { + const id = + item.id === undefined || item.id === null || item.id === '' ? '' : String(item.id); + if (!id) return []; + return [ + { + label: `${' '.repeat(level)}${item.title || item.deptName || item.name}`, + value: id, + }, + ...(item.children && item.children.length + ? this.flattenDept(item.children, level + 1) + : []), + ]; + }); + }, + normalizeListQuery(params = {}) { + const query = { ...params, ...this.query }; + const rawDeptId = query.deptId ?? query.searchDeptId; + delete query.searchDeptId; + if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') { + query.deptId = String(rawDeptId).split(',')[0].trim(); + } else { + delete query.deptId; + } + query.allDept = this.isAdmin ? 1 : 0; + return query; }, displayStatus(status) { const statusMap = { @@ -1074,9 +1097,9 @@ export default { this.onLoad(this.page, this.query); }, searchChange(params, done) { - this.query = params; + this.query = this.normalizeListQuery(params); this.page.currentPage = 1; - this.onLoad(this.page, params); + this.onLoad(this.page, this.query); done(); }, selectionChange(list) { @@ -1099,12 +1122,10 @@ export default { }, onLoad(page, params = {}) { this.loading = true; + const query = this.normalizeListQuery(params); + this.query = query; api - .getList(page.currentPage, page.pageSize, { - ...params, - ...this.query, - allDept: this.isAdmin ? 1 : 0, - }) + .getList(page.currentPage, page.pageSize, query) .then(res => { const result = res.data.data || {}; this.page.total = result.total || 0; @@ -1117,8 +1138,7 @@ export default { }, buildExportParams() { return { - ...this.query, - allDept: this.isAdmin ? 1 : 0, + ...this.normalizeListQuery(this.query), ids: this.ids, [this.website.tokenHeader]: getToken(), };