gaoshp
2024-06-16 7fac4c1e1bb1f03e0755ea8a2052bd6dabc8a947
update
已修改1个文件
65 ■■■■■ 文件已修改
src/views/console/tooling/fixture.vue 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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:12:24
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/tooling/fixture.vue
-->
<template>
@@ -126,6 +126,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 +243,7 @@
            },
            info: {},
            infoList: [],
            fileList: [],
            selectNode: {},
            apiObj: {
                get: async (data) => {
@@ -250,7 +273,8 @@
            },
            trayId: [],
            surfaceId: [],
            selection: []
            selection: [],
            row: {}
        }
    },
    watch: {
@@ -258,6 +282,7 @@
            handler(val) {
                this.info = {}
                this.infoList = []
                this.fileList = []
                if (val) {
                    this.queryInfo()
                }
@@ -287,6 +312,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 +452,7 @@
            data?.[0] && this.rowClick(data?.[0])
        },
        rowClick(row) {
            this.row = row
            console.log(row.id)
            this.queryChildInfo(row.id)
        },
@@ -410,6 +470,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