✨ 新增司机时预填所属组织为广西桂物物流服务集团有限公司

This commit is contained in:
2026-11-05 19:19:40 +08:00
parent 6e48fa50cf
commit 07af103ecb
+17 -2
View File
@@ -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;
}