lzhe
2024-05-19 509756bb9310a63e5d66bcc357f895a40e6d3be2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!--
 * @Date: 2024-05-16 22:40:01
 * @LastEditors: Sneed
 * @LastEditTime: 2024-05-18 21:35:42
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/document/index.vue
-->
<template>
    <el-main style="height: 100%;">
        <el-card shadow="never" style="height: 100%;" body-style="height: 100%">
            <el-container>
                <el-aside width="200px">
                    <el-container>
                        <el-main>
                            <el-tree default-expand-all ref="group" node-key="id" :data="treeData" :props="{
                                label: 'name',
                            }" @node-click="nodeClick" highlight-current :current-node-key="selectNode.id">
                                <template #default="{ node, data }">
                                    <span :class="data.isGroup ? 'active' : ''" class="custom-tree-node">
                                        <span>{{
                                            node.label || data.code }}</span>
                                    </span>
                                </template>
                            </el-tree>
                        </el-main>
                        <!-- <el-footer>
                            <el-button type="primary" round @click="addFolder">新增文件夹</el-button>
                        </el-footer> -->
                    </el-container>
                </el-aside>
                <el-container>
                    <el-header>
                        <el-button type="">返回上一级</el-button>
                        <el-dropdown style="margin-left: 8px;">
                            <el-button type="primary">
                                新建<el-icon class="el-icon--right"><el-icon-arrow-down /></el-icon>
                            </el-button>
                            <template #dropdown>
                                <el-dropdown-menu>
                                    <el-dropdown-item @click="addFolder">文件夹</el-dropdown-item>
                                    <el-dropdown-item>文件</el-dropdown-item>
                                </el-dropdown-menu>
                            </template>
                        </el-dropdown>
                        <el-button type="primary" style="margin-left: 8px;">上传文件</el-button>
                        <el-dropdown style="margin-left: 8px;">
                            <el-button type="primary">
                                更多操作<el-icon class="el-icon--right"><el-icon-arrow-down /></el-icon>
                            </el-button>
                            <template #dropdown>
                                <el-dropdown-menu>
                                    <el-dropdown-item>复制</el-dropdown-item>
                                    <el-dropdown-item>移动</el-dropdown-item>
                                </el-dropdown-menu>
                            </template>
                        </el-dropdown>
                        <el-button style="margin-left: 8px;" type="danger" plain>删除</el-button>
                        <el-button-group style="margin-left: auto;">
                            <el-button type="primary">
                                <el-icon>
                                    <el-icon-fold />
                                </el-icon>
                            </el-button>
                            <el-button type="primary">
                                <el-icon>
                                    <el-icon-grid />
                                </el-icon>
                            </el-button>
                        </el-button-group>
                        <el-input v-model="input3" style="margin-left: 8px;max-width: 240px" placeholder="请输入关键词"
                            class="input-with-select">
                            <template #append>
                                <el-button type="primary" class="header-search" @click="search">
                                    <el-icon>
                                        <el-icon-search />
                                    </el-icon>
                                </el-button>
 
                            </template>
                        </el-input>
                    </el-header>
                </el-container>
            </el-container>
        </el-card>
        <el-dialog v-model="visible" title="新建文件夹" width="500">
            <el-form :model="form" :rules="rules" ref="dialogForm" label-width="120px" label-position="center">
                <el-form-item label="文件夹名称" prop="name">
                    <el-input v-model="form.name" />
                </el-form-item>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="saveFolder">
                        确定
                    </el-button>
                </div>
            </template>
        </el-dialog>
    </el-main>
</template>
 
<script>
export default {
    data() {
        return {
            treeData: [],
            selectNode: {},
            visible: false,
            form: {},
            rules: {
                name: [{
                    required: true, message: '必填'
                }]
            }
        }
    },
    created() {
        this.init()
    },
    methods: {
        init() {
            this.$HTTP.get(`/api/blade-dnc/folder/folder-tree`).then(res => {
                this.treeData = [{
                    group: true,
                    id: 0,
                    name: '我的文档',
                    children: res.data
                }]
                this.selectNode = {
                    group: true,
                    id: 0,
                    name: '我的文档',
                }
            })
        },
        nodeClick(node) {
            this.selectNode = node
        },
        search() {
            alert(1)
        },
        // 新增文件夹
        addFolder() {
            this.visible = true
            this.form = {}
        },
        saveFolder() {
            console.log(this.form)
            this.$HTTP
        }
    }
}
</script>
 
<style lang="scss" scoped>
.header-search {
    cursor: pointer;
}
</style>