From bd30f37040c59a04c74084371f1477968ff4bfc4 Mon Sep 17 00:00:00 2001
From: pyt <626651354@qq.com>
Date: 星期四, 20 三月 2025 16:31:51 +0800
Subject: [PATCH] feat

---
 src/views/storing-data/index.vue |  175 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 88 insertions(+), 87 deletions(-)

diff --git a/src/views/storing-data/index.vue b/src/views/storing-data/index.vue
index 5ea6318..d85765c 100644
--- a/src/views/storing-data/index.vue
+++ b/src/views/storing-data/index.vue
@@ -4,20 +4,10 @@
     <div class="search-area">
       <el-form :inline="true" :model="queryParams" class="search-form">
         <el-form-item label="镇街">
-          <el-input
-            v-model="queryParams.street"
-            placeholder="请输入"
-            clearable
-            size="small"
-          />
+          <el-input v-model="queryParams.street" placeholder="请输入" clearable size="small" />
         </el-form-item>
         <el-form-item label="资料名称">
-          <el-input
-            v-model="queryParams.name"
-            placeholder="请输入"
-            clearable
-            size="small"
-          />
+          <el-input v-model="queryParams.name" placeholder="请输入" clearable size="small" />
         </el-form-item>
         <el-form-item>
           <el-button type="default" @click="resetQuery">重置</el-button>
@@ -32,43 +22,24 @@
     </div>
 
     <!-- 表格区域 -->
-    <el-table
-      v-loading="loading"
-      :data="tableData"
-      border
-      style="width: 100%"
-    >
-      <el-table-column prop="batchNo" label="镇/街道" min-width="120" align="center" />
-      <el-table-column prop="totalApplications" label="资料名称" min-width="100" align="center" >
+    <el-table v-loading="loading" :data="tableData" border style="width: 100%">
+      <el-table-column prop="street" label="镇/街道" min-width="120" align="center" />
+      <el-table-column prop="name" label="资料名称" min-width="100" align="center">
+        
+      </el-table-column>
+      <el-table-column prop="totalApplicants" label="附件内容" min-width="100" align="center" >
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            @click="handleView(scope.row, 'view')"
-          >查看</el-button>
+          <el-button type="text" @click="handleDownload(scope.row)">{{ scope.row.attachName }}</el-button>
         </template>
       </el-table-column>
-      <el-table-column prop="totalApplicants" label="附件内容" min-width="100" align="center" />
-      <el-table-column prop="compensationAmount" label="更新时间" min-width="150" align="center" />
-      
+      <el-table-column prop="updateTime" label="更新时间" min-width="150" align="center" />
+
       <el-table-column label="操作" width="180" align="center" fixed="right">
         <template slot-scope="scope">
           <template>
-            <el-button
-              size="mini"
-              type="text"
-              @click="handleView(scope.row, 'detail')"
-            >详情</el-button>
-            <el-button
-              size="mini"
-              type="text"
-              @click="handleView(scope.row, 'detail')"
-            >编辑</el-button>
-            <el-button
-              size="mini"
-              type="text"
-              @click="handleDelete(scope.row)"
-            >删除</el-button>
+            <el-button size="mini" type="text" @click="handleView(scope.row, 'detail')">详情</el-button>
+            <el-button size="mini" type="text" @click="handleView(scope.row, 'edit')">编辑</el-button>
+            <el-button size="mini" type="text" @click="handleDelete(scope.row)">删除</el-button>
           </template>
         </template>
       </el-table-column>
@@ -76,35 +47,19 @@
 
     <!-- 分页区域 -->
     <div class="pagination-container">
-      <el-pagination
-        background
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-        :current-page="queryParams.pageNum"
-        :page-sizes="[10, 20, 30, 40]"
-        :page-size="queryParams.pageSize"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="total"
-      >
+      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
+        :current-page="queryParams.pageNum" :page-sizes="[10, 20, 30, 40]" :page-size="queryParams.pageSize"
+        layout="total, sizes, prev, pager, next, jumper" :total="total">
       </el-pagination>
     </div>
 
     <!-- 审核对话框 -->
-    <approval-dialog
-      ref="approvalDialog"
-      :visible.sync="approvalDialogVisible"
-      :type="approvalType"
-      :row-data="currentRow"
-      @audit-submit="handleApprovalSubmit"
-    />
+    <approval-dialog ref="approvalDialog" :visible.sync="approvalDialogVisible" :type="approvalType"
+      :row-data="currentRow" @audit-submit="handleApprovalSubmit" />
 
     <!-- 上传组件 -->
-    <upload-dialog
-      ref="uploadDialog"
-      :visible.sync="uploadDialogVisible"
-      :type="uploadType"
-      @success="handleUploadSuccess"
-    />
+    <upload-dialog ref="uploadDialog" :visible.sync="uploadDialogVisible" :type="uploadType" :streetOptions="streetOptions"
+      @success="handleUploadSuccess" />
   </div>
 </template>
 
@@ -113,7 +68,7 @@
 import UploadDialog from "./components/UploadDialog";
 import ApprovalDialog from "./components/ApprovalDialog";
 import { list, add, del, update } from "@/api/storing-data";
-
+import { getDictData } from '@/api/placement'
 
 export default {
   name: "StoringData",
@@ -150,10 +105,15 @@
         street: undefined,
         name: undefined
       },
+      streetOptions: []
     };
   },
   created() {
     this.getList();
+    // 镇(街道)
+    getDictData('street').then(response => {
+      this.streetOptions = response.data
+    })
   },
   methods: {
     /** 查询列表 */
@@ -190,6 +150,14 @@
     handleImport() {
       // 实现下载逻辑
     },
+    handleSizeChange(size) {
+      this.queryParams.pageSize = size;
+      this.getList();
+    },
+    handleCurrentChange(page) {
+      this.queryParams.pageNum = page;
+      this.getList();
+    },
     /** 批量导入按钮操作 */
     handleBatchImport() {
       this.uploadType = "batch";
@@ -197,13 +165,10 @@
     },
     /** 统一的查看/详情按钮操作 */
     handleView(row, type) {
-      this.$router.push({
-        path: "/applicationBatchList/detail",
-        query: {
-          batchNo: row.batchNo,
-          type: type // 'audit'/'view'/'detail'
-        },
-      });
+      this.$refs.uploadDialog.form = JSON.parse(JSON.stringify(row));
+      this.$refs.uploadDialog.fileList = [{name: row.attachName, url: row.attachUrl}];
+      this.uploadType = type;
+      this.uploadDialogVisible = true;
     },
     /** 审核提交处理 */
     handleApprovalSubmit(data) {
@@ -218,20 +183,22 @@
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      this.$confirm("是否确认删除该批次数据?", "警告", {
+      this.$confirm("是否确认删除该资料?", "警告", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(() => {
-          // 这里添加删除逻辑
-          this.$message({
-            type: "success",
-            message: "删除成功!",
-          });
-          this.getList();
-        })
-        .catch(() => {});
+          del({id: row.id}).then(res => {
+            this.$message({
+              type: "success",
+              message: "删除成功!",
+            });
+            this.getList();
+          })
+          .catch(() => { });
+      })
+      .catch(() => { });
     },
     /** 上传成功回调 */
     handleUploadSuccess() {
@@ -240,6 +207,40 @@
       this.$message({
         type: "success",
         message: this.uploadType === "add" ? "新增成功!" : "批量导入成功!",
+      });
+    },
+    // 处理文件下载
+    handleDownload(row) {
+      if (!row.attachUrl) {
+        this.$message.error('文件不存在');
+        return;
+      }
+      
+      // 显示加载提示
+      this.loading = true;
+      
+      // 使用fetch获取文件内容
+      fetch(row.attachUrl)
+      .then(response => response.blob())
+      .then(blob => {
+        // 创建blob URL
+        const url = window.URL.createObjectURL(blob);
+        // 创建临时a标签
+        const link = document.createElement('a');
+        link.href = url;
+        link.download = row.attachName || '下载文件';
+        document.body.appendChild(link);
+        link.click();
+        // 清理
+        document.body.removeChild(link);
+        window.URL.revokeObjectURL(url);
+      })
+      .catch(error => {
+        console.error('下载失败:', error);
+        this.$message.error('文件下载失败');
+      })
+      .finally(() => {
+        this.loading = false;
       });
     },
   },
@@ -260,7 +261,7 @@
     .search-form {
       display: flex;
       align-items: center;
-      
+
       .el-form-item {
         margin-bottom: 0;
         margin-right: 20px;
@@ -270,7 +271,7 @@
 
   .action-buttons {
     margin-bottom: 20px;
-    
+
     .el-button {
       margin-right: 10px;
     }
@@ -278,10 +279,10 @@
 
   .el-table {
     margin-bottom: 20px;
-    
+
     .el-button--text {
       padding: 0 8px;
-      
+
       &:not(:last-child) {
         border-right: 1px solid #dcdfe6;
       }

--
Gitblit v1.7.1