CN-1062 fix:问题:编辑一条正确的记录,修改为错误数据后,点击其它记录的编辑按钮,原来的数据显示错误
This commit is contained in:
@@ -251,9 +251,6 @@ export default {
|
|||||||
return validate
|
return validate
|
||||||
}
|
}
|
||||||
const nameAndLabelDuplicateValidator = (rule, value, callback) => {
|
const nameAndLabelDuplicateValidator = (rule, value, callback) => {
|
||||||
if (this.backEditFlag) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
let validate = true
|
let validate = true
|
||||||
let index = -1 // 当前编辑的键值index
|
let index = -1 // 当前编辑的键值index
|
||||||
// 查看是否重名前,需要对名称进行校验,分别是IP、domain、APP的校验
|
// 查看是否重名前,需要对名称进行校验,分别是IP、domain、APP的校验
|
||||||
@@ -275,22 +272,20 @@ export default {
|
|||||||
return validate
|
return validate
|
||||||
}
|
}
|
||||||
const requiredItemValidator = (rule, value, callback) => {
|
const requiredItemValidator = (rule, value, callback) => {
|
||||||
if (this.backEditFlag) {
|
value = this.editTagForm.tagName
|
||||||
return true
|
|
||||||
}
|
|
||||||
let validate = true
|
let validate = true
|
||||||
|
const index = this.editIndex
|
||||||
const realValue = value.replace(/\s+/g, '')// 去掉空格
|
const realValue = value.replace(/\s+/g, '')// 去掉空格
|
||||||
if (realValue === '') {
|
if (realValue === '') {
|
||||||
validate = false
|
validate = false
|
||||||
this.editTagErrorTip = rule.message
|
this.editTagErrorTip = rule.message
|
||||||
|
this.showImportedData[index].msg = rule.message
|
||||||
|
this.showImportedData[index].isValid = 0
|
||||||
callback(new Error())
|
callback(new Error())
|
||||||
}
|
}
|
||||||
return validate
|
return validate
|
||||||
}
|
}
|
||||||
const requiredValueValidator = (rule, value, callback) => {
|
const requiredValueValidator = (rule, value, callback) => {
|
||||||
if (this.backEditFlag) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
value = this.editTagForm.tagValue
|
value = this.editTagForm.tagValue
|
||||||
const index = this.editIndex
|
const index = this.editIndex
|
||||||
let validate = true
|
let validate = true
|
||||||
@@ -305,9 +300,6 @@ export default {
|
|||||||
return validate
|
return validate
|
||||||
}
|
}
|
||||||
const nameFormatValidator = (rule, value, callback) => {
|
const nameFormatValidator = (rule, value, callback) => {
|
||||||
if (this.backEditFlag) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
value = this.editTagForm.tagName
|
value = this.editTagForm.tagName
|
||||||
const index = this.editIndex
|
const index = this.editIndex
|
||||||
let validate = true
|
let validate = true
|
||||||
@@ -641,22 +633,35 @@ export default {
|
|||||||
this.typeSelectDisable = true
|
this.typeSelectDisable = true
|
||||||
this.isClick = false
|
this.isClick = false
|
||||||
},
|
},
|
||||||
|
backEditData(){
|
||||||
|
if(this.oldTagItem.isValid){
|
||||||
|
this.showImportedData[this.oldTagItem.index].isValid = this.oldTagItem.isValid
|
||||||
|
this.showImportedData[this.oldTagItem.index].msg = this.oldTagItem.msg
|
||||||
|
}
|
||||||
|
},
|
||||||
pageNo (val) {
|
pageNo (val) {
|
||||||
|
this.backEditData()
|
||||||
if (val !== this.importedPageObj.pageNo) {
|
if (val !== this.importedPageObj.pageNo) {
|
||||||
this.editTagErrorTip = ''
|
this.editTagErrorTip = ''
|
||||||
}
|
}
|
||||||
this.importedPageObj.pageNo = val
|
this.importedPageObj.pageNo = val
|
||||||
this.editIndex = -1
|
this.editIndex = -1
|
||||||
|
this.oldTagItem = {}
|
||||||
},
|
},
|
||||||
prev () {
|
prev () {
|
||||||
|
this.backEditData()
|
||||||
this.importedPageObj.pageNo--
|
this.importedPageObj.pageNo--
|
||||||
this.editIndex = -1
|
this.editIndex = -1
|
||||||
|
this.oldTagItem = {}
|
||||||
},
|
},
|
||||||
next () {
|
next () {
|
||||||
|
this.backEditData()
|
||||||
this.importedPageObj.pageNo++
|
this.importedPageObj.pageNo++
|
||||||
this.editIndex = -1
|
this.editIndex = -1
|
||||||
|
this.oldTagItem = {}
|
||||||
},
|
},
|
||||||
removeImportedData (index) { // index 为记录在当前页的索引
|
removeImportedData (index) { // index 为记录在当前页的索引
|
||||||
|
this.backEditData()
|
||||||
this.editIndex = -1 // 取消编辑标识
|
this.editIndex = -1 // 取消编辑标识
|
||||||
this.addEditFlag = false // 取消新增标识
|
this.addEditFlag = false // 取消新增标识
|
||||||
this.editTagErrorTip = ''
|
this.editTagErrorTip = ''
|
||||||
@@ -700,6 +705,7 @@ export default {
|
|||||||
this.previewErrorTip = ''
|
this.previewErrorTip = ''
|
||||||
}
|
}
|
||||||
this.isPreviewChange = true
|
this.isPreviewChange = true
|
||||||
|
this.oldTagItem = {}
|
||||||
},
|
},
|
||||||
cancel () {
|
cancel () {
|
||||||
const self = this
|
const self = this
|
||||||
@@ -861,6 +867,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
editImportedData (index) {
|
editImportedData (index) {
|
||||||
|
this.backEditData()
|
||||||
this.editTagForm.tagName = this.showImportedData[index].tagName
|
this.editTagForm.tagName = this.showImportedData[index].tagName
|
||||||
this.editTagForm.tagValue = this.showImportedData[index].tagValue
|
this.editTagForm.tagValue = this.showImportedData[index].tagValue
|
||||||
|
|
||||||
@@ -876,7 +883,10 @@ export default {
|
|||||||
}
|
}
|
||||||
this.oldTagItem = {
|
this.oldTagItem = {
|
||||||
isValid: this.showImportedData[index].isValid,
|
isValid: this.showImportedData[index].isValid,
|
||||||
msg: this.showImportedData[index].msg
|
msg: this.showImportedData[index].msg,
|
||||||
|
tagName: this.showImportedData[index].tagName,
|
||||||
|
tagValue: this.showImportedData[index].tagValue,
|
||||||
|
index:index
|
||||||
}
|
}
|
||||||
this.editIndex = index
|
this.editIndex = index
|
||||||
this.backEditFlag = true
|
this.backEditFlag = true
|
||||||
@@ -1013,6 +1023,7 @@ export default {
|
|||||||
self.editIndex = -1
|
self.editIndex = -1
|
||||||
self.backEditFlag = false
|
self.backEditFlag = false
|
||||||
self.isPreviewChange = true
|
self.isPreviewChange = true
|
||||||
|
this.oldTagItem = {}
|
||||||
} else {
|
} else {
|
||||||
self.showImportedData[index].isValid = 0
|
self.showImportedData[index].isValid = 0
|
||||||
}
|
}
|
||||||
@@ -1030,9 +1041,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
addTagAtLast () {
|
addTagAtLast () {
|
||||||
|
this.backEditData()
|
||||||
this.editTagForm.tagName = ''
|
this.editTagForm.tagName = ''
|
||||||
this.editTagForm.tagValue = ''
|
this.editTagForm.tagValue = ''
|
||||||
// this.editTagForm.isValid = 1
|
|
||||||
const total = this.importedData.length
|
const total = this.importedData.length
|
||||||
this.addEditFlag = true
|
this.addEditFlag = true
|
||||||
// 如果已经有新增空白项,则不再进行新增操作
|
// 如果已经有新增空白项,则不再进行新增操作
|
||||||
@@ -1050,6 +1061,7 @@ export default {
|
|||||||
this.editIndex = this.showImportedData.length - 1
|
this.editIndex = this.showImportedData.length - 1
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
this.oldTagItem = {}
|
||||||
},
|
},
|
||||||
downloadTemplate () {
|
downloadTemplate () {
|
||||||
window.open('/assets/knowledgeBaseTemplate.zip', '_blank')
|
window.open('/assets/knowledgeBaseTemplate.zip', '_blank')
|
||||||
|
|||||||
Reference in New Issue
Block a user