fix: 新增配置添加确定对接函数
Build and Deploy Vue3 / build (push) Successful in 1m37s
Build and Deploy Vue3 / deploy (push) Successful in 55s

This commit is contained in:
2026-03-10 14:20:47 +08:00
parent c100c37a32
commit 2e82ff8a34
+48
View File
@@ -1015,6 +1015,54 @@ const removeStringItem = (index) => {
settingForm.value = currentItems.join(',')
}
// 提交配置表单
const submitSettingForm = async () => {
if (!settingFormRef.value) return
try {
await settingFormRef.value.validate()
const submitData = {
name: settingForm.name,
value: settingForm.value,
type: settingForm.type,
setting_group_id: settingForm.settingGroupID,
open: settingForm.open,
note: settingForm.note
}
const res = settingForm.id
? await updateSetting(settingForm.id, submitData)
: await createSetting(submitData)
if (res.data.code === 200) {
ElMessage.success(settingForm.id ? '修改成功' : '创建成功')
settingDialogVisible.value = false
// 重新加载数据
if (settingForm.settingGroupID) {
// 找到对应的配置组并重新加载其配置项
const groupNode = treeData.value.find(item =>
item.type === 'group' && item.data.id === settingForm.settingGroupID
)
if (groupNode) {
groupNode._children = []
groupNode._expanded = false
await toggleExpand(groupNode)
}
} else {
// 重新加载所有数据
loadGroups()
}
} else {
ElMessage.error(res.data.message || '操作失败')
}
} catch (error) {
console.error('提交配置失败:', error)
ElMessage.error('操作失败')
}
}
// 初始化
onMounted(() => {
// 初始化时加载配置组数据