gaoshp
2024-05-19 a053d63221385b983dfaf675da0bead117faba31
src/views/dnc/document/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-05-16 22:40:01
 * @LastEditors: Sneed
 * @LastEditTime: 2024-05-19 19:26:43
 * @LastEditTime: 2024-05-19 19:52:38
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/document/index.vue
-->
<template>
@@ -11,7 +11,7 @@
                <el-aside width="200px">
                    <el-container>
                        <el-main>
                            <el-tree default-expand-all ref="group" node-key="id" :data="treeData" :props="{
                            <el-tree default-expand-all ref="tree" node-key="id" :data="treeData" :props="{
                                label: 'name',
                            }" @node-click="nodeClick" highlight-current :current-node-key="selectNode.id">
                                <template #default="{ node, data }">
@@ -29,7 +29,7 @@
                </el-aside>
                <el-container>
                    <el-header>
                        <el-button type="">返回上一级</el-button>
                        <el-button type="" @click="back">返回上一级</el-button>
                        <el-dropdown style="margin-left: 8px;">
                            <el-button type="primary">
                                新建<el-icon class="el-icon--right"><el-icon-arrow-down /></el-icon>
@@ -53,9 +53,9 @@
                                </el-dropdown-menu>
                            </template>
                        </el-dropdown>
                        <el-button style="margin-left: 8px;" type="danger" plain
                            :disabled="selection.length == 0">删除</el-button>
                        <el-button-group style="margin-left: auto;">
                        <el-button style="margin-left: 8px;" type="danger" plain :disabled="selection.length == 0"
                            @click="del(selection)">删除</el-button>
                        <!-- <el-button-group style="margin-left: auto;">
                            <el-button :type="type === 'list' ? 'primary' : ''" @click="type = 'list'">
                                <el-icon>
                                    <el-icon-fold />
@@ -66,8 +66,8 @@
                                    <el-icon-grid />
                                </el-icon>
                            </el-button>
                        </el-button-group>
                        <el-input v-model="params.searchKey" style="margin-left: 8px;max-width: 240px"
                        </el-button-group> -->
                        <el-input v-model="params.searchKey" style="margin-left: auto;max-width: 240px"
                            placeholder="请输入关键词" class="input-with-select">
                            <template #append>
                                <el-button type="primary" class="header-search" @click="search">
@@ -82,7 +82,13 @@
                        <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>
                            <el-table-column label="文件名称" prop="name">
                                <template #default="scope">
                                    <a v-if="scope.row.fileType === 1" @click="goCurrent(scope.row)"
                                        style="color: var(--el-color-primary);cursor: pointer;">{{ scope.row.name }}</a>
                                    <span v-else>{{ scope.row.name }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="文件路径" prop="allPathName"></el-table-column>
                            <el-table-column label="大小" prop="contentLength"></el-table-column>
                            <el-table-column label="文件类型" prop="suffix"></el-table-column>
@@ -92,11 +98,8 @@
                                    <el-button-group>
                                        <el-button text type="primary" size="small"
                                            @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                                        <el-popconfirm title="确定删除吗?" @confirm="table_del([scope.row], '0')">
                                            <template #reference>
                                                <el-button text type="primary" size="small">删除</el-button>
                                            </template>
                                        </el-popconfirm>
                                        <el-button text type="primary" size="small"
                                            @click="del([scope, row])">删除</el-button>
                                    </el-button-group>
                                </template>
                            </el-table-column>
@@ -181,6 +184,14 @@
        nodeClick(node) {
            this.selectNode = node
        },
        goCurrent(row) {
            this.selectNode = { id: row.id }
            console.log(row)
        },
        back() {
            console.log(this.$refs.tree.getCurrentNode())
            this.selectNode = { id: this.$refs.tree.getCurrentNode().parentId }
        },
        search() {
            this.$refs?.table.reload()
        },
@@ -190,6 +201,11 @@
            this.form = { isNewFile: false }
        },
        saveFolder() {
            if (this.form.id) {
                return this.$HTTP.put(`/api/blade-dnc/file/${this.form.id}/rename`, { fileType: this.form.fileType, newName: this.form.name, parentId: this.form.parentId }).then(res => {
                    this.search()
                })
            }
            let data = {
                ...this.form,
                parent: this.selectNode.id
@@ -215,7 +231,16 @@
        move() {
            this.$HTTP.post(`/api/blade-dnc/file/move`, { parentId: this.formFile.parentId, sourceIdList: this.selection.map(v => v.id) })
        },
        async del() {
        table_edit(row) {
            this.form = {
                id: row.id,
                name: row.name,
                fileType: row.fileType,
                parentId: row.parentId
            }
            this.visible = true
        },
        async del(selection) {
            let confirm = await this.$HTTP.post(`/api/blade-dnc/file/exists-file`).then(res => {
                if (res.data) {
                    return res.data