This commit is contained in:
yziiy
2025-10-23 18:05:08 +08:00
parent 865ddbad43
commit be95e77f30
2 changed files with 61 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ export function useData() {
loading.value = true;
const { data, code } = await getConfigTypeList({});
if (code) {
tableList.value = data
tableList.value = data.filter(ele => { return ele.id !== 11 })
activeId.value = data[0].id
getInfo(activeId.value)
}

View File

@@ -0,0 +1,60 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { message } from "@/utils/message";
import { ElMessageBox } from "element-plus";
import {
getConfigSetInfo,
SetConfigData
} from "@/api/modules/system";
const Info = ref({
key_desc: '',
key_title: '',
key_value: ''
})
const formData = ref({
})
const getInfo = async (id) => {
const { data, code } = await getConfigSetInfo({ type: id })
if (code) {
// console.log(data)
Info.value = data[0]
formData.value[Info.value.key_title] = Info.value.key_value
}
}
const save = async () => {
ElMessageBox.confirm(
`该操作将覆盖之前的数据,是否继续?`,
"提示",
{
type: "warning"
}
)
.then(async () => {
const { code, msg } = await SetConfigData({
...formData.value,
type: 11
})
if (code) {
message("操作成功", { type: "success" });
getInfo(11)
} else {
message(msg, { type: "error" });
}
})
.catch(() => { });
}
onMounted(() => {
getInfo(11);
});
</script>
<template>
<el-form ref="form" :model="formData" label-width="100px">
<el-form-item :label="Info.key_desc" :prop="Info.key_title">
<el-input v-model="formData[Info.key_title]" style="width: 280px;" :show-password="true"></el-input>
</el-form-item>
<el-form-item label="">
<el-button @click="save">保存配置</el-button>
</el-form-item>
</el-form>
</template>