From c9cedc3fb60ea48dd1ce42d9486508ef29b7f91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= Date: Mon, 18 Nov 2024 20:25:32 +0800 Subject: [PATCH] =?UTF-8?q?CN-1733=20fix:=201=E3=80=81=E4=BF=AE=E5=A4=8DEn?= =?UTF-8?q?tity=20Setting=E9=A1=B5=E9=9D=A2=E7=9A=84mapping=E5=92=8Crelati?= =?UTF-8?q?on=E8=A2=AB=E5=88=A0=E7=A9=BA=E8=83=BD=E8=A2=AB=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0source=E5=88=97=E8=A1=A8=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8C=89=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=B8=8A=E4=BC=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/table/setting/SourcesTable.vue | 6 ++---- .../setting/entitySetting/EntitySettingForm.vue | 14 ++++++++++---- 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: () => {} })