| | |
| | | VITE_COMPANY=TEST |
| | | VITE_COMPANY=LN |
| | | |
| | | VITE_BASE=/ |
| | | |
| | |
| | | favicon: '/logos/TEST.ico', |
| | | apiUrl: 'http://36.213.90.123:9501/admin-api', |
| | | }, |
| | | JHHG: { |
| | | name: 'å®å¤ä¹æ³åå·¥', |
| | | LN: { |
| | | name: 'æ°çç»¿è½æ°å建æ', |
| | | logo: '/logos/TEST.png', |
| | | favicon: '/logos/TEST.ico', |
| | | apiUrl: 'http://42.63.70.90:9001/admin-api', |
| | | }, |
| | | YZFX: { |
| | | name: 'å®å¤è±æ³½é²é', |
| | | logo: '/logos/YZFXLogo.png', |
| | | favicon: '/logos/YZFXLogo.ico', |
| | | apiUrl: 'http://42.63.70.231:9001/admin-api', |
| | | }, |
| | | WTXC: { |
| | | name: 'å®å¤ä¸éæ°æ', |
| | | logo: '/logos/YZFXLogo.png', |
| | | favicon: '/logos/YZFXLogo.ico', |
| | | apiUrl: 'http://42.63.71.140:9001/admin-api', |
| | | }, |
| | | YSJX: { |
| | | name: 'å®å¤çå±±æºæ¢°', |
| | | logo: '/logos/YZFXLogo.png', |
| | | favicon: '/logos/YZFXLogo.ico', |
| | | apiUrl: 'http://42.63.71.140:9004/admin-api', |
| | | }, |
| | | XLZB: { |
| | | name: 'å®å¤ååè£
å¤', |
| | | logo: '/logos/YZFXLogo.png', |
| | | favicon: '/logos/YZFXLogo.ico', |
| | | apiUrl: 'http://42.63.71.140:9004/admin-api', |
| | | apiUrl: 'http://114.132.189.42:9061/admin-api', |
| | | }, |
| | | }; |
| | |
| | | REM Configuration |
| | | REM ========================= |
| | | |
| | | set "COMPANY=TEST" |
| | | set "COMPANY=LN" |
| | | |
| | | set "REMOTE_USER=root" |
| | | set "REMOTE_HOST=36.213.90.123" |
| | | set "REMOTE_PORT=65022" |
| | | set "REMOTE_USER=dell" |
| | | set "REMOTE_HOST=114.132.189.42" |
| | | set "REMOTE_PORT=9100" |
| | | |
| | | set "PASSWORD=Xdrjkj@10086#" |
| | | set "PASSWORD=qweasdzxc2580@.." |
| | | |
| | | set "ZIP_FILE=dist.zip" |
| | | set "REMOTE_DIR=/data/project/mom/vue/test/dist" |
| | | set "REMOTE_DIR=/home/vue/mom-xjln/dist" |
| | | |
| | | set "SSH_OPTS=-o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=3" |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | function downloadBlob(blob: Blob, headers?: any) { |
| | | let filename = 'backup.sql'; |
| | | if (headers) { |
| | | const disposition = headers['content-disposition'] || headers['Content-Disposition']; |
| | | if (disposition && disposition.indexOf('filename=') !== -1) { |
| | | const matches = disposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/); |
| | | if (matches != null && matches[1]) { |
| | | filename = matches[1].replace(/['"]/g, ''); |
| | | } |
| | | } |
| | | } |
| | | |
| | | const url = window.URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.style.display = 'none'; |
| | | link.href = url; |
| | | link.setAttribute('download', decodeURIComponent(filename)); |
| | | document.body.append(link); |
| | | link.click(); |
| | | link.remove(); |
| | | window.URL.revokeObjectURL(url); |
| | | } |
| | | |
| | | /** ä¸è½½æ°æ®åºå¤ä»½æä»¶ */ |
| | | export function backupDatabase(onDownloadProgress?: (progressEvent: any) => void) { |
| | | return requestClient.request('/system/database/backup', { |
| | | method: 'GET', |
| | | responseType: 'blob', |
| | | timeout: 300000, // 5åé |
| | | onDownloadProgress, |
| | | responseReturn: 'raw', |
| | | }).then((res: any) => { |
| | | const blob = res.data || res; |
| | | if (blob instanceof Blob) { |
| | | downloadBlob(blob, res.headers); |
| | | } |
| | | return res; |
| | | }).catch((err: any) => { |
| | | if (err instanceof Blob) { |
| | | downloadBlob(err); |
| | | return err; |
| | | } else if (err?.response?.data instanceof Blob) { |
| | | downloadBlob(err.response.data, err.response.headers); |
| | | return err; |
| | | } |
| | | throw err; |
| | | }); |
| | | } |
| | |
| | | CloudUpload, |
| | | Copy, |
| | | CornerDownLeft, |
| | | DatabaseBackup, |
| | | Download, |
| | | Ellipsis, |
| | | Eraser, |
| | |
| | | import { VbenFullScreen, VbenIconButton } from '../../../../../@core/ui-kit/shadcn-ui/src'; |
| | | |
| | | import { |
| | | DatabaseBackupButton, |
| | | GlobalSearch, |
| | | LanguageToggle, |
| | | PreferencesButton, |
| | |
| | | } |
| | | // å好设置快æ·åè½ |
| | | if (preferencesButtonPosition.value.header) { |
| | | // æ°æ®åºå¤ä»½æé® |
| | | list.push({ |
| | | index: REFERENCE_VALUE + 5, |
| | | name: 'database-backup', |
| | | }); |
| | | |
| | | list.push({ |
| | | index: REFERENCE_VALUE + 10, |
| | | name: 'preferences', |
| | |
| | | /> |
| | | </template> |
| | | |
| | | <template v-else-if="slot.name === 'database-backup'"> |
| | | <DatabaseBackupButton class="mr-1" /> |
| | | </template> |
| | | <template v-else-if="slot.name === 'preferences'"> |
| | | <PreferencesButton |
| | | class="mr-1" |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import { DatabaseBackup } from '../../../../../icons/src'; |
| | | import { VbenIconButton } from '../../../../../@core/ui-kit/shadcn-ui/src'; |
| | | import { useVbenModal } from '../../../../../@core/ui-kit/popup-ui/src'; |
| | | import { backupDatabase } from '../../../../../../api/system/database'; |
| | | import { ref } from 'vue'; |
| | | |
| | | const isDownloading = ref(false); |
| | | const downloadProgress = ref(0); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | onConfirm: async () => { |
| | | modalApi.close(); |
| | | try { |
| | | isDownloading.value = true; |
| | | downloadProgress.value = 0; |
| | | await backupDatabase((progressEvent) => { |
| | | if (progressEvent.total) { |
| | | downloadProgress.value = Math.round((progressEvent.loaded * 100) / progressEvent.total); |
| | | } |
| | | }); |
| | | } catch (error: any) { |
| | | // Ignore if it's the Blob being thrown by the response interceptor |
| | | if (!(error instanceof Blob) && !(error?.response?.data instanceof Blob)) { |
| | | console.error('Backup failed:', error); |
| | | } |
| | | } finally { |
| | | isDownloading.value = false; |
| | | downloadProgress.value = 0; |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | function handleOpen() { |
| | | modalApi.open(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="relative"> |
| | | <VbenIconButton |
| | | v-access:code="['system:database:backup']" |
| | | class="hover:animate-[shrink_0.3s_ease-in-out]" |
| | | @click="handleOpen" |
| | | > |
| | | <DatabaseBackup class="size-4 text-foreground" /> |
| | | </VbenIconButton> |
| | | |
| | | <Modal |
| | | title="æç¤º" |
| | | content-class="px-8 min-h-10" |
| | | footer-class="border-none mb-3 mr-3" |
| | | header-class="border-none" |
| | | > |
| | | 确认è¦ä¸è½½æ°æ®åºçå¤ä»½æä»¶åï¼ |
| | | </Modal> |
| | | |
| | | <teleport to="body"> |
| | | <div |
| | | v-if="isDownloading" |
| | | class="fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-sm" |
| | | > |
| | | <div class="flex flex-col items-center space-y-4 rounded-lg bg-background p-6 shadow-lg"> |
| | | <div class="size-8 animate-spin rounded-full border-4 border-primary border-t-transparent"></div> |
| | | <p class="text-lg font-medium text-foreground">æ£å¨ä¸è½½å¤ä»½: {{ downloadProgress }}%</p> |
| | | </div> |
| | | </div> |
| | | </teleport> |
| | | </div> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | export { default as DatabaseBackupButton } from './database-backup.vue'; |
| | |
| | | export * from './theme-toggle'; |
| | | export * from './timezone'; |
| | | export * from './user-dropdown'; |
| | | export * from './database-backup'; |
| | |
| | | fieldName: 'blindFlag', |
| | | label: 'æ¯å¦ç²ç', |
| | | component: 'Switch', |
| | | defaultValue: false, |
| | | componentProps: { |
| | | checkedChildren: 'æ¯', |
| | | unCheckedChildren: 'å¦', |
| | |
| | | fieldName: 'frozen', |
| | | label: 'å»ç»åºå', |
| | | component: 'Switch', |
| | | defaultValue: false, |
| | | componentProps: { |
| | | checkedChildren: 'æ¯', |
| | | unCheckedChildren: 'å¦', |
| | |
| | | proxy: { |
| | | "/admin-api": { |
| | | changeOrigin: true, |
| | | target: "http://36.213.90.123:9500", |
| | | target: "http://192.168.0.10:48080", |
| | | ws: true, |
| | | }, |
| | | }, |