Skip to content

Commit 8bf4ac2

Browse files
committed
fix(User Management): Deleting configured system parameters caused the "Add System Parameter" button to disappear from the user editing page.
1 parent 8a7ad44 commit 8bf4ac2

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

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

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
<span style="width: calc(48% - 2px)">{{ t('variables.variables') }}</span>
382382
<span>{{ t('variables.variable_value') }}</span>
383383
</div>
384-
<div v-for="(_, index) in state.form.system_variables" class="item">
384+
<div v-for="(_, index) in state.form.system_variables" :key="index" class="item">
385385
<el-select
386386
v-model="state.form.system_variables[index].variableId"
387387
style="width: 236px"
@@ -863,29 +863,36 @@ const drawerMainClose = () => {
863863
drawerMainRef.value.close()
864864
}
865865
const editHandler = (row: any) => {
866-
variablesApi.listAll().then((res: any) => {
867-
variables.value = res.filter((ele: any) => ele.type === 'custom')
868-
variableValueMap.value = variables.value.reduce((pre, next) => {
869-
pre[next.id] = {
870-
value: next.value,
871-
var_type: next.var_type,
872-
name: next.name,
873-
}
874-
return pre
875-
}, {})
876-
877-
if (row) {
878-
state.form = {
879-
...row,
880-
system_variables: (row.system_variables || []).map((ele: any) => ({
881-
...ele,
882-
variableValue: ele.variableValues[0],
883-
})),
866+
variablesApi
867+
.listAll()
868+
.then((res: any) => {
869+
variables.value = res.filter((ele: any) => ele.type === 'custom')
870+
variableValueMap.value = variables.value.reduce((pre, next) => {
871+
pre[next.id] = {
872+
value: next.value,
873+
var_type: next.var_type,
874+
name: next.name,
875+
}
876+
return pre
877+
}, {})
878+
879+
if (row) {
880+
state.form = {
881+
...row,
882+
system_variables: (row.system_variables || []).map((ele: any) => ({
883+
...ele,
884+
variableValue: ele.variableValues[0],
885+
})),
886+
}
884887
}
885-
}
886-
})
887-
dialogFormVisible.value = true
888-
dialogTitle.value = row?.id ? t('user.edit_user') : t('user.add_users')
888+
})
889+
.finally(() => {
890+
state.form.system_variables = state.form.system_variables.filter((ele: any) => {
891+
return !!variableValueMap.value[ele.variableId]
892+
})
893+
dialogTitle.value = row?.id ? t('user.edit_user') : t('user.add_users')
894+
dialogFormVisible.value = true
895+
})
889896
}
890897

891898
const statusHandler = (row: any) => {

0 commit comments

Comments
 (0)