CN-965 知识库Preview:1.一条一条删除数据,直到删除完毕,列表未显示nodata;2.列表没有数据时,不弹出对话框;3.删除最后一条记录时报错;4.导入数据中,此时点击报错按钮,报错;
This commit is contained in:
@@ -431,8 +431,7 @@ export default {
|
|||||||
if (this.fileList.length > 0 && this.fileList[0].status === 'success') {
|
if (this.fileList.length > 0 && this.fileList[0].status === 'success') {
|
||||||
this.fileListBack = this.fileList[0]
|
this.fileListBack = this.fileList[0]
|
||||||
}
|
}
|
||||||
const file = fileList.slice(-1)
|
this.fileList = fileList.slice(-1)
|
||||||
this.fileList = file
|
|
||||||
},
|
},
|
||||||
uploadError () {
|
uploadError () {
|
||||||
this.uploadLoading = false
|
this.uploadLoading = false
|
||||||
@@ -481,6 +480,7 @@ export default {
|
|||||||
this.editTagErrorTip = ''
|
this.editTagErrorTip = ''
|
||||||
this.editIndex = -1
|
this.editIndex = -1
|
||||||
this.isPreviewChange = true
|
this.isPreviewChange = true
|
||||||
|
this.importedDataNoData = true
|
||||||
}
|
}
|
||||||
if (this.fileListBack !== undefined && this.fileListBack.status === 'success' &&
|
if (this.fileListBack !== undefined && this.fileListBack.status === 'success' &&
|
||||||
this.importedData.length > 0) {
|
this.importedData.length > 0) {
|
||||||
@@ -491,6 +491,7 @@ export default {
|
|||||||
if (!this.isShowUploadTips) {
|
if (!this.isShowUploadTips) {
|
||||||
this.isShowUploadTips = true
|
this.isShowUploadTips = true
|
||||||
const self = this
|
const self = this
|
||||||
|
if (this.importedData.length > 0) {
|
||||||
this.$confirm(this.$t('tip.uploadFile'), {
|
this.$confirm(this.$t('tip.uploadFile'), {
|
||||||
confirmButtonText: this.$t('tip.confirm'),
|
confirmButtonText: this.$t('tip.confirm'),
|
||||||
cancelButtonText: this.$t('overall.cancel'),
|
cancelButtonText: this.$t('overall.cancel'),
|
||||||
@@ -505,6 +506,11 @@ export default {
|
|||||||
}).catch(e => {}).finally(() => {
|
}).catch(e => {}).finally(() => {
|
||||||
this.isShowUploadTips = false
|
this.isShowUploadTips = false
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
this.isClick = true
|
||||||
|
this.isShowUploadTips = false
|
||||||
|
self.$refs.upload.$refs.uploadRef.handleClick()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
promiseState (p) {
|
promiseState (p) {
|
||||||
@@ -525,6 +531,7 @@ export default {
|
|||||||
reject(new Error(this.$t('validate.fileSizeLimit', { size: unitConvert(this.uploadFileSizeLimit, unitTypes.byte).join('') })))
|
reject(new Error(this.$t('validate.fileSizeLimit', { size: unitConvert(this.uploadFileSizeLimit, unitTypes.byte).join('') })))
|
||||||
} else {
|
} else {
|
||||||
if (!this.isClick) {
|
if (!this.isClick) {
|
||||||
|
if (this.importedData.length > 0) {
|
||||||
this.$confirm(this.$t('tip.uploadFile'), {
|
this.$confirm(this.$t('tip.uploadFile'), {
|
||||||
confirmButtonText: this.$t('tip.confirm'),
|
confirmButtonText: this.$t('tip.confirm'),
|
||||||
cancelButtonText: this.$t('overall.cancel'),
|
cancelButtonText: this.$t('overall.cancel'),
|
||||||
@@ -541,6 +548,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return promise
|
return promise
|
||||||
@@ -575,7 +585,7 @@ export default {
|
|||||||
// 删除内容为空的新增记录
|
// 删除内容为空的新增记录
|
||||||
const lastIndex = this.importedData.length - 1
|
const lastIndex = this.importedData.length - 1
|
||||||
const lastData = this.importedData[lastIndex]
|
const lastData = this.importedData[lastIndex]
|
||||||
if (lastData.tagItem === '' && lastData.tagValue === '') {
|
if (lastData !== undefined && lastData.tagItem === '' && lastData.tagValue === '') {
|
||||||
this.importedData.pop()
|
this.importedData.pop()
|
||||||
}
|
}
|
||||||
this.importedPageObj.total = this.importedData.length
|
this.importedPageObj.total = this.importedData.length
|
||||||
@@ -639,10 +649,14 @@ export default {
|
|||||||
this.previewErrorTip = ''
|
this.previewErrorTip = ''
|
||||||
}
|
}
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if (this.$refs.editForm) {
|
||||||
this.$refs.editForm.validate((validImportData) => {
|
this.$refs.editForm.validate((validImportData) => {
|
||||||
if (validImportData) {
|
if (validImportData) {
|
||||||
// 校验通过后组织数据、请求接口
|
// 校验通过后组织数据、请求接口
|
||||||
if (valid && !this.uploadErrorTip && !this.previewErrorTip) {
|
if (valid && !this.uploadErrorTip && !this.previewErrorTip) {
|
||||||
|
if (this.importedData.length === 1 && this.importedData[0].tagItem === '') {
|
||||||
|
// this.blockOperation.save = false
|
||||||
|
} else {
|
||||||
const postData = {
|
const postData = {
|
||||||
tagName: this.editObject.tagName,
|
tagName: this.editObject.tagName,
|
||||||
tagType: this.editObject.tagType,
|
tagType: this.editObject.tagType,
|
||||||
@@ -714,6 +728,7 @@ export default {
|
|||||||
this.blockOperation.save = false
|
this.blockOperation.save = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.blockOperation.save = false
|
this.blockOperation.save = false
|
||||||
}
|
}
|
||||||
@@ -724,6 +739,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.blockOperation.save = false
|
this.blockOperation.save = false
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.blockOperation.save = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
hasErrorImportedData () {
|
hasErrorImportedData () {
|
||||||
@@ -806,11 +824,13 @@ export default {
|
|||||||
if (total > 0 && total < 10) {
|
if (total > 0 && total < 10) {
|
||||||
this.importedData.push({ tagItem: '', tagValue: '', status: 1 })
|
this.importedData.push({ tagItem: '', tagValue: '', status: 1 })
|
||||||
this.showImportedData.push({ tagItem: '', tagValue: '', status: 1 })
|
this.showImportedData.push({ tagItem: '', tagValue: '', status: 1 })
|
||||||
|
this.importedDataNoData = false
|
||||||
} else {
|
} else {
|
||||||
const lastPageSize = Math.ceil((total + 1) / 10)
|
const lastPageSize = Math.ceil((total + 1) / 10)
|
||||||
this.pageNo(lastPageSize)
|
this.pageNo(lastPageSize)
|
||||||
this.importedData.push({ tagItem: '', tagValue: '', status: 1 })
|
this.importedData.push({ tagItem: '', tagValue: '', status: 1 })
|
||||||
this.showImportedData.push({ tagItem: '', tagValue: '', status: 1 })
|
this.showImportedData.push({ tagItem: '', tagValue: '', status: 1 })
|
||||||
|
this.importedDataNoData = false
|
||||||
}
|
}
|
||||||
this.importedPageObj.total = this.importedData.length
|
this.importedPageObj.total = this.importedData.length
|
||||||
this.timer = setTimeout(() => {
|
this.timer = setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user