feat: refactor monolithic App.vue into modular Vue component architecture

- Extract 711-line App.vue into 15+ focused files across 5 directories
- Add data layer (icons, metrics, policies, auditTrail, requests)
- Add composables (useNavigation, useRequests, useChat, useToast)
- Add layout components (SidebarRail, TopBar, FilterBar)
- Add shared components (PanelHead, InfoRow, ToastNotification)
- Add business component (RequestTable) and 5 view components
- Extract global CSS to assets/styles/global.css
- Add start.sh with WSL/Windows cross-platform support
- Add .gitignore for node_modules, dist, and IDE dirs
This commit is contained in:
2026-04-28 17:20:52 +08:00
commit 7141e1d11a
40 changed files with 10133 additions and 0 deletions

97
start.sh Normal file
View File

@@ -0,0 +1,97 @@
#!/usr/bin/env bash
set -euo pipefail
# ============================================================
# X-Financial Reimbursement Admin - Start Script
# ============================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[INFO]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
error() { echo -e "${RED}[ERROR]${NC} $*"; exit 1; }
# ----------------------------------------------------------
# Check Node.js
# ----------------------------------------------------------
if ! command -v node &>/dev/null; then
error "Node.js is not installed. Install it first: https://nodejs.org"
fi
if ! command -v npm &>/dev/null; then
error "npm is not installed. It should come with Node.js."
fi
info "Node.js $(node -v) | npm $(npm -v)"
# ----------------------------------------------------------
# Detect WSL + Windows node_modules platform mismatch
# ----------------------------------------------------------
is_wsl() {
grep -qi microsoft /proc/version 2>/dev/null
}
check_platform_mismatch() {
local rollup_dir="node_modules/@rollup"
if [ ! -d "$rollup_dir" ]; then
return 1
fi
# List installed rollup platform packages
local platforms
platforms="$(ls -1 "$rollup_dir" 2>/dev/null | grep -E '^rollup-(win|linux)')"
if [ -z "$platforms" ]; then
return 1
fi
# Running on WSL/Linux but has Windows rollup bindings
if echo "$platforms" | grep -q "win32"; then
return 0
fi
return 1
}
# ----------------------------------------------------------
# Install dependencies if node_modules is missing or mismatched
# ----------------------------------------------------------
NEED_INSTALL=false
if [ ! -d "node_modules" ]; then
warn "node_modules not found"
NEED_INSTALL=true
elif is_wsl && check_platform_mismatch; then
warn "Detected WSL with Windows node_modules (rollup platform mismatch)"
warn "Removing node_modules to reinstall with correct platform bindings..."
# WSL can't delete locked Windows .exe/.node files, use PowerShell instead
WIN_PATH="$(wslpath -w "$SCRIPT_DIR")"
if command -v powershell.exe &>/dev/null; then
powershell.exe -NoProfile -Command "Remove-Item -Recurse -Force '${WIN_PATH}\\node_modules','${WIN_PATH}\\package-lock.json'" 2>/dev/null || true
elif command -v cmd.exe &>/dev/null; then
cmd.exe /c "rd /s /q \"${WIN_PATH}\\node_modules\"" 2>/dev/null || true
cmd.exe /c "del /f /q \"${WIN_PATH}\\package-lock.json\"" 2>/dev/null || true
else
rm -rf node_modules package-lock.json 2>/dev/null || true
fi
# Fallback: clean up anything remaining via WSL
rm -rf node_modules package-lock.json 2>/dev/null || true
NEED_INSTALL=true
fi
if [ "$NEED_INSTALL" = true ]; then
info "Running npm install..."
npm install
fi
# ----------------------------------------------------------
# Start dev server
# ----------------------------------------------------------
info "Starting X-Financial Reimbursement Admin..."
info "Access: http://127.0.0.1:5173"
echo ""
exec npm start