修改loading与上传文件逻辑
This commit is contained in:
@@ -32,9 +32,8 @@
|
|||||||
></el-input>
|
></el-input>
|
||||||
<el-button type="primary" @click="handleSearch" :icon="Search">搜索</el-button>
|
<el-button type="primary" @click="handleSearch" :icon="Search">搜索</el-button>
|
||||||
<el-button @click="handleRefresh" :icon="Refresh">重置</el-button>
|
<el-button @click="handleRefresh" :icon="Refresh">重置</el-button>
|
||||||
<el-button @click="handleAddNewDir" type="primary" :icon="Plus">新建文件夹</el-button>
|
|
||||||
<el-upload
|
<el-upload
|
||||||
v-if="!progressVisibile"
|
v-if="!progressVisibile && activePath != '/'"
|
||||||
action=""
|
action=""
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
@@ -49,6 +48,9 @@
|
|||||||
<el-icon class="el-icon--right"><Upload /></el-icon>
|
<el-icon class="el-icon--right"><Upload /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<el-button @click="handleAddNewDir" v-if="activePath != '/'" type="primary" :icon="Plus">
|
||||||
|
新建文件夹
|
||||||
|
</el-button>
|
||||||
<div class="upload_progress" v-if="progressVisibile">
|
<div class="upload_progress" v-if="progressVisibile">
|
||||||
{{ fileName }}
|
{{ fileName }}
|
||||||
<el-progress :percentage="30" :indeterminate="true">
|
<el-progress :percentage="30" :indeterminate="true">
|
||||||
@@ -62,28 +64,16 @@
|
|||||||
<el-button v-if="item?.type == 'file'" size="small" @click="handleDownLoad(item)" circle>
|
<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-button>
|
||||||
<el-button v-if="activePath!='/'" type="danger" @click="handleDelDirOrFile(item)" size="small" circle>
|
<el-button
|
||||||
|
v-if="activePath != '/'"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelDirOrFile(item)"
|
||||||
|
size="small"
|
||||||
|
circle
|
||||||
|
>
|
||||||
<el-icon><Delete /></el-icon>
|
<el-icon><Delete /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="item_upload">
|
|
||||||
<el-upload
|
|
||||||
v-if="item?.type == 'dir'"
|
|
||||||
style="display: inline-block"
|
|
||||||
action=""
|
|
||||||
class="upload-demo"
|
|
||||||
:auto-upload="false"
|
|
||||||
:on-change="
|
|
||||||
(file:any, fileList:any) => {
|
|
||||||
handleUpload(file, fileList, item)
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-button size="small" circle>
|
|
||||||
<el-icon><Upload /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
</el-upload>
|
|
||||||
</div> -->
|
|
||||||
<img v-if="item?.type == 'dir'" @click="handleIntoDir(item)" src="@/assets/img/wenjianjia.svg" />
|
<img v-if="item?.type == 'dir'" @click="handleIntoDir(item)" src="@/assets/img/wenjianjia.svg" />
|
||||||
<img
|
<img
|
||||||
class="img_file"
|
class="img_file"
|
||||||
@@ -218,6 +208,7 @@ const handleSearch = () => {
|
|||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
filterFileName.value = ''
|
filterFileName.value = ''
|
||||||
dirList.value = currentDirList.value
|
dirList.value = currentDirList.value
|
||||||
|
reloadCurrentMenu('')
|
||||||
}
|
}
|
||||||
//装置重启
|
//装置重启
|
||||||
const deviceRestartLoading = ref<boolean>(false)
|
const deviceRestartLoading = ref<boolean>(false)
|
||||||
@@ -310,16 +301,9 @@ const handleAddNewDir = () => {
|
|||||||
form.value.path = ''
|
form.value.path = ''
|
||||||
addDeviceDirOpen.value = true
|
addDeviceDirOpen.value = true
|
||||||
}
|
}
|
||||||
//新建文件夹
|
const formRef = ref()
|
||||||
const submitDeviceDir = () => {
|
//重新加载当前页面菜单
|
||||||
let obj = {
|
const reloadCurrentMenu = (msg: string) => {
|
||||||
nDid: nDid.value,
|
|
||||||
path: activePath.value == '/' ? activePath.value + form.value.path : activePath.value + '/' + form.value.path
|
|
||||||
}
|
|
||||||
loading.value=true
|
|
||||||
addDeviceDir(obj).then((res: any) => {
|
|
||||||
if (res.code == 'A0000') {
|
|
||||||
ElMessage.success(res.message)
|
|
||||||
getFileServiceFileOrDir({ nDid: nDid.value, name: activePath.value, type: 'dir' }).then((resp: any) => {
|
getFileServiceFileOrDir({ nDid: nDid.value, name: activePath.value, type: 'dir' }).then((resp: any) => {
|
||||||
if (resp.code == 'A0000') {
|
if (resp.code == 'A0000') {
|
||||||
dirList.value = resp.data
|
dirList.value = resp.data
|
||||||
@@ -330,30 +314,40 @@ const submitDeviceDir = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
if (!msg) return
|
||||||
|
ElMessage.success(msg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
//新建文件夹
|
||||||
|
const submitDeviceDir = () => {
|
||||||
|
formRef.value.validate((valid: any) => {
|
||||||
|
if (valid) {
|
||||||
|
let obj = {
|
||||||
|
nDid: nDid.value,
|
||||||
|
path:
|
||||||
|
activePath.value == '/'
|
||||||
|
? activePath.value + form.value.path
|
||||||
|
: activePath.value + '/' + form.value.path
|
||||||
|
}
|
||||||
|
loading.value = true
|
||||||
|
addDeviceDir(obj).then((res: any) => {
|
||||||
|
if (res.code == 'A0000') {
|
||||||
|
reloadCurrentMenu(res.message)
|
||||||
|
// ElMessage.success(res.message)
|
||||||
addDeviceDirOpen.value = false
|
addDeviceDirOpen.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
//删除文件夹或文件
|
//删除文件夹或文件
|
||||||
const handleDelDirOrFile = (row: any) => {
|
const handleDelDirOrFile = (row: any) => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
delDeviceDir({ nDid: nDid.value, path: row.prjDataPath }).then((res: any) => {
|
delDeviceDir({ nDid: nDid.value, path: row.prjDataPath }).then((res: any) => {
|
||||||
if (res.code == 'A0000') {
|
if (res.code == 'A0000') {
|
||||||
getFileServiceFileOrDir({ nDid: nDid.value, name: activePath.value, type: 'dir' }).then((resp:any) => {
|
reloadCurrentMenu(res.message)
|
||||||
if (resp.code == 'A0000') {
|
// ElMessage.success(res.message)
|
||||||
dirList.value = resp.data
|
|
||||||
currentDirList.value = resp.data
|
|
||||||
activePathList.value.map((item: any, index: any) => {
|
|
||||||
if (item.path.includes(activePath.value) && item.path.length > activePath.value.length) {
|
|
||||||
activePathList.value.splice(index, 1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
loading.value = false
|
|
||||||
ElMessage.success(res.message)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -367,6 +361,7 @@ const handleDownLoad = async (row: any) => {
|
|||||||
const progressVisibile = ref<boolean>(false)
|
const progressVisibile = ref<boolean>(false)
|
||||||
const fileName = ref<string>('')
|
const fileName = ref<string>('')
|
||||||
const handleUpload = (e: any, fileList: any, row: any) => {
|
const handleUpload = (e: any, fileList: any, row: any) => {
|
||||||
|
// loading.value=true
|
||||||
fileName.value = e.name
|
fileName.value = e.name
|
||||||
const obj = {
|
const obj = {
|
||||||
id: nDid.value,
|
id: nDid.value,
|
||||||
@@ -374,9 +369,9 @@ const handleUpload = (e: any, fileList: any, row: any) => {
|
|||||||
filePath: row || row.prjDataPath
|
filePath: row || row.prjDataPath
|
||||||
}
|
}
|
||||||
progressVisibile.value = true
|
progressVisibile.value = true
|
||||||
uploadDeviceFile(obj).then(res => {
|
uploadDeviceFile(obj).then((res: any) => {
|
||||||
if (res.code == 'A0000') {
|
if (res.code == 'A0000') {
|
||||||
ElMessage.success(res.message)
|
reloadCurrentMenu(res.message)
|
||||||
progressVisibile.value = false
|
progressVisibile.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -521,4 +516,8 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.el-form {
|
||||||
|
padding: 20px 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ const handleDownLoad = () => {
|
|||||||
? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
|
? fileData.value?.prjDataPath.split('/')[fileData.value?.prjDataPath.split('/').length - 1]
|
||||||
: '/'
|
: '/'
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
|
downLoading.value = false
|
||||||
link.click()
|
link.click()
|
||||||
|
ElMessage.success('文件下载成功')
|
||||||
link.remove()
|
link.remove()
|
||||||
} else {
|
} else {
|
||||||
console.log(6666)
|
console.log(6666)
|
||||||
|
|||||||
Reference in New Issue
Block a user