From a88ea2ee141ffddaea40dd3c7dbdbc7949206bf2 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 16 Mar 2026 11:33:45 +0800 Subject: [PATCH 1/2] fix(User Management): Users can bind system variables; the same system variable can be bound repeatedly. --- frontend/src/i18n/en.json | 1 + frontend/src/i18n/ko-KR.json | 1 + frontend/src/i18n/zh-CN.json | 1 + frontend/src/views/chat/ExecutionDetails.vue | 1 + frontend/src/views/system/user/User.vue | 9 ++++++--- frontend/src/views/system/variables/index.vue | 20 ++++++++++++++++++- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index bbdbcaaf..3803e0bf 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -8,6 +8,7 @@ "Details": "Details" }, "variables": { + "number_variable_error": "Please enter the correct numerical range.", "built_in": "Built-in", "normal_value": "Normal value", "​​cannot_be_empty": "Variable values ​​cannot be empty.", diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json index 4cedf417..6e82bc4b 100644 --- a/frontend/src/i18n/ko-KR.json +++ b/frontend/src/i18n/ko-KR.json @@ -24,6 +24,7 @@ "return_to_view": "화면으로 돌아가기" }, "variables": { + "number_variable_error": "올바른 숫자 범위를 입력하십시오.", "built_in": "내장형", "normal_value": "정상값", "​​cannot_be_empty": "변수 값은 비어 있을 수 없습니다.", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index f3b6e61d..a66c902e 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -24,6 +24,7 @@ "return_to_view": "返回查看" }, "variables": { + "number_variable_error": "请输入正确的数值范围", "built_in": "已内置", "normal_value": "常规值", "​​cannot_be_empty": "变量值不能为空", diff --git a/frontend/src/views/chat/ExecutionDetails.vue b/frontend/src/views/chat/ExecutionDetails.vue index a6545d5f..78dc4e63 100644 --- a/frontend/src/views/chat/ExecutionDetails.vue +++ b/frontend/src/views/chat/ExecutionDetails.vue @@ -173,6 +173,7 @@ defineExpose({ border: 1px solid #dee0e3; padding: 16px; margin-bottom: 8px; + cursor: pointer; .header { display: flex; diff --git a/frontend/src/views/system/user/User.vue b/frontend/src/views/system/user/User.vue index cf7b4419..78c3b01f 100644 --- a/frontend/src/views/system/user/User.vue +++ b/frontend/src/views/system/user/User.vue @@ -391,6 +391,9 @@ v-for="item in variables" :key="item.id" :label="item.name" + :disabled=" + state.form.system_variables.map((ele: any) => ele.variableId).includes(item.id) + " :value="item.id" >
@@ -434,7 +437,7 @@ > - { } return } - if (value.some((ele: any) => ele === '')) { + if (var_type === 'datetime') { + if (value === null) { + callback(new Error(t('datasource.please_enter') + t('common.empty') + t('variables.date'))) + } + } + if (value.some((ele: any) => ele === '' || ele === null)) { callback( new Error( t('datasource.please_enter') + @@ -237,6 +242,17 @@ const saveHandler = () => { obj.value = [...new Set(obj.value)] } + if (obj.var_type === 'number') { + const [min = 0, max = 0] = obj.value + if (min > max) { + ElMessage({ + type: 'error', + message: t('variables.number_variable_error'), + }) + return + } + } + variablesApi.save(obj).then(() => { ElMessage({ type: 'success', @@ -553,12 +569,14 @@ const handleCurrentChange = (val: number) => { v-model.number="pageForm.value[0]" :placeholder="$t('variables.please_enter_value')" clearable + max="10000000000000000" controls-position="right" /> From b5df4ebf28f790887b81af2a341b072a9e145e8f Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 16 Mar 2026 11:43:40 +0800 Subject: [PATCH 2/2] fix(User Management): The variable value is a date, not a range. After selecting a date value, it is necessary to verify whether this value is within the date range set for the variable. --- frontend/src/i18n/en.json | 1 + frontend/src/i18n/ko-KR.json | 3 ++- frontend/src/i18n/zh-CN.json | 1 + frontend/src/views/system/user/User.vue | 15 +++++---------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 3803e0bf..f7e995c2 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -8,6 +8,7 @@ "Details": "Details" }, "variables": { + "please_select_date": "Please select a date", "number_variable_error": "Please enter the correct numerical range.", "built_in": "Built-in", "normal_value": "Normal value", diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json index 6e82bc4b..34c27650 100644 --- a/frontend/src/i18n/ko-KR.json +++ b/frontend/src/i18n/ko-KR.json @@ -24,6 +24,7 @@ "return_to_view": "화면으로 돌아가기" }, "variables": { + "please_select_date": "날짜를 선택하십시오", "number_variable_error": "올바른 숫자 범위를 입력하십시오.", "built_in": "내장형", "normal_value": "정상값", @@ -944,4 +945,4 @@ "to_doc": "API 보기", "trigger_limit": "최대 {0}개의 API 키 생성 지원" } -} +} \ No newline at end of file diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index a66c902e..66f81772 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -24,6 +24,7 @@ "return_to_view": "返回查看" }, "variables": { + "please_select_date": "请选择日期", "number_variable_error": "请输入正确的数值范围", "built_in": "已内置", "normal_value": "常规值", diff --git a/frontend/src/views/system/user/User.vue b/frontend/src/views/system/user/User.vue index 78c3b01f..aa8dc732 100644 --- a/frontend/src/views/system/user/User.vue +++ b/frontend/src/views/system/user/User.vue @@ -452,12 +452,10 @@ { if (obj.var_type === 'datetime') { const [min, max] = obj.value - const [minVal, maxVal] = ele.variableValues if ( - +new Date(minVal) > +new Date(max) || - +new Date(maxVal) < +new Date(min) || - +new Date(maxVal) > +new Date(max) || - +new Date(minVal) < +new Date(min) + +new Date(ele.variableValues) > +new Date(max) || + +new Date(ele.variableValues) < +new Date(min) ) { ElMessage.error( t('variables.1_to_100_de', {