huminmin
2 天以前 350d00bbcba851589f7c611c470165f82cda4c14
修改文件上传
已修改1个文件
48 ■■■■ 文件已修改
src/components/Dialog/FileList.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Dialog/FileList.vue
@@ -129,22 +129,23 @@
  const saveUpload = async () => {
    // 检查是否有新上传的文件
    if (newFileList.value.length > 0) {
      try {
        await createAttachment({
          application: "file",
          recordType: props.recordType,
          recordId: props.recordId,
          storageBlobDTOs: [...newFileList.value, ...tableData.value],
        });
        newFileList.value = [];
        // 刷新列表
        setList();
      } catch (error) {
        proxy?.$modal?.msgError("上传失败");
      }
      createAttachment({
        application: "file",
        recordType: props.recordType,
        recordId: props.recordId,
        storageBlobDTOs: [...newFileList.value, ...tableData.value],
      }).then((res) => {
        if (res && res.code === 200) {
          proxy?.$modal?.msgSuccess("上传成功");
          newFileList.value = [];
          // 刷新列表
          setList();
        }
      }).finally(() => {
        uploadDialogVisible.value = false;
      })
    }
    uploadDialogVisible.value = false;
  };
  }
  const closeUpload = () => {
    newFileList.value = [];
@@ -152,13 +153,12 @@
  };
  const handleDelete = async (row, index) => {
    try {
      await deleteAttachment([row.storageAttachmentId]);
      proxy?.$modal?.msgSuccess("删除成功");
      setList();
    } catch (error) {
      proxy?.$modal?.msgError("删除失败");
    }
    deleteAttachment([row.storageAttachmentId]).then((res) => {
      if (res && res.code === 200) {
        proxy?.$modal?.msgSuccess("删除成功");
        setList();
      }
    })
  };
  const setList = () => {
@@ -166,9 +166,7 @@
      recordType: props.recordType,
      recordId: props.recordId,
    }).then(res => {
      if (res && res.data) {
        tableData.value = res.data || [];
      }
      tableData.value = (res && res.data) || [];
    });
  };