Skip to content

Commit a88ea2e

Browse files
committed
fix(User Management): Users can bind system variables; the same system variable can be bound repeatedly.
1 parent 4feb553 commit a88ea2e

File tree

6 files changed

+29
-4
lines changed

6 files changed

+29
-4
lines changed

frontend/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"Details": "Details"
99
},
1010
"variables": {
11+
"number_variable_error": "Please enter the correct numerical range.",
1112
"built_in": "Built-in",
1213
"normal_value": "Normal value",
1314
"​​cannot_be_empty": "Variable values ​​cannot be empty.",

frontend/src/i18n/ko-KR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"return_to_view": "화면으로 돌아가기"
2525
},
2626
"variables": {
27+
"number_variable_error": "올바른 숫자 범위를 입력하십시오.",
2728
"built_in": "내장형",
2829
"normal_value": "정상값",
2930
"​​cannot_be_empty": "변수 값은 비어 있을 수 없습니다.",

frontend/src/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"return_to_view": "返回查看"
2525
},
2626
"variables": {
27+
"number_variable_error": "请输入正确的数值范围",
2728
"built_in": "已内置",
2829
"normal_value": "常规值",
2930
"​​cannot_be_empty": "变量值不能为空",

frontend/src/views/chat/ExecutionDetails.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ defineExpose({
173173
border: 1px solid #dee0e3;
174174
padding: 16px;
175175
margin-bottom: 8px;
176+
cursor: pointer;
176177
177178
.header {
178179
display: flex;

frontend/src/views/system/user/User.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@
391391
v-for="item in variables"
392392
:key="item.id"
393393
:label="item.name"
394+
:disabled="
395+
state.form.system_variables.map((ele: any) => ele.variableId).includes(item.id)
396+
"
394397
:value="item.id"
395398
>
396399
<div style="width: 100%; display: flex; align-items: center">
@@ -434,17 +437,17 @@
434437
>
435438
</el-option>
436439
</el-select>
437-
<el-input
440+
<el-input-number
438441
v-else-if="
439442
variableValueMap[state.form.system_variables[index].variableId].var_type ===
440443
'number'
441444
"
442445
v-model.number="state.form.system_variables[index].variableValue"
443446
style="width: 236px"
444447
:placeholder="$t('variables.please_enter_value')"
445-
autocomplete="off"
446-
maxlength="50"
447448
clearable
449+
max="10000000000000000"
450+
controls-position="right"
448451
/>
449452
<el-date-picker
450453
v-else

frontend/src/views/system/variables/index.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,12 @@ const validateValue = (_: any, value: any, callback: any) => {
189189
}
190190
return
191191
}
192-
if (value.some((ele: any) => ele === '')) {
192+
if (var_type === 'datetime') {
193+
if (value === null) {
194+
callback(new Error(t('datasource.please_enter') + t('common.empty') + t('variables.date')))
195+
}
196+
}
197+
if (value.some((ele: any) => ele === '' || ele === null)) {
193198
callback(
194199
new Error(
195200
t('datasource.please_enter') +
@@ -237,6 +242,17 @@ const saveHandler = () => {
237242
obj.value = [...new Set(obj.value)]
238243
}
239244
245+
if (obj.var_type === 'number') {
246+
const [min = 0, max = 0] = obj.value
247+
if (min > max) {
248+
ElMessage({
249+
type: 'error',
250+
message: t('variables.number_variable_error'),
251+
})
252+
return
253+
}
254+
}
255+
240256
variablesApi.save(obj).then(() => {
241257
ElMessage({
242258
type: 'success',
@@ -553,12 +569,14 @@ const handleCurrentChange = (val: number) => {
553569
v-model.number="pageForm.value[0]"
554570
:placeholder="$t('variables.please_enter_value')"
555571
clearable
572+
max="10000000000000000"
556573
controls-position="right"
557574
/>
558575
<span class="ed-range-separator separator"></span>
559576
<el-input-number
560577
v-model.number="pageForm.value[1]"
561578
:placeholder="$t('variables.please_enter_value')"
579+
max="10000000000000000"
562580
clearable
563581
controls-position="right"
564582
/>

0 commit comments

Comments
 (0)