gongchunyi
7 天以前 dd3e662b56304b41680bc283302d712b57551bd7
fix: 除图片类型附件上传不回显
已修改1个文件
44 ■■■■ 文件已修改
src/views/equipmentManagement/measurementEquipment/filesDia.vue 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/measurementEquipment/filesDia.vue
@@ -1,38 +1,16 @@
<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">
@@ -136,7 +114,11 @@
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,
@@ -191,6 +173,4 @@
});
</script>
<style scoped>
</style>
<style scoped></style>