Skip to content

Commit 26c12b4

Browse files
committed
fix(system variables): Both data sources and system variables now include icons displaying field types.
1 parent 15c7536 commit 26c12b4

File tree

8 files changed

+117
-4
lines changed

8 files changed

+117
-4
lines changed
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

frontend/src/style.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,13 @@ strong {
419419
margin-top: -7px;
420420
}
421421
}
422+
423+
.text-variables.text-variables {
424+
color: #3370ff;
425+
}
426+
.number-variables.number-variables {
427+
color: #04b49c;
428+
}
429+
.datetime-variables.datetime-variables {
430+
color: #3370ff;
431+
}

frontend/src/views/ds/DataTable.vue

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ const editTable = () => {
190190
tableComment.value = currentTable.value.custom_comment
191191
tableDialog.value = true
192192
}
193+
const changeChecked = () => {
194+
datasourceApi.saveTable(currentTable.value).then(() => {
195+
ElMessage({
196+
message: t('common.save_success'),
197+
type: 'success',
198+
showClose: true,
199+
})
200+
})
201+
}
193202
const saveTable = () => {
194203
currentTable.value.custom_comment = tableComment.value
195204
datasourceApi.saveTable(currentTable.value).then(() => {
@@ -473,7 +482,27 @@ const btnSelectClick = (val: any) => {
473482
class="info-table"
474483
>
475484
<div class="table-name">
476-
<div class="name">{{ currentTable.table_name }}</div>
485+
<div class="name">
486+
{{ currentTable.table_name }}
487+
<div
488+
style="
489+
display: inline-flex;
490+
align-items: center;
491+
margin-left: 30px;
492+
font-size: 14px;
493+
font-weight: 400;
494+
"
495+
>
496+
<el-switch
497+
v-model="currentTable.checked"
498+
@change="changeChecked"
499+
size="small"
500+
style="margin-right: 8px"
501+
/>
502+
503+
{{ currentTable.checked ? t('user.disable') : t('user.enable') }}
504+
</div>
505+
</div>
477506
<div class="notes">
478507
{{ $t('about.remark') }}:
479508
<span :title="currentTable.custom_comment" class="field-notes">{{

frontend/src/views/system/permission/auth-tree/FilterFiled.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { ref, inject, computed, onBeforeMount, toRefs, type Ref, shallowRef } fr
44
import { variablesApi } from '@/api/variables'
55
import { useI18n } from 'vue-i18n'
66
import { allOptions } from '../options'
7+
import field_text from '@/assets/svg/field_text.svg'
8+
import field_time from '@/assets/svg/field_time.svg'
9+
import field_value from '@/assets/svg/field_value.svg'
10+
711
export interface Item {
812
term: string
913
field_id: string
@@ -118,6 +122,12 @@ const initEnumOptions = () => {
118122
console.info('initEnumOptions')
119123
}
120124
125+
const iconMap = {
126+
text: field_text,
127+
number: field_value,
128+
datetime: field_time,
129+
}
130+
121131
const selectItem = ({ field_name, id }: any) => {
122132
Object.assign(item.value, {
123133
field_id: id,
@@ -248,6 +258,12 @@ const emits = defineEmits(['update:item', 'del'])
248258
:placeholder="t('datasource.Please_select')"
249259
>
250260
<el-option v-for="ele in variables" :key="ele.id" :label="ele.name" :value="ele.id">
261+
<div style="width: 100%; display: flex; align-items: center">
262+
<el-icon :class="`${ele.var_type}-variables`" size="16" style="margin-right: 4px">
263+
<component :is="iconMap[ele.var_type as keyof typeof iconMap]"></component>
264+
</el-icon>
265+
{{ ele.name }}
266+
</div>
251267
</el-option>
252268
</el-select>
253269
</template>

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,18 @@
393393
:label="item.name"
394394
:value="item.id"
395395
>
396+
<div style="width: 100%; display: flex; align-items: center">
397+
<el-icon
398+
:class="`${variableValueMap[item.id].var_type}-variables`"
399+
size="16"
400+
style="margin-right: 4px"
401+
>
402+
<component
403+
:is="iconMap[variableValueMap[item.id].var_type as keyof typeof iconMap]"
404+
></component>
405+
</el-icon>
406+
{{ item.name }}
407+
</div>
396408
</el-option>
397409
</el-select>
398410
<el-select
@@ -544,6 +556,9 @@ import logo_lark from '@/assets/img/lark.png'
544556
import logo_wechat_work from '@/assets/img/wechat.png'
545557
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
546558
import { userApi } from '@/api/user'
559+
import field_text from '@/assets/svg/field_text.svg'
560+
import field_time from '@/assets/svg/field_time.svg'
561+
import field_value from '@/assets/svg/field_value.svg'
547562
import { request } from '@/utils/request'
548563
import { workspaceList } from '@/api/workspace'
549564
import { variablesApi } from '@/api/variables'
@@ -566,6 +581,12 @@ const drawerMainRef = ref()
566581
const userImportRef = ref()
567582
const syncUserRef = ref()
568583
const selectionLoading = ref(false)
584+
585+
const iconMap = {
586+
text: field_text,
587+
number: field_value,
588+
datetime: field_time,
589+
}
569590
const filterOption = ref<any[]>([
570591
{
571592
type: 'enum',

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import IconOpeDelete from '@/assets/svg/icon_delete.svg'
77
import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlined.svg'
88
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
99
import { useI18n } from 'vue-i18n'
10+
import field_text from '@/assets/svg/field_text.svg'
11+
import field_time from '@/assets/svg/field_time.svg'
12+
import field_value from '@/assets/svg/field_value.svg'
1013
import { cloneDeep } from 'lodash-es'
1114
1215
interface Form {
@@ -21,6 +24,11 @@ const multipleSelectionAll = ref<any[]>([])
2124
const keywords = ref('')
2225
const oldKeywords = ref('')
2326
const searchLoading = ref(false)
27+
const iconMap = {
28+
text: field_text,
29+
number: field_value,
30+
datetime: field_time,
31+
}
2432
2533
const selectable = (row: any) => {
2634
return ![1, 2, 3].includes(row.id)
@@ -322,7 +330,30 @@ const handleCurrentChange = (val: number) => {
322330
<el-table-column prop="name" :label="$t('variables.variable_name')">
323331
<template #default="scope">
324332
<div style="display: flex; align-items: center" :title="scope.row.name">
325-
<div class="ellipsis" style="max-width: calc(100% - 60px); width: fit-content">
333+
<div
334+
class="ellipsis"
335+
style="
336+
max-width: calc(100% - 60px);
337+
width: fit-content;
338+
position: relative;
339+
padding-left: 20px;
340+
"
341+
>
342+
<el-icon
343+
:class="`${scope.row.var_type}-variables`"
344+
size="16"
345+
style="
346+
margin-right: 4px;
347+
position: absolute;
348+
left: 0;
349+
top: 50%;
350+
transform: translateY(-50%);
351+
"
352+
>
353+
<component
354+
:is="iconMap[scope.row.var_type as keyof typeof iconMap]"
355+
></component>
356+
</el-icon>
326357
{{ scope.row.name }}
327358
</div>
328359
<div v-if="scope.row.type === 'system'" class="system-flag">
@@ -629,8 +660,11 @@ const handleCurrentChange = (val: number) => {
629660
margin-left: 4px;
630661
color: var(--ed-color-primary-15-d, #189e7a);
631662
}
632-
.ed-icon {
633-
color: #646a73;
663+
664+
&:not(:has(.ellipsis)) {
665+
.ed-icon {
666+
color: #646a73;
667+
}
634668
}
635669
636670
.field-comment {

0 commit comments

Comments
 (0)