diff --git a/pc/public.zip b/pc/public.zip
new file mode 100644
index 0000000..028483f
Binary files /dev/null and b/pc/public.zip differ
diff --git a/pc/src/api/resource.js b/pc/src/api/resource.js
new file mode 100644
index 0000000..12fb916
--- /dev/null
+++ b/pc/src/api/resource.js
@@ -0,0 +1,54 @@
+import request from '@/utils/request'
+
+/**
+ * 上传附件
+ * @param {File} file 文件对象
+ * @returns {Promise} 返回包含fileId和fileName的Promise
+ */
+export function uploadAttachment(file) {
+ const formData = new FormData()
+ formData.append('file', file)
+ return request({
+ url: '/resource/attachment/uploadAttachment',
+ method: 'post',
+ data: formData,
+ headers: {
+ 'Content-Type': 'multipart/form-data'
+ }
+ })
+}
+
+/**
+ * 下载附件
+ * @param {string} fileId 文件ID
+ * @returns {Promise} 返回文件流的Promise
+ */
+export function downloadAttachment(fileId) {
+ return request({
+ url: `/resource/attachment/downloadAttachment?fileId=${fileId}`,
+ method: 'get',
+ responseType: 'blob'
+ })
+}
+
+/**
+ * 批量删除附件
+ * @param {Array} fileIds 文件ID数组
+ * @returns {Promise} 返回操作结果的Promise
+ */
+export function batchDeleteAttachment(fileIds) {
+ return request({
+ url: '/resource/attachment/batchDeleteAttachment',
+ method: 'post',
+ data: fileIds
+ })
+}
+
+/**
+ * 删除单个附件
+ * @param {string} fileId 文件ID
+ * @returns {Promise} 返回操作结果的Promise
+ */
+export function deleteAttachment(fileId) {
+ return batchDeleteAttachment([fileId])
+}
\ No newline at end of file
diff --git a/pc/src/main.js b/pc/src/main.js
index 0794d55..58a436d 100644
--- a/pc/src/main.js
+++ b/pc/src/main.js
@@ -11,13 +11,36 @@ Vue.config.productionTip = false
// 添加下载方法
Vue.prototype.download = function(res, fileName) {
- // 创建blob链接
- const blob = new Blob([res])
- const link = document.createElement('a')
- link.href = URL.createObjectURL(blob)
- link.download = fileName
- link.click()
- URL.revokeObjectURL(link.href)
+ // 检查响应类型
+ if (res.type && (res.type === 'application/vnd.ms-excel' ||
+ res.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
+ res.type.includes('excel') ||
+ res.type === 'application/octet-stream')) {
+ // 如果已经是Blob类型且是Excel类型,直接使用
+ const blob = res
+ const link = document.createElement('a')
+ link.href = URL.createObjectURL(blob)
+ link.download = fileName
+ link.click()
+ URL.revokeObjectURL(link.href)
+ } else {
+ // 如果不是Blob类型或无法确定类型,根据文件扩展名处理
+ let blob
+ if (fileName.endsWith('.xlsx') || fileName.endsWith('.xls')) {
+ // Excel文件需要使用二进制格式
+ blob = new Blob([res], {
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+ })
+ } else {
+ // 其他类型使用默认处理
+ blob = new Blob([res])
+ }
+ const link = document.createElement('a')
+ link.href = URL.createObjectURL(blob)
+ link.download = fileName
+ link.click()
+ URL.revokeObjectURL(link.href)
+ }
}
new Vue({
diff --git a/pc/src/views/project/index.vue b/pc/src/views/project/index.vue
index a5002dd..408e560 100644
--- a/pc/src/views/project/index.vue
+++ b/pc/src/views/project/index.vue
@@ -188,6 +188,17 @@