修改 bug

This commit is contained in:
GGJ
2024-09-25 16:36:53 +08:00
parent 470c8f5bd6
commit cb8e49646d
11 changed files with 246 additions and 205 deletions

View File

@@ -7,13 +7,11 @@
<div class="main_right" v-loading="loading">
<div class="right_nav">
<div class="menu" v-if="activePathList.length != 0">
<el-breadcrumb :separator-icon="ArrowRight">
<el-breadcrumb-item
v-for="(item, index) in activePathList"
style="cursor: pointer"
:key="index"
@click="handleIntoByPath(item)"
>
<el-breadcrumb separator="/">
<el-breadcrumb-item v-for="(item, index) in activePathList" style="cursor: pointer" :key="index"
@click="handleIntoByPath(item)">
<span>{{ outPutPath(item, index) }}</span>
</el-breadcrumb-item>
</el-breadcrumb>
@@ -24,28 +22,19 @@
</div>
<div class="filter" v-if="activePathList.length != 0">
<el-input
style="width: 200px; height: 32px"
placeholder="请输入文件或文件夹名称"
clearable
v-model="filterFileName"
></el-input>
<el-input style="width: 200px; height: 32px" placeholder="请输入文件或文件夹名称" clearable
v-model="filterFileName"></el-input>
<el-button type="primary" @click="handleSearch" :icon="Search">搜索</el-button>
<el-button @click="handleRefresh" :icon="Refresh">重置</el-button>
<el-upload
v-if="activePath != '/'"
action=""
:auto-upload="false"
:show-file-list="false"
:on-change="
(file:any, fileList:any) => {
handleUpload(file, fileList, activePath)
}
"
>
<el-upload v-if="activePath != '/'" action="" :auto-upload="false" :show-file-list="false" :on-change="(file: any, fileList: any) => {
handleUpload(file, fileList, activePath)
}
">
<el-button>
文件上传
<el-icon class="el-icon--right"><Upload /></el-icon>
<el-icon class="el-icon--right">
<Upload />
</el-icon>
</el-button>
</el-upload>
<el-button @click="handleAddNewDir" v-if="activePath != '/'" type="primary" :icon="Plus">
@@ -62,17 +51,16 @@
<div class="list" v-if="dirList.length != 0 && !loading">
<div class="list_item" v-for="(item, index) in dirList" :key="index">
<div class="item_download">
<el-button
v-if="activePath && activePath != '/'"
type="danger"
size="small"
@click="handleDelDirOrFile(item)"
circle
>
<el-icon><Delete /></el-icon>
<el-button v-if="activePath && activePath != '/'" type="danger" size="small"
@click="handleDelDirOrFile(item)" circle>
<el-icon>
<Delete />
</el-icon>
</el-button>
<el-button v-if="item?.type == 'file'" size="small" @click="handleDownLoad(item)" circle>
<el-icon><Download /></el-icon>
<el-icon>
<Download />
</el-icon>
</el-button>
<!-- <el-popconfirm
@@ -88,22 +76,18 @@
<el-icon><Delete /></el-icon>
</el-button>
</template>
</el-popconfirm> -->
</el-popconfirm> -->
</div>
<img v-if="item?.type == 'dir'" @click="handleIntoDir(item)" src="@/assets/img/wenjianjia.svg" />
<img
class="img_file"
@click="handleIntoDir(item)"
v-if="item?.type == 'file'"
src="@/assets/img/wenjian.svg"
/>
<img class="img_file" @click="handleIntoDir(item)" v-if="item?.type == 'file'"
src="@/assets/img/wenjian.svg" />
<span v-if="!item.type">暂无数据</span>
<p>
{{
item &&
item?.prjDataPath &&
item?.prjDataPath.includes(activePath) &&
item?.prjDataPath.length > activePath.length
item?.prjDataPath &&
item?.prjDataPath.includes(activePath) &&
item?.prjDataPath.length > activePath.length
? item?.prjDataPath.replace(activePath, ' ').replace('/', ' ')
: item?.prjDataPath.replace('/', ' ')
}}
@@ -113,20 +97,11 @@
<el-empty v-if="dirList.length === 0" />
</div>
<popup ref="fileRef"></popup>
<el-dialog
v-model="addDeviceDirOpen"
:destroy-on-close="true"
title="新建文件夹目录"
width="500"
@closed="close"
>
<el-form
ref="formRef"
:model="form"
:rules="{ path: [{ required: true, message: '请输入文件夹路径', trigger: 'blur' }] }"
>
<el-form-item label="文件夹路径" prop="path">
<el-input v-model="form.path" placeholder="请输入文件夹路径" />
<el-dialog v-model="addDeviceDirOpen" :destroy-on-close="true" title="新建文件夹目录" width="500" @closed="close">
<el-form ref="formRef" :model="form"
:rules="{ path: [{ required: true, message: '请输入文件夹名称', trigger: 'blur' }] }">
<el-form-item label="文件夹名称" prop="path">
<el-input v-model="form.path" placeholder="请输入文件夹名称" />
</el-form-item>
</el-form>
<template #footer>
@@ -184,7 +159,9 @@ const activePath = ref<string>('')
//判断是否是根目录
const isRoot = ref<boolean>(true)
//储存所有点击过的目录
const activePathList: any = ref([])
const activePathList: any = ref([
])
const nodeClick = (e: any) => {
if (e.level == 2) {
loading.value = true
@@ -235,14 +212,11 @@ const deviceRestartLoading = ref<boolean>(false)
const handleRestartDevice = () => {
deviceRestartLoading.value = true
ElMessageBox.prompt('二次校验密码确认', '装置重启', {
// confirmButtonText: '确认',
// cancelButtonText: '取消',
// customClass: 'customInput',
// inputType: 'text'
confirmButtonText: '确认',
cancelButtonText: '取消',
customClass: 'custom-message-box',
inputType: 'text'
})
.then(({ value }) => {
if (!value) {
@@ -297,14 +271,20 @@ const handleIntoDir = (row: any) => {
activePathList.value.splice(index, 1)
}
})
isRoot.value = false
}).catch(e => {
loading.value = false
})
isRoot.value = false
}
//处理导航栏路径
const outPutPath = (row: any, key: any) => {
let path = ''
if (key <= 1) {
if (key == 0) {
path = '/根目录'
}
if (key == 1) {
path = row.path
}
if (key > 1) {
@@ -313,9 +293,10 @@ const outPutPath = (row: any, key: any) => {
}
if (row.path.split('/').length !== 0) {
path = '/' + row.path.split('/')[row.path.split('/').length - 1]
}
}
return path
return path.split('/')[1]
}
//根据面包屑导航切换
@@ -335,8 +316,10 @@ const handleIntoByPath = async (val: any) => {
}
})
loading.value = false
}).catch(e => {
loading.value = false
})
isRoot.value = false
}
const form = ref({
path: ''
@@ -354,6 +337,7 @@ const handleAddNewDir = () => {
const formRef = ref()
//重新加载当前页面菜单
const reloadCurrentMenu = (msg: string) => {
loading.value = true
getFileServiceFileOrDir({ nDid: nDid.value, name: activePath.value, type: 'dir' }).then((resp: any) => {
if (resp.code == 'A0000') {
loading.value = false
@@ -364,10 +348,18 @@ const reloadCurrentMenu = (msg: string) => {
activePathList.value.splice(index, 1)
}
})
loading.value = false
if (!msg) return
ElMessage({ message: msg, type: 'success', duration: 5000 })
}
}).catch(e => {
loading.value = false
})
// setTimeout(() => {
// loading.value = false
// },0)
}
//新建文件夹
const submitDeviceDir = () => {
@@ -393,7 +385,7 @@ const submitDeviceDir = () => {
}
//删除文件夹或文件
const handleDelDirOrFile = (row: any) => {
loading.value = true
// delDeviceDir({ nDid: nDid.value, path: row.prjDataPath }).then((res: any) => {
// if (res.code == 'A0000') {
// reloadCurrentMenu(res.message)
@@ -410,15 +402,17 @@ const handleDelDirOrFile = (row: any) => {
.then(({ value }) => {
if (!value) {
ElMessage.warning('请输入密码')
loading.value = false
} else {
loading.value = true
passwordConfirm(value)
.then((resp: any) => {
if (resp.code == 'A0000') {
delDeviceDir({ nDid: nDid.value, path: row.prjDataPath }).then((res: any) => {
if (res.code == 'A0000') {
reloadCurrentMenu(res.message)
loading.value = false
// ElMessage({ message: res.message, type: 'success', duration: 5000 })
}
})
@@ -429,15 +423,13 @@ const handleDelDirOrFile = (row: any) => {
})
}
})
.catch(() => {
loading.value = false
})
}
const changeType = ref<any>('')
//下载文件
const fileRef = ref()
const handleDownLoad = async (row: any) => {
;(await nDid.value) && fileRef.value && fileRef.value.open(row, nDid.value)
; (await nDid.value) && fileRef.value && fileRef.value.open(row, nDid.value)
fileName.value = row?.prjDataPath.split('/')[row?.prjDataPath.split('/').length - 1]
localStorage.setItem('fileName', fileName.value)
changeType.value = 'download'
@@ -546,24 +538,29 @@ onBeforeUnmount(() => {
.main {
display: flex;
justify-content: space-between;
.main_left {
// width: 280px;
}
.main_right {
overflow: hidden;
flex: 1;
padding: 10px 10px 10px 10px;
//margin-left: 10px;
border: 1px solid #eee;
.el-input__wrapper {
-webkit-text-security: disc !important;
}
.right_nav {
width: 100%;
height: 32px;
display: flex;
justify-content: space-between;
align-items: center;
.menu {
width: 100%;
height: 100%;
@@ -573,6 +570,7 @@ onBeforeUnmount(() => {
align-items: center;
background-color: var(--el-color-primary);
border-radius: 4px;
span {
font-size: 14px;
font-weight: 800;
@@ -581,6 +579,7 @@ onBeforeUnmount(() => {
cursor: pointer;
}
}
.el-button {
margin: 0 10px;
}
@@ -592,9 +591,11 @@ onBeforeUnmount(() => {
display: flex;
margin-top: 10px;
justify-content: flex-start;
.el-button {
margin-left: 10px;
}
.upload_progress {
flex: 1;
height: 30px;
@@ -602,12 +603,14 @@ onBeforeUnmount(() => {
align-items: center;
justify-content: flex-start;
margin-left: 10px;
.el-progress {
width: 300px;
margin-left: 10px;
}
}
}
.list {
display: flex;
flex-wrap: wrap;
@@ -619,6 +622,7 @@ onBeforeUnmount(() => {
padding-bottom: 200px;
z-index: 100;
position: relative;
.list_upload {
position: absolute;
width: 100px;
@@ -626,6 +630,7 @@ onBeforeUnmount(() => {
right: 20px;
top: 10px;
}
.list_item {
flex: none;
width: 23.3%;
@@ -640,6 +645,7 @@ onBeforeUnmount(() => {
cursor: pointer;
position: relative;
z-index: 1001 !important;
.item_download,
.item_upload {
position: absolute;
@@ -647,19 +653,23 @@ onBeforeUnmount(() => {
right: 10px;
z-index: 2001;
}
.img_file {
width: 60px;
height: 60px;
}
img {
width: 50px;
height: 50px;
cursor: pointer !important;
}
p {
margin-top: 10px;
}
}
.list_item:nth-child(4n + 2),
.list_item:nth-child(4n + 3) {
margin: 10px 0.8%;
@@ -667,10 +677,13 @@ onBeforeUnmount(() => {
}
}
}
.el-form {
padding: 20px 10px;
box-sizing: border-box;
}
.customInput {
:deep(.el-breadcrumb__separator) {
margin: 0px -10px 0px 0px;
}
</style>