gaoluyang
15 小时以前 121b7edf3f2e8ad5cb7f8d7b602172b64f6fa4da
银川
1.部署修改
已添加2个文件
已修改1个文件
171 ■■■■■ 文件已修改
bin/sshpass.exe 补丁 | 查看 | 原始文档 | blame | 历史
deploy.bat 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/resignation/modules/form.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
bin/sshpass.exe
Binary files differ
deploy.bat
对比新文件
@@ -0,0 +1,169 @@
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: ================= Config =================
set "USER=root"
set "PASS=Xdrjkj@10086#"
set "IP=36.213.180.217"
set "PORT=65022"
set "DIST_DIR=dist"
set "REMOTE_DIR=/data/project/mom/vue/test"
set "SSH_OPTS=-o StrictHostKeyChecking=no -o ConnectTimeout=10"
:: ===========================================
echo ==========================================
echo        Vue Dist Auto Deploy Script
echo ==========================================
echo.
:: Check if sshpass is available
set "SSHPASS_DIR=%~dp0bin"
if exist "!SSHPASS_DIR!\sshpass.exe" (
    set "PATH=!SSHPASS_DIR!;%PATH%"
)
where sshpass >nul 2>&1
if %errorlevel% equ 0 goto :check_node
echo [WARN] sshpass not found, trying to install...
echo.
where bash >nul 2>&1
if %errorlevel% equ 0 (
    echo [INFO] Git Bash detected, trying pacman install...
    bash -c "pacman -S --noconfirm sshpass" 2>nul
    if !errorlevel! equ 0 (
        echo [OK] sshpass installed via pacman!
        goto :check_node
    )
)
if not exist "!SSHPASS_DIR!" mkdir "!SSHPASS_DIR!"
if exist "!SSHPASS_DIR!\sshpass.exe" (
    set "PATH=!SSHPASS_DIR!;%PATH%"
    echo [OK] sshpass found at: !SSHPASS_DIR!
    goto :check_node
)
echo [INFO] Downloading sshpass...
powershell -NoProfile -Command "$url='https://github.com/xhcoding/sshpass-win32/releases/download/v1.0.3/sshpass.exe'; $out='!SSHPASS_DIR!\sshpass.exe'; Write-Host \"Downloading to: $out\"; try { Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing; exit 0 } catch { Write-Host $_.Exception.Message; exit 1 }"
if !errorlevel! neq 0 (
    echo [ERROR] Failed to download sshpass!
    echo [HINT] Please install sshpass manually or use Git Bash: pacman -S sshpass
    goto :error_exit
)
set "PATH=!SSHPASS_DIR!;%PATH%"
echo [OK] sshpass downloaded to: !SSHPASS_DIR!
echo.
:check_node
:: Check if pnpm is available
where pnpm >nul 2>&1
if %errorlevel% neq 0 (
    echo [ERROR] pnpm not found! Please install pnpm first.
    echo [HINT] npm install -g pnpm
    goto :error_exit
)
:: Check if node_modules exists
if not exist "node_modules" (
    echo [INFO] node_modules not found, running pnpm install...
    echo.
    call pnpm install
    if !errorlevel! neq 0 (
        echo [ERROR] pnpm install failed!
        goto :error_exit
    )
    echo.
)
:: Check if dist exists and ask user
if exist "%DIST_DIR%" (
    echo [WARN] dist directory already exists.
    set /p "REBUILD=Do you want to rebuild? (Y/N, default Y): "
    if /i "!REBUILD!"=="N" (
        echo [INFO] Skip build, using existing dist
        goto :upload
    )
)
:: Build the project
echo [STEP 1/3] Building project...
echo [INFO] Running: pnpm run build
echo.
call pnpm run build
if !errorlevel! neq 0 (
    echo [ERROR] Build failed! Check your project configuration.
    goto :error_exit
)
echo [OK] Build completed!
echo.
:upload
if not exist "%DIST_DIR%" (
    echo [ERROR] Dist directory not found: %DIST_DIR%
    echo [HINT] Build may have failed or output directory is incorrect.
    goto :error_exit
)
:: Count files and calculate size
set "FILE_COUNT=0"
set "TOTAL_SIZE=0"
for /r "%DIST_DIR%" %%F in (*) do (
    set /a "FILE_COUNT+=1"
    set /a "TOTAL_SIZE+=%%~zF"
)
set /a "TOTAL_SIZE_MB=TOTAL_SIZE/1024/1024"
echo [INFO] Dist directory: %DIST_DIR%
echo [INFO] Files count: %FILE_COUNT%
echo [INFO] Total size: %TOTAL_SIZE_MB% MB
echo [INFO] Target: %USER%@%IP%:%PORT%
echo [INFO] Remote dir: %REMOTE_DIR%
echo.
:: Optional: Ask for confirmation before upload
set /p "CONFIRM=Proceed with upload? (Y/N, default Y): "
if /i "!CONFIRM!"=="N" (
    echo [INFO] Upload cancelled by user.
    goto :end
)
:: Upload dist directory
echo [STEP 2/3] Uploading dist directory...
sshpass -p "%PASS%" scp -P %PORT% %SSH_OPTS% -r "%DIST_DIR%" %USER%@%IP%:%REMOTE_DIR%/
if %errorlevel% neq 0 (
    echo [ERROR] Upload failed! Check network or credentials.
    goto :error_exit
)
echo [OK] Upload completed!
echo.
:: Optional: Remote restart/cleanup (uncomment if needed)
:: echo [STEP 3/3] Restarting remote service...
:: sshpass -p "%PASS%" ssh -p %PORT% %SSH_OPTS% %USER%@%IP% "cd %REMOTE_DIR% && npm run restart"
echo.
echo ==========================================
echo [SUCCESS] Deploy completed!
echo ==========================================
echo.
echo Summary:
echo   - Build: Completed
echo   - Upload: %FILE_COUNT% files (%TOTAL_SIZE_MB% MB)
echo   - Target: %USER%@%IP%:%PORT%%REMOTE_DIR%
echo.
goto :end
:error_exit
echo.
echo ==========================================
echo [FAILED] Deploy failed!
echo ==========================================
:end
pause
src/views/hrm/resignation/modules/form.vue
@@ -97,7 +97,7 @@
</script>
<template>
  <Modal :title="getTitle" class="w-[600px]">
  <Modal :title="getTitle" class="w-[850px]">
    <Form class="mx-4" />
  </Modal>
</template>