fix: 去除entity setting的relation必选校验
This commit is contained in:
@@ -610,10 +610,7 @@ export default {
|
|||||||
const valid2 = await this.$refs.mappingForm.validate((valid) => {
|
const valid2 = await this.$refs.mappingForm.validate((valid) => {
|
||||||
return valid
|
return valid
|
||||||
})
|
})
|
||||||
const valid3 = await this.$refs.relationForm.validate((valid) => {
|
if (valid1 && valid2) {
|
||||||
return valid
|
|
||||||
})
|
|
||||||
if (valid1 && valid2 && valid3) {
|
|
||||||
const formObj = this.$_.cloneDeep(this.editObj)
|
const formObj = this.$_.cloneDeep(this.editObj)
|
||||||
formObj.schemaMappingData.data.forEach((item) => {
|
formObj.schemaMappingData.data.forEach((item) => {
|
||||||
const obj = {}
|
const obj = {}
|
||||||
@@ -624,7 +621,8 @@ export default {
|
|||||||
})
|
})
|
||||||
formObj.entities = JSON.stringify(formObj.schemaMappingData.data)
|
formObj.entities = JSON.stringify(formObj.schemaMappingData.data)
|
||||||
formObj.relations = JSON.stringify(formObj.relationData.data)
|
formObj.relations = JSON.stringify(formObj.relationData.data)
|
||||||
if (formObj.schemaMappingData.data.length === 0 || formObj.relationData.data.length === 0) {
|
|
||||||
|
if (formObj.schemaMappingData.data.length === 0) {
|
||||||
this.activeNames = ['1', '2']
|
this.activeNames = ['1', '2']
|
||||||
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
@@ -632,6 +630,33 @@ export default {
|
|||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (formObj.relationData.data.length === 1) {
|
||||||
|
const obj = formObj.relationData.data.find(d => !d.from_entity_index && !d.to_entity_index && !d.type)
|
||||||
|
if (!obj) {
|
||||||
|
const valid3 = await this.$refs.relationForm.validate((valid) => {
|
||||||
|
return valid
|
||||||
|
})
|
||||||
|
if (!valid3) {
|
||||||
|
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
callback: () => {}
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (formObj.relationData.data.length > 1) {
|
||||||
|
const obj = formObj.relationData.data.find(d => !d.from_entity_index || !d.to_entity_index || !d.type)
|
||||||
|
if (obj) {
|
||||||
|
this.activeNames = ['1', '2']
|
||||||
|
this.$refs.relationForm.validate(() => null)
|
||||||
|
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
callback: () => {}
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
this.myLoading = true
|
this.myLoading = true
|
||||||
if (!this.ruleId) {
|
if (!this.ruleId) {
|
||||||
// post调用是新增,put是编辑
|
// post调用是新增,put是编辑
|
||||||
@@ -684,12 +709,6 @@ export default {
|
|||||||
this.myLoading = false
|
this.myLoading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.activeNames = ['1', '2']
|
|
||||||
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
callback: () => {}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 底部返回按钮 */
|
/** 底部返回按钮 */
|
||||||
|
|||||||
Reference in New Issue
Block a user