CN-1733 fix: 1、修复Entity Setting页面的mapping和relation被删空能被上传的问题;2、添加source列表上传文件按设置的格式上传。
This commit is contained in:
@@ -196,6 +196,7 @@ export default {
|
||||
clickOption (item) {
|
||||
this.sourceId = item.id
|
||||
this.dialogVisible = true
|
||||
this.fileTypeLimit = `.${item.dataFormat}`
|
||||
},
|
||||
// 禁止勾选buildIn为1的项,即禁止修改、删除admin的账号
|
||||
checkSelectable (row) {
|
||||
@@ -256,7 +257,7 @@ export default {
|
||||
beforeUpload (file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 判断后缀,仅支持.csv
|
||||
if (!_.endsWith(file.name, '.csv')) {
|
||||
if (!_.endsWith(file.name, this.fileTypeLimit)) {
|
||||
this.$message.error(this.$t('validate.fileTypeLimit', { types: this.fileTypeLimit }))
|
||||
this.fileList = []
|
||||
reject(new Error(this.$t('validate.fileTypeLimit', { types: this.fileTypeLimit })))
|
||||
@@ -303,9 +304,6 @@ export default {
|
||||
}
|
||||
this.uploadLoading = false
|
||||
this.$message.error(this.$t('tip.uploadFailed', { msg: errorMsg }))
|
||||
},
|
||||
downloadTemplate () {
|
||||
window.open('/assets/tagTemplate.csv', '_blank')
|
||||
}
|
||||
},
|
||||
setup () {
|
||||
|
||||
@@ -364,6 +364,7 @@ export default {
|
||||
if (this.editObj.relations && typeof this.editObj.relations === 'string') {
|
||||
this.editObj.relationData.data = JSON.parse(this.editObj.relations)
|
||||
}
|
||||
this.onChangeSource(this.editObj.sourceId)
|
||||
this.activeNames = ['1', '2']
|
||||
} else {
|
||||
console.error(response.data)
|
||||
@@ -383,8 +384,7 @@ export default {
|
||||
onContinue () {
|
||||
this.$refs.mappingForm.validate(valid => {
|
||||
if (valid) {
|
||||
// this.editObj.schemaMappingData.data[index].list.push({ field: '', source: '' })
|
||||
// this.isCloseMappingItem = true
|
||||
this.activeNames = ['1', '2']
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -619,7 +619,6 @@ export default {
|
||||
return valid
|
||||
})
|
||||
if (valid1 && valid2 && valid3) {
|
||||
this.myLoading = true
|
||||
const formObj = this.$_.cloneDeep(this.editObj)
|
||||
formObj.schemaMappingData.data.forEach((item) => {
|
||||
const obj = {}
|
||||
@@ -630,7 +629,14 @@ export default {
|
||||
})
|
||||
formObj.entities = JSON.stringify(formObj.schemaMappingData.data)
|
||||
formObj.relations = JSON.stringify(formObj.relationData.data)
|
||||
|
||||
if (formObj.schemaMappingData.data.length === 0 && formObj.relationData.data.length === 0) {
|
||||
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
||||
confirmButtonText: 'OK',
|
||||
callback: () => {}
|
||||
})
|
||||
return true
|
||||
}
|
||||
this.myLoading = true
|
||||
if (!this.ruleId) {
|
||||
// post调用是新增,put是编辑
|
||||
axios.post(api.setting.profiles.profiles, formObj).then(response => {
|
||||
|
||||
@@ -327,7 +327,7 @@ export default {
|
||||
this.sourceObj.fields = JSON.stringify(this.sourceObj.fieldsData.data)
|
||||
this.sourceObj.lookups = JSON.stringify(this.sourceObj.lookupsData.data)
|
||||
if (this.sourceObj.fieldsData.data.length === 0 && this.sourceObj.lookupsData.data.length === 0) {
|
||||
ElMessageBox.alert(`${this.$t('detection.create.informationFilled')}`, this.$t('overall.tip'), {
|
||||
ElMessageBox.alert(this.$t('detection.create.informationFilled'), this.$t('overall.tip'), {
|
||||
confirmButtonText: 'OK',
|
||||
callback: () => {}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user