Ver Fonte

增加部署脚本

lingmin_package@163.com há 3 semanas atrás
pai
commit
687de32456

+ 45 - 0
scripts/lq_db_update.sql

@@ -1,6 +1,18 @@
 
 
 
+-- 2026-02-04
+
+ALTER TABLE t_samp_knowledge_base
+  MODIFY COLUMN collection_name_parent VARCHAR(100) NULL COMMENT 'Milvus集合名称(Table Name)(父)',
+  ADD COLUMN has_parent_collection TINYINT NOT NULL DEFAULT 1 COMMENT '是否有父集合: 1-有, 0-无' AFTER collection_name_children;
+
+UPDATE t_samp_knowledge_base
+SET has_parent_collection = CASE
+  WHEN collection_name_parent IS NULL OR collection_name_parent = '' THEN 0
+  ELSE 1
+END;
+
 
 
 
@@ -18,3 +30,36 @@ ALTER TABLE t_samp_knowledge_base
   ADD `collection_name2` 
     VARCHAR(100)  NOT NULL 
     COMMENT 'Milvus集合名称(Table Name)(子)';
+
+
+
+
+
+
+-- 施工标准规范、施工方案元数据字段信息
+
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('0e6bc8e3-1e54-40e9-918c-58c70078feb1', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '方案概述', 'plan_summary', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('18065ede-a630-4422-b225-369f2df72a3a', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '文档层级信息', 'hierarchy', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('187e391e-85dd-40ad-a011-98536d763064', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '文件URL', 'file_url', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('1d40e6f1-c227-4623-88cb-ae517d3ec87f', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '文件名称', 'file_name', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('507f5ad5-2aa8-439a-bf88-e05961b315ee', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '文件类型', 'document_type', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('50f4ab3c-780f-4930-b391-8b7280a29ae9', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '编制单位', 'compiling_unit', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('55a82dd5-1aaf-437b-886d-814ace66e9da', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '编制日期', 'compiling_date', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('5b324468-fa6c-4b37-8c3f-6dad3e25650f', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '标准编号', 'standard_number', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('5c0096ac-f142-4f26-8b6f-bfb790361185', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '四级分类', 'type_level_4', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('8e17feb6-02cd-4ac2-b2fa-9e4bb194acf4', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '文件URL', 'file_url', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('904bebe1-4063-4ca3-8eb4-65e3f0e35835', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '施工方案类型', 'plan_type', 'text', '');
+
+
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('9f980a1b-35f8-49c0-8c84-7223c6e36b8b', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '发布单位', 'issuing_authority', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('a77936ba-3f87-4928-9910-f01f1809410c', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '文件名称', 'file_name', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('b5459405-411a-4957-87c1-90c8177037c0', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '方案名称', 'plan_name', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('b62f8410-a8f9-48e8-bc0c-48006c7d63ad', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '分块唯一id', 'chunk_id', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('bfb7661c-46c7-4159-9b3a-9fd9e9c8a503', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '专业领域', 'professional_field', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('c00720a4-2884-4f25-bf96-0be1a7f63e62', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '三级分类', 'type_level_3', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('c2263e6e-26f9-4835-9a6e-e31758725dfb', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '工程名称', 'project_name', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('ca5ef925-beb3-4c7e-89e0-58298837a0c7', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '二级分类', 'type_level_2', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('e60c8a7e-e0af-47d8-8eeb-ef8e4d0db02d', 'a61e1530-9ff3-4640-b2f7-fe7c9edfcbc1', '文档层级信息', 'hierarchy', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('e63df93a-4a6b-405c-a479-acad6859d518', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '施工地', 'construction_site', 'text', '');
+INSERT INTO `t_samp_metadata`(`id`, `knowledge_base_id`, `field_zh_name`, `field_en_name`, `field_type`, `remark`) VALUES ('f2af7d41-22c4-4934-99b2-913d300dd31a', 'a6b7280f-63be-494f-8f16-9d4415b9b559', '一级分类', 'type_level_1', 'text', '');
+

+ 13 - 0
scripts/t_samp_knowledge_base_update_2026_02_03.sql

@@ -1,5 +1,18 @@
+
+
+
+
+
+-- 日期:2026-02-04
+ALTER TABLE t_samp_knowledge_base MODIFY COLUMN collection_name_parent VARCHAR(100)  COMMENT 'Milvus集合名称(Table Name)(父)';
+
+
+
 -- 变更记录:将 t_samp_knowledge_base 表中的 collection_name1 和 collection_name2 字段重命名
 -- 日期:2026-02-03
 
 ALTER TABLE t_samp_knowledge_base CHANGE COLUMN collection_name1 collection_name_parent VARCHAR(100) NOT NULL COMMENT 'Milvus集合名称(Table Name)(父)';
 ALTER TABLE t_samp_knowledge_base CHANGE COLUMN collection_name2 collection_name_children VARCHAR(100) NULL COMMENT 'Milvus集合名称(Table Name)(子)';
+
+
+

+ 232 - 11
src/deploy/admin_front_deploy.py

@@ -13,6 +13,7 @@ import paramiko
 import argparse
 import tempfile
 import hashlib
+import subprocess
 from pathlib import Path
 from typing import Optional, Tuple, List
 import getpass
@@ -22,6 +23,8 @@ class VueAutoDeployer:
     def __init__(self, hostname: str, username: str, 
                  local_source_dir: str, remote_deploy_dir: str,
                  remote_script_path: str,
+                 frontend_project_dir: Optional[str] = None,
+                 build_command: str = "npm run build:dev",
                  password: Optional[str] = None,
                  port: int = 22, 
                  key_filename: Optional[str] = None):
@@ -34,6 +37,8 @@ class VueAutoDeployer:
             local_source_dir: 本地Vue构建文件目录(包含assets和index.html)
             remote_deploy_dir: 远程服务器部署目录(上传zip文件的目录)
             remote_script_path: 远程部署脚本路径
+            frontend_project_dir: 前端项目根目录(可选,如果提供则会先执行打包)
+            build_command: 前端打包命令,默认为 npm run build:dev
             password: SSH密码(可选,密钥认证不需要)
             port: SSH端口,默认22
             key_filename: SSH私钥文件路径(可选)
@@ -43,6 +48,8 @@ class VueAutoDeployer:
         self.local_source_dir = os.path.expanduser(local_source_dir)
         self.remote_deploy_dir = remote_deploy_dir
         self.remote_script_path = remote_script_path
+        self.frontend_project_dir = os.path.expanduser(frontend_project_dir) if frontend_project_dir else None
+        self.build_command = build_command
         self.password = password
         self.port = port
         self.key_filename = key_filename
@@ -53,9 +60,189 @@ class VueAutoDeployer:
         self.zip_filename = "dist-dev.zip"
         
         # 验证目录
-        self._validate_directories()
+        self._validate_local_directories()
+    
+    def build_frontend(self) -> bool:
+        """
+        执行前端打包
+        
+        Returns:
+            是否打包成功
+        """
+        if not self.frontend_project_dir:
+            print("⚠ 未指定前端项目目录,跳过打包步骤")
+            return True
         
-    def _validate_directories(self):
+        print(f"\n正在执行前端打包...")
+        print(f"项目目录: {self.frontend_project_dir}")
+        print(f"打包命令: {self.build_command}")
+        print("-" * 50)
+        
+        try:
+            # 检查前端项目目录是否存在
+            if not os.path.exists(self.frontend_project_dir):
+                raise FileNotFoundError(f"前端项目目录不存在: {self.frontend_project_dir}")
+            
+            # 检查package.json是否存在
+            package_json_path = os.path.join(self.frontend_project_dir, 'package.json')
+            if not os.path.exists(package_json_path):
+                raise FileNotFoundError(f"package.json不存在: {package_json_path}")
+            
+            # 检查npm是否可用
+            print("检查npm环境...")
+            try:
+                if os.name == 'nt':  # Windows系统
+                    npm_check = subprocess.run(
+                        "npm --version",
+                        capture_output=True,
+                        text=True,
+                        shell=True,
+                        timeout=10
+                    )
+                else:  # Unix/Linux系统
+                    npm_check = subprocess.run(
+                        ["npm", "--version"],
+                        capture_output=True,
+                        text=True,
+                        timeout=10
+                    )
+                
+                if npm_check.returncode == 0:
+                    print(f"✓ npm版本: {npm_check.stdout.strip()}")
+                else:
+                    print(f"⚠ npm检查失败: {npm_check.stderr}")
+                    print("请确保npm已正确安装并添加到PATH环境变量中")
+                    return False
+                    
+            except Exception as e:
+                print(f"✗ npm环境检查失败: {e}")
+                print("请确保npm已正确安装并添加到PATH环境变量中")
+                return False
+            
+            # 检查node_modules是否存在,如果不存在则先安装依赖
+            node_modules_path = os.path.join(self.frontend_project_dir, 'node_modules')
+            if not os.path.exists(node_modules_path):
+                print("⚠ node_modules不存在,正在安装依赖...")
+                
+                # 在Windows系统上,需要通过shell执行npm命令
+                if os.name == 'nt':  # Windows系统
+                    install_result = subprocess.run(
+                        "npm install",
+                        cwd=self.frontend_project_dir,
+                        capture_output=True,
+                        text=True,
+                        shell=True,  # 在Windows上使用shell
+                        timeout=300  # 5分钟超时
+                    )
+                else:  # Unix/Linux系统
+                    install_result = subprocess.run(
+                        ["npm", "install"],
+                        cwd=self.frontend_project_dir,
+                        capture_output=True,
+                        text=True,
+                        timeout=300  # 5分钟超时
+                    )
+                
+                if install_result.returncode != 0:
+                    print(f"✗ 依赖安装失败:")
+                    print(f"错误输出: {install_result.stderr}")
+                    return False
+                
+                print("✓ 依赖安装完成")
+            
+            # 清理之前的构建文件
+            dist_path = os.path.join(self.frontend_project_dir, 'dist-dev')
+            if os.path.exists(dist_path):
+                print(f"清理之前的构建文件: {dist_path}")
+                shutil.rmtree(dist_path)
+            
+            # 执行打包命令
+            print(f"执行打包命令: {self.build_command}")
+            start_time = time.time()
+            
+            # 在Windows系统上,需要通过shell执行npm命令
+            if os.name == 'nt':  # Windows系统
+                build_result = subprocess.run(
+                    self.build_command,
+                    cwd=self.frontend_project_dir,
+                    capture_output=True,
+                    text=True,
+                    shell=True,  # 在Windows上使用shell
+                    timeout=600  # 10分钟超时
+                )
+            else:  # Unix/Linux系统
+                cmd_parts = self.build_command.split()
+                build_result = subprocess.run(
+                    cmd_parts,
+                    cwd=self.frontend_project_dir,
+                    capture_output=True,
+                    text=True,
+                    timeout=600  # 10分钟超时
+                )
+            
+            elapsed_time = time.time() - start_time
+            
+            if build_result.returncode != 0:
+                print(f"✗ 前端打包失败 (耗时: {elapsed_time:.1f}秒)")
+                print(f"返回码: {build_result.returncode}")
+                print(f"错误输出:")
+                print(build_result.stderr)
+                if build_result.stdout:
+                    print(f"标准输出:")
+                    print(build_result.stdout)
+                return False
+            
+            print(f"✓ 前端打包成功 (耗时: {elapsed_time:.1f}秒)")
+            
+            # 显示打包输出(如果有的话)
+            if build_result.stdout:
+                print("打包输出:")
+                print(build_result.stdout)
+            
+            # 验证构建结果
+            if os.path.exists(dist_path):
+                # 检查构建文件
+                files_count = len([f for f in os.listdir(dist_path) if os.path.isfile(os.path.join(dist_path, f))])
+                dirs_count = len([d for d in os.listdir(dist_path) if os.path.isdir(os.path.join(dist_path, d))])
+                print(f"✓ 构建文件验证通过: {files_count} 个文件, {dirs_count} 个目录")
+                
+                # 显示构建结果
+                print("构建文件列表:")
+                for item in os.listdir(dist_path):
+                    item_path = os.path.join(dist_path, item)
+                    if os.path.isdir(item_path):
+                        print(f"  📁 {item}/")
+                    else:
+                        size = os.path.getsize(item_path)
+                        print(f"  📄 {item} ({size/1024:.1f} KB)")
+            else:
+                print(f"⚠ 构建目录不存在: {dist_path}")
+                return False
+            
+            return True
+            
+        except subprocess.TimeoutExpired:
+            print("✗ 前端打包超时")
+            return False
+        except FileNotFoundError as e:
+            print(f"✗ 文件不存在: {e}")
+            return False
+        except Exception as e:
+            print(f"✗ 前端打包失败: {e}")
+            return False
+
+    def _validate_local_directories(self):
+        """验证本地目录是否存在且包含必要文件"""
+        print(f"检查前端应用目录: {self.frontend_project_dir}")
+        
+        if not os.path.exists(self.frontend_project_dir):
+            raise FileNotFoundError(f"前端应用目录不存在: {self.frontend_project_dir}")
+        print("✓ 前端应用目录验证通过")
+    
+    
+
+
+    def _validate_all_local_directories(self):
         """验证本地目录是否存在且包含必要文件"""
         print(f"检查本地目录: {self.local_source_dir}")
         
@@ -94,6 +281,8 @@ class VueAutoDeployer:
                 print(f"  📄 {item}")
         
         print("✓ 本地目录验证通过")
+
+
     
     def _create_zip_from_source(self) -> str:
         """
@@ -450,14 +639,27 @@ class VueAutoDeployer:
         temp_dir = None
         
         try:
+            # 步骤0: 前端打包(如果指定了前端项目目录)
+            if self.frontend_project_dir:
+                print("\n[步骤 0/5] 前端应用打包")
+                print("-"*40)
+                if not self.build_frontend():
+                    return False
+            
             # 步骤1: 本地压缩文件
-            print("\n[步骤 1/4] 本地压缩Vue构建文件")
+            step_num = "1/5" if self.frontend_project_dir else "1/4"
+            print(f"\n[步骤 {step_num}] 本地压缩Vue构建文件")
             print("-"*40)
             temp_zip_path = self._create_zip_from_source()
             temp_dir = os.path.dirname(temp_zip_path)
+
+
+            # 验证所有目录
+            self._validate_all_local_directories()
             
             # 步骤2: 连接到服务器
-            print("\n[步骤 2/4] 连接到远程服务器")
+            step_num = "2/5" if self.frontend_project_dir else "2/4"
+            print(f"\n[步骤 {step_num}] 连接到远程服务器")
             print("-"*40)
             if not self.connect():
                 return False
@@ -467,7 +669,8 @@ class VueAutoDeployer:
                 return False
             
             # 步骤3: 上传文件
-            print("\n[步骤 3/4] 上传文件到服务器")
+            step_num = "3/5" if self.frontend_project_dir else "3/4"
+            print(f"\n[步骤 {step_num}] 上传文件到服务器")
             print("-"*40)
             remote_zip_path = os.path.join(self.remote_deploy_dir, self.zip_filename)
             
@@ -475,11 +678,12 @@ class VueAutoDeployer:
                 return False
             
             # 步骤4: 执行部署脚本
-            print("\n[步骤 4/4] 执行远程部署脚本")
+            step_num = "4/5" if self.frontend_project_dir else "4/4"
+            print(f"\n[步骤 {step_num}] 执行远程部署脚本")
             print("-"*40)
             
-            # 构建部署命令,传递上传的zip文件路径作为参数 {remote_zip_path}
-            deploy_command = f"{self.remote_script_path} "
+            # 构建部署命令,传递上传的zip文件路径作为参数  {remote_zip_path}
+            deploy_command = f"{self.remote_script_path}"
             
             print(f"执行部署命令: {deploy_command}")
             print("-"*40)
@@ -501,7 +705,7 @@ class VueAutoDeployer:
             
             # 可选: 验证部署结果
             print("\n验证部署结果...")
-            self.execute_command("ls -la /usr/share/nginx/html/ 2>/dev/null | head -10", verbose=True)
+            self.execute_command("ls -la /home/lq/nginx/html/ 2>/dev/null | head -10", verbose=True)
             
             return True
             
@@ -530,8 +734,17 @@ def parse_arguments():
         formatter_class=argparse.RawDescriptionHelpFormatter,
         epilog="""
 使用示例:
-  %(prog)s --host 192.168.1.100 --user deploy --source ./dist --remote-dir /home/deploy --script /home/deploy/deploy.sh
-  %(prog)s --host example.com --user ubuntu --key ~/.ssh/id_rsa --source ./build --remote-dir /tmp
+  # 基本用法(仅上传已构建的文件)
+  %(prog)s --host 192.168.1.100 --user deploy --source ./dist-dev
+  
+  # 完整流程(先打包再部署)
+  %(prog)s --host 192.168.1.100 --user deploy --source ./dist-dev --frontend-dir ./LQAdminFront
+  
+  # 自定义打包命令
+  %(prog)s --host 192.168.1.100 --user deploy --source ./dist-dev --frontend-dir ./LQAdminFront --build-cmd "npm run build:prod"
+  
+  # 使用SSH密钥认证
+  %(prog)s --host example.com --user ubuntu --key ~/.ssh/id_rsa --source ./build --frontend-dir ./frontend
         """
     )
     
@@ -541,6 +754,9 @@ def parse_arguments():
     parser.add_argument('--source', required=True, help='本地Vue构建文件目录(包含assets和index.html)')
     
     # 可选参数
+    parser.add_argument('--frontend-dir', help='前端项目根目录(如果提供则会先执行打包)')
+    parser.add_argument('--build-cmd', default='npm run build:dev', 
+                       help='前端打包命令 (默认: npm run build:dev)')
     parser.add_argument('--remote-dir', default='/home/lq/lq_workspace/deploy_workspace/put/', 
                        help='远程服务器上传目录 (默认: /home/lq/lq_workspace/deploy_workspace/put/)')
     parser.add_argument('--script', default='/home/lq/lq_workspace/deploy_workspace/admin_front_deploy.sh',
@@ -567,6 +783,9 @@ def main():
     print(f"服务器: {args.host}:{args.port}")
     print(f"用户: {args.user}")
     print(f"本地源目录: {args.source}")
+    if args.frontend_dir:
+        print(f"前端项目目录: {args.frontend_dir}")
+        print(f"打包命令: {args.build_cmd}")
     print(f"远程目录: {args.remote_dir}")
     print(f"部署脚本: {args.script}")
     print("="*70)
@@ -579,6 +798,8 @@ def main():
             local_source_dir=args.source,
             remote_deploy_dir=args.remote_dir,
             remote_script_path=args.script,
+            frontend_project_dir=args.frontend_dir,
+            build_command=args.build_cmd,
             password=args.password,
             port=args.port,
             key_filename=args.key

+ 65 - 12
src/deploy/dempoy_README.md

@@ -1,17 +1,6 @@
 
 
 
-
-
-#### 前端部署
-    帮我生成一个python 代码用于 ssh 连接linux 服务器 上传前端zip文件到指定目录下,再执行shell脚本 完成部署
-    1、指定上传文件的源目录,将源文件中的assets、index.html 压缩为zip文件 dist-dev.zip
-    2、再将dist-dev.zip 上传到远程linux 的指定目录下   /home/lq/lq_workspace/deploy_workspace/put
-    3、再执行服务器上指定的shell脚本 开始部署           /home/lq/lq_workspace/deploy_workspace/admin_front_deploy.sh
-
-
-
-
 #### 服务器部署脚本 admin_front_deploy.sh
     帮我生成一个 shell 脚本 用于部署vue前端应用到nginx 
     1、定义目录变量(部署临时目录 put_tmp_directory、nginx 部署目录 nginx_html_directory、备份目录 nginx_html_bak)
@@ -26,7 +15,71 @@
 /home/lq/lq_workspace/deploy_workspace/deploy_bak/LQAdminFrontServer
 
 
+python admin_front_deploy.py --host 192.168.92.61 --user lq --source I:/wangxun_dev_workspace/lq_workspace/LQAdminFront/dist-dev
+
+
+
+python admin_front_deploy.py  --host 192.168.92.61 --user lq --source I:/wangxun_dev_workspace/lq_workspace/LQAdminFront/dist-dev --frontend-dir I:/wangxun_dev_workspace/lq_workspace/LQAdminFront
+
+
+#### 前端部署  admin_front_deploy.py
+
+Vue前端应用自动化部署工具,支持完整的前端打包和部署流程。
+
+**功能特性:**
+1. 自动执行前端打包(可选)
+2. 压缩构建文件为zip包
+3. SSH上传到远程服务器
+4. 执行远程部署脚本
+
+**使用方法:**
+
+**方式1:完整流程(推荐)**
+```bash
+# 自动打包 + 部署
+python admin_front_deploy.py \
+  --host 192.168.92.61 \
+  --user lq \
+  --source I:/wangxun_dev_workspace/lq_workspace/LQAdminFront/dist-dev \
+  --frontend-dir I:/wangxun_dev_workspace/lq_workspace/LQAdminFront
+
+# 使用自定义打包命令
+python admin_front_deploy.py \
+  --host 192.168.92.61 \
+  --user lq \
+  --source I:/wangxun_dev_workspace/lq_workspace/LQAdminFront/dist-dev \
+  --frontend-dir I:/wangxun_dev_workspace/lq_workspace/LQAdminFront \
+  --build-cmd "npm run build:prod"
+```
+
+**方式2:仅部署已构建文件**
+```bash
+# 仅上传和部署(不执行打包)
+python admin_front_deploy.py \
+  --host 192.168.92.61 \
+  --user lq \
+  --source I:/wangxun_dev_workspace/lq_workspace/LQAdminFront/dist-dev
+```
+
+**部署流程:**
+1. **前端打包**(可选):进入前端项目目录,执行 `npm run build:dev`
+2. **文件压缩**:将 assets、index.html 压缩为 dist-dev.zip
+3. **文件上传**:上传到远程服务器 `/home/lq/lq_workspace/deploy_workspace/put`
+4. **执行部署**:运行远程脚本 `/home/lq/lq_workspace/deploy_workspace/admin_front_deploy.sh`
+
+**参数说明:**
+- `--host`: 服务器地址(必需)
+- `--user`: SSH用户名(必需)
+- `--source`: 构建文件目录(必需)
+- `--frontend-dir`: 前端项目根目录(可选,提供则先打包)
+- `--build-cmd`: 打包命令(默认:npm run build:dev)
+- `--remote-dir`: 远程上传目录(默认:/home/lq/lq_workspace/deploy_workspace/put)
+- `--script`: 远程部署脚本(默认:/home/lq/lq_workspace/deploy_workspace/admin_front_deploy.sh)
+
+
+
+
+
 
 
 
-python admin_front_deploy.py --host 192.168.92.61 --user lq --source I:/wangxun_dev_workspace/lq_workspace/LQAdminFront/dist-dev