From 07af103ecb902f9e70d0eaeec9c0ca50714f9933 Mon Sep 17 00:00:00 2001 From: weicw <594098497@qq.com> Date: Thu, 5 Nov 2026 19:19:40 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0=E5=A2=9E=E5=8F=B8?= =?UTF-8?q?=E6=9C=BA=E6=97=B6=E9=A2=84=E5=A1=AB=E6=89=80=E5=B1=9E=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E4=B8=BA=E5=B9=BF=E8=A5=BF=E6=A1=82=E7=89=A9=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E6=9C=8D=E5=8A=A1=E9=9B=86=E5=9B=A2=E6=9C=89=E9=99=90?= =?UTF-8?q?=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/transportCapacity/driver.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/views/transportCapacity/driver.vue b/src/views/transportCapacity/driver.vue index ab82766..c6c0ae2 100644 --- a/src/views/transportCapacity/driver.vue +++ b/src/views/transportCapacity/driver.vue @@ -765,6 +765,10 @@ const emptyForm = () => ({ status: 1, }); +// 新增司机时预填的组织。名称必须与组织树里的节点完全一致:级联框按名称回显, +// 保存时后端也按名称反查 dept_id,写成树里没有的名字会两边都落空。 +const DEFAULT_ORGANIZATION_NAME = '广西桂物物流服务集团有限公司'; + export default { components: { ImageUploadField, @@ -985,7 +989,7 @@ export default { ); vehicleColumn.dicData = this.organizationOptions; if (this.driverBox && !this.driverForm.id && !this.driverForm.organizationName) { - this.driverForm.organizationName = this.getCurrentOrganizationName(); + this.driverForm.organizationName = this.getDefaultOrganizationName(); } }); }, @@ -1016,6 +1020,17 @@ export default { }); return result; }, + // 组织树受数据权限裁剪、不含预填节点时退回当前登录人组织, + // 否则级联框会预填一个树里没有的名称,显示为空 + getDefaultOrganizationName() { + const matched = this.organizationTreeFlatOptions.find( + item => item.rawLabel === DEFAULT_ORGANIZATION_NAME + ); + if (matched || !this.organizationTreeFlatOptions.length) { + return DEFAULT_ORGANIZATION_NAME; + } + return this.getCurrentOrganizationName(); + }, getCurrentOrganizationName() { const currentDeptId = this.userInfo.deptId || this.userInfo.dept_id; const currentDept = this.organizationOptions.find( @@ -1203,7 +1218,7 @@ export default { this.submitAttempted = false; if (!row?.id) { this.driverForm = emptyForm(); - this.driverForm.organizationName = this.getCurrentOrganizationName(); + this.driverForm.organizationName = this.getDefaultOrganizationName(); this.driverBox = true; return; }