fix(User Management): Deleting configured system parameters caused the "Add System Parameter" button to disappear from the user editing page.

This commit is contained in:
dataeaseShu
2026-03-12 17:33:19 +08:00
committed by dataeaseShu
parent 8a7ad4450a
commit b25470ac14
+29 -22
View File
@@ -381,7 +381,7 @@
<span style="width: calc(48% - 2px)">{{ t('variables.variables') }}</span>
<span>{{ t('variables.variable_value') }}</span>
</div>
<div v-for="(_, index) in state.form.system_variables" class="item">
<div v-for="(_, index) in state.form.system_variables" :key="index" class="item">
<el-select
v-model="state.form.system_variables[index].variableId"
style="width: 236px"
@@ -863,29 +863,36 @@ const drawerMainClose = () => {
drawerMainRef.value.close()
}
const editHandler = (row: any) => {
variablesApi.listAll().then((res: any) => {
variables.value = res.filter((ele: any) => ele.type === 'custom')
variableValueMap.value = variables.value.reduce((pre, next) => {
pre[next.id] = {
value: next.value,
var_type: next.var_type,
name: next.name,
}
return pre
}, {})
variablesApi
.listAll()
.then((res: any) => {
variables.value = res.filter((ele: any) => ele.type === 'custom')
variableValueMap.value = variables.value.reduce((pre, next) => {
pre[next.id] = {
value: next.value,
var_type: next.var_type,
name: next.name,
}
return pre
}, {})
if (row) {
state.form = {
...row,
system_variables: (row.system_variables || []).map((ele: any) => ({
...ele,
variableValue: ele.variableValues[0],
})),
if (row) {
state.form = {
...row,
system_variables: (row.system_variables || []).map((ele: any) => ({
...ele,
variableValue: ele.variableValues[0],
})),
}
}
}
})
dialogFormVisible.value = true
dialogTitle.value = row?.id ? t('user.edit_user') : t('user.add_users')
})
.finally(() => {
state.form.system_variables = state.form.system_variables.filter((ele: any) => {
return !!variableValueMap.value[ele.variableId]
})
dialogTitle.value = row?.id ? t('user.edit_user') : t('user.add_users')
dialogFormVisible.value = true
})
}
const statusHandler = (row: any) => {