From 7d7e8ecae28b29668a5a6683049b621b052e766d Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期日, 19 五月 2024 19:55:46 +0800
Subject: [PATCH] update
---
src/views/dnc/document/index.vue | 267 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 262 insertions(+), 5 deletions(-)
diff --git a/src/views/dnc/document/index.vue b/src/views/dnc/document/index.vue
index 036843e..132d210 100644
--- a/src/views/dnc/document/index.vue
+++ b/src/views/dnc/document/index.vue
@@ -1,19 +1,276 @@
<!--
* @Date: 2024-05-16 22:40:01
* @LastEditors: Sneed
- * @LastEditTime: 2024-05-16 22:40:07
+ * @LastEditTime: 2024-05-19 19:54:53
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/document/index.vue
-->
<template>
- <div>
- 鎴戠殑鏂囨。
- </div>
+ <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="tree" 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="" @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>
+ </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;" :disabled="selection.length == 0">
+ <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="copy">澶嶅埗</el-dropdown-item>
+ <el-dropdown-item @click="move">绉诲姩</el-dropdown-item>
+ </el-dropdown-menu>
+ </template>
+ </el-dropdown>
+ <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 />
+ </el-icon>
+ </el-button>
+ <el-button :type="type !== 'list' ? 'primary' : ''" @click="type = 'card'">
+ <el-icon>
+ <el-icon-grid />
+ </el-icon>
+ </el-button>
+ </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">
+ <el-icon>
+ <el-icon-search />
+ </el-icon>
+ </el-button>
+ </template>
+ </el-input>
+ </el-header>
+ <el-main>
+ <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">
+ <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>
+ <el-table-column label="鏇存柊鏃堕棿" prop="updateTime"></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="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
+ <el-button text type="primary" size="small"
+ @click="del([scope, row])">鍒犻櫎</el-button>
+ </el-button-group>
+ </template>
+ </el-table-column>
+ </scTable>
+ </el-main>
+ </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: '蹇呭~'
+ }]
+ },
+ params: {
+ searchKey: '',
+ },
+ apiObj: {
+ get: async (data) => {
+ let params = {
+ ...data,
+ parent: this.selectNode.id,
+ ...this.params
+ }
+ return await this.$HTTP.get(`/api/blade-dnc/folder/page`, {}, { params }).then(res => {
+ return res
+ })
+ }
+ },
+ selection: [],
+ type: 'list'
+ }
+ },
+ watch: {
+ 'selectNode.id': function () {
+ this.search()
+ }
+ },
+ mounted() {
+ 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
+ },
+ 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()
+ },
+ // 鏂板鏂囦欢澶�
+ addFolder() {
+ this.visible = true
+ 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.visible = false
+ this.search()
+ })
+ }
+ let data = {
+ ...this.form,
+ parent: this.selectNode.id
+ }
+ try {
+ Reflect.deleteProperty(data, 'isNewFile')
+ } catch (error) {
+ }
+ this.$HTTP.post(`/api/blade-dnc/folder`, data).then(res => {
+ this.visible = false
+ this.init()
+ })
+ },
+ selectionChange(selection) {
+ this.selection = selection
+ },
+ action() {
+
+ },
+ copy() {
+ this.$HTTP.post(`/api/blade-dnc/file/copy`, { parentId: this.formFile.parentId, sourceIdList: this.selection.map(v => v.id) })
+ },
+ move() {
+ this.$HTTP.post(`/api/blade-dnc/file/move`, { parentId: this.formFile.parentId, sourceIdList: this.selection.map(v => v.id) })
+ },
+ 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
+ }
+ })
+ let delFlag = true
+ if (confirm) {
+ delFlag = await this.$confirm(`姝ゆ搷浣滀細灏嗗綋鍓嶆枃浠跺す涓嬬殑鎵�鏈夋枃浠跺垹闄わ紝鏄惁缁х画??`, '鎻愮ず', {
+ type: 'warning',
+ }).then(() => {
+ return true
+ }).catch(() => {
+ return false
+ })
+ }
+ if (!delFlag) {
+ return
+ }
+ this.$HTTP.post(`/api/blade-dnc/file`, { sourceIdList: this.selection.map(v => v.id) }).then(res => {
+ this.init()
+ })
+ }
+ }
}
</script>
-<style lang="scss" scoped></style>
\ No newline at end of file
+<style lang="scss" scoped>
+.header-search {
+ cursor: pointer;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3