From f5ee0c0a279ba18baea0235213b1653c35faba25 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 25 Sep 2025 15:50:58 +0800 Subject: [PATCH] feat(Term): Effective data source --- frontend/src/i18n/en.json | 3 + frontend/src/i18n/zh-CN.json | 3 + .../src/views/system/professional/index.vue | 85 +++++++++++++++++-- 3 files changed, 86 insertions(+), 5 deletions(-) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 5c69a0ba8..7c6a2df91 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -7,6 +7,9 @@ "AI Model Configuration": "AI Model Configuration" }, "training": { + "effective_data_sources": "Effective data sources", + "all_data_sources": "All data sources", + "partial_data_sources": "Partial data sources", "add_it_here": "Drag the table name on the left to add it here", "table_relationship_management": "Table relationship management", "system_anagement": "System Management", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 27ce2e3c5..dc77bf278 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -7,6 +7,9 @@ "AI Model Configuration": "模型配置" }, "training": { + "effective_data_sources": "生效数据源", + "all_data_sources": "所有数据源", + "partial_data_sources": "部分数据源", "add_it_here": "拖拽左侧表名,添加到这里", "table_relationship_management": "表关系管理", "system_anagement": "系统管理", diff --git a/frontend/src/views/system/professional/index.vue b/frontend/src/views/system/professional/index.vue index 79bcca873..8f007bea6 100644 --- a/frontend/src/views/system/professional/index.vue +++ b/frontend/src/views/system/professional/index.vue @@ -3,6 +3,7 @@ import { nextTick, onMounted, reactive, ref, unref } from 'vue' import icon_export_outlined from '@/assets/svg/icon_export_outlined.svg' import { professionalApi } from '@/api/professional' import { formatTimestamp } from '@/utils/date' +import { datasourceApi } from '@/api/datasource' import ccmUpload from '@/assets/svg/icon_ccm-upload_outlined.svg' import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg' import IconOpeEdit from '@/assets/svg/icon_edit_outlined.svg' @@ -16,11 +17,15 @@ interface Form { id?: string | null word: string | null other_words: string[] + specific_ds: boolean + datasource_ids: number[] + datasource_names: string[] description: string | null } const { t } = useI18n() const multipleSelectionAll = ref([]) +const allDsList = ref([]) const keywords = ref('') const oldKeywords = ref('') const searchLoading = ref(false) @@ -48,7 +53,10 @@ const defaultForm = { id: null, word: null, description: null, + specific_ds: false, + datasource_ids: [], other_words: [''], + datasource_names: [], } const pageForm = ref
(cloneDeep(defaultForm)) @@ -197,6 +205,14 @@ const search = () => { const termFormRef = ref() +const validatePass = (_: any, value: any, callback: any) => { + if (pageForm.value.specific_ds && !value.length) { + callback(new Error(t('datasource.Please_select') + t('common.empty') + t('ds.title'))) + } else { + callback() + } +} + const rules = { word: [ { @@ -211,6 +227,16 @@ const rules = { t('datasource.please_enter') + t('common.empty') + t('professional.term_description'), }, ], + datasource_ids: [ + { + validator: validatePass, + trigger: 'blur', + }, + ], +} + +const handleChange = () => { + termFormRef.value.validateField('datasource_ids') } const saveHandler = () => { @@ -241,7 +267,11 @@ const saveHandler = () => { } }) } - +const list = () => { + datasourceApi.list().then((res) => { + allDsList.value = res + }) +} const editHandler = (row: any) => { pageForm.value.id = null if (row) { @@ -254,6 +284,7 @@ const editHandler = (row: any) => { ? t('professional.editing_terminology') : t('professional.create_new_term') dialogFormVisible.value = true + list() } const onFormClose = () => { @@ -353,10 +384,7 @@ const deleteHandlerItem = (idx: number) => { }} - + + { type="textarea" /> + + + {{ $t('training.all_data_sources') }} + {{ $t('training.partial_data_sources') }} + + + + +