fix: 人员数据治理迁移3
This commit is contained in:
+5
@@ -140,6 +140,11 @@ public class PersonApiConfigServiceImpl extends BaseServiceImpl<PersonApiConfig>
|
||||
}
|
||||
Assert.isTrue(List.of("HTTP_API", "SYSTEM_TABLE").contains(config.getSourceType()), "同步方式不正确");
|
||||
mappings = mappings == null ? new ArrayList<>() : mappings;
|
||||
if (Boolean.TRUE.equals(config.getEnabled())) {
|
||||
Assert.hasText(config.getTargetTable(), "启用同步任务前请选择目标表");
|
||||
Assert.isTrue(mappings.stream().anyMatch(mapping -> Strings.isNotBlank(mapping.getSourceField())
|
||||
&& Strings.isNotBlank(mapping.getTargetField())), "启用同步任务前请至少完成一条来源字段与目标字段的映射");
|
||||
}
|
||||
PersonApiFieldMapping identity = mappings.stream()
|
||||
.filter(v -> Boolean.TRUE.equals(v.getIdentityFlag()))
|
||||
.findFirst()
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
</div>
|
||||
<div class="person-governance-mapping-toolbar-item person-governance-mapping-switch">
|
||||
<label>启用同步任务</label>
|
||||
<el-switch v-model="form.enabled" :disabled="mappings.length===0||cronValidating" @change="handleEnabledChange"></el-switch>
|
||||
<el-switch v-model="form.enabled" :disabled="!hasMappedField||cronValidating" @change="handleEnabledChange"></el-switch>
|
||||
</div>
|
||||
<div class="person-governance-mapping-toolbar-item person-governance-task-cron">
|
||||
<label>任务周期</label>
|
||||
@@ -258,8 +258,9 @@
|
||||
<template v-slot="{row}"><el-switch v-model="row.required"></el-switch></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="唯一标识" width="100">
|
||||
<template v-slot="{row}">
|
||||
<el-radio v-model="identityRow" :label="row">设为标识</el-radio>
|
||||
<template v-slot="{row,$index}">
|
||||
<el-radio :value="mappings.indexOf(identityRow)" :label="$index"
|
||||
:disabled="!isIdentityMapping(row)" @input="identityRow=mappings[$event]">设为标识</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
@@ -576,6 +577,11 @@
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
isIdentityMapping(row) {
|
||||
return Boolean(row && row.sourceField && row.sourceField.trim()
|
||||
&& row.targetField && row.targetField.trim()
|
||||
&& !['id', 'pullTime'].includes(row.targetField))
|
||||
},
|
||||
// 弹窗使用独立草稿;启停状态不限制周期编辑,取消不修改配置,未设置时预选每5分钟。
|
||||
openCronDialog() {
|
||||
if (this.formLoading || this.cronValidating || this.cronDialogVisible) {
|
||||
@@ -928,6 +934,12 @@
|
||||
}
|
||||
},
|
||||
save() {
|
||||
if (this.form.syncMode && this.form.syncMode !== 'APPEND'
|
||||
&& (!this.mappings.includes(this.identityRow) || !this.isIdentityMapping(this.identityRow))) {
|
||||
this.notifyWarning('请在唯一标识列选择完整的业务字段映射(例如工号 gh);目标字段不能是 id 或 pullTime')
|
||||
this.$set(this, 'activeTab', 'mapping')
|
||||
return
|
||||
}
|
||||
const formRef = this.form.sourceType === 'SYSTEM_TABLE'
|
||||
? this.$refs.systemForm
|
||||
: this.$refs.httpForm
|
||||
@@ -1033,9 +1045,6 @@
|
||||
this.$set(this, 'activeTab', 'mapping')
|
||||
}
|
||||
this.$set(this, 'mappings', res.data.mappings || [])
|
||||
if (!this.hasMappedField) {
|
||||
this.$set(this.form, 'enabled', false)
|
||||
}
|
||||
const params = (res.data.params || []).map((v) => {
|
||||
if (!v.requestScope) {
|
||||
this.$set(v, 'requestScope', 'DATA')
|
||||
|
||||
Reference in New Issue
Block a user