From fd7586c8d91473d2850af1e48b12f1a289e6b8d1 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期四, 13 六月 2024 00:10:43 +0800
Subject: [PATCH] 新增文件

---
 src/views/dnc/factory-file/index.vue |   44 ++++++++++++++++++++++++++------------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/src/views/dnc/factory-file/index.vue b/src/views/dnc/factory-file/index.vue
index 0d0427a..857bfc2 100644
--- a/src/views/dnc/factory-file/index.vue
+++ b/src/views/dnc/factory-file/index.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-05-20 21:43:10
  * @LastEditors: Sneed
- * @LastEditTime: 2024-05-20 21:57:06
+ * @LastEditTime: 2024-06-06 23:11:22
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/factory-file/index.vue
 -->
 <template>
@@ -9,8 +9,7 @@
         <el-card shadow="never" style="height: 100%;" body-style="height: 100%">
             <el-container>
                 <el-header>
-                    <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload"
-                        action="/api/blade-resource/oss/endpoint/put-file">
+                    <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload" :http-request="request">
                         <el-button type="primary">涓婁紶鏂囦欢</el-button>
                     </el-upload>
                     <el-button style="margin-left: 8px;margin-right: auto;" type="danger" plain
@@ -20,7 +19,7 @@
                     <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table"
                         :params="params" :apiObj="apiObj" @selection-change="selectionChange" stripe>
                         <el-table-column type="selection" width="50"></el-table-column>
-                        <el-table-column label="鏂囦欢鍚嶇О" prop="name">
+                        <el-table-column label="鏂囦欢鍚嶇О" prop="filename">
                             <!-- <template #default="scope">
                                 <el-icon style="margin-right: 4px;">
                                     <el-icon-folder v-if="scope.row.fileType === 1" />
@@ -32,16 +31,14 @@
                                     style="color: var(--el-color-primary);cursor: pointer;">{{ scope.row.name }}</a>
                             </template> -->
                         </el-table-column>
-                        <el-table-column label="鐗堟湰" prop="allPathName"></el-table-column>
+                        <el-table-column label="鐗堟湰" prop="versionDesc"></el-table-column>
                         <el-table-column label="鏂囦欢澶у皬" prop="contentLength"></el-table-column>
                         <el-table-column label="鏂囦欢绫诲瀷" prop="suffix"></el-table-column>
-                        <el-table-column label="鍒涘缓浜�" prop="updateTime"></el-table-column>
-                        <el-table-column label="鍒涘缓鏃堕棿" prop="updateTime"></el-table-column>
+                        <el-table-column label="鍒涘缓浜�" prop="createUserName"></el-table-column>
+                        <el-table-column label="鍒涘缓鏃堕棿" prop="createTime"></el-table-column>
                         <el-table-column label="鎿嶄綔" fixed="right" align="right" width="160">
                             <template #default="scope">
                                 <el-button-group>
-                                    <el-button text type="primary" size="small"
-                                        @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
                                     <el-button text type="primary" size="small" @click="del([scope.row])">鍒犻櫎</el-button>
                                 </el-button-group>
                             </template>
@@ -77,16 +74,27 @@
             this.selection = selection
         },
         del(selection) {
-
+            this.$HTTP.delete(`/api/blade-dnc/dnc-factory-file/remove`, {}, { data: selection.map(v => v.id) }).then(res => {
+                this.$refs.table.reload()
+            })
         },
-        table_edit() {
-
-        },
-        rowClick() {
-
-        },
-        dataChange() {
-
+        request(options) {
+            const formData = new FormData()
+            formData.append('file', options.file)
+            console.log(options)
+            this.$HTTP.post(`/api/blade-resource/oss/endpoint/put-file`, formData).then(res => {
+                this.$HTTP.post(`/api/blade-dnc/dnc-factory-file/insert`, {
+                    contentLength: options.file.size,
+                    contentType: options.file.type,
+                    filename: options.file.name,
+                    link: res.data.link,
+                    objectKey: res.data.name,
+                    originalFilename: options.file.name,
+                    suffix: res.data.originalName.split('.').pop(),
+                }).then(res => {
+                    this.$refs.table.reload()
+                })
+            })
         }
     }
 }

--
Gitblit v1.9.3