From b58f53769f004fb0ba6b5aedf55ef602850c7c97 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期日, 20 九月 2026 15:46:05 +0800
Subject: [PATCH] 天津豹鸣app 1.部署修改

---
 src/pages/projectManagement/project/archive.vue |  186 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 186 insertions(+), 0 deletions(-)

diff --git a/src/pages/projectManagement/project/archive.vue b/src/pages/projectManagement/project/archive.vue
new file mode 100644
index 0000000..1c7ba29
--- /dev/null
+++ b/src/pages/projectManagement/project/archive.vue
@@ -0,0 +1,186 @@
+<!--
+  鏂囨。褰掓。
+
+  鏁版嵁鏉ヨ嚜 getProjectAttachments(id)锛岃繑鍥炴寜妯″潡鍒嗙粍鐨勯檮浠讹細
+    [{ moduleName, files: [{ name, url }] }]
+  锛堝榻愮鐞嗙 components/ArchiveDialog.vue 鐨� res.data 缁撴瀯锛�
+
+  闄勪欢涓嬭浇澶嶇敤 utils/file.js 鐨� openFile锛歳equest.ts 鏈�忎紶 responseType锛�
+  鍙兘 downloadFile 鍒颁复鏃舵枃浠跺啀 openDocument銆�
+-->
+<template>
+  <view class="project-archive">
+    <PageHeader :title="pageTitle"
+                @back="goBack" />
+
+    <view v-if="loading"
+          class="state-text">
+      <text>鍔犺浇涓�...</text>
+    </view>
+
+    <view v-else-if="groups.length === 0"
+          class="state-text">
+      <text>鏆傛棤褰掓。闄勪欢</text>
+    </view>
+
+    <view v-else
+          class="archive-list">
+      <view v-for="(group, index) in groups"
+            :key="index"
+            class="archive-group">
+        <view class="group-header"
+              @click="toggleGroup(index)">
+          <text class="group-title">
+            {{ group.moduleName || "鏈懡鍚嶆ā鍧�" }}锛坽{ group.files.length }}锛�
+          </text>
+          <up-icon :name="isOpen(index) ? 'arrow-up' : 'arrow-down'"
+                   size="16"
+                   color="#909399"></up-icon>
+        </view>
+
+        <view v-if="isOpen(index)"
+              class="file-list">
+          <view v-for="(file, fileIndex) in group.files"
+                :key="fileIndex"
+                class="file-item"
+                @click="openFile(file.url)">
+            <up-icon name="attach"
+                     size="18"
+                     color="#5b8ff9"></up-icon>
+            <text class="file-name">{{ file.name || "鏈懡鍚嶆枃浠�" }}</text>
+            <up-icon name="download"
+                     size="18"
+                     color="#909399"></up-icon>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script setup>
+  import { computed, ref } from "vue";
+  import { onLoad } from "@dcloudio/uni-app";
+  import PageHeader from "@/components/PageHeader.vue";
+  import { openFile } from "@/utils/file";
+  import { getProjectAttachments } from "@/api/projectManagement/project";
+
+  const loading = ref(true);
+  const projectId = ref("");
+  const projectName = ref("");
+  const groups = ref([]);
+  const openIndex = ref([]);
+
+  const pageTitle = computed(() =>
+    projectName.value ? `鏂囨。褰掓。 - ${projectName.value}` : "鏂囨。褰掓。"
+  );
+
+  const goBack = () => uni.navigateBack();
+
+  const isOpen = index => openIndex.value.includes(index);
+
+  const toggleGroup = index => {
+    openIndex.value = isOpen(index)
+      ? openIndex.value.filter(item => item !== index)
+      : [...openIndex.value, index];
+  };
+
+  // 鍚庣鍙兘鍥� files 涓� null锛岀粺涓�鎴愭暟缁勶紝閬垮厤妯℃澘閲屽彇 length 鎶ラ敊
+  const normalize = list =>
+    (Array.isArray(list) ? list : []).map(group => ({
+      moduleName: group?.moduleName ?? "",
+      files: (Array.isArray(group?.files) ? group.files : []).map(file => ({
+        name: file?.name ?? "",
+        url: file?.url ?? "",
+      })),
+    }));
+
+  const loadAttachments = async () => {
+    try {
+      const res = await getProjectAttachments(projectId.value);
+      const raw = res?.data?.data ?? res?.data ?? res;
+      groups.value = normalize(raw);
+      // 鍏ㄩ儴鍒嗙粍榛樿灞曞紑锛屼笌绠$悊绔� ArchiveDialog 鐨� activeNames 琛屼负涓�鑷�
+      openIndex.value = groups.value.map((_, index) => index);
+    } catch (error) {
+      groups.value = [];
+      uni.showToast({ title: "鑾峰彇褰掓。闄勪欢澶辫触", icon: "none" });
+    } finally {
+      loading.value = false;
+    }
+  };
+
+  onLoad(options => {
+    projectId.value = options?.id || "";
+    projectName.value = options?.name ? decodeURIComponent(options.name) : "";
+    if (projectId.value) {
+      loadAttachments();
+    } else {
+      loading.value = false;
+    }
+  });
+</script>
+
+<style scoped lang="scss">
+  .project-archive {
+    min-height: 100vh;
+    background: #f5f6fa;
+  }
+
+  .state-text {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    padding: 80px 0;
+    font-size: 14px;
+    color: #909399;
+  }
+
+  .archive-list {
+    padding: 12px;
+    display: flex;
+    flex-direction: column;
+    gap: 12px;
+  }
+
+  .archive-group {
+    background: #ffffff;
+    border-radius: 12px;
+    overflow: hidden;
+    box-shadow: 0 2px 10px rgba(15, 35, 95, 0.05);
+  }
+
+  .group-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 14px 16px;
+    background: #f8fbff;
+  }
+
+  .group-title {
+    font-size: 15px;
+    font-weight: 600;
+    color: #22324d;
+  }
+
+  .file-list {
+    display: flex;
+    flex-direction: column;
+  }
+
+  .file-item {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    padding: 12px 16px;
+    border-top: 1px solid #f0f2f5;
+  }
+
+  .file-name {
+    flex: 1;
+    font-size: 14px;
+    color: #606266;
+    word-break: break-all;
+  }
+</style>

--
Gitblit v1.9.3