From ddbb2bd2691629336faa4491a59fdc3dc3c5934e Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期一, 17 六月 2024 23:44:23 +0800
Subject: [PATCH] update

---
 src/views/console/tooling/fixture.vue |   74 ++++++++++++++++++++++++++++++++++---
 1 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/src/views/console/tooling/fixture.vue b/src/views/console/tooling/fixture.vue
index 3217e4a..6c8fb7f 100644
--- a/src/views/console/tooling/fixture.vue
+++ b/src/views/console/tooling/fixture.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-05-12 20:02:31
  * @LastEditors: Sneed
- * @LastEditTime: 2024-05-16 22:07:06
+ * @LastEditTime: 2024-06-16 16:17:58
  * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/tooling/fixture.vue
 -->
 <template>
@@ -9,10 +9,11 @@
         <el-aside width="200px">
             <el-container>
                 <el-main>
-                    <el-tree default-expand-all ref="group" node-key="id" :data="treeData" :props="{
-                        label: 'name',
-                        disabled: 'isGroup'
-                    }" @node-click="nodeClick">
+                    <el-tree :expand-on-click-node="false" default-expand-all ref="group" node-key="id" :data="treeData"
+                        :props="{
+                            label: 'name',
+                            disabled: 'isGroup'
+                        }" @node-click="nodeClick">
                         <template #default="{ node, data }">
                             <div :class="data.isGroup ? 'active' : ''" class="custom-tree-node">
                                 <span>{{ node.label || data.code }}</span>
@@ -126,6 +127,28 @@
                                 </template>
                             </el-table-column>
                         </el-table>
+                        <h2 style="margin:14px 0;">鍏宠仈鏂囨。</h2>
+                        <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload"
+                            :http-request="request">
+                            <el-button type="primary">涓婁紶鏂囦欢</el-button>
+                        </el-upload>
+                        <el-table :data="fileList" style="width: 100%" stripe>
+                            <el-table-column label="鏂囨。鍚嶇О" prop="fileName"></el-table-column>
+                            <el-table-column label="鍒涘缓鏃堕棿" prop="createTime"></el-table-column>
+                            <el-table-column label="澶у皬" prop="fileLength"></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="downFile">涓嬭浇</el-button>
+                                        <el-popconfirm title="纭畾鍒犻櫎鍚楋紵" @confirm="delFile(scope.row, '0')">
+                                            <template #reference>
+                                                <el-button text type="primary" size="small">鍒犻櫎</el-button>
+                                            </template>
+                                        </el-popconfirm>
+                                    </el-button-group>
+                                </template>
+                            </el-table-column>
+                        </el-table>
                     </el-col>
                 </el-row>
             </el-main>
@@ -221,6 +244,7 @@
             },
             info: {},
             infoList: [],
+            fileList: [],
             selectNode: {},
             apiObj: {
                 get: async (data) => {
@@ -250,7 +274,8 @@
             },
             trayId: [],
             surfaceId: [],
-            selection: []
+            selection: [],
+            row: {}
         }
     },
     watch: {
@@ -258,6 +283,7 @@
             handler(val) {
                 this.info = {}
                 this.infoList = []
+                this.fileList = []
                 if (val) {
                     this.queryInfo()
                 }
@@ -287,6 +313,40 @@
         })
     },
     methods: {
+        request(options) {
+            const formData = new FormData()
+            console.log(options)
+            formData.append('file', options.file)
+            this.$HTTP.post(`/api/blade-resource/oss/endpoint/put-file`, formData).then(resFile => {
+                this.$HTTP.post(`/api/blade-cps/fixture/file`, {
+                    contentType: options.file.type,
+                    fileLength: options.file.size,
+                    fileLink: resFile.data.link,
+                    fileName: resFile.data.originalName,
+                    objectKey: resFile.data.name,
+                    parentId: this.row.id
+                }).then(res => {
+                    if (res.success) {
+                        this.rowClick(this.row)
+                    } else {
+                        this.$message.error(res.msg)
+                    }
+                })
+
+            })
+        },
+        delFile(row) {
+            this.$HTTP.delete(`/api/blade-cps/tool-appendix/remove`, [row.id]).then(res => {
+                if (res.success) {
+                    this.rowClick(this.row)
+                } else {
+                    this.$message.error(res.msg)
+                }
+            })
+        },
+        downFile(row) {
+            window.open(row.fileLink)
+        },
         selectionChange(selection) {
             this.selection = selection
         },
@@ -393,6 +453,7 @@
             data?.[0] && this.rowClick(data?.[0])
         },
         rowClick(row) {
+            this.row = row
             console.log(row.id)
             this.queryChildInfo(row.id)
         },
@@ -410,6 +471,7 @@
                         trayName: res.data.trayName,
                     }
                 ]
+                this.fileList = res.data.toolAppendixVOList
             })
             // await this.$HTTP.get(`/api/blade-cps/tray-surface/list/${id}`).then(res => {
             //     this.infoList = res.data

--
Gitblit v1.9.3