Skip to content

Commit 9fc8690

Browse files
dataeaseShuXiaJunjie2020
authored andcommitted
fix(System Management): Supports system variables
1 parent d912907 commit 9fc8690

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
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+
"built_in": "Built-in",
1112
"normal_value": "Normal value",
1213
"​​cannot_be_empty": "Variable values ​​cannot be empty.",
1314
"1_to_100": "{name}, the numerical range is {min} to {max}.",

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+
"built_in": "내장형",
2728
"normal_value": "정상값",
2829
"​​cannot_be_empty": "변수 값은 비어 있을 수 없습니다.",
2930
"1_to_100": "{name}, 숫자 범위는 {min}부터 {max}까지입니다.",

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+
"built_in": "已内置",
2728
"normal_value": "常规值",
2829
"​​cannot_be_empty": "变量值不能为空",
2930
"1_to_100": "{name}数值范围 {min}~{max}",

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const deleteBatchUser = () => {
7979
})
8080
}
8181
const deleteHandler = (row: any) => {
82+
if (row.type === 'system') return
83+
8284
ElMessageBox.confirm(t('embedded.delete', { msg: row.name }), {
8385
confirmButtonType: 'danger',
8486
confirmButtonText: t('dashboard.delete'),
@@ -145,7 +147,10 @@ const search = ($event: any = {}) => {
145147
.listPage(pageInfo.currentPage, pageInfo.pageSize, data)
146148
.then((res) => {
147149
toggleRowLoading.value = true
148-
fieldList.value = res.items
150+
fieldList.value = res.items.map((ele: any) => ({
151+
...ele,
152+
value: ele.type === 'system' ? t('variables.built_in') : ele.value,
153+
}))
149154
pageInfo.total = res.total
150155
searchLoading.value = false
151156
nextTick(() => {
@@ -234,6 +239,7 @@ const saveHandler = () => {
234239
const editHandler = (row: any) => {
235240
pageForm.value.id = null
236241
if (row) {
242+
if (row.type === 'system') return
237243
const { id, name, var_type, value } = row
238244
pageForm.value.id = id
239245
pageForm.value.name = name
@@ -340,7 +346,12 @@ const handleCurrentChange = (val: number) => {
340346
:content="$t('datasource.edit')"
341347
placement="top"
342348
>
343-
<el-icon class="action-btn" size="16" @click="editHandler(scope.row)">
349+
<el-icon
350+
class="action-btn"
351+
:class="scope.row.type === 'system' && 'not-allow'"
352+
size="16"
353+
@click="editHandler(scope.row)"
354+
>
344355
<IconOpeEdit></IconOpeEdit>
345356
</el-icon>
346357
</el-tooltip>
@@ -350,7 +361,12 @@ const handleCurrentChange = (val: number) => {
350361
:content="$t('dashboard.delete')"
351362
placement="top"
352363
>
353-
<el-icon class="action-btn" size="16" @click="deleteHandler(scope.row)">
364+
<el-icon
365+
class="action-btn"
366+
:class="scope.row.type === 'system' && 'not-allow'"
367+
size="16"
368+
@click="deleteHandler(scope.row)"
369+
>
354370
<IconOpeDelete></IconOpeDelete>
355371
</el-icon>
356372
</el-tooltip>
@@ -643,6 +659,7 @@ const handleCurrentChange = (val: number) => {
643659
644660
&.not-allow {
645661
cursor: not-allowed;
662+
color: #bbbfc4;
646663
}
647664
}
648665
.ed-icon + .ed-icon {

0 commit comments

Comments
 (0)