From a053d63221385b983dfaf675da0bead117faba31 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期日, 19 五月 2024 19:53:23 +0800
Subject: [PATCH] 我的文档
---
src/views/dnc/document/index.vue | 55 ++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 40 insertions(+), 15 deletions(-)
diff --git a/src/views/dnc/document/index.vue b/src/views/dnc/document/index.vue
index 925cdf2..61033c6 100644
--- a/src/views/dnc/document/index.vue
+++ b/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
--
Gitblit v1.9.3