NEZ-2359 feat:web terminal 支持文件上传下载界面开发
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="file-directory-content" v-my-loading="fileDirectoryLoading">
|
||||
<div v-if="fileDirectory !== '/'" @click="backFileDirectory" class="file-item"><i class="nz-icon nz-icon-a-upperlevel"/>{{$t('terminal.back')}}</div>
|
||||
<div v-if="fileDirectory !== '/'" @click="backFileDirectory" class="file-item"><i class="nz-icon nz-icon-a-upperlevel" style="margin-right: 10px"/>{{$t('terminal.back')}}</div>
|
||||
<div v-for="(item,index) in fileList" :key="index" class="file-item" @click="selectFile(item)">
|
||||
<div class="text-ellipsis file-name">
|
||||
<i class="nz-icon" :class="selIcon(item)"/>
|
||||
@@ -58,7 +58,16 @@ export default {
|
||||
fileList: [],
|
||||
newFolderBoxShow: false,
|
||||
folder: '',
|
||||
fileDirectoryLoading: false
|
||||
fileDirectoryLoading: false,
|
||||
timer: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
updateUuid () {
|
||||
return this.$store.getters.getUpdateUuid
|
||||
},
|
||||
updateIndex () {
|
||||
return this.$store.getters.getUpdateIndex
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@@ -69,6 +78,17 @@ export default {
|
||||
if (n) {
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
updateIndex (n) {
|
||||
if (this.updateUuid == this.uuid) {
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer)
|
||||
}
|
||||
this.timer = setTimeout(() => {
|
||||
this.getSftpPath(this.fileDirectory)
|
||||
this.timer = null
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -169,6 +189,7 @@ export default {
|
||||
if (res.code == 200) {
|
||||
this.getSftpPath(this.fileDirectory)
|
||||
} else {
|
||||
this.getSftpPath(this.fileDirectory)
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -177,6 +177,7 @@ export default {
|
||||
item.cancel.cancel('operation canceled by the user.')
|
||||
if (item.done || (item.fileLength === item.total)) { // 取消 上传 50-100
|
||||
clearInterval(item.timer)
|
||||
if (item.tid) {
|
||||
this.$delete('/terminal/sftp/cancel/' + item.tid).then(res => {
|
||||
if (res.code === 200) {
|
||||
} else {
|
||||
@@ -185,6 +186,7 @@ export default {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$store.dispatch('dispatchDelFileList', item)
|
||||
},
|
||||
upload (item) {
|
||||
@@ -234,6 +236,7 @@ export default {
|
||||
item.isFinish = true
|
||||
clearInterval(item.timer)
|
||||
// todo 上传成功后 刷新对应terminal
|
||||
this.$store.dispatch('upDateConsole', item.uuid)
|
||||
}
|
||||
})
|
||||
}, 200)
|
||||
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
const vars = this.$store.getters.getVariablesArr.map(item => {
|
||||
return {
|
||||
name: item.name,
|
||||
value: item.checked.join('|')
|
||||
values: item.checked
|
||||
}
|
||||
})
|
||||
const params = {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
const terminalFile = {
|
||||
state: {
|
||||
fileList: [],
|
||||
uploadItem: {}
|
||||
uploadItem: {},
|
||||
updateUuid: '', // 根据uuid的变化 判断页面是否需要刷新
|
||||
updateIndex: 1
|
||||
},
|
||||
mutations: {
|
||||
setFileList (state, arr) {
|
||||
@@ -15,6 +17,13 @@ const terminalFile = {
|
||||
},
|
||||
setUploadItem (state, item) {
|
||||
state.uploadItem = item
|
||||
},
|
||||
setUpdateUuid (state, uuid) {
|
||||
state.updateUuid = uuid
|
||||
state.updateIndex++
|
||||
if (state.updateIndex == 10) {
|
||||
state.updateIndex = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
@@ -23,6 +32,12 @@ const terminalFile = {
|
||||
},
|
||||
getUploadItem (state) {
|
||||
return state.uploadItem
|
||||
},
|
||||
getUpdateUuid (state) {
|
||||
return state.updateUuid
|
||||
},
|
||||
getUpdateIndex (state) {
|
||||
return state.updateIndex
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -37,6 +52,9 @@ const terminalFile = {
|
||||
},
|
||||
uploadFile (store, item) {
|
||||
store.commit('setUploadItem', item)
|
||||
},
|
||||
upDateConsole (store, uuid) {
|
||||
store.commit('setUpdateUuid', uuid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user