| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="上传附件" |
| | | width="50%" |
| | | @close="closeDia" |
| | | > |
| | | <el-dialog v-model="dialogFormVisible" title="上传附件" width="50%" @close="closeDia"> |
| | | <div style="margin-bottom: 10px;text-align: right"> |
| | | <el-upload |
| | | v-model:file-list="fileList" |
| | | class="upload-demo" |
| | | :action="uploadUrl" |
| | | :on-success="handleUploadSuccess" |
| | | :on-error="handleUploadError" |
| | | name="files" |
| | | :show-file-list="false" |
| | | :headers="headers" |
| | | style="display: inline;margin-right: 10px" |
| | | > |
| | | <el-upload v-model:file-list="fileList" class="upload-demo" :action="uploadUrl" |
| | | :on-success="handleUploadSuccess" :on-error="handleUploadError" name="files" :show-file-list="false" |
| | | :headers="headers" style="display: inline;margin-right: 10px"> |
| | | <el-button type="primary">上传附件</el-button> |
| | | </el-upload> |
| | | <el-button type="danger" plain @click="handleDelete">删除</el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="paginationSearch" |
| | | height="500" |
| | | > |
| | | <PIMTable rowKey="id" :column="tableColumn" :tableData="tableData" :page="page" :tableLoading="tableLoading" |
| | | :isSelection="true" @selection-change="handleSelectionChange" @pagination="paginationSearch" height="500"> |
| | | </PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | |
| | | function handleUploadSuccess(res, file) { |
| | | // 如果上传成功 |
| | | if (res.code == 200 && res.data && res.data.length > 0) { |
| | | const mergedFiles = [...tableData.value, ...res.data]; |
| | | const newFiles = res.data.map(item => ({ |
| | | ...item, |
| | | name: item.originalFilename || item.name |
| | | })); |
| | | const mergedFiles = [...(tableData.value || []), ...newFiles]; |
| | | const storageAttachmentDTO = { |
| | | recordType: accountType.value, |
| | | recordId: currentId.value, |
| | |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | <style scoped></style> |