fix: 导出备份配置调整

This commit is contained in:
TsMask
2025-02-11 18:33:47 +08:00
parent f188e193f3
commit 8bfa73a67a
2 changed files with 92 additions and 94 deletions

View File

@@ -1,3 +1,5 @@
import { CACHE_SESSION_CRYPTO_API } from '@/constants/cache-keys-constants';
import { sessionGet } from '@/utils/cache-session-utils';
import { request } from '@/plugins/http-fetch'; import { request } from '@/plugins/http-fetch';
/** /**
@@ -62,6 +64,7 @@ export function updateFTPInfo(data: Record<string, any>) {
url: `/lm/table/ftp`, url: `/lm/table/ftp`,
method: 'post', method: 'post',
data: data, data: data,
crypto: sessionGet(CACHE_SESSION_CRYPTO_API) !== 'false',
}); });
} }
@@ -74,6 +77,7 @@ export function getFTPInfo() {
return request({ return request({
url: `/lm/table/ftp`, url: `/lm/table/ftp`,
method: 'get', method: 'get',
crypto: sessionGet(CACHE_SESSION_CRYPTO_API) !== 'false',
}); });
} }

View File

@@ -290,13 +290,13 @@ type ModalStateType = {
/**FTP日志对象信息状态 */ /**FTP日志对象信息状态 */
let modalState: ModalStateType = reactive({ let modalState: ModalStateType = reactive({
openByEdit: false, openByEdit: false,
title: 'FTP上报服务设置', title: '设置远程备份配置',
from: { from: {
useranme: '', username: '',
password: '', password: '',
toIp: '', toIp: '',
toPort: 22, toPort: 22,
protocol: 'ftp', enable: false,
dir: '', dir: '',
}, },
confirmLoading: false, confirmLoading: false,
@@ -343,12 +343,12 @@ function fnModalVisibleByEdit() {
hide(); hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data); modalState.from = Object.assign(modalState.from, res.data);
modalState.title = 'FTP Info'; modalState.title = 'Setting Remote Backup';
modalState.openByEdit = true; modalState.openByEdit = true;
} else { } else {
message.error(res.msg, 3); message.error(res.msg, 3);
modalState.title = 'FTP Info'; modalState.title = 'Setting Remote Backup';
modalState.openByEdit = true; modalState.openByEdit = false;
} }
}); });
} }
@@ -361,9 +361,10 @@ function fnModalOk() {
updateFTPInfo(from) updateFTPInfo(from)
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success(`FTP configuration saved successfully`, 3); message.success(`Configuration saved successfully`, 3);
fnModalCancel();
} else { } else {
message.warning(`FTP configuration save exception`, 3); message.warning(`Configuration save exception`, 3);
} }
}) })
.finally(() => { .finally(() => {
@@ -389,7 +390,7 @@ function fnSyncFileToFTP(row: Record<string, any>) {
putFTPInfo(row.filePath, row.fileName) putFTPInfo(row.filePath, row.fileName)
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success(`OK`, 3); message.success(t('common.operateOk'), 3);
} else { } else {
message.warning(res.msg, 3); message.warning(res.msg, 3);
} }
@@ -435,7 +436,7 @@ function fnSyncFileToFTP(row: Record<string, any>) {
<template #extra> <template #extra>
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>Setting</template> <template #title>Setting Remote Backup</template>
<a-button type="text" @click.prevent="fnModalVisibleByEdit()"> <a-button type="text" @click.prevent="fnModalVisibleByEdit()">
<template #icon><DeliveredProcedureOutlined /></template> <template #icon><DeliveredProcedureOutlined /></template>
</a-button> </a-button>
@@ -512,91 +513,84 @@ function fnSyncFileToFTP(row: Record<string, any>) {
:label-col="{ span: 6 }" :label-col="{ span: 6 }"
:label-wrap="true" :label-wrap="true"
> >
<a-row> <a-form-item label="Enable" name="enable" :label-col="{ span: 3 }">
<a-col :lg="12" :md="12" :xs="24"> <a-switch
<a-form-item v-model:checked="modalState.from.enable"
label="Service IP" :checked-children="t('common.switch.open')"
name="toIp" :un-checked-children="t('common.switch.shut')"
v-bind="modalStateFrom.validateInfos.toIp" />
> </a-form-item>
<a-input
v-model:value="modalState.from.toIp" <template v-if="modalState.from.enable">
allow-clear <a-row>
:placeholder="t('common.inputPlease')" <a-col :lg="12" :md="12" :xs="24">
></a-input> <a-form-item
</a-form-item> label="Service IP"
</a-col> name="toIp"
<a-col :lg="12" :md="12" :xs="24"> v-bind="modalStateFrom.validateInfos.toIp"
<a-form-item
label="Service Port"
name="toPort"
v-bind="modalStateFrom.validateInfos.toPort"
>
<a-input-number
v-model:value="modalState.from.toPort"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input-number>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="UserName"
name="username"
v-bind="modalStateFrom.validateInfos.username"
>
<a-input
v-model:value="modalState.from.username"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="Password"
name="password"
v-bind="modalStateFrom.validateInfos.password"
>
<a-input-password
v-model:value="modalState.from.password"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input-password>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="Protocol" name="protocol">
<a-select
v-model:value="modalState.from.protocol"
default-value="N"
:placeholder="t('common.selectPlease')"
:options="[
{ value: 'ftp', label: 'FTP' },
{ value: 'ssh', label: 'SSH' },
]"
> >
</a-select> <a-input
</a-form-item> v-model:value="modalState.from.toIp"
</a-col> allow-clear
<a-col :lg="12" :md="12" :xs="24"> :placeholder="t('common.inputPlease')"
<a-form-item ></a-input>
label="Save Dir" </a-form-item>
name="dir" </a-col>
v-bind="modalStateFrom.validateInfos.dir" <a-col :lg="12" :md="12" :xs="24">
> <a-form-item
<a-input label="Service Port"
v-model:value="modalState.from.dir" name="toPort"
allow-clear v-bind="modalStateFrom.validateInfos.toPort"
:placeholder="t('common.inputPlease')" >
></a-input> <a-input-number
</a-form-item> v-model:value="modalState.from.toPort"
</a-col> allow-clear
</a-row> :placeholder="t('common.inputPlease')"
></a-input-number>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="UserName"
name="username"
v-bind="modalStateFrom.validateInfos.username"
>
<a-input
v-model:value="modalState.from.username"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="Password"
name="password"
v-bind="modalStateFrom.validateInfos.password"
>
<a-input-password
v-model:value="modalState.from.password"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input-password>
</a-form-item>
</a-col>
</a-row>
<a-form-item
label="Save Dir"
name="dir"
v-bind="modalStateFrom.validateInfos.dir"
:label-col="{ span: 3 }"
>
<a-input
v-model:value="modalState.from.dir"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input>
</a-form-item>
</template>
</a-form> </a-form>
</ProModal> </ProModal>
</PageContainer> </PageContainer>