diff options
| author | 刘洪洪 <[email protected]> | 2024-11-18 20:25:32 +0800 |
|---|---|---|
| committer | 刘洪洪 <[email protected]> | 2024-11-18 20:25:32 +0800 |
| commit | c9cedc3fb60ea48dd1ce42d9486508ef29b7f91b (patch) | |
| tree | 2f5e11c73313fe120ba7ea858e0ff8c69189505b /src | |
| parent | b8aa493d6fcb38b4d8e2e89bc4c848b2a55003bc (diff) | |
CN-1733 fix: 1、修复Entity Setting页面的mapping和relation被删空能被上传的问题;2、添加source列表上传文件按设置的格式上传。
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/table/setting/SourcesTable.vue | 6 | ||||
| -rw-r--r-- | src/views/setting/entitySetting/EntitySettingForm.vue | 14 | ||||
| -rw-r--r-- | src/views/setting/sources/SourcesForm.vue | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/components/table/setting/SourcesTable.vue b/src/components/table/setting/SourcesTable.vue index e8c3ee57..aa82ebca 100644 --- a/src/components/table/setting/SourcesTable.vue +++ b/src/components/table/setting/SourcesTable.vue @@ -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 () { diff --git a/src/views/setting/entitySetting/EntitySettingForm.vue b/src/views/setting/entitySetting/EntitySettingForm.vue index ea108f33..76813f26 100644 --- a/src/views/setting/entitySetting/EntitySettingForm.vue +++ b/src/views/setting/entitySetting/EntitySettingForm.vue @@ -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 => { diff --git a/src/views/setting/sources/SourcesForm.vue b/src/views/setting/sources/SourcesForm.vue index 4752067e..4f686a19 100644 --- a/src/views/setting/sources/SourcesForm.vue +++ b/src/views/setting/sources/SourcesForm.vue @@ -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: () => {} }) |
