完成:安全维保管理模块

This commit is contained in:
gxwebsoft
2024-02-25 16:19:52 +08:00
parent 726bb3c163
commit 08f83ed015

View File

@@ -50,6 +50,7 @@
v-model:value="files"
:item-style="{ width: '90px', height: '90px' }"
:limit="20"
:upload-handler="uploadHandler"
@upload="onUpload"
/>
</a-form-item>
@@ -176,6 +177,25 @@
form.replaceAccessories = e.target.value;
}
/* 上传事件 */
const uploadHandler = (file: File) => {
const item: ItemType = {
file,
uid: (file as any).uid,
name: file.name
};
if (!file.type.startsWith('image')) {
message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 2) {
message.error('大小不能超过 2MB');
return;
}
onUpload(item);
};
// 上传文件
const onUpload = (d: ItemType) => {
uploadFile(<File>d.file)