fix: 修改entity setting的relation初始化为空
This commit is contained in:
@@ -133,8 +133,7 @@
|
|||||||
v-model="item.from_entity_index"
|
v-model="item.from_entity_index"
|
||||||
class="relation-field__select"
|
class="relation-field__select"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
@visible-change="visibleFromEntity($event, index)"
|
@visible-change="visibleFromEntity($event, index)">
|
||||||
@change="changeFromEntity(index)">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="obj in editObj.schemaMappingData.data"
|
v-for="obj in editObj.schemaMappingData.data"
|
||||||
:key="obj.index"
|
:key="obj.index"
|
||||||
@@ -152,8 +151,7 @@
|
|||||||
v-model="item.to_entity_index"
|
v-model="item.to_entity_index"
|
||||||
class="relation-field__select"
|
class="relation-field__select"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
@visible-change="visibleToEntity($event, index)"
|
@visible-change="visibleToEntity($event, index)">
|
||||||
@change="changeToEntity(index)">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="obj in editObj.schemaMappingData.data"
|
v-for="obj in editObj.schemaMappingData.data"
|
||||||
:key="obj.index"
|
:key="obj.index"
|
||||||
@@ -303,7 +301,7 @@ export default {
|
|||||||
},
|
},
|
||||||
relations: [],
|
relations: [],
|
||||||
relationData: {
|
relationData: {
|
||||||
data: [{ from_entity_index: '', to_entity_index: '', type: '', fromDisabled: false, toDisabled: false }]
|
data: []
|
||||||
},
|
},
|
||||||
enable: 1
|
enable: 1
|
||||||
})
|
})
|
||||||
@@ -428,7 +426,7 @@ export default {
|
|||||||
addRelationItem () {
|
addRelationItem () {
|
||||||
this.$refs.relationForm.validate(valid => {
|
this.$refs.relationForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.editObj.relationData.data.push({ from_entity_index: '', to_entity_index: '', type: '', fromDisabled: false, toDisabled: false })
|
this.editObj.relationData.data.push({ from_entity_index: '', to_entity_index: '', type: '' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -596,12 +594,6 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeFromEntity (index) {
|
|
||||||
this.editObj.relationData.data[index].fromDisabled = true
|
|
||||||
},
|
|
||||||
changeToEntity (index) {
|
|
||||||
this.editObj.relationData.data[index].toDisabled = true
|
|
||||||
},
|
|
||||||
/** 创建entity */
|
/** 创建entity */
|
||||||
async saveEntity () {
|
async saveEntity () {
|
||||||
const valid1 = await this.$refs.sourceForm.validate((valid) => {
|
const valid1 = await this.$refs.sourceForm.validate((valid) => {
|
||||||
@@ -631,21 +623,7 @@ export default {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formObj.relationData.data.length === 1) {
|
if (formObj.relationData.data.length > 0) {
|
||||||
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)
|
const obj = formObj.relationData.data.find(d => !d.from_entity_index || !d.to_entity_index || !d.type)
|
||||||
if (obj) {
|
if (obj) {
|
||||||
this.activeNames = ['1', '2']
|
this.activeNames = ['1', '2']
|
||||||
|
|||||||
Reference in New Issue
Block a user