✨ 机构同步编码校验对齐GWWL三位数字规则

组织编码校验改为上级直拼三位数字;全量同步清除提示同步保留外部组织与集团锚点。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-14 10:44:40 +08:00
parent 6762cf7b83
commit cdd30b8211
+11 -3
View File
@@ -333,9 +333,17 @@ export default {
callback(new Error('上级组织未配置组织编码,请先完善上级组织编码'));
return;
}
const pattern = new RegExp(`^${escapeRegExp(this.parentDeptCode)}-\\d+$`);
// 公司:GWWL+三位数字;部门:所属公司编码+三位数字;其他:上级编码+三位数字(中间不加-)
let expectedPrefix = this.parentDeptCode;
const category = Number(this.form?.deptCategory);
if (category === 2) {
expectedPrefix = 'GWWL';
} else if (category === 3 && this.form?.belongCompanyCode) {
expectedPrefix = String(this.form.belongCompanyCode).trim();
}
const pattern = new RegExp(`^${escapeRegExp(expectedPrefix)}\\d{3}$`);
if (!pattern.test(deptCode)) {
callback(new Error(`组织编码格式应为:${this.parentDeptCode}-分段数字`));
callback(new Error(`组织编码格式应为:${expectedPrefix}三位数字(不足补零,中间不加-)`));
return;
}
callback();
@@ -650,7 +658,7 @@ export default {
methods: {
handleOaOrgFullSync() {
this.$confirm(
'全量同步将拉取 OA 全部公司/部门;已存在且 OA 更新时间一致的记录会跳过。是否清除非顶级组织?选择“是”将先删除顶级以外的组织后再同步;选择“否”则直接全量同步。',
'全量同步将拉取 OA 全部公司/部门;已存在且 OA 更新时间一致的记录会跳过。是否清除后同步?选择“是”将保留顶级「外部组织」与集团锚点(id=135/GWWL),删除其余组织后再同步;选择“否”则直接全量同步。',
'全量同步',
{
confirmButtonText: '是',