refactor(frontend): 优化多个视图组件代码结构和功能

fix(frontend): 修复表单重置和刷新功能的潜在问题
style(frontend): 统一按钮样式和布局
feat(frontend): 在仪表盘添加文档链接
chore: 删除不再需要的开发数据库文件和git属性配置
This commit is contained in:
zhangtao
2025-07-24 00:24:48 +08:00
parent 2c0ee65844
commit 80179adb73
22 changed files with 676 additions and 356 deletions
@@ -91,6 +91,17 @@ const modelValue = defineModel("modelValue", {
default: () => "",
});
/**
* 定义组件触发的事件
*/
const emit = defineEmits<{
(e: 'success', fileInfo: FileInfo): void;
(e: 'error', error: any): void;
(e: 'input', value: string): void;
(e: 'onSuccess', fileInfo: FileInfo): void;
(e: 'onError', error: any): void;
}>();
/**
* 限制用户上传文件的格式和大小
*/
@@ -177,7 +188,7 @@ function handlePreview(imagePath: string) {
*/
const onSuccess = (fileInfo: FileInfo) => {
ElMessage.success("上传成功");
modelValue.value = fileInfo.url;
emit('onSuccess', fileInfo); // 触发 onSuccess 事件
};
/**
@@ -186,6 +197,7 @@ const onSuccess = (fileInfo: FileInfo) => {
const onError = (error: any) => {
console.log("onError");
ElMessage.error("上传失败: " + error.message);
emit('onError', error); // 触发 onError 事件
};
</script>