feat base

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Ironsp
2026-05-26 15:11:19 +08:00
parent 0422e43070
commit 5fde4ea0f7

View File

@@ -32,7 +32,7 @@
</el-form-item>
<el-form-item class="button-item">
<div class="flex justify-center gap-4">
<el-button @click="cancel" class="w-120px mr-200px -ml-100px"> </el-button>
<el-button @click="cancel" class="w-120px mr-100px -ml-100px"> </el-button>
<el-button type="primary" @click="save" class="w-120px">保存配置</el-button>
</div>
</el-form-item>
@@ -52,10 +52,9 @@ import { get } from 'node:http';
const uploadUrl = import.meta.env.VITE_BASE_API + '/system/logo/upload';
const form = reactive({
const form = ref({
name: '可视化电子围栏管理系统',
remark: '',
logoUrl: ''
url: ''
});
const getList = async () => {
@@ -70,18 +69,19 @@ const getList = async () => {
name: '系统图标'
}
];
form.logoUrl = res.data.url;
form.name = res.data.name;
form.value.url = res.data.url;
form.value.name = res.data.name;
}
};
const cancel = () => {
fileList.value = [];
form.logoUrl = '';
form.name = '';
form.value.url = '';
form.value.name = '';
};
const save = async () => {
updateDemo(form)
console.log('保存数据', form.value);
updateDemo(form.value)
.then((res) => {
console.log('保存成功', res);
//ElMessage.success('保存成功');
@@ -101,7 +101,8 @@ const dialogVisible = ref(false);
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
// 清空 logo 字段
form.logoUrl = '';
form.value.name = '';
form.value.url = '';
};
// 自定义 change 处理函数
@@ -115,12 +116,10 @@ const handleChange = (file: any) => {
uploadDemo(realFile)
.then((res) => {
console.log('上传成功', res);
const logoImage = {
name: res.data.name,
url: res.data.url
};
fileList.value = [logoImage];
getList(); // 刷新列表获取最新的 logo URL
form.value.url = res.data.imgUrl;
console.log('上传设备', form.value);
fileList.value = [form.value];
//getList(); // 刷新列表获取最新的 logo URL
})
.catch((err) => {
console.error('上传失败', err);