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