diff --git a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-chmod-modal.vue b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-chmod-modal.vue index 5269c3c3..584ba3f4 100644 --- a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-chmod-modal.vue +++ b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-chmod-modal.vue @@ -48,12 +48,13 @@ import type { ISftpSession } from '@/views/terminal/interfaces'; import useVisible from '@/hooks/visible'; import { nextTick, ref } from 'vue'; - import { useTerminalStore } from '@/store'; import { permission10toString } from '@/utils/file'; - import { TerminalSessionTypes } from '@/views/terminal/types/const'; + + const props = defineProps<{ + session?: ISftpSession; + }>(); const { visible, setVisible } = useVisible(); - const { sessionManager } = useTerminalStore(); const sessionKey = ref(); const modRef = ref(); @@ -92,10 +93,9 @@ if (error) { return false; } - // 获取会话 - const session = sessionManager.getSession(sessionKey.value); - if (session?.type === TerminalSessionTypes.SFTP.type) { - session.chmod(formModel.value.path, formModel.value.mod); + // 提权 + if (props.session) { + props.session.chmod(formModel.value.path, formModel.value.mod); } } catch (e) { return false; diff --git a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-create-modal.vue b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-create-modal.vue index 2552ab05..9f4ecc03 100644 --- a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-create-modal.vue +++ b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-create-modal.vue @@ -33,13 +33,13 @@ import type { ISftpSession } from '@/views/terminal/interfaces'; import useVisible from '@/hooks/visible'; import { nextTick, ref } from 'vue'; - import { useTerminalStore } from '@/store'; - import { TerminalSessionTypes } from '@/views/terminal/types/const'; + + const props = defineProps<{ + session?: ISftpSession; + }>(); const { visible, setVisible } = useVisible(); - const { sessionManager } = useTerminalStore(); - const sessionKey = ref(); const touch = ref(false); const pathRef = ref(); const formRef = ref(); @@ -48,8 +48,7 @@ }); // 打开新增 - const open = (key: string, path: string, isTouch: boolean) => { - sessionKey.value = key; + const open = (path: string, isTouch: boolean) => { if (path === '/') { formModel.value.path = path; } else { @@ -73,15 +72,13 @@ if (error) { return false; } - // 获取会话 - const session = sessionManager.getSession(sessionKey.value); - if (session?.type === TerminalSessionTypes.SFTP.type) { + if (props.session) { if (touch.value) { // 创建文件 - session.touch(formModel.value.path); + props.session.touch(formModel.value.path); } else { // 创建文件夹 - session.mkdir(formModel.value.path); + props.session.mkdir(formModel.value.path); } } } catch (e) { diff --git a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-move-modal.vue b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-move-modal.vue index 1a1fdc97..67784643 100644 --- a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-move-modal.vue +++ b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-move-modal.vue @@ -41,11 +41,12 @@ import type { ISftpSession } from '@/views/terminal/interfaces'; import useVisible from '@/hooks/visible'; import { nextTick, ref } from 'vue'; - import { useTerminalStore } from '@/store'; - import { TerminalSessionTypes } from '@/views/terminal/types/const'; + + const props = defineProps<{ + session?: ISftpSession; + }>(); const { visible, setVisible } = useVisible(); - const { sessionManager } = useTerminalStore(); const sessionKey = ref(); const targetRef = ref(); @@ -77,10 +78,9 @@ if (error) { return false; } - // 获取会话 - const session = sessionManager.getSession(sessionKey.value); - if (session?.type === TerminalSessionTypes.SFTP.type) { - session.move(formModel.value.path, formModel.value.target); + // 移动文件 + if (props.session) { + props.session.move(formModel.value.path, formModel.value.target); } } catch (e) { return false; diff --git a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-table-header.vue b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-table-header.vue index 98664f0b..6de1fd27 100644 --- a/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-table-header.vue +++ b/orion-visor-ui/src/views/terminal/components/view/sftp/sftp-table-header.vue @@ -135,7 +135,7 @@ arrow-class="terminal-tooltip-content" content="创建文件"> + @click="createFile(true)"> @@ -148,7 +148,7 @@ arrow-class="terminal-tooltip-content" content="创建文件夹"> + @click="createFile(false)"> @@ -174,7 +174,7 @@ arrow-class="terminal-tooltip-content" content="上传"> + @click="openUpload"> @@ -204,9 +204,8 @@