1. 实现集中式的附件统一管理,统一上传统一预览(代码生成器,公共组件,公共附件元数据定义)

2. 实现统一的 DB 字段数据库定义(代码生成器,共用规范检查)

(cherry picked from commit c2195ee3cf)
This commit is contained in:
chenbowen
2025-08-01 08:47:13 +08:00
committed by chenbowen
parent f9dc200d26
commit 014bd716de
63 changed files with 1674 additions and 351 deletions

View File

@@ -64,6 +64,11 @@ export const ${simpleClassName}Api = {
export${simpleClassName}: async (params) => {
return await request.download({ url: `${baseURL}/export-excel`, params })
},
// 查询接口相关的文件上传元数据信息
getFileUploadInfo: async () => {
return await request.get({url: `${baseURL}/upload-info`})
}
## 特殊:主子表专属逻辑
#foreach ($subTable in $subTables)
#set ($index = $foreach.count - 1)

View File

@@ -115,6 +115,11 @@
#end
#end
#end
#if($isFileUpload && $isFileUpload == true)
<el-form-item label="附件" prop="files">
<UploadFile v-model="formData.files" />
</el-form-item>
#end
</el-form>
## 特殊:主子表专属逻辑
#if ( $table.templateType == 10 || $table.templateType == 12 )
@@ -171,6 +176,9 @@ const formData = ref({
#end
#end
#end
#if($isFileUpload && $isFileUpload == true)
files: undefined
#end
})
const formRules = reactive({
#foreach ($column in $columns)
@@ -281,6 +289,9 @@ const resetForm = () => {
$column.javaField: undefined,
#end
#end
#end
#if($isFileUpload && $isFileUpload == true)
files: undefined
#end
}
formRef.value?.resetFields()

View File

@@ -181,7 +181,7 @@
#end
#end
#end
<el-table-column label="操作" align="center" min-width="120px">
<el-table-column label="操作" align="center" min-width="200px">
<template #default="scope">
<el-button
link
@@ -199,6 +199,9 @@
>
删除
</el-button>
#if($isFileUpload && $isFileUpload == true)
<el-button link @click="openBusinessFile(scope.row.id)">附件</el-button>
#end
</template>
</el-table-column>
</el-table>
@@ -248,6 +251,16 @@ import ${simpleClassName}Form from './${simpleClassName}Form.vue'
import ${subSimpleClassName}List from './components/${subSimpleClassName}List.vue'
#end
#end
#if($isFileUpload && $isFileUpload == true)
import {useDialogStore} from '@/store/modules/dialog'
import {FileUploadInfoVO} from '@/api/infra/file'
const dialogStore = useDialogStore()
const openBusinessFile = async (id: string) => {
let fileUploadInfoVO : FileUploadInfoVO = await ${simpleClassName}Api.getFileUploadInfo();
fileUploadInfoVO.businessId = id
dialogStore.openBusinessFileDialog(fileUploadInfoVO)
}
#end
/** ${table.classComment} 列表 */
defineOptions({ name: '${table.className}' })