<template>
  <div class="bidding-system">
    <aside class="bidding-sidebar">
      <div class="sidebar-header">
        <div class="system-title">
          <div class="title-icon-wrapper">
            <el-icon class="title-icon"><Document /></el-icon>
          </div>
          <div class="title-info">
            <span class="title-text">招标助手</span>
            <span class="title-desc">Bidding Assistant</span>
          </div>
        </div>
      </div>
      <nav class="bidding-nav">
        <div v-for="item in navItems" :key="item.key" class="nav-group">
          <div class="nav-item" :class="{ active: activeNav === item.key && !item.children, expanded: item.expanded }" @click="handleNavClick(item)">
            <div class="nav-left">
              <el-icon class="nav-icon"><component :is="item.icon" /></el-icon>
              <span class="nav-label">{{ item.label }}</span>
            </div>
            <el-icon v-if="item.children" class="nav-arrow"><ArrowDown v-if="item.expanded" /><ArrowRight v-else /></el-icon>
          </div>
          <div v-if="item.children && item.expanded" class="nav-children">
            <div v-for="child in item.children" :key="child.key" class="nav-child" :class="{ active: activeNav === child.key }" @click.stop="activeNav = child.key">
              <span class="child-dot"></span>
              <span>{{ child.label }}</span>
            </div>
          </div>
        </div>
      </nav>
    </aside>
    <div class="bidding-content">
      <header class="content-header">
        <div class="header-left">
          <el-breadcrumb separator="/">
            <el-breadcrumb-item>招标助手</el-breadcrumb-item>
            <el-breadcrumb-item v-if="activeNav === 'step-detail' && currentStepProject" @click="backToProjectDetail" style="cursor: pointer;">进行中项目</el-breadcrumb-item>
            <el-breadcrumb-item v-if="activeNav === 'step-detail' && currentStepDetail">{{ currentStepDetail.title }}</el-breadcrumb-item>
            <el-breadcrumb-item v-if="activeNav !== 'step-detail'">{{ currentNavLabel }}</el-breadcrumb-item>
          </el-breadcrumb>
        </div>
        <div class="header-right">
          <el-button circle size="small">
            <el-icon><Refresh /></el-icon>
          </el-button>
        </div>
      </header>
      <div class="content-main">
        <!-- 知识库总览 -->
        <div v-if="activeNav === 'kb-overview'" class="panel">
          <div class="panel-header">
            <h3>知识库总览</h3>
            <el-button type="primary" size="small" @click="showUploadDialog = true">
              <el-icon><Upload /></el-icon>
              上传文件
            </el-button>
          </div>
          <div class="stats-cards">
            <div class="stat-card"><div class="stat-value">{{ totalFiles }}</div><div class="stat-label">文档总数</div></div>
            <div class="stat-card"><div class="stat-value">4</div><div class="stat-label">分类目录</div></div>
            <div class="stat-card"><div class="stat-value">{{ monthlyFiles }}</div><div class="stat-label">本月新增</div></div>
            <div class="stat-card"><div class="stat-value">98.5%</div><div class="stat-label">分类准确率</div></div>
          </div>
          <div class="kb-categories">
            <div class="category-card" v-for="cat in kbCategories" :key="cat.name" @click="viewCategory(cat.key)">
              <div class="cat-icon" :style="{ background: cat.color }">
                <el-icon><component :is="cat.icon" /></el-icon>
              </div>
              <div class="cat-info">
                <div class="cat-name">{{ cat.name }}</div>
                <div class="cat-count">{{ cat.count }} 个文件</div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 分类管理 -->
        <div v-if="activeNav === 'kb-category'" class="panel category-management">
          <div class="category-layout">
            <!-- 左侧分类导航 -->
            <div class="category-sidebar">
              <div class="category-nav-header">
                <div class="header-title">
                  <h4>文件分类</h4>
                  <span class="header-subtitle">{{ kbCategories.length }} 个分类</span>
                </div>
              </div>
              <div class="category-nav-list">
                <div 
                  v-for="cat in kbCategories" 
                  :key="cat.key"
                  class="category-nav-item"
                  :class="{ active: activeCategoryTab === cat.key }"
                  @click="activeCategoryTab = cat.key"
                >
                  <div class="category-nav-icon" :style="{ background: cat.color }">
                    <el-icon><component :is="cat.icon" /></el-icon>
                  </div>
                  <div class="category-nav-info">
                    <div class="category-nav-name">{{ cat.name }}</div>
                    <div class="category-nav-count">{{ cat.count }} 个文件</div>
                  </div>
                  <el-icon class="nav-arrow-icon">
                    <ArrowRight />
                  </el-icon>
                </div>
              </div>
              
              <!-- 侧边栏底部统计 -->
              <div class="category-sidebar-footer">
                <div class="footer-stat">
                  <div class="stat-icon">📊</div>
                  <div class="stat-info">
                    <div class="stat-label">总文件数</div>
                    <div class="stat-value">{{ totalFiles }}</div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- 右侧文件列表 -->
            <div class="category-content">
              <!-- 顶部信息栏 -->
              <div class="category-content-header">
                <div class="header-info">
                  <div class="category-title-wrapper">
                    <div class="category-icon-large" :style="{ background: getCurrentCategoryColor() }">
                      <el-icon><component :is="getCurrentCategoryIcon()" /></el-icon>
                    </div>
                    <div class="category-title-info">
                      <h3>{{ getCategoryLabel(activeCategoryTab) }}</h3>
                      <p class="category-desc">{{ getCategoryFiles(activeCategoryTab).length }} 个文件</p>
                    </div>
                  </div>
                  <div class="header-actions">
                    <el-button type="primary" @click="showUploadDialog = true">
                      <el-icon><Upload /></el-icon>
                      上传文件
                    </el-button>
                  </div>
                </div>
                
                <!-- 搜索和筛选栏 -->
                <div class="category-toolbar">
                  <el-input 
                    v-model="categorySearch" 
                    placeholder="搜索文件名..." 
                    style="width: 300px;"
                    clearable
                  >
                    <template #prefix>
                      <el-icon><Search /></el-icon>
                    </template>
                  </el-input>
                  <div class="toolbar-right">
                    <el-button circle>
                      <el-icon><Refresh /></el-icon>
                    </el-button>
                  </div>
                </div>
              </div>
              
              <!-- 文件列表 -->
              <div class="category-table-wrapper">
                <el-table 
                  :data="filteredCategoryFiles" 
                  style="width: 100%"
                  :empty-text="categorySearch ? '未找到匹配的文件' : '暂无文件'"
                  stripe
                >
                  <el-table-column type="index" label="#" width="60" />
                  <el-table-column prop="name" label="文件名称" min-width="220">
                    <template #default="{ row }">
                      <div class="file-name-cell">
                        <el-icon class="file-icon" :style="{ color: getFileIconColor(row.name) }">
                          <Document />
                        </el-icon>
                        <span class="file-name">{{ row.name }}</span>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="description" label="文件描述" min-width="180" show-overflow-tooltip />
                  <el-table-column prop="uploadTime" label="上传时间" width="180" sortable />
                  <el-table-column prop="size" label="文件大小" width="120" align="right" />
                  <el-table-column label="操作" width="200" fixed="right">
                    <template #default="{ row }">
                      <div class="table-actions">
                        <el-button type="primary" link size="small" @click="downloadFile(row)">
                          <el-icon><Download /></el-icon>
                          下载
                        </el-button>
                        <el-button type="danger" link size="small" @click="deleteFile(row)">
                          <el-icon><Delete /></el-icon>
                          删除
                        </el-button>
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 历史文件 -->
        <div v-if="activeNav === 'kb-history'" class="panel">
          <div class="panel-header">
            <h3>历史文件</h3>
            <div class="header-actions">
              <el-input 
                v-model="historySearch" 
                placeholder="搜索文件名..." 
                style="width: 200px; margin-right: 12px;"
                clearable
              >
                <template #prefix>
                  <el-icon><Search /></el-icon>
                </template>
              </el-input>
              <el-select v-model="historyFilter" placeholder="筛选分类" style="width: 150px;" clearable>
                <el-option label="全部分类" value="" />
                <el-option label="资质文件" value="qualification" />
                <el-option label="技术模块文件" value="technical" />
                <el-option label="项目案例" value="case" />
                <el-option label="其他资料" value="other" />
              </el-select>
            </div>
          </div>
          
          <el-table :data="filteredHistoryFiles" style="width: 100%">
            <el-table-column prop="name" label="文件名称" min-width="200" />
            <el-table-column prop="category" label="所属分类" width="150">
              <template #default="{ row }">
                <el-tag :type="getCategoryTagType(row.category)" size="small">
                  {{ getCategoryLabel(row.category) }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="description" label="文件描述" min-width="150" />
            <el-table-column prop="uploadTime" label="上传时间" width="180" sortable />
            <el-table-column prop="size" label="文件大小" width="100" />
            <el-table-column label="操作" width="150">
              <template #default="{ row }">
                <el-button type="primary" link size="small" @click="downloadFile(row)">
                  <el-icon><Download /></el-icon>
                  下载
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>

        <!-- 进行中项目 -->
        <div v-if="activeNav === 'project-ongoing'" class="panel">
          <div class="panel-header">
            <h3>进行中项目</h3>
            <div class="header-actions">
              <el-input 
                v-model="projectSearch" 
                placeholder="搜索项目名称..." 
                style="width: 200px; margin-right: 12px;"
                clearable
              >
                <template #prefix>
                  <el-icon><Search /></el-icon>
                </template>
              </el-input>
              <el-button type="primary" @click="showCreateProjectDialog = true">
                <el-icon><Plus /></el-icon>
                创建项目
              </el-button>
            </div>
          </div>
          
          <div v-if="!selectedProject" class="project-list">
            <div 
              v-for="project in filteredOngoingProjects" 
              :key="project.id"
              class="project-card"
              @click="viewProjectDetail(project)"
            >
              <div class="project-card-header">
                <div class="project-title">
                  <h4>{{ project.name }}</h4>
                  <el-tag :type="getProgressTagType(project.progress)" size="small">
                    {{ project.progress }}
                  </el-tag>
                </div>
                <div class="project-meta">
                  <span class="meta-item">
                    <el-icon><Clock /></el-icon>
                    创建时间：{{ project.createTime }}
                  </span>
                </div>
              </div>
              <div class="project-progress-bar">
                <div class="progress-info">
                  <span>当前进度</span>
                  <span>{{ getProgressPercentage(project.progress) }}%</span>
                </div>
                <el-progress 
                  :percentage="getProgressPercentage(project.progress)" 
                  :color="getProgressColor(project.progress)"
                  :show-text="false"
                />
              </div>
            </div>
          </div>

          <!-- 项目详情 -->
          <div v-else class="project-detail">
            <div class="detail-header">
              <el-button @click="selectedProject = null" link>
                <el-icon><ArrowLeft /></el-icon>
                返回列表
              </el-button>
            </div>
            
            <div class="detail-content">
              <div class="detail-title">
                <h2>{{ selectedProject.name }}</h2>
                <el-tag :type="getProgressTagType(selectedProject.progress)" size="large">
                  {{ selectedProject.progress }}
                </el-tag>
              </div>
              
              <div class="detail-info">
                <div class="info-item">
                  <span class="info-label">创建时间：</span>
                  <span class="info-value">{{ selectedProject.createTime }}</span>
                </div>
                <div class="info-item">
                  <span class="info-label">当前进度：</span>
                  <span class="info-value">{{ selectedProject.progress }}</span>
                </div>
              </div>

              <div class="project-timeline">
                <h3>项目流程</h3>
                <el-steps :active="getActiveStep(selectedProject.progress)" align-center>
                  <el-step 
                    v-for="(step, index) in projectSteps" 
                    :key="index"
                    :title="step.title"
                    :status="getStepStatus(selectedProject.progress, step.key)"
                    class="clickable-step"
                    @click="viewStepDetail(step, selectedProject)"
                  >
                    <template #icon>
                      <el-icon v-if="getStepStatus(selectedProject.progress, step.key) === 'finish'">
                        <CircleCheck />
                      </el-icon>
                      <el-icon v-else-if="getStepStatus(selectedProject.progress, step.key) === 'process'">
                        <Loading />
                      </el-icon>
                      <span v-else>{{ index + 1 }}</span>
                    </template>
                  </el-step>
                </el-steps>
              </div>

              <!-- 招标信息提取结果 -->
              <div v-if="selectedProject.extractedInfo" class="extracted-info-section">
                <h3>
                  <el-icon><Document /></el-icon>
                  招标信息提取结果
                </h3>
                
                <el-tabs type="border-card">
                  <!-- 商务关键信息 -->
                  <el-tab-pane>
                    <template #label>
                      <span class="tab-label">
                        <el-icon><Document /></el-icon>
                        商务关键信息
                      </span>
                    </template>
                    <div class="info-table-wrapper">
                      <el-table :data="selectedProject.extractedInfo.businessInfo" border stripe>
                        <el-table-column prop="field" label="信息项" width="150" />
                        <el-table-column prop="content" label="信息内容" min-width="250" />
                        <el-table-column prop="source" label="提取来源" width="120" />
                        <el-table-column label="核实状态" width="180">
                          <template #default="{ row }">
                            <div :class="['verify-status', `status-${row.verifyStatus}`]">
                              <el-icon v-if="row.verifyStatus === 'no-need'"><Check /></el-icon>
                              <el-icon v-else-if="row.verifyStatus === 'need'"><Warning /></el-icon>
                              <el-icon v-else><Close /></el-icon>
                              <span>{{ getVerifyStatusText(row.verifyStatus) }}</span>
                            </div>
                          </template>
                        </el-table-column>
                      </el-table>
                    </div>
                  </el-tab-pane>

                  <!-- 技术关键信息 -->
                  <el-tab-pane>
                    <template #label>
                      <span class="tab-label">
                        <el-icon><MagicStick /></el-icon>
                        技术关键信息
                      </span>
                    </template>
                    <div class="info-table-wrapper">
                      <el-table :data="selectedProject.extractedInfo.techInfo" border stripe>
                        <el-table-column prop="field" label="信息项" width="150" />
                        <el-table-column prop="content" label="信息内容" min-width="250" />
                        <el-table-column prop="source" label="提取来源" width="120" />
                        <el-table-column label="核实状态" width="180">
                          <template #default="{ row }">
                            <div :class="['verify-status', `status-${row.verifyStatus}`]">
                              <el-icon v-if="row.verifyStatus === 'no-need'"><Check /></el-icon>
                              <el-icon v-else-if="row.verifyStatus === 'need'"><Warning /></el-icon>
                              <el-icon v-else><Close /></el-icon>
                              <span>{{ getVerifyStatusText(row.verifyStatus) }}</span>
                            </div>
                          </template>
                        </el-table-column>
                      </el-table>
                    </div>
                  </el-tab-pane>
                </el-tabs>
              </div>

              <!-- 进度操作区 -->
              <div class="progress-actions">
                <h3>当前阶段操作</h3>
                <div class="action-cards">
                  <div 
                    v-for="step in projectSteps" 
                    :key="step.key"
                    class="action-card"
                    :class="{ 
                      active: selectedProject.progress === step.title,
                      completed: getStepStatus(selectedProject.progress, step.key) === 'finish'
                    }"
                  >
                    <div class="action-card-header">
                      <div class="action-title">
                        <el-icon v-if="getStepStatus(selectedProject.progress, step.key) === 'finish'" color="#10b981">
                          <CircleCheck />
                        </el-icon>
                        <el-icon v-else-if="selectedProject.progress === step.title" color="#7c3aed">
                          <Loading class="rotating" />
                        </el-icon>
                        <el-icon v-else color="#d1d5db">
                          <Clock />
                        </el-icon>
                        <span>{{ step.title }}</span>
                      </div>
                      <el-tag 
                        v-if="selectedProject.progress === step.title" 
                        type="warning" 
                        size="small"
                      >
                        进行中
                      </el-tag>
                      <el-tag 
                        v-else-if="getStepStatus(selectedProject.progress, step.key) === 'finish'" 
                        type="success" 
                        size="small"
                      >
                        已完成
                      </el-tag>
                    </div>
                    <div class="action-card-body">
                      <p class="action-desc">{{ step.description }}</p>
                      <div class="action-buttons">
                        <el-button 
                          v-if="selectedProject.progress === step.title"
                          type="primary"
                          size="small"
                          @click="goToFunction(step.key)"
                        >
                          <el-icon><Right /></el-icon>
                          前往操作
                        </el-button>
                        <el-button 
                          v-if="selectedProject.progress === step.title && getActiveStep(selectedProject.progress) < projectSteps.length - 1"
                          type="success"
                          size="small"
                          @click="completeCurrentStep(selectedProject)"
                        >
                          <el-icon><Check /></el-icon>
                          完成此步骤
                        </el-button>
                        <el-button 
                          v-if="selectedProject.progress === step.title && getActiveStep(selectedProject.progress) === projectSteps.length - 1"
                          type="success"
                          size="small"
                          @click="finishProject(selectedProject)"
                        >
                          <el-icon><Check /></el-icon>
                          完结项目
                        </el-button>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 已完结项目 -->
        <div v-if="activeNav === 'project-completed'" class="panel">
          <div class="panel-header">
            <h3>已完结项目</h3>
            <div class="header-actions">
              <el-input 
                v-model="projectSearch" 
                placeholder="搜索项目名称..." 
                style="width: 200px; margin-right: 12px;"
                clearable
              >
                <template #prefix>
                  <el-icon><Search /></el-icon>
                </template>
              </el-input>
            </div>
          </div>
          
          <div v-if="!selectedProject" class="project-list">
            <div 
              v-for="project in filteredOldCompletedProjects" 
              :key="project.id"
              class="project-card completed"
              @click="viewProjectDetail(project)"
            >
              <div class="project-card-header">
                <div class="project-title">
                  <h4>{{ project.name }}</h4>
                  <el-tag type="success" size="small">已完结</el-tag>
                </div>
                <div class="project-meta">
                  <span class="meta-item">
                    <el-icon><Clock /></el-icon>
                    创建时间：{{ project.createTime }}
                  </span>
                  <span class="meta-item">
                    <el-icon><Check /></el-icon>
                    完成时间：{{ project.completeTime }}
                  </span>
                </div>
              </div>
              <div class="project-result">
                <div class="result-status">
                  <el-tag :type="project.result === '中标' ? 'success' : 'info'">
                    {{ project.result }}
                  </el-tag>
                  <span v-if="project.result === '中标' && project.bidAmount" class="bid-amount">
                    中标金额：{{ project.bidAmount }}
                  </span>
                  <span v-if="project.result === '未中标' && project.failReason" class="fail-reason">
                    <el-icon><Warning /></el-icon>
                    {{ project.failReason }}
                  </span>
                </div>
              </div>
            </div>
          </div>

          <!-- 项目详情 -->
          <div v-else class="project-detail">
            <div class="detail-header">
              <el-button @click="selectedProject = null" link>
                <el-icon><ArrowLeft /></el-icon>
                返回列表
              </el-button>
            </div>
            
            <div class="detail-content">
              <div class="detail-title">
                <h2>{{ selectedProject.name }}</h2>
                <el-tag type="success" size="large">已完结</el-tag>
              </div>
              
              <div class="detail-info">
                <div class="info-item">
                  <span class="info-label">创建时间：</span>
                  <span class="info-value">{{ selectedProject.createTime }}</span>
                </div>
                <div class="info-item">
                  <span class="info-label">完成时间：</span>
                  <span class="info-value">{{ selectedProject.completeTime }}</span>
                </div>
                <div class="info-item">
                  <span class="info-label">项目结果：</span>
                  <span class="info-value">
                    <el-tag :type="selectedProject.result === '中标' ? 'success' : 'info'">
                      {{ selectedProject.result }}
                    </el-tag>
                  </span>
                </div>
                <div v-if="selectedProject.result === '中标' && selectedProject.bidAmount" class="info-item">
                  <span class="info-label">中标金额：</span>
                  <span class="info-value bid-amount-highlight">{{ selectedProject.bidAmount }}</span>
                </div>
                <div v-if="selectedProject.result === '未中标' && selectedProject.failReason" class="info-item full-width">
                  <span class="info-label">未中标原因：</span>
                  <span class="info-value fail-reason-highlight">
                    <el-icon><Warning /></el-icon>
                    {{ selectedProject.failReason }}
                  </span>
                </div>
              </div>

              <div class="project-timeline">
                <h3>项目流程</h3>
                <el-steps :active="5" align-center finish-status="success">
                  <el-step 
                    v-for="(step, index) in projectSteps" 
                    :key="index"
                    :title="step.title"
                    :description="step.description"
                  >
                    <template #icon>
                      <el-icon><CircleCheck /></el-icon>
                    </template>
                  </el-step>
                </el-steps>
              </div>
            </div>
          </div>
        </div>

        <!-- 新项目管理 - 进行中项目 -->
        <div v-if="activeNav === 'pm-ongoing'" class="panel">
          <div class="panel-header">
            <h3>进行中项目</h3>
            <div class="header-actions">
              <el-input 
                v-model="pmProjectSearch" 
                placeholder="搜索项目名称..." 
                style="width: 240px; margin-right: 12px;"
                clearable
              >
                <template #prefix>
                  <el-icon><Search /></el-icon>
                </template>
              </el-input>
              <el-button type="primary" @click="showPmCreateDialog = true">
                <el-icon><Plus /></el-icon>
                新建项目
              </el-button>
            </div>
          </div>
          
          <div v-if="!selectedPmProject" class="pm-project-cards">
            <div 
              v-for="project in filteredPmOngoingProjects" 
              :key="project.id" 
              class="pm-project-card"
              @click="viewPmProjectDetail(project)"
            >
              <div class="pm-card-header">
                <h4 class="pm-card-title">{{ project.name }}</h4>
                <el-dropdown trigger="click" @command="handlePmCardAction($event, project)" @click.stop>
                  <el-button text circle size="small">
                    <el-icon><MoreFilled /></el-icon>
                  </el-button>
                  <template #dropdown>
                    <el-dropdown-menu>
                      <el-dropdown-item command="edit">编辑</el-dropdown-item>
                      <el-dropdown-item command="delete" divided>删除</el-dropdown-item>
                    </el-dropdown-menu>
                  </template>
                </el-dropdown>
              </div>
              <div class="pm-card-info">
                <div class="pm-info-row">
                  <span class="pm-info-label"><el-icon><Calendar /></el-icon>创建时间</span>
                  <span class="pm-info-value">{{ project.createTime }}</span>
                </div>
                <div class="pm-info-row">
                  <span class="pm-info-label"><el-icon><Clock /></el-icon>递交日期</span>
                  <span class="pm-info-value deadline">{{ project.deadline }}</span>
                </div>
                <div class="pm-info-row">
                  <span class="pm-info-label"><el-icon><EditPen /></el-icon>最近修改</span>
                  <span class="pm-info-value">{{ project.lastModified }}</span>
                </div>
                <div class="pm-info-row">
                  <span class="pm-info-label"><el-icon><User /></el-icon>创建人</span>
                  <span class="pm-info-value">{{ project.creator }}</span>
                </div>
              </div>
              <div class="pm-card-progress">
                <div class="pm-progress-header">
                  <span>完成进度</span>
                  <span class="pm-progress-value">{{ project.progress }}%</span>
                </div>
                <el-progress 
                  :percentage="project.progress" 
                  :color="getProgressGradient(project.progress)"
                  :show-text="false"
                />
              </div>
            </div>
            
            <!-- 空状态 -->
            <div v-if="filteredPmOngoingProjects.length === 0 && !selectedPmProject" class="pm-empty-state">
              <el-empty description="暂无进行中的项目">
                <el-button type="primary" @click="showPmCreateDialog = true">
                  <el-icon><Plus /></el-icon>
                  新建项目
                </el-button>
              </el-empty>
            </div>
          </div>
          
          <!-- 项目详情视图 -->
          <div v-if="selectedPmProject" class="pm-project-detail">
            <div class="pm-detail-header">
              <el-button @click="selectedPmProject = null" link>
                <el-icon><ArrowLeft /></el-icon>
                返回项目列表
              </el-button>
            </div>
            
            <div class="pm-detail-content">
              <div class="pm-detail-title">
                <h2>{{ selectedPmProject.name }}</h2>
                <el-tag type="warning" size="large">进行中</el-tag>
              </div>
              
              <!-- 编辑开关 -->
              <div class="pm-info-edit-toggle">
                <span class="toggle-label">{{ pmInfoEditMode ? '编辑中' : '查看模式' }}</span>
                <el-switch 
                  v-model="pmInfoEditMode" 
                  active-text="编辑"
                  inactive-text="查看"
                  @change="togglePmInfoEditMode"
                />
              </div>
              
              <div class="pm-detail-info-grid" :class="{ editing: pmInfoEditMode }">
                <!-- 左列 -->
                <div class="pm-info-column">
                  <!-- 项目信息 -->
                  <div class="pm-info-section">
                    <div class="pm-info-section-title">
                      <el-icon><OfficeBuilding /></el-icon>
                      <span>项目信息</span>
                    </div>
                    <div class="pm-info-section-content">
                      <div class="pm-info-row">
                        <span class="label">招标单位</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.tenderUnit" size="small" placeholder="请输入招标单位" />
                        </template>
                        <span v-else class="value">{{ selectedPmProject.tenderUnit || '-' }}</span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">预算金额</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.budget" size="small" placeholder="请输入预算金额" />
                        </template>
                        <span v-else class="value budget">{{ selectedPmProject.budget ? `￥${selectedPmProject.budget}` : '-' }}</span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">评标方式</span>
                        <template v-if="pmInfoEditMode">
                          <el-select v-model="selectedPmProject.bidMethod" size="small" placeholder="请选择" style="width: 100%">
                            <el-option label="综合评分法" value="综合评分法" />
                            <el-option label="最低价法" value="最低价法" />
                            <el-option label="性价比法" value="性价比法" />
                          </el-select>
                        </template>
                        <span v-else class="value">
                          <el-tag v-if="selectedPmProject.bidMethod" size="small" type="primary">{{ selectedPmProject.bidMethod }}</el-tag>
                          <span v-else>-</span>
                        </span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">项目编号</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.projectNo" size="small" placeholder="请输入项目编号" />
                        </template>
                        <span v-else class="value code">{{ selectedPmProject.projectNo || '-' }}</span>
                      </div>
                    </div>
                  </div>
                  
                  <!-- 资格要求 -->
                  <div class="pm-info-section">
                    <div class="pm-info-section-title">
                      <el-icon><Medal /></el-icon>
                      <span>资格要求</span>
                    </div>
                    <div class="pm-info-section-content">
                      <div class="pm-info-row">
                        <span class="label">资质要求</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.qualificationReq" size="small" placeholder="请输入资质要求" />
                        </template>
                        <span v-else class="value">
                          <el-tag v-if="selectedPmProject.qualificationReq" size="small">{{ selectedPmProject.qualificationReq }}</el-tag>
                          <span v-else>-</span>
                        </span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">业绩要求</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.performanceReq" size="small" placeholder="请输入业绩要求" />
                        </template>
                        <span v-else class="value">
                          <el-tag v-if="selectedPmProject.performanceReq" size="small" type="success">{{ selectedPmProject.performanceReq }}</el-tag>
                          <span v-else>-</span>
                        </span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">人员要求</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.personnelReq" size="small" placeholder="请输入人员要求" />
                        </template>
                        <span v-else class="value">
                          <el-tag v-if="selectedPmProject.personnelReq" size="small" type="warning">{{ selectedPmProject.personnelReq }}</el-tag>
                          <span v-else>-</span>
                        </span>
                      </div>
                    </div>
                  </div>
                </div>
                
                <!-- 右列 -->
                <div class="pm-info-column">
                  <!-- 时间节点 -->
                  <div class="pm-info-section">
                    <div class="pm-info-section-title">
                      <el-icon><Clock /></el-icon>
                      <span>时间节点</span>
                    </div>
                    <div class="pm-info-section-content">
                      <div class="pm-info-row highlight">
                        <span class="label">投标截止</span>
                        <template v-if="pmInfoEditMode">
                          <el-date-picker v-model="selectedPmProject.deadline" type="date" size="small" placeholder="选择日期" value-format="YYYY-MM-DD" style="width: 100%" />
                        </template>
                        <span v-else class="value deadline">
                          <el-icon v-if="selectedPmProject.deadline"><Warning /></el-icon>
                          {{ selectedPmProject.deadline || '-' }}
                        </span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">开标时间</span>
                        <template v-if="pmInfoEditMode">
                          <el-date-picker v-model="selectedPmProject.openBidTime" type="datetime" size="small" placeholder="选择时间" value-format="YYYY-MM-DD HH:mm" style="width: 100%" />
                        </template>
                        <span v-else class="value">{{ selectedPmProject.openBidTime || '-' }}</span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">保证金截止</span>
                        <template v-if="pmInfoEditMode">
                          <el-date-picker v-model="selectedPmProject.depositDeadline" type="date" size="small" placeholder="选择日期" value-format="YYYY-MM-DD" style="width: 100%" />
                        </template>
                        <span v-else class="value">{{ selectedPmProject.depositDeadline || '-' }}</span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">保证金额</span>
                        <template v-if="pmInfoEditMode">
                          <el-input v-model="selectedPmProject.deposit" size="small" placeholder="请输入保证金额" />
                        </template>
                        <span v-else class="value">{{ selectedPmProject.deposit || '-' }}</span>
                      </div>
                    </div>
                  </div>
                  
                  <!-- 系统信息 -->
                  <div class="pm-info-section system">
                    <div class="pm-info-section-title">
                      <el-icon><Setting /></el-icon>
                      <span>系统信息</span>
                    </div>
                    <div class="pm-info-section-content">
                      <div class="pm-info-row">
                        <span class="label">创建时间</span>
                        <span class="value">{{ selectedPmProject.createTime }}</span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">最近修改</span>
                        <span class="value">{{ selectedPmProject.lastModified }}</span>
                      </div>
                      <div class="pm-info-row">
                        <span class="label">创建人</span>
                        <span class="value">{{ selectedPmProject.creator }}</span>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              
              <!-- 五大进度流程 -->
              <div class="pm-progress-timeline">
                <h3>项目流程进度</h3>
                <el-steps :active="getPmActiveStep(selectedPmProject.progress)" align-center>
                  <el-step 
                    v-for="(step, index) in pmProjectSteps" 
                    :key="index"
                    :title="step.title"
                    :description="step.description"
                    :status="getPmStepStatus(selectedPmProject.progress, index)"
                    class="pm-step-item"
                    @click="handlePmStepClick(step, index)"
                  >
                    <template #icon>
                      <div class="pm-step-icon" :class="getPmStepStatus(selectedPmProject.progress, index)">
                        <el-icon v-if="getPmStepStatus(selectedPmProject.progress, index) === 'finish'"><Check /></el-icon>
                        <el-icon v-else-if="getPmStepStatus(selectedPmProject.progress, index) === 'process'"><Loading /></el-icon>
                        <span v-else>{{ index + 1 }}</span>
                      </div>
                    </template>
                  </el-step>
                </el-steps>
              </div>
              
              <!-- 当前进度详情 -->
              <div class="pm-current-step-detail">
                <!-- 招标信息提取步骤 -->
                <div v-if="currentStepIndex === 0" class="pm-step-extract">
                  <div class="pm-step-detail-card">
                    <div class="pm-step-detail-header">
                      <h4>招标信息提取</h4>
                      <el-tag type="warning" size="small">进行中</el-tag>
                    </div>
                    
                    <!-- 未上传状态 -->
                    <div v-if="!pmExtractFileData" class="pm-extract-upload">
                      <div class="pm-upload-area">
                        <el-upload
                          ref="pmExtractUploadRef"
                          class="pm-upload-dragger"
                          drag
                          :auto-upload="false"
                          :on-change="handlePmExtractFileSelect"
                          :show-file-list="false"
                          accept=".pdf,.doc,.docx"
                        >
                          <div class="pm-upload-content">
                            <el-icon class="pm-upload-icon"><UploadFilled /></el-icon>
                            <p class="pm-upload-title">点击或拖拽上传招标文件</p>
                            <p class="pm-upload-hint">支持 PDF、Word 格式文件</p>
                          </div>
                        </el-upload>
                        
                        <div v-if="pmPendingExtractFile" class="pm-selected-file">
                          <el-icon><Document /></el-icon>
                          <span class="file-name">{{ pmPendingExtractFile.name }}</span>
                          <el-button text circle size="small" @click="pmPendingExtractFile = null">
                            <el-icon><Close /></el-icon>
                          </el-button>
                        </div>
                        
                        <el-button 
                          type="primary" 
                          size="large"
                          :disabled="!pmPendingExtractFile"
                          :loading="pmExtractAnalyzing"
                          @click="startPmExtractAnalyze"
                          class="pm-analyze-btn"
                        >
                          <el-icon v-if="!pmExtractAnalyzing"><MagicStick /></el-icon>
                          {{ pmExtractAnalyzing ? '正在解析中...' : '开始解析' }}
                        </el-button>
                      </div>
                    </div>
                    
                    <!-- 解析结果 -->
                    <div v-else class="pm-extract-result">
                      <div class="pm-extract-result-header">
                        <div class="file-info">
                          <el-icon class="file-icon"><Document /></el-icon>
                          <div class="file-detail">
                            <span class="file-name">{{ pmExtractFileData.name }}</span>
                            <span class="file-meta">共 {{ pmExtractFileData.pages }} 页 | 上传于 {{ pmExtractFileData.uploadTime }}</span>
                          </div>
                        </div>
                        <el-button type="primary" link @click="resetPmExtract">
                          <el-icon><Refresh /></el-icon>
                          重新上传
                        </el-button>
                      </div>
                      
                      <!-- 主体内容：左右布局 -->
                      <div class="pm-extract-body">
                        <!-- 左侧：关键信息区域 -->
                        <div class="pm-extract-left">
                          <!-- 选项卡导航 -->
                          <div class="pm-extract-tabs">
                            <div 
                              v-for="tab in pmExtractTabs" 
                              :key="tab.key" 
                              class="pm-extract-tab"
                              :class="{ active: pmActiveExtractTab === tab.key }"
                              @click="pmActiveExtractTab = tab.key"
                            >
                              {{ tab.label }}
                            </div>
                          </div>
                          
                          <!-- 选项卡内容 -->
                          <div class="pm-extract-tab-content">
                            <!-- 总体分析 -->
                            <div v-if="pmActiveExtractTab === 'overview'" class="pm-tab-panel">
                              <!-- 上部：评分权重分布 + 报价策略建议 -->
                              <div class="pm-overview-row">
                                <!-- 评分权重分布 -->
                                <div class="pm-overview-card">
                                  <div class="pm-card-title"><el-icon><TrendCharts /></el-icon>评分权重分布</div>
                                  <div class="pm-score-distribution">
                                    <div class="pm-donut-chart">
                                      <div class="pm-donut-ring">
                                        <div class="pm-donut-center">
                                          <span class="pm-donut-percent">100%</span>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="pm-score-legend">
                                      <div class="pm-legend-item"><span class="pm-legend-dot tech"></span>技术评分 <span class="pm-legend-value">45%</span></div>
                                      <div class="pm-legend-item"><span class="pm-legend-dot business"></span>商务评分 <span class="pm-legend-value">35%</span></div>
                                      <div class="pm-legend-item"><span class="pm-legend-dot price"></span>报价评分 <span class="pm-legend-value">20%</span></div>
                                    </div>
                                  </div>
                                </div>
                                <!-- 报价策略建议 -->
                                <div class="pm-overview-card">
                                  <div class="pm-card-title"><el-icon><DataLine /></el-icon>报价策略建议</div>
                                  <div class="pm-price-strategy">
                                    <div class="pm-strategy-tip">
                                      <el-icon><InfoFilled /></el-icon>
                                      基于历史数据分析，建议报价在预算的<span class="highlight">92%-95%</span>区间
                                    </div>
                                    <div class="pm-price-chart">
                                      <div class="pm-chart-bars">
                                        <div class="pm-bar" style="height: 60%"><span>70%</span></div>
                                        <div class="pm-bar" style="height: 75%"><span>82%</span></div>
                                        <div class="pm-bar highlight" style="height: 85%"><span>93%</span></div>
                                        <div class="pm-bar" style="height: 70%"><span>79%</span></div>
                                        <div class="pm-bar" style="height: 55%"><span>68%</span></div>
                                      </div>
                                      <div class="pm-chart-labels">
                                        <span>90%</span><span>92%</span><span>94%</span><span>96%</span><span>100%</span>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                              
                              <!-- 关键时间节点规划 -->
                              <div class="pm-timeline-section">
                                <div class="pm-card-title"><el-icon><Clock /></el-icon>关键时间节点规划</div>
                                <div class="pm-timeline-row">
                                  <div class="pm-countdown-box">
                                    <div class="pm-countdown-value">28</div>
                                    <div class="pm-countdown-label">剩余天数</div>
                                  </div>
                                  <div class="pm-time-nodes">
                                    <div class="pm-time-node">
                                      <div class="pm-node-date">2025-07-01</div>
                                      <div class="pm-node-label">投标截止日期</div>
                                    </div>
                                    <div class="pm-time-node warning">
                                      <div class="pm-node-date">2025-06-15</div>
                                      <div class="pm-node-label">保证金截止日</div>
                                    </div>
                                    <div class="pm-time-node primary">
                                      <div class="pm-node-date">2025-07-01</div>
                                      <div class="pm-node-label">开标日期</div>
                                    </div>
                                  </div>
                                </div>
                                <!-- 进度条 -->
                                <div class="pm-progress-bars">
                                  <div class="pm-progress-item">
                                    <span class="pm-progress-label">最终审核</span>
                                    <div class="pm-progress-bar"><div class="pm-progress-fill" style="width: 100%"></div></div>
                                  </div>
                                  <div class="pm-progress-item">
                                    <span class="pm-progress-label">报价策略</span>
                                    <div class="pm-progress-bar"><div class="pm-progress-fill" style="width: 85%"></div></div>
                                  </div>
                                  <div class="pm-progress-item">
                                    <span class="pm-progress-label">商务文件</span>
                                    <div class="pm-progress-bar"><div class="pm-progress-fill" style="width: 70%"></div></div>
                                  </div>
                                  <div class="pm-progress-item">
                                    <span class="pm-progress-label">技术方案</span>
                                    <div class="pm-progress-bar"><div class="pm-progress-fill" style="width: 55%"></div></div>
                                  </div>
                                  <div class="pm-progress-item">
                                    <span class="pm-progress-label">文件准备</span>
                                    <div class="pm-progress-bar"><div class="pm-progress-fill" style="width: 40%"></div></div>
                                  </div>
                                </div>
                              </div>
                              
                              <!-- 关键注意事项 + 智能建议 -->
                              <div class="pm-overview-row">
                                <div class="pm-overview-card half">
                                  <div class="pm-card-title warning"><el-icon><Warning /></el-icon>关键注意事项</div>
                                  <div class="pm-notice-list">
                                    <div class="pm-notice-item">
                                      <el-icon><Warning /></el-icon>
                                      <span>投标保证金：<strong>80,000元</strong>，需在开标前20日前到账</span>
                                    </div>
                                  </div>
                                </div>
                                <div class="pm-overview-card half">
                                  <div class="pm-card-title success"><el-icon><Checked /></el-icon>智能建议</div>
                                  <div class="pm-suggestion-list">
                                    <div class="pm-suggestion-item">
                                      <el-icon><Check /></el-icon>
                                      <span>重点突出智慧园区智能化系统集成经验</span>
                                    </div>
                                    <div class="pm-suggestion-item">
                                      <el-icon><Check /></el-icon>
                                      <span>在施工组织设计中增加BIM技术应用细节</span>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                            
                            <!-- 商务信息提取 -->
                            <div v-if="pmActiveExtractTab === 'business'" class="pm-tab-panel">
                              <div class="pm-key-info-section">
                                <div class="pm-section-header">
                                  <div class="pm-section-title"><el-icon><Coin /></el-icon>商务关键信息</div>
                                  <el-button type="primary" size="small" @click="addBusinessKeyInfo">
                                    <el-icon><Plus /></el-icon>添加字段
                                  </el-button>
                                </div>
                                <div class="pm-key-info-table">
                                  <el-table :data="pmBusinessKeyInfo" border size="small">
                                    <el-table-column prop="field" label="字段" width="120">
                                      <template #default="{ row }">
                                        <el-input v-model="row.field" size="small" placeholder="请输入字段名" />
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="content" label="内容" min-width="160">
                                      <template #default="{ row }">
                                        <el-input v-model="row.content" size="small" placeholder="请输入内容" />
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="pageNum" label="页码" width="70" align="center">
                                      <template #default="{ row }">
                                        <el-link type="primary" @click="locatePmPreview(row.pageNum)">第{{ row.pageNum }}页</el-link>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="状态" width="90" align="center">
                                      <template #default="{ row }">
                                        <el-select v-model="row.verifyStatus" size="small">
                                          <el-option label="必须核验" value="must" />
                                          <el-option label="需核验" value="need" />
                                          <el-option label="已确认" value="confirmed" />
                                        </el-select>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="AI识别" width="100" align="center">
                                      <template #default="{ row, $index }">
                                        <el-button 
                                          type="primary" 
                                          size="small" 
                                          :loading="row.aiLoading"
                                          @click="aiRecognizeBusinessInfo(row, $index)"
                                        >
                                          <el-icon v-if="!row.aiLoading"><MagicStick /></el-icon>
                                          识别
                                        </el-button>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="操作" width="70" align="center">
                                      <template #default="{ $index }">
                                        <el-button type="danger" size="small" link @click="removeBusinessKeyInfo($index)">
                                          <el-icon><Delete /></el-icon>
                                        </el-button>
                                      </template>
                                    </el-table-column>
                                  </el-table>
                                </div>
                              </div>
                            </div>
                            
                            <!-- 技术信息提取 -->
                            <div v-if="pmActiveExtractTab === 'technical'" class="pm-tab-panel">
                              <div class="pm-key-info-section">
                                <div class="pm-section-header">
                                  <div class="pm-section-title"><el-icon><Cpu /></el-icon>技术关键信息</div>
                                  <el-button type="primary" size="small" @click="addTechKeyInfo">
                                    <el-icon><Plus /></el-icon>添加字段
                                  </el-button>
                                </div>
                                <div class="pm-key-info-table">
                                  <el-table :data="pmTechKeyInfo" border size="small">
                                    <el-table-column prop="field" label="字段" width="120">
                                      <template #default="{ row }">
                                        <el-input v-model="row.field" size="small" placeholder="请输入字段名" />
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="content" label="内容" min-width="160">
                                      <template #default="{ row }">
                                        <el-input v-model="row.content" size="small" placeholder="请输入内容" />
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="pageNum" label="页码" width="70" align="center">
                                      <template #default="{ row }">
                                        <el-link type="primary" @click="locatePmPreview(row.pageNum)">第{{ row.pageNum }}页</el-link>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="状态" width="90" align="center">
                                      <template #default="{ row }">
                                        <el-select v-model="row.verifyStatus" size="small">
                                          <el-option label="必须核验" value="must" />
                                          <el-option label="需核验" value="need" />
                                          <el-option label="已确认" value="confirmed" />
                                        </el-select>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="AI识别" width="100" align="center">
                                      <template #default="{ row, $index }">
                                        <el-button 
                                          type="primary" 
                                          size="small" 
                                          :loading="row.aiLoading"
                                          @click="aiRecognizeTechInfo(row, $index)"
                                        >
                                          <el-icon v-if="!row.aiLoading"><MagicStick /></el-icon>
                                          识别
                                        </el-button>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="操作" width="70" align="center">
                                      <template #default="{ $index }">
                                        <el-button type="danger" size="small" link @click="removeTechKeyInfo($index)">
                                          <el-icon><Delete /></el-icon>
                                        </el-button>
                                      </template>
                                    </el-table-column>
                                  </el-table>
                                </div>
                              </div>
                            </div>
                            
                            <!-- 招标要求 -->
                            <div v-if="pmActiveExtractTab === 'bidding'" class="pm-tab-panel">
                              <div class="pm-qualification-section">
                                <div class="pm-section-title"><el-icon><OfficeBuilding /></el-icon>企业资质要求<span class="pm-badge danger">必须满足</span></div>
                                <div class="pm-requirement-list">
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">注册资本：</span><span class="value primary">不低于5000万元人民币</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">行业资质：</span><span class="value">具备建筑智能化工程专业承包壹级资质</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">ISO认证：</span><span class="value">需提供ISO 9001质量管理体系认证</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">业绩要求：</span><span class="value">近三年完成过3个及以上类似项目</span></div>
                                </div>
                              </div>
                              <div class="pm-qualification-section">
                                <div class="pm-section-title"><el-icon><User /></el-icon>人员资格要求<span class="pm-badge danger">必须满足</span></div>
                                <div class="pm-requirement-list">
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">项目经理：</span><span class="value">具备一级建造师资格（机电工程专业）</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">技术负责人：</span><span class="value">高级工程师职称，8年以上相关经验</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">安全员：</span><span class="value">持有有效的安全生产考核合格证</span></div>
                                </div>
                              </div>
                              <div class="pm-qualification-section">
                                <div class="pm-section-title"><el-icon><Document /></el-icon>文件格式要求<span class="pm-badge danger">必须满足</span></div>
                                <div class="pm-requirement-list">
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">文件构成：</span><span class="value">投标文件须包含商务标书、技术标书和报价单三部分，分别装订</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">文件格式：</span><span class="value">正本1份(需逐页小签)，副本6份，电子版1份(PDF+WORD)</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">装订要求：</span><span class="value">采用胶装方式，不得使用活页夹或文件夹</span></div>
                                </div>
                              </div>
                              <div class="pm-qualification-section">
                                <div class="pm-section-title"><el-icon><Stamp /></el-icon>签名与盖章要求<span class="pm-badge danger">必须满足</span></div>
                                <div class="pm-requirement-list">
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">法定代表人签名：</span><span class="value">授权委托书、投标函等重要文件需法定代表人亲笔签名</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">公章要求：</span><span class="value primary">所有复印件需加盖公司公章，正本需加盖骑缝章</span></div>
                                </div>
                              </div>
                            </div>
                            
                            <!-- 否决项识别 -->
                            <div v-if="pmActiveExtractTab === 'reject'" class="pm-tab-panel">
                              <div class="pm-reject-section">
                                <div class="pm-section-header">
                                  <div class="pm-section-title"><el-icon><Warning /></el-icon>否决项清单<span class="pm-badge danger">重点关注</span></div>
                                  <el-button type="primary" size="small" @click="addRejectItem">
                                    <el-icon><Plus /></el-icon>添加否决项
                                  </el-button>
                                </div>
                                <div class="pm-reject-table">
                                  <el-table :data="pmRejectItems" border size="small" style="width: 100%">
                                    <el-table-column prop="name" label="项目名称" min-width="150">
                                      <template #default="{ row, $index }">
                                        <el-input v-model="row.name" size="small" placeholder="请输入项目名称" />
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="否决类型" width="120">
                                      <template #default="{ row }">
                                        <el-select v-model="row.type" size="small" placeholder="选择类型">
                                          <el-option label="资格类" value="qualification" />
                                          <el-option label="技术类" value="technical" />
                                          <el-option label="商务类" value="business" />
                                          <el-option label="其他" value="other" />
                                        </el-select>
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="content" label="否决条款内容" min-width="200">
                                      <template #default="{ row }">
                                        <el-input v-model="row.content" size="small" placeholder="请输入否决条款内容" />
                                      </template>
                                    </el-table-column>
                                    <el-table-column prop="pageNum" label="页码" width="80" align="center">
                                      <template #default="{ row }">
                                        <el-link type="primary" @click="locatePmPreview(row.pageNum)">第{{ row.pageNum }}页</el-link>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="AI识别" width="100" align="center">
                                      <template #default="{ row, $index }">
                                        <el-button 
                                          type="primary" 
                                          size="small" 
                                          :loading="row.aiLoading"
                                          @click="aiRecognizeRejectItem(row, $index)"
                                        >
                                          <el-icon v-if="!row.aiLoading"><MagicStick /></el-icon>
                                          识别
                                        </el-button>
                                      </template>
                                    </el-table-column>
                                    <el-table-column label="操作" width="70" align="center">
                                      <template #default="{ $index }">
                                        <el-button type="danger" size="small" link @click="removeRejectItem($index)">
                                          <el-icon><Delete /></el-icon>
                                        </el-button>
                                      </template>
                                    </el-table-column>
                                  </el-table>
                                </div>
                              </div>
                            </div>
                            
                            <!-- 开标流程 -->
                            <div v-if="pmActiveExtractTab === 'process'" class="pm-tab-panel">
                              <div class="pm-timeline">
                                <div class="pm-timeline-item">
                                  <div class="pm-timeline-badge">2025-07-01</div>
                                  <div class="pm-timeline-content">
                                    <div class="pm-timeline-title">09:30 投标文件递交截止</div>
                                    <div class="pm-timeline-desc">邮寄地点：公共资源交易中心三楼开标室</div>
                                  </div>
                                </div>
                                <div class="pm-timeline-item">
                                  <div class="pm-timeline-content">
                                    <div class="pm-timeline-title">10:00 开标仪式</div>
                                    <div class="pm-timeline-desc">公开唱标：公布投标人名单</div>
                                  </div>
                                </div>
                                <div class="pm-timeline-item">
                                  <div class="pm-timeline-badge">2025-07-02 至 2025-07-05</div>
                                  <div class="pm-timeline-content">
                                    <div class="pm-timeline-title">评标阶段</div>
                                    <div class="pm-timeline-desc">评标委员会封闭评标</div>
                                  </div>
                                </div>
                                <div class="pm-timeline-item">
                                  <div class="pm-timeline-badge">2025-07-06</div>
                                  <div class="pm-timeline-content">
                                    <div class="pm-timeline-title">结果公示</div>
                                    <div class="pm-timeline-desc">在公共资源交易网公示3个工作日</div>
                                  </div>
                                </div>
                              </div>
                            </div>
                            
                            <!-- 风险分析 -->
                            <div v-if="pmActiveExtractTab === 'risk'" class="pm-tab-panel">
                              <div class="pm-qualification-section">
                                <div class="pm-section-title"><el-icon><Warning /></el-icon>高风险项目<span class="pm-badge warning">需重点关注</span></div>
                                <div class="pm-requirement-list">
                                  <div class="pm-requirement-item risk"><el-icon><Warning /></el-icon><span class="label">业绩要求：</span><el-tag type="danger" size="small">高风险</el-tag><span class="value">缺少1个类似项目业绩证明</span></div>
                                  <div class="pm-requirement-item risk"><el-icon><Warning /></el-icon><span class="label">项目经理：</span><el-tag type="danger" size="small">高风险</el-tag><span class="value">拟派项目经理注册专业不符要求</span></div>
                                  <div class="pm-requirement-item risk"><el-icon><Warning /></el-icon><span class="label">技术方案：</span><el-tag type="warning" size="small">中风险</el-tag><span class="value">BIM技术应用方案不够详细</span></div>
                                </div>
                              </div>
                              <div class="pm-qualification-section">
                                <div class="pm-section-title"><el-icon><Check /></el-icon>改进意见<span class="pm-badge success">优化建议</span></div>
                                <div class="pm-requirement-list">
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">业绩要求：</span><span class="value">补充提供智慧城市类项目业绩证明</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">项目经理：</span><span class="value">更换机电工程专业一级建造师担任项目经理</span></div>
                                  <div class="pm-requirement-item"><el-icon><Check /></el-icon><span class="label">技术方案：</span><span class="value">增加BIM技术在施工阶段的应用细节</span></div>
                                </div>
                              </div>
                            </div>
                          </div>
                          
                        </div>
                        
                        <!-- 右侧：文件预览区域 -->
                        <div class="pm-extract-right">
                          <div class="pm-preview-header">
                            <h5><el-icon><View /></el-icon>招标文件预览</h5>
                            <div class="pm-preview-tools">
                              <el-button 
                                size="small" 
                                :type="pmIsTranslated ? 'primary' : 'default'"
                                @click="togglePmTranslation"
                                :loading="pmTranslating"
                              >
                                <el-icon><Grid /></el-icon>
                                {{ pmIsTranslated ? '显示原文' : '全文翻译' }}
                              </el-button>
                              <el-button-group style="margin-left: 8px;">
                                <el-button size="small" @click="pmZoomOut">
                                  <el-icon><ZoomOut /></el-icon>
                                </el-button>
                                <el-button size="small" @click="pmZoomIn">
                                  <el-icon><ZoomIn /></el-icon>
                                </el-button>
                                <el-button size="small" @click="pmResetZoom">
                                  <el-icon><Refresh /></el-icon>
                                </el-button>
                              </el-button-group>
                            </div>
                          </div>
                          <div class="pm-preview-content" ref="pmPreviewContentRef" :style="{ transform: `scale(${pmPreviewZoom})` }">
                            <div class="pm-preview-pages">
                              <div 
                                v-for="page in pmExtractFileData.pages" 
                                :key="page" 
                                :id="`pm-page-${page}`"
                                class="pm-preview-page"
                              >
                                <div class="pm-page-number">第 {{ page }} 页</div>
                                <div class="pm-page-content">
                                  <p class="pm-preview-text" v-html="getPmPageContent(page)"></p>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      
                      <!-- 底部操作按钮 -->
                      <div class="pm-extract-footer">
                        <el-button type="primary" @click="confirmPmExtract">
                          <el-icon><Check /></el-icon>
                          确认信息并进入下一步
                        </el-button>
                      </div>
                    </div>
                  </div>
                </div>
                
                <!-- 撰写招标文件步骤 -->
                <div v-else-if="currentStepIndex === 1" class="pm-write-container">
                  <!-- 未选择投标类型时显示选择界面 -->
                  <div v-if="!pmWriteType" class="pm-write-type-selection">
                    <div class="pm-write-type-header">
                      <h4><el-icon><Edit /></el-icon>选择投标类型</h4>
                      <p>请选择您要编写的标书类型，不同类型的标书有不同的编写流程</p>
                    </div>
                    <div class="pm-write-type-cards">
                      <div class="pm-write-type-card" @click="selectWriteType('business')">
                        <div class="pm-type-icon business">
                          <el-icon><Coin /></el-icon>
                        </div>
                        <h5>商务标</h5>
                        <p>包含企业资质、业绩证明、报价清单等商务内容</p>
                        <div class="pm-type-steps">
                          <span>大纲生成</span>
                          <el-icon><Right /></el-icon>
                          <span>关联项目匹配</span>
                          <el-icon><Right /></el-icon>
                          <span>标书生成</span>
                        </div>
                      </div>
                      <div class="pm-write-type-card" @click="selectWriteType('technical')">
                        <div class="pm-type-icon technical">
                          <el-icon><Cpu /></el-icon>
                        </div>
                        <h5>技术标</h5>
                        <p>包含技术方案、施工组织设计、质量保证措施等技术内容</p>
                        <div class="pm-type-steps">
                          <span>大纲生成</span>
                          <el-icon><Right /></el-icon>
                          <span>关联项目匹配</span>
                          <el-icon><Right /></el-icon>
                          <span>技术项生成</span>
                          <el-icon><Right /></el-icon>
                          <span>标书生成</span>
                        </div>
                      </div>
                    </div>
                  </div>
                  
                  <!-- 已选择投标类型后显示编写流程 -->
                  <div v-else class="pm-write-workflow">
                    <!-- 顶部：类型切换和进度节点 -->
                    <div class="pm-write-header">
                      <div class="pm-write-type-badge" :class="pmWriteType">
                        <el-icon><Coin v-if="pmWriteType === 'business'" /><Cpu v-else /></el-icon>
                        {{ pmWriteType === 'business' ? '商务标' : '技术标' }}
                        <el-button type="primary" link size="small" @click="pmWriteType = null">
                          <el-icon><Refresh /></el-icon>切换类型
                        </el-button>
                      </div>
                      <div class="pm-write-progress-nodes">
                        <div 
                          v-for="(step, idx) in currentWriteSteps" 
                          :key="step.key"
                          class="pm-write-node"
                          :class="{ 
                            active: pmWriteStepIndex === idx, 
                            completed: idx < pmWriteStepIndex,
                            clickable: idx <= pmWriteStepIndex
                          }"
                          @click="idx <= pmWriteStepIndex && (pmWriteStepIndex = idx)"
                        >
                          <div class="pm-node-dot">
                            <el-icon v-if="idx < pmWriteStepIndex"><Check /></el-icon>
                            <span v-else>{{ idx + 1 }}</span>
                          </div>
                          <span class="pm-node-text">{{ step.title }}</span>
                          <div v-if="idx < currentWriteSteps.length - 1" class="pm-node-line"></div>
                        </div>
                      </div>
                    </div>
                    
                    <!-- 三分栏内容区域（仅在标书生成步骤显示） -->
                    <div v-if="currentWriteSteps[pmWriteStepIndex]?.key === 'generate'" class="pm-write-three-column">
                      <!-- 左侧：大纲导航（1/5宽度） -->
                      <div class="pm-column-left">
                        <div class="pm-column-header">
                          <h5><el-icon><List /></el-icon>标书大纲</h5>
                        </div>
                        <div class="pm-outline-nav">
                          <el-tree
                            :data="pmOutlineData"
                            node-key="id"
                            default-expand-all
                            :highlight-current="true"
                            @node-click="handleOutlineNodeClick"
                          >
                            <template #default="{ data }">
                              <span class="pm-outline-nav-item" :class="{ active: pmCurrentOutlineId === data.id }">
                                {{ data.title }}
                              </span>
                            </template>
                          </el-tree>
                        </div>
                      </div>
                      
                      <!-- 中间：标书编辑区（2/5宽度） -->
                      <div class="pm-column-middle">
                        <div class="pm-column-header">
                          <h5><el-icon><Document /></el-icon>标书内容编辑</h5>
                          <div class="pm-editor-toolbar">
                            <el-select v-model="pmEditorFontFamily" size="small" style="width: 100px;">
                              <el-option label="宋体" value="SimSun" />
                              <el-option label="黑体" value="SimHei" />
                              <el-option label="微软雅黑" value="Microsoft YaHei" />
                              <el-option label="楷体" value="KaiTi" />
                            </el-select>
                            <el-select v-model="pmEditorFontSize" size="small" style="width: 70px;">
                              <el-option label="12" :value="12" />
                              <el-option label="14" :value="14" />
                              <el-option label="16" :value="16" />
                              <el-option label="18" :value="18" />
                              <el-option label="20" :value="20" />
                              <el-option label="24" :value="24" />
                            </el-select>
                            <el-button-group>
                              <el-button size="small" :type="pmEditorBold ? 'primary' : 'default'" @click="pmEditorBold = !pmEditorBold">
                                <b>B</b>
                              </el-button>
                              <el-button size="small" :type="pmEditorItalic ? 'primary' : 'default'" @click="pmEditorItalic = !pmEditorItalic">
                                <i>I</i>
                              </el-button>
                              <el-button size="small" :type="pmEditorUnderline ? 'primary' : 'default'" @click="pmEditorUnderline = !pmEditorUnderline">
                                <u>U</u>
                              </el-button>
                            </el-button-group>
                            <el-button-group>
                              <el-button size="small" :type="pmEditorAlign === 'left' ? 'primary' : 'default'" @click="pmEditorAlign = 'left'" title="左对齐">
                                <span style="font-size: 12px;">左</span>
                              </el-button>
                              <el-button size="small" :type="pmEditorAlign === 'center' ? 'primary' : 'default'" @click="pmEditorAlign = 'center'" title="居中">
                                <span style="font-size: 12px;">中</span>
                              </el-button>
                              <el-button size="small" :type="pmEditorAlign === 'right' ? 'primary' : 'default'" @click="pmEditorAlign = 'right'" title="右对齐">
                                <span style="font-size: 12px;">右</span>
                              </el-button>
                            </el-button-group>
                          </div>
                        </div>
                        <div class="pm-editor-content">
                          <div class="pm-document-paper">
                            <div 
                              class="pm-document-title"
                              contenteditable="true"
                              @input="updateDocumentTitle"
                            >{{ pmDocumentTitle }}</div>
                            <div 
                              class="pm-document-body"
                              contenteditable="true"
                              :style="{
                                fontFamily: pmEditorFontFamily,
                                fontSize: pmEditorFontSize + 'px',
                                fontWeight: pmEditorBold ? 'bold' : 'normal',
                                fontStyle: pmEditorItalic ? 'italic' : 'normal',
                                textDecoration: pmEditorUnderline ? 'underline' : 'none',
                                textAlign: pmEditorAlign
                              }"
                              @input="updateDocumentContent"
                            >{{ pmDocumentContent }}</div>
                          </div>
                        </div>
                        <div class="pm-editor-footer">
                          <el-button type="primary" @click="saveDocument">
                            <el-icon><Check /></el-icon>保存文档
                          </el-button>
                          <el-button @click="exportDocument">
                            <el-icon><Download /></el-icon>导出Word
                          </el-button>
                        </div>
                      </div>
                      
                      <!-- 右侧：AI助手（2/5宽度） -->
                      <div class="pm-column-right">
                        <div class="pm-column-header">
                          <h5><el-icon><ChatDotRound /></el-icon>AI标书助手</h5>
                        </div>
                        <div class="pm-ai-chat">
                          <div class="pm-chat-messages" ref="chatMessagesRef">
                            <div 
                              v-for="(msg, idx) in pmChatMessages" 
                              :key="idx" 
                              class="pm-chat-message"
                              :class="msg.role"
                            >
                              <div class="pm-message-avatar">
                                <el-icon v-if="msg.role === 'assistant'"><Service /></el-icon>
                                <el-icon v-else><User /></el-icon>
                              </div>
                              <div class="pm-message-content">
                                <div class="pm-message-text">{{ msg.content }}</div>
                                <div class="pm-message-time">{{ msg.time }}</div>
                              </div>
                            </div>
                            <div v-if="pmAiTyping" class="pm-chat-message assistant">
                              <div class="pm-message-avatar">
                                <el-icon><Service /></el-icon>
                              </div>
                              <div class="pm-message-content">
                                <div class="pm-message-text pm-typing">
                                  <span></span><span></span><span></span>
                                </div>
                              </div>
                            </div>
                          </div>
                          <div class="pm-chat-input">
                            <el-input
                              v-model="pmChatInput"
                              type="textarea"
                              :rows="3"
                              placeholder="输入您的问题，AI助手将帮您优化标书内容..."
                              @keydown.enter.ctrl="sendChatMessage"
                            />
                            <div class="pm-chat-actions">
                              <span class="pm-chat-tip">Ctrl + Enter 发送</span>
                              <el-button type="primary" @click="sendChatMessage" :loading="pmAiTyping">
                                <el-icon><Promotion /></el-icon>发送
                              </el-button>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    
                    <!-- 步骤内容区域（大纲生成和关联项目匹配步骤显示） -->
                    <div v-if="currentWriteSteps[pmWriteStepIndex]?.key !== 'generate'" class="pm-write-content">
                      <!-- 大纲生成步骤 -->
                      <div v-if="currentWriteSteps[pmWriteStepIndex]?.key === 'outline'" class="pm-write-step-content">
                        <div class="pm-write-body">
                          <!-- 左侧：大纲编辑 -->
                          <div class="pm-write-left">
                            <div class="pm-outline-header">
                              <h5><el-icon><List /></el-icon>大纲编辑</h5>
                              <div class="pm-outline-actions">
                                <el-button size="small" type="primary" @click="autoGenerateOutline">
                                  <el-icon><MagicStick /></el-icon>自动生成
                                </el-button>
                                <el-button size="small" @click="addOutlineItem(null)">
                                  <el-icon><Plus /></el-icon>添加章节
                                </el-button>
                              </div>
                            </div>
                            <div class="pm-outline-tree">
                              <el-tree
                                ref="outlineTreeRef"
                                :data="pmOutlineData"
                                node-key="id"
                                default-expand-all
                                draggable
                                :expand-on-click-node="false"
                              >
                                <template #default="{ node, data }">
                                  <div class="pm-outline-node">
                                    <span class="pm-outline-title">{{ data.title }}</span>
                                    <div class="pm-outline-node-actions">
                                      <el-button link size="small" @click.stop="editOutlineItem(data)">
                                        <el-icon><Edit /></el-icon>
                                      </el-button>
                                      <el-button link size="small" @click.stop="addOutlineItem(data)">
                                        <el-icon><Plus /></el-icon>
                                      </el-button>
                                      <el-button link size="small" type="danger" @click.stop="deleteOutlineItem(node, data)">
                                        <el-icon><Delete /></el-icon>
                                      </el-button>
                                    </div>
                                  </div>
                                </template>
                              </el-tree>
                            </div>
                          </div>
                          
                          <!-- 右侧：招标原文预览 -->
                          <div class="pm-write-right">
                            <div class="pm-preview-header">
                              <h5><el-icon><View /></el-icon>招标文件预览</h5>
                              <div class="pm-preview-tools">
                                <el-button size="small" :type="pmWritePreviewTranslated ? 'primary' : 'default'" @click="pmWritePreviewTranslated = !pmWritePreviewTranslated">
                                  <el-icon><Grid /></el-icon>
                                  {{ pmWritePreviewTranslated ? '显示原文' : '全文翻译' }}
                                </el-button>
                                <el-button-group style="margin-left: 8px;">
                                  <el-button size="small" @click="pmWritePreviewZoom = Math.max(0.5, pmWritePreviewZoom - 0.1)"><el-icon><ZoomOut /></el-icon></el-button>
                                  <el-button size="small" @click="pmWritePreviewZoom = Math.min(2, pmWritePreviewZoom + 0.1)"><el-icon><ZoomIn /></el-icon></el-button>
                                  <el-button size="small" @click="pmWritePreviewZoom = 1"><el-icon><Refresh /></el-icon></el-button>
                                </el-button-group>
                              </div>
                            </div>
                            <div class="pm-preview-content" :style="{ transform: `scale(${pmWritePreviewZoom})` }">
                              <div class="pm-preview-pages">
                                <div v-for="page in 3" :key="page" class="pm-preview-page">
                                  <div class="pm-page-number">第 {{ page }} 页</div>
                                  <div class="pm-page-content">
                                    <p class="pm-preview-text" v-html="getPmPageContent(page)"></p>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="pm-write-step-footer">
                          <el-button type="primary" @click="pmWriteStepIndex++">
                            下一步：关联项目匹配
                            <el-icon><Right /></el-icon>
                          </el-button>
                        </div>
                      </div>
                      
                      <!-- 材料智能匹配填充步骤 -->
                      <div v-else-if="currentWriteSteps[pmWriteStepIndex]?.key === 'match'" class="pm-write-step-content">
                        <div class="pm-material-match-container">
                          <!-- 头部标题 -->
                          <div class="pm-material-header">
                            <h4><el-icon><Link /></el-icon>材料智能匹配填充</h4>
                            <p>自动检索知识库中企业资质、财务报表等资料，自动提取并适应模板并填充全部信息</p>
                          </div>
                          
                          <!-- 筛选条件 -->
                          <div class="pm-material-filter">
                            <div class="pm-filter-label">
                              <el-icon><Filter /></el-icon>
                              应用资料范围
                            </div>
                            <div class="pm-filter-controls">
                              <el-select v-model="pmMaterialRegion" placeholder="选择地域" style="width: 140px;" clearable>
                                <el-option label="江西省" value="jiangxi" />
                                <el-option label="广东省" value="guangdong" />
                                <el-option label="浙江省" value="zhejiang" />
                              </el-select>
                              <el-select v-model="pmMaterialIndustry" placeholder="选择行业" style="width: 140px;" clearable>
                                <el-option label="智慧城市" value="smart_city" />
                                <el-option label="信息化" value="it" />
                                <el-option label="市政工程" value="municipal" />
                              </el-select>
                              <el-select v-model="pmMaterialYear" placeholder="选择年份" style="width: 140px;" clearable>
                                <el-option label="2024" value="2024" />
                                <el-option label="2023" value="2023" />
                                <el-option label="2022" value="2022" />
                              </el-select>
                              <el-button type="primary" plain @click="handleMaterialMatch">
                                <el-icon><Search /></el-icon>智能匹配
                              </el-button>
                              <el-button type="success" @click="handleMaterialApplyAll">
                                <el-icon><Check /></el-icon>一键应用
                              </el-button>
                            </div>
                          </div>
                          
                          <!-- 材料项列表 -->
                          <div class="pm-material-list">
                            <div class="pm-material-item" v-for="(item, idx) in pmMaterialItems" :key="idx">
                              <div class="pm-material-item-header">
                                <div class="pm-material-title">{{ idx + 1 }}. {{ item.title }}</div>
                                <div class="pm-material-actions">
                                  <el-button size="small" plain @click="handleItemMatch(item)">
                                    <el-icon><Search /></el-icon>智能匹配
                                  </el-button>
                                  <el-button size="small" plain @click="handleAddFile(item)">
                                    <el-icon><Plus /></el-icon>添加文件
                                  </el-button>
                                  <el-button size="small" type="success" @click="handleItemApply(item)">
                                    <el-icon><Check /></el-icon>一键应用
                                  </el-button>
                                </div>
                              </div>
                              <div class="pm-material-item-content">
                                <div v-if="item.files && item.files.length > 0" class="pm-material-files">
                                  <div class="pm-file-tag" v-for="(file, fIdx) in item.files" :key="fIdx">
                                    <span class="pm-file-tag-content" @click="previewMaterialFile(file)">
                                      <el-icon><Document /></el-icon>
                                      {{ file.name }}
                                    </span>
                                    <el-icon class="pm-file-close" @click.stop="removeFile(item, fIdx)"><Close /></el-icon>
                                  </div>
                                </div>
                                <div v-else class="pm-material-empty">
                                  暂无匹配材料，请点击"智能匹配"或"添加文件"
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                        
                        <!-- 底部按钮 -->
                        <div class="pm-write-step-footer pm-footer-between">
                          <el-button @click="pmWriteStepIndex--">
                            <el-icon><ArrowLeft /></el-icon>上一步
                          </el-button>
                          <el-button type="primary" @click="pmWriteStepIndex++">
                            下一步
                            <el-icon><Right /></el-icon>
                          </el-button>
                        </div>
                        
                        <!-- 添加文件弹窗 -->
                        <el-dialog v-model="pmAddFileDialogVisible" title="添加文件" width="700px">
                          <template #header>
                            <div class="pm-dialog-header">
                              <span>添加</span>
                              <span class="pm-dialog-subtitle">为"{{ pmCurrentMaterialItem?.title }}"选择文件</span>
                            </div>
                          </template>
                          <div class="pm-add-file-content">
                            <div class="pm-file-upload-area">
                              <el-upload
                                drag
                                action="#"
                                :auto-upload="false"
                                :on-change="handleMaterialFileUpload"
                              >
                                <el-icon class="pm-upload-icon"><Upload /></el-icon>
                                <div class="pm-upload-text">拖拽文件到此处或 <span class="pm-upload-link">点击上传</span></div>
                                <div class="pm-upload-tip">支持 PDF、Word、Excel、图片等格式，可同时上传多个文件</div>
                              </el-upload>
                            </div>
                            <div class="pm-file-filter">
                              <el-select v-model="pmFileFilterRegion" placeholder="地域" style="width: 100px;" size="small" clearable>
                                <el-option label="江西省" value="jiangxi" />
                              </el-select>
                              <el-select v-model="pmFileFilterIndustry" placeholder="行业" style="width: 100px;" size="small" clearable>
                                <el-option label="智慧城市" value="smart_city" />
                              </el-select>
                              <el-select v-model="pmFileFilterYear" placeholder="年份" style="width: 100px;" size="small" clearable>
                                <el-option label="2024" value="2024" />
                              </el-select>
                              <el-button type="primary" size="small">
                                <el-icon><Search /></el-icon>检索
                              </el-button>
                            </div>
                            <el-table :data="pmKnowledgeFiles" style="width: 100%;" max-height="300" @selection-change="handleMaterialFileSelect">
                              <el-table-column type="selection" width="40" />
                              <el-table-column label="文件名" prop="name" min-width="200">
                                <template #default="{ row }">
                                  <div class="pm-file-name-cell">
                                    <el-icon><Document /></el-icon>
                                    <span>{{ row.name }}</span>
                                  </div>
                                </template>
                              </el-table-column>
                              <el-table-column label="分类" prop="category" width="100">
                                <template #default="{ row }">
                                  <el-tag size="small" :type="row.categoryType">{{ row.category }}</el-tag>
                                </template>
                              </el-table-column>
                              <el-table-column label="地域" prop="region" width="80" />
                              <el-table-column label="年份" prop="year" width="60" />
                              <el-table-column label="操作" width="60">
                                <template #default="{ row }">
                                  <el-button link type="primary" size="small" @click="previewFile(row)">查阅</el-button>
                                </template>
                              </el-table-column>
                            </el-table>
                          </div>
                          <template #footer>
                            <el-button @click="pmAddFileDialogVisible = false">取消</el-button>
                            <el-button type="primary" @click="confirmAddMaterialFiles" :disabled="pmSelectedFiles.length === 0">
                              <el-icon><Plus /></el-icon>添加选中文件 ({{ pmSelectedFiles.length }})
                            </el-button>
                          </template>
                        </el-dialog>
                        
                        <!-- 文件预览弹窗 -->
                        <el-dialog v-model="pmFilePreviewVisible" :title="'预览: ' + (pmPreviewingFile?.name || '')" width="600px">
                          <div class="pm-file-preview-content">
                            <div class="pm-preview-meta">
                              <el-tag size="small" type="danger">{{ pmPreviewingFile?.fileType }}</el-tag>
                              <span>文件大小: {{ pmPreviewingFile?.fileSize }}</span>
                              <span>上传时间: {{ pmPreviewingFile?.uploadTime }}</span>
                            </div>
                            
                            <div v-if="pmPreviewingFile?.details" class="pm-preview-details">
                              <div class="pm-preview-icon">
                                <el-icon style="font-size: 48px; color: #ef4444;"><Document /></el-icon>
                              </div>
                              <h4 style="color: #ef4444; text-align: center;">{{ pmPreviewingFile.details.title }}</h4>
                              <div class="pm-preview-info-list">
                                <div v-if="pmPreviewingFile.details.code" class="pm-preview-info-item">
                                  <span class="pm-info-label">编号/代码：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.code }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.company" class="pm-preview-info-item">
                                  <span class="pm-info-label">企业名称：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.company }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.type" class="pm-preview-info-item">
                                  <span class="pm-info-label">类型：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.type }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.level" class="pm-preview-info-item">
                                  <span class="pm-info-label">资质等级：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.level }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.legalPerson" class="pm-preview-info-item">
                                  <span class="pm-info-label">法定代表人：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.legalPerson }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.capital" class="pm-preview-info-item">
                                  <span class="pm-info-label">注册资本：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.capital }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.establishDate" class="pm-preview-info-item">
                                  <span class="pm-info-label">成立日期：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.establishDate }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.issueDate" class="pm-preview-info-item">
                                  <span class="pm-info-label">发证日期：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.issueDate }}</span>
                                </div>
                                <div v-if="pmPreviewingFile.details.validPeriod" class="pm-preview-info-item">
                                  <span class="pm-info-label">有效期限：</span>
                                  <span class="pm-info-value">{{ pmPreviewingFile.details.validPeriod }}</span>
                                </div>
                              </div>
                            </div>
                            
                            <div v-else class="pm-preview-placeholder">
                              <el-icon style="font-size: 64px; color: #9ca3af;"><Document /></el-icon>
                              <p>{{ pmPreviewingFile?.name }}</p>
                              <p class="pm-preview-tip">文件预览功能开发中...</p>
                            </div>
                          </div>
                          <template #footer>
                            <el-button @click="pmFilePreviewVisible = false">关闭</el-button>
                            <el-button type="primary" @click="downloadMaterialFile">
                              <el-icon><Download /></el-icon>下载文件
                            </el-button>
                          </template>
                        </el-dialog>
                      </div>
                      
                      <!-- 技术项生成步骤（仅技术标） -->
                      <div v-else-if="currentWriteSteps[pmWriteStepIndex]?.key === 'techGen'" class="pm-write-step-content">
                        <div class="pm-tech-gen-container">
                          <div class="pm-tech-gen-header">
                            <h5><el-icon><Cpu /></el-icon>技术项内容生成</h5>
                            <p>根据大纲和匹配的项目，自动生成技术方案内容</p>
                          </div>
                          <div class="pm-tech-sections">
                            <div class="pm-tech-section" v-for="(section, idx) in pmTechSections" :key="idx">
                              <div class="pm-tech-section-header">
                                <span class="pm-tech-section-title">{{ section.title }}</span>
                                <el-tag :type="section.status === 'done' ? 'success' : section.status === 'generating' ? 'warning' : 'info'" size="small">
                                  {{ section.status === 'done' ? '已生成' : section.status === 'generating' ? '生成中' : '待生成' }}
                                </el-tag>
                              </div>
                              <div class="pm-tech-section-progress">
                                <el-progress :percentage="section.progress" :status="section.status === 'done' ? 'success' : ''"></el-progress>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="pm-write-step-footer">
                          <el-button @click="pmWriteStepIndex--">
                            <el-icon><ArrowLeft /></el-icon>上一步
                          </el-button>
                          <el-button type="primary" @click="pmWriteStepIndex++">
                            下一步：标书样式
                            <el-icon><Right /></el-icon>
                          </el-button>
                        </div>
                      </div>
                      
                      <!-- 标书样式步骤 -->
                      <div v-else-if="currentWriteSteps[pmWriteStepIndex]?.key === 'style'" class="pm-write-step-content">
                        <div class="pm-style-container">
                          <div class="pm-style-header">
                            <h5><el-icon><Setting /></el-icon>标书样式设置</h5>
                            <p>配置标书文档的字体、字号、对齐方式等格式规范</p>
                          </div>
                          
                          <!-- 标题层级样式 -->
                          <div class="pm-style-section">
                            <div class="pm-style-section-header">
                              <span class="pm-style-section-title">标题层级</span>
                              <el-button type="primary" size="small" @click="addTitleStyle">
                                <el-icon><Plus /></el-icon>添加
                              </el-button>
                            </div>
                            <el-table :data="pmTitleStyles" border size="small" class="pm-style-table">
                              <el-table-column prop="level" label="层级" width="160">
                                <template #default="{ row }">
                                  <el-input v-model="row.level" size="small" placeholder="请输入层级" />
                                </template>
                              </el-table-column>
                              <el-table-column prop="font" label="字体" width="120">
                                <template #default="{ row }">
                                  <el-select v-model="row.font" size="small">
                                    <el-option label="方正小标宋" value="方正小标宋" />
                                    <el-option label="黑体" value="黑体" />
                                    <el-option label="宋体" value="宋体" />
                                    <el-option label="仿宋" value="仿宋" />
                                    <el-option label="仿宋_GB2312" value="仿宋_GB2312" />
                                    <el-option label="楷体" value="楷体" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="size" label="字号" width="100">
                                <template #default="{ row }">
                                  <el-select v-model="row.size" size="small">
                                    <el-option label="一号" value="一号" />
                                    <el-option label="小一" value="小一" />
                                    <el-option label="二号" value="二号" />
                                    <el-option label="小二" value="小二" />
                                    <el-option label="三号" value="三号" />
                                    <el-option label="小三" value="小三" />
                                    <el-option label="四号" value="四号" />
                                    <el-option label="小四" value="小四" />
                                    <el-option label="五号" value="五号" />
                                    <el-option label="小五" value="小五" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="align" label="对齐" width="100">
                                <template #default="{ row }">
                                  <el-select v-model="row.align" size="small">
                                    <el-option label="居中" value="居中" />
                                    <el-option label="左对齐" value="左对齐" />
                                    <el-option label="右对齐" value="右对齐" />
                                    <el-option label="两端对齐" value="两端对齐" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="bold" label="加粗" width="80">
                                <template #default="{ row }">
                                  <el-select v-model="row.bold" size="small">
                                    <el-option label="是" value="是" />
                                    <el-option label="否" value="否" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="special" label="特殊格式" min-width="140">
                                <template #default="{ row }">
                                  <el-input v-model="row.special" size="small" placeholder="特殊格式" />
                                </template>
                              </el-table-column>
                              <el-table-column label="操作" width="60" align="center">
                                <template #default="{ $index }">
                                  <el-button type="danger" size="small" link @click="removeTitleStyle($index)">
                                    <el-icon><Delete /></el-icon>
                                  </el-button>
                                </template>
                              </el-table-column>
                            </el-table>
                          </div>
                          
                          <!-- 正文内容样式 -->
                          <div class="pm-style-section">
                            <div class="pm-style-section-header">
                              <span class="pm-style-section-title">正文内容</span>
                              <el-button type="primary" size="small" @click="addContentStyle">
                                <el-icon><Plus /></el-icon>添加
                              </el-button>
                            </div>
                            <el-table :data="pmContentStyles" border size="small" class="pm-style-table">
                              <el-table-column prop="type" label="内容类型" width="120">
                                <template #default="{ row }">
                                  <el-input v-model="row.type" size="small" placeholder="请输入类型" />
                                </template>
                              </el-table-column>
                              <el-table-column prop="font" label="字体" width="120">
                                <template #default="{ row }">
                                  <el-select v-model="row.font" size="small">
                                    <el-option label="方正小标宋" value="方正小标宋" />
                                    <el-option label="黑体" value="黑体" />
                                    <el-option label="宋体" value="宋体" />
                                    <el-option label="仿宋" value="仿宋" />
                                    <el-option label="仿宋_GB2312" value="仿宋_GB2312" />
                                    <el-option label="楷体" value="楷体" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="size" label="字号" width="100">
                                <template #default="{ row }">
                                  <el-select v-model="row.size" size="small">
                                    <el-option label="四号" value="四号" />
                                    <el-option label="小四" value="小四" />
                                    <el-option label="五号" value="五号" />
                                    <el-option label="小五" value="小五" />
                                    <el-option label="六号" value="六号" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="align" label="对齐" width="100">
                                <template #default="{ row }">
                                  <el-select v-model="row.align" size="small">
                                    <el-option label="居中" value="居中" />
                                    <el-option label="左对齐" value="左对齐" />
                                    <el-option label="右对齐" value="右对齐" />
                                    <el-option label="两端对齐" value="两端对齐" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="bold" label="加粗" width="80">
                                <template #default="{ row }">
                                  <el-select v-model="row.bold" size="small">
                                    <el-option label="是" value="是" />
                                    <el-option label="否" value="否" />
                                  </el-select>
                                </template>
                              </el-table-column>
                              <el-table-column prop="special" label="特殊格式" min-width="140">
                                <template #default="{ row }">
                                  <el-input v-model="row.special" size="small" placeholder="特殊格式" />
                                </template>
                              </el-table-column>
                              <el-table-column label="操作" width="60" align="center">
                                <template #default="{ $index }">
                                  <el-button type="danger" size="small" link @click="removeContentStyle($index)">
                                    <el-icon><Delete /></el-icon>
                                  </el-button>
                                </template>
                              </el-table-column>
                            </el-table>
                          </div>
                        </div>
                        <div class="pm-write-step-footer">
                          <el-button @click="pmWriteStepIndex--">
                            <el-icon><ArrowLeft /></el-icon>上一步
                          </el-button>
                          <el-button type="primary" @click="pmWriteStepIndex++">
                            下一步：标书生成
                            <el-icon><Right /></el-icon>
                          </el-button>
                        </div>
                      </div>
                      
                      <!-- 标书生成步骤 -->
                      <div v-else-if="currentWriteSteps[pmWriteStepIndex]?.key === 'generate'" class="pm-write-step-content">
                        <div class="pm-generate-container">
                          <div class="pm-generate-header">
                            <h5><el-icon><Document /></el-icon>标书文件生成</h5>
                            <p>系统正在整合所有内容，生成完整的标书文件</p>
                          </div>
                          <div class="pm-generate-preview">
                            <div class="pm-generate-doc">
                              <el-icon class="pm-doc-icon"><Document /></el-icon>
                              <div class="pm-doc-info">
                                <span class="pm-doc-name">{{ pmWriteType === 'business' ? '商务标书' : '技术标书' }}_智慧园区项目.docx</span>
                                <span class="pm-doc-size">预计大小：2.5MB</span>
                              </div>
                            </div>
                            <div class="pm-generate-actions">
                              <el-button type="primary" @click="generateDocument">
                                <el-icon><Download /></el-icon>生成并下载
                              </el-button>
                              <el-button @click="previewDocument">
                                <el-icon><View /></el-icon>在线预览
                              </el-button>
                            </div>
                          </div>
                        </div>
                        <div class="pm-write-step-footer">
                          <el-button @click="pmWriteStepIndex--">
                            <el-icon><ArrowLeft /></el-icon>上一步
                          </el-button>
                          <el-button type="success" @click="completeWriteStep">
                            <el-icon><Check /></el-icon>完成并进入下一阶段
                          </el-button>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                
                <!-- 开标步骤 -->
                <div v-else-if="currentStepIndex === 3" class="pm-step-bid-opening">
                  <div class="pm-bid-opening-card">
                    <!-- 顶部：开标时间和状态 -->
                    <div class="pm-bid-opening-header">
                      <div class="pm-bid-time-info">
                        <div class="pm-bid-time-label">
                          <el-icon><Clock /></el-icon>
                          <span>开标时间</span>
                        </div>
                        <div class="pm-bid-time-value">{{ bidOpeningInfo.openTime }}</div>
                      </div>
                      <div class="pm-bid-status">
                        <el-tag 
                          :type="bidOpeningInfo.status === 'completed' ? 'success' : bidOpeningInfo.status === 'ongoing' ? 'warning' : 'info'" 
                          size="large"
                        >
                          <el-icon v-if="bidOpeningInfo.status === 'waiting'"><Clock /></el-icon>
                          <el-icon v-else-if="bidOpeningInfo.status === 'ongoing'"><Loading /></el-icon>
                          <el-icon v-else><Check /></el-icon>
                          {{ bidOpeningInfo.status === 'completed' ? '已开标' : bidOpeningInfo.status === 'ongoing' ? '开标进行中' : '等待开标' }}
                          <span v-if="bidOpeningInfo.status === 'waiting'" class="countdown">({{ bidOpeningCountdown }})</span>
                        </el-tag>
                      </div>
                    </div>
                    
                    <!-- 中部：开标信息 -->
                    <div class="pm-bid-opening-info">
                      <div class="pm-bid-info-item">
                        <div class="pm-bid-info-icon location">
                          <el-icon><OfficeBuilding /></el-icon>
                        </div>
                        <div class="pm-bid-info-content">
                          <span class="label">开标地点</span>
                          <span class="value">{{ bidOpeningInfo.location }}</span>
                        </div>
                      </div>
                      <div class="pm-bid-info-item">
                        <div class="pm-bid-info-icon online">
                          <el-icon><Link /></el-icon>
                        </div>
                        <div class="pm-bid-info-content">
                          <span class="label">线上参会</span>
                          <a class="value link" :href="bidOpeningInfo.onlineLink" target="_blank">{{ bidOpeningInfo.onlineLink }}</a>
                        </div>
                      </div>
                      <div class="pm-bid-info-item">
                        <div class="pm-bid-info-icon person">
                          <el-icon><User /></el-icon>
                        </div>
                        <div class="pm-bid-info-content">
                          <span class="label">我方代表</span>
                          <span class="value">
                            {{ bidOpeningInfo.representative }}
                            <el-tag v-if="bidOpeningInfo.authUploaded" type="success" size="small">授权委托书已上传</el-tag>
                            <el-tag v-else type="danger" size="small">授权委托书未上传</el-tag>
                          </span>
                        </div>
                      </div>
                    </div>
                    
                    <!-- 底部：开标结果（开标完成后显示） -->
                    <div v-if="bidOpeningInfo.status === 'completed'" class="pm-bid-opening-result">
                      <div class="pm-bid-result-header">
                        <h4>
                          <el-icon><TrendCharts /></el-icon>
                          开标结果
                        </h4>
                        <el-button type="primary" text>
                          <el-icon><Download /></el-icon>
                          下载开标记录
                        </el-button>
                      </div>
                      <el-table :data="bidOpeningInfo.results" stripe style="width: 100%">
                        <el-table-column prop="company" label="投标单位" min-width="200">
                          <template #default="{ row }">
                            <span :class="{ 'our-company': row.isOur }">
                              {{ row.company }}
                              <el-tag v-if="row.isOur" type="primary" size="small">我方</el-tag>
                            </span>
                          </template>
                        </el-table-column>
                        <el-table-column prop="price" label="投标报价" width="150">
                          <template #default="{ row }">
                            <span class="price">￥{{ row.price }}</span>
                          </template>
                        </el-table-column>
                        <el-table-column prop="status" label="状态" width="120">
                          <template #default="{ row }">
                            <el-tag :type="row.status === 'valid' ? 'success' : 'danger'" size="small">
                              <el-icon v-if="row.status === 'valid'"><CircleCheck /></el-icon>
                              <el-icon v-else><CircleClose /></el-icon>
                              {{ row.status === 'valid' ? '有效' : '废标' }}
                            </el-tag>
                          </template>
                        </el-table-column>
                      </el-table>
                    </div>
                    
                    <!-- 等待开标时的提示 -->
                    <div v-else class="pm-bid-waiting-tip">
                      <el-icon><InfoFilled /></el-icon>
                      <span>开标结果将在开标完成后显示</span>
                    </div>
                  </div>
                </div>
                
                <!-- 结果公示步骤 -->
                <div v-else-if="currentStepIndex === 4" class="pm-step-result-announcement">
                  <div class="pm-result-card">
                    <!-- 顶部状态栏 -->
                    <div class="pm-result-header">
                      <div class="pm-result-title">
                        <el-icon><Document /></el-icon>
                        <span>公示信息录入</span>
                      </div>
                      <el-tag :type="resultAnnouncementInfo.result ? 'success' : 'info'" size="large">
                        {{ resultAnnouncementInfo.result ? '已录入' : '待录入' }}
                      </el-tag>
                    </div>
                    
                    <!-- 基础信息录入 -->
                    <div class="pm-result-section">
                      <div class="pm-result-section-title">
                        <el-icon><EditPen /></el-icon>
                        <span>基础信息</span>
                      </div>
                      <div class="pm-result-form">
                        <el-form label-width="100px" label-position="left">
                          <el-row :gutter="20">
                            <el-col :span="12">
                              <el-form-item label="公示发布日期">
                                <el-date-picker 
                                  v-model="resultAnnouncementInfo.publishDate" 
                                  type="date" 
                                  placeholder="选择日期"
                                  style="width: 100%"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="12">
                              <el-form-item label="公示截止日期">
                                <el-date-picker 
                                  v-model="resultAnnouncementInfo.endDate" 
                                  type="date" 
                                  placeholder="选择日期"
                                  style="width: 100%"
                                />
                              </el-form-item>
                            </el-col>
                          </el-row>
                          <el-form-item label="中标结果">
                            <el-radio-group v-model="resultAnnouncementInfo.result">
                              <el-radio value="win">中标</el-radio>
                              <el-radio value="lose">未中标</el-radio>
                              <el-radio value="invalid">废标</el-radio>
                            </el-radio-group>
                          </el-form-item>
                          <el-row :gutter="20">
                            <el-col :span="12">
                              <el-form-item label="中标单位">
                                <el-input v-model="resultAnnouncementInfo.winnerCompany" placeholder="请输入中标单位名称" />
                              </el-form-item>
                            </el-col>
                            <el-col :span="12">
                              <el-form-item label="中标金额">
                                <el-input v-model="resultAnnouncementInfo.winnerAmount" placeholder="请输入">
                                  <template #append>万元</template>
                                </el-input>
                              </el-form-item>
                            </el-col>
                          </el-row>
                          <el-row :gutter="20">
                            <el-col :span="12">
                              <el-form-item label="我方投标金额">
                                <el-input v-model="resultAnnouncementInfo.ourAmount" placeholder="请输入">
                                  <template #append>万元</template>
                                </el-input>
                              </el-form-item>
                            </el-col>
                            <el-col :span="6">
                              <el-form-item label="我方排名">
                                <el-input v-model="resultAnnouncementInfo.ourRank" placeholder="第几名" />
                              </el-form-item>
                            </el-col>
                            <el-col :span="6">
                              <el-form-item label="投标单位数">
                                <el-input v-model="resultAnnouncementInfo.totalBidders" placeholder="共几家" />
                              </el-form-item>
                            </el-col>
                          </el-row>
                        </el-form>
                      </div>
                    </div>
                    
                    <!-- 评分信息 -->
                    <div class="pm-result-section">
                      <div class="pm-result-section-title">
                        <el-icon><DataLine /></el-icon>
                        <span>评分信息</span>
                        <span class="pm-section-tip">（选填，如有评分明细）</span>
                      </div>
                      <div class="pm-result-score-table">
                        <el-table :data="resultAnnouncementInfo.scoreItems" border style="width: 100%">
                          <el-table-column label="评分项" min-width="150">
                            <template #default="{ row }">
                              <el-input v-model="row.name" placeholder="评分项名称" size="small" />
                            </template>
                          </el-table-column>
                          <el-table-column label="满分" width="100">
                            <template #default="{ row }">
                              <el-input-number v-model="row.fullScore" :min="0" :max="100" size="small" controls-position="right" style="width: 100%" />
                            </template>
                          </el-table-column>
                          <el-table-column label="我方得分" width="100">
                            <template #default="{ row }">
                              <el-input-number v-model="row.ourScore" :min="0" :max="100" size="small" controls-position="right" style="width: 100%" />
                            </template>
                          </el-table-column>
                          <el-table-column label="中标方得分" width="100">
                            <template #default="{ row }">
                              <el-input-number v-model="row.winnerScore" :min="0" :max="100" size="small" controls-position="right" style="width: 100%" />
                            </template>
                          </el-table-column>
                          <el-table-column label="操作" width="60" align="center">
                            <template #default="{ $index }">
                              <el-button type="danger" link size="small" @click="removeScoreItem($index)">
                                <el-icon><Delete /></el-icon>
                              </el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                        <div class="pm-score-footer">
                          <el-button type="primary" link @click="addScoreItem">
                            <el-icon><Plus /></el-icon>添加评分项
                          </el-button>
                          <div class="pm-score-total">
                            <span>合计：</span>
                            <span class="total-item">满分 <strong>{{ calculateTotalScore.fullScore }}</strong></span>
                            <span class="total-item">我方 <strong class="our">{{ calculateTotalScore.ourScore }}</strong></span>
                            <span class="total-item">中标方 <strong class="winner">{{ calculateTotalScore.winnerScore }}</strong></span>
                          </div>
                        </div>
                      </div>
                    </div>
                    
                    <!-- 附件上传 -->
                    <div class="pm-result-section">
                      <div class="pm-result-section-title">
                        <el-icon><Folder /></el-icon>
                        <span>附件上传</span>
                      </div>
                      <div class="pm-result-upload">
                        <el-upload
                          drag
                          multiple
                          action="#"
                          :auto-upload="false"
                        >
                          <el-icon class="el-icon--upload"><Upload /></el-icon>
                          <div class="el-upload__text">拖拽文件到此处，或<em>点击上传</em></div>
                          <template #tip>
                            <div class="el-upload__tip">支持上传中标公告、评标报告等文件</div>
                          </template>
                        </el-upload>
                      </div>
                    </div>
                    
                    <!-- 补充说明 -->
                    <div class="pm-result-section">
                      <div class="pm-result-section-title">
                        <el-icon><ChatDotRound /></el-icon>
                        <span>补充说明</span>
                      </div>
                      <div class="pm-result-remarks">
                        <el-input
                          v-model="resultAnnouncementInfo.remarks"
                          type="textarea"
                          :rows="4"
                          placeholder="请输入项目相关的补充信息，如评标现场反馈、专家意见、竞争对手优势等，AI将基于这些信息生成分析报告..."
                        />
                      </div>
                    </div>
                    
                    <!-- 操作按钮 -->
                    <div class="pm-result-actions">
                      <el-button @click="saveResultAnnouncement">
                        <el-icon><Folder /></el-icon>保存信息
                      </el-button>
                      <el-button 
                        type="primary" 
                        @click="generateAIReport"
                        :loading="resultAnnouncementInfo.aiReportGenerating"
                        :disabled="!resultAnnouncementInfo.result"
                      >
                        <el-icon><MagicStick /></el-icon>AI生成分析报告
                      </el-button>
                    </div>
                    
                    <!-- AI分析报告 -->
                    <div v-if="resultAnnouncementInfo.aiReport" class="pm-result-ai-report">
                      <div class="pm-ai-report-header">
                        <h4>
                          <el-icon><MagicStick /></el-icon>
                          AI分析报告
                        </h4>
                        <span class="pm-report-time">生成时间：{{ resultAnnouncementInfo.aiReport.generatedTime }}</span>
                      </div>
                      
                      <div class="pm-ai-report-section">
                        <div class="pm-report-subtitle">📊 结果概述</div>
                        <p class="pm-report-summary">{{ resultAnnouncementInfo.aiReport.summary }}</p>
                      </div>
                      
                      <div class="pm-ai-report-section">
                        <div class="pm-report-subtitle">{{ resultAnnouncementInfo.result === 'win' ? '🏆 中标原因分析' : '🔍 失分原因分析' }}</div>
                        <div class="pm-report-reasons">
                          <div v-for="(reason, idx) in resultAnnouncementInfo.aiReport.reasons" :key="idx" class="pm-reason-item">
                            <div class="pm-reason-title">
                              <span>{{ reason.title }}</span>
                              <el-tag v-if="reason.score" :type="reason.score < 0 ? 'danger' : 'success'" size="small">
                                {{ reason.score > 0 ? '+' : '' }}{{ reason.score }}分
                              </el-tag>
                            </div>
                            <p class="pm-reason-content">{{ reason.content }}</p>
                          </div>
                        </div>
                      </div>
                      
                      <div class="pm-ai-report-section">
                        <div class="pm-report-subtitle">💡 {{ resultAnnouncementInfo.result === 'win' ? '后续建议' : '改进建议' }}</div>
                        <ul class="pm-report-suggestions">
                          <li v-for="(suggestion, idx) in resultAnnouncementInfo.aiReport.suggestions" :key="idx">
                            {{ suggestion }}
                          </li>
                        </ul>
                      </div>
                      
                      <div class="pm-ai-report-actions">
                        <el-button type="primary" text>
                          <el-icon><DocumentCopy /></el-icon>复制报告
                        </el-button>
                        <el-button type="primary" text>
                          <el-icon><Download /></el-icon>导出PDF
                        </el-button>
                        <el-button type="primary" text>
                          <el-icon><Folder /></el-icon>存入项目档案
                        </el-button>
                      </div>
                    </div>
                  </div>
                </div>
                
                <!-- 其他步骤 -->
                <div v-else class="pm-step-detail-card">
                  <div class="pm-step-detail-header">
                    <h4>{{ pmProjectSteps[currentStepIndex]?.title || '招标信息提取' }}</h4>
                    <el-tag :type="getStepTagType(currentStepIndex)" size="small">
                      {{ getStepTagText(currentStepIndex) }}
                    </el-tag>
                  </div>
                  <div class="pm-step-detail-content">
                    <p class="pm-step-desc">{{ pmProjectSteps[currentStepIndex]?.detail || '' }}</p>
                    <div class="pm-step-actions">
                      <el-button 
                        v-if="currentStepIndex === getPmActiveStep(selectedPmProject.progress)" 
                        type="primary" 
                        @click="handleEnterStep(currentStepIndex)"
                      >
                        <el-icon><Right /></el-icon>
                        进入该步骤
                      </el-button>
                      <el-button 
                        v-else-if="currentStepIndex < getPmActiveStep(selectedPmProject.progress)" 
                        type="success" 
                        plain
                      >
                        <el-icon><Check /></el-icon>
                        已完成
                      </el-button>
                      <el-button 
                        v-else 
                        type="info" 
                        plain
                        disabled
                      >
                        <el-icon><Clock /></el-icon>
                        待开始
                      </el-button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 新建项目弹窗 -->
        <el-dialog 
          v-model="showPmCreateDialog" 
          title="新建项目" 
          width="500px"
          :close-on-click-modal="false"
        >
          <el-form :model="newPmProject" label-width="100px" label-position="top">
            <el-form-item label="项目名称" required>
              <el-input 
                v-model="newPmProject.name" 
                placeholder="请输入项目名称"
                maxlength="50"
                show-word-limit
              />
            </el-form-item>
            <el-form-item label="项目编号">
              <el-input 
                v-model="newPmProject.projectNo" 
                placeholder="留空则自动生成"
              />
            </el-form-item>
            <el-form-item label="招标单位" required>
              <el-input 
                v-model="newPmProject.tenderUnit" 
                placeholder="请输入招标单位名称"
              />
            </el-form-item>
            <el-form-item label="预算金额">
              <el-input 
                v-model="newPmProject.budget" 
                placeholder="请输入预算金额"
              >
                <template #append>万元</template>
              </el-input>
            </el-form-item>
            <el-form-item label="投标截止时间" required>
              <el-date-picker 
                v-model="newPmProject.deadline" 
                type="date" 
                placeholder="选择截止日期"
                style="width: 100%"
                value-format="YYYY-MM-DD"
              />
            </el-form-item>
          </el-form>
          <template #footer>
            <el-button @click="showPmCreateDialog = false">取消</el-button>
            <el-button type="primary" @click="createPmProject">创建项目</el-button>
          </template>
        </el-dialog>

        <!-- 新项目管理 - 已完结项目 -->
        <div v-if="activeNav === 'pm-completed'" class="panel pm-completed-panel">
          <div class="panel-header">
            <h3>已完结项目</h3>
            <div class="header-actions">
              <el-input 
                v-model="pmProjectSearch" 
                placeholder="搜索项目名称..." 
                style="width: 200px; margin-right: 12px;"
                clearable
              >
                <template #prefix>
                  <el-icon><Search /></el-icon>
                </template>
              </el-input>
              <el-select v-model="pmResultFilter" placeholder="筛选结果" style="width: 120px;" clearable>
                <el-option label="全部" value="" />
                <el-option label="中标" value="中标" />
                <el-option label="未中标" value="未中标" />
              </el-select>
            </div>
          </div>
          
          <!-- 统计概览 -->
          <div class="pm-completed-stats">
            <div class="pm-stat-card">
              <div class="pm-stat-icon total">
                <el-icon><Folder /></el-icon>
              </div>
              <div class="pm-stat-info">
                <span class="pm-stat-value">{{ completedProjectStats.total }}</span>
                <span class="pm-stat-label">总项目数</span>
              </div>
            </div>
            <div class="pm-stat-card">
              <div class="pm-stat-icon won">
                <el-icon><Trophy /></el-icon>
              </div>
              <div class="pm-stat-info">
                <span class="pm-stat-value won">{{ completedProjectStats.won }}</span>
                <span class="pm-stat-label">中标项目</span>
              </div>
            </div>
            <div class="pm-stat-card">
              <div class="pm-stat-icon lost">
                <el-icon><CircleClose /></el-icon>
              </div>
              <div class="pm-stat-info">
                <span class="pm-stat-value lost">{{ completedProjectStats.lost }}</span>
                <span class="pm-stat-label">未中标</span>
              </div>
            </div>
            <div class="pm-stat-card">
              <div class="pm-stat-icon rate">
                <el-icon><TrendCharts /></el-icon>
              </div>
              <div class="pm-stat-info">
                <span class="pm-stat-value rate">{{ completedProjectStats.rate }}%</span>
                <span class="pm-stat-label">中标率</span>
              </div>
            </div>
          </div>
          
          <!-- 项目卡片列表 -->
          <div class="pm-completed-cards">
            <div 
              v-for="project in filteredCompletedProjects" 
              :key="project.id" 
              class="pm-completed-card"
              :class="{ won: project.result === '中标', lost: project.result === '未中标' }"
            >
              <!-- 卡片头部 -->
              <div class="pm-completed-card-header">
                <el-tag :type="project.result === '中标' ? 'success' : 'danger'" size="large">
                  <el-icon v-if="project.result === '中标'"><Trophy /></el-icon>
                  <el-icon v-else><CircleClose /></el-icon>
                  {{ project.result }}
                </el-tag>
                <h4 class="pm-completed-card-title">{{ project.name }}</h4>
              </div>
              
              <!-- 卡片内容 -->
              <div class="pm-completed-card-body">
                <div class="pm-completed-info-grid">
                  <div class="pm-completed-info-item">
                    <span class="label">招标单位</span>
                    <span class="value">{{ project.client }}</span>
                  </div>
                  <div class="pm-completed-info-item">
                    <span class="label">项目预算</span>
                    <span class="value">￥{{ project.budget }}</span>
                  </div>
                  <div class="pm-completed-info-item">
                    <span class="label">{{ project.result === '中标' ? '中标金额' : '我方报价' }}</span>
                    <span class="value amount">￥{{ project.ourAmount }}</span>
                  </div>
                  <div class="pm-completed-info-item">
                    <span class="label">完结时间</span>
                    <span class="value">{{ project.completeTime }}</span>
                  </div>
                  <div class="pm-completed-info-item">
                    <span class="label">我方排名</span>
                    <span class="value">第{{ project.ourRank }}名 / 共{{ project.totalBidders }}家</span>
                  </div>
                  <div v-if="project.result === '未中标' && project.failReason" class="pm-completed-info-item full-width">
                    <span class="label">失标原因</span>
                    <span class="value fail-reason">{{ project.failReason }}</span>
                  </div>
                </div>
              </div>
              
              <!-- 卡片底部 -->
              <div class="pm-completed-card-footer">
                <el-button type="primary" text @click="viewPmProjectDetail(project)">
                  <el-icon><Folder /></el-icon>查看档案
                </el-button>
                <el-button type="primary" text>
                  <el-icon><DataLine /></el-icon>分析报告
                </el-button>
                <el-button text @click="exportPmProject(project)">
                  <el-icon><Download /></el-icon>导出资料
                </el-button>
              </div>
            </div>
            
            <!-- 空状态 -->
            <div v-if="filteredCompletedProjects.length === 0" class="pm-empty-state">
              <el-empty description="暂无已完结项目" />
            </div>
          </div>
        </div>

        <!-- 步骤详情页面 -->
        <div v-if="activeNav === 'step-detail' && currentStepDetail && currentStepProject" class="panel">
          <div class="step-detail-container">
            <!-- 返回按钮 -->
            <div class="detail-header">
              <el-button @click="backToProjectDetail" link>
                <el-icon><ArrowLeft /></el-icon>
                返回项目详情
              </el-button>
            </div>

            <!-- 项目信息 -->
            <div class="step-project-info">
              <h2>{{ currentStepProject.name }}</h2>
              <div class="project-meta">
                <span>创建时间：{{ currentStepProject.createTime }}</span>
                <el-tag :type="getProgressTagType(currentStepProject.progress)" size="small">
                  {{ currentStepProject.progress }}
                </el-tag>
              </div>
            </div>

            <!-- 流程条 -->
            <div class="project-timeline">
              <h3>项目流程</h3>
              <el-steps :active="getActiveStep(currentStepProject.progress)" align-center>
                <el-step 
                  v-for="(step, index) in projectSteps" 
                  :key="index"
                  :title="step.title"
                  :status="getStepStatus(currentStepProject.progress, step.key)"
                  class="clickable-step"
                  @click="viewStepDetail(step, currentStepProject)"
                >
                  <template #icon>
                    <el-icon v-if="getStepStatus(currentStepProject.progress, step.key) === 'finish'">
                      <CircleCheck />
                    </el-icon>
                    <el-icon v-else-if="getStepStatus(currentStepProject.progress, step.key) === 'process'">
                      <Loading />
                    </el-icon>
                    <span v-else>{{ index + 1 }}</span>
                  </template>
                </el-step>
              </el-steps>
            </div>

            <!-- 当前步骤的功能内容 -->
            <div class="step-function-content">
              <!-- 招标信息提取 (get-file) -->
              <div v-if="currentStepDetail.key === 'get-file'" class="step-content">
                <div class="panel-header">
                  <h3>{{ currentStepDetail.title }}</h3>
                  <div class="header-actions" v-if="biddingFileData">
                    <el-button type="primary" @click="createProjectFromRecognition">
                      <el-icon><Plus /></el-icon>
                      新建项目
                    </el-button>
                    <el-button @click="exportExtractedInfo">
                      <el-icon><Download /></el-icon>
                      导出提取信息
                    </el-button>
                  </div>
                </div>

                <!-- 未上传文件时的上传区域 -->
                <div v-if="!biddingFileData" class="upload-area-container">
                  <el-upload
                    :auto-upload="false"
                    :on-change="handleBiddingFileUpload"
                    :show-file-list="false"
                    accept=".pdf,.doc,.docx,.xls,.xlsx"
                    class="full-upload"
                    drag
                  >
                    <div class="upload-box">
                      <el-icon class="upload-plus-icon"><Plus /></el-icon>
                      <p class="upload-title">上传招标文件</p>
                      <p class="upload-hint">支持格式：PDF、Word、Excel</p>
                    </div>
                  </el-upload>
                </div>

                <!-- 已上传文件后的双栏布局 -->
                <div v-else class="file-recognition-layout">
                  <!-- 左侧：招标信息提取 -->
                  <div class="extraction-panel">
                    <div class="section-header">
                      <h4>招标信息提取</h4>
                      <div class="recognition-status">
                        <el-icon color="#10b981"><CircleCheck /></el-icon>
                        <span>识别完成</span>
                      </div>
                    </div>

                    <!-- 商务关键信息 -->
                    <div class="info-section">
                      <div class="section-title">
                        <el-icon><Document /></el-icon>
                        商务关键信息
                      </div>
                      <el-table :data="businessKeyInfo" border stripe>
                        <el-table-column prop="field" label="信息项" width="150" />
                        <el-table-column prop="content" label="信息内容" min-width="200" />
                        <el-table-column prop="source" label="提取来源" width="150">
                          <template #default="{ row }">
                            <el-link type="primary" @click="locateInPreview(row.pageNum, row.lineNum)">
                              第{{ row.pageNum }}页 第{{ row.lineNum }}行
                            </el-link>
                          </template>
                        </el-table-column>
                        <el-table-column label="AI核实分析" width="220">
                          <template #default="{ row }">
                            <div :class="['verify-status', `status-${row.verifyStatus}`]">
                              <el-icon v-if="row.verifyStatus === 'no-need'"><Check /></el-icon>
                              <el-icon v-else-if="row.verifyStatus === 'need'"><Warning /></el-icon>
                              <el-icon v-else><Close /></el-icon>
                              <span>{{ getVerifyStatusText(row.verifyStatus) }}</span>
                            </div>
                          </template>
                        </el-table-column>
                      </el-table>
                    </div>

                    <!-- 技术关键信息 -->
                    <div class="info-section">
                      <div class="section-title">
                        <el-icon><MagicStick /></el-icon>
                        技术关键信息
                      </div>
                      <el-table :data="techKeyInfo" border stripe>
                        <el-table-column prop="field" label="信息项" width="150" />
                        <el-table-column prop="content" label="信息内容" min-width="200" />
                        <el-table-column prop="source" label="提取来源" width="150">
                          <template #default="{ row }">
                            <el-link type="primary" @click="locateInPreview(row.pageNum, row.lineNum)">
                              第{{ row.pageNum }}页 第{{ row.lineNum }}行
                            </el-link>
                          </template>
                        </el-table-column>
                        <el-table-column label="AI核实分析" width="220">
                          <template #default="{ row }">
                            <div :class="['verify-status', `status-${row.verifyStatus}`]">
                              <el-icon v-if="row.verifyStatus === 'no-need'"><Check /></el-icon>
                              <el-icon v-else-if="row.verifyStatus === 'need'"><Warning /></el-icon>
                              <el-icon v-else><Close /></el-icon>
                              <span>{{ getVerifyStatusText(row.verifyStatus) }}</span>
                            </div>
                          </template>
                        </el-table-column>
                      </el-table>
                    </div>
                  </div>

                  <!-- 右侧：原文预览 -->
                  <div class="preview-panel">
                    <div class="preview-header">
                      <h4>原文预览</h4>
                      <div class="preview-tools">
                        <el-button 
                          size="small" 
                          :type="isTranslated ? 'primary' : 'default'"
                          @click="toggleTranslation"
                          :loading="translatingDocument"
                        >
                          <el-icon><Grid /></el-icon>
                          {{ isTranslated ? '显示原文' : '翻译全文' }}
                        </el-button>
                        <el-button-group style="margin-left: 8px;">
                          <el-button size="small" @click="zoomOut">
                            <el-icon><ZoomOut /></el-icon>
                          </el-button>
                          <el-button size="small" @click="zoomIn">
                            <el-icon><ZoomIn /></el-icon>
                          </el-button>
                          <el-button size="small" @click="resetZoom">
                            <el-icon><Refresh /></el-icon>
                          </el-button>
                        </el-button-group>
                      </div>
                    </div>
                    <div class="preview-content" ref="previewContentRef" :style="{ transform: `scale(${previewZoom})` }">
                      <div class="file-info-bar">
                        <span>文件名：{{ biddingFileData.name }}</span>
                        <span>页数：{{ biddingFileData.pages }} 页</span>
                      </div>
                      <div class="preview-pages">
                        <div 
                          v-for="page in biddingFileData.pages" 
                          :key="page" 
                          :id="`page-${page}`"
                          class="preview-page"
                        >
                          <div class="page-number">第 {{ page }} 页</div>
                          <div class="page-content">
                            <p class="preview-text" v-html="getPageContentWithLines(page)"></p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 文件提交步骤 -->
              <div v-else-if="currentStepDetail.key === 'submit'" class="step-content">
                <FileSubmission :project="currentStepProject" @update="handleProjectUpdate" />
              </div>

              <!-- 开标步骤 -->
              <div v-else-if="currentStepDetail.key === 'open-bid'" class="step-content">
                <BiddingInfo :project="currentStepProject" @update="handleProjectUpdate" />
              </div>

              <!-- 结果公示步骤 -->
              <div v-else-if="currentStepDetail.key === 'result'" class="step-content">
                <ResultAnnouncement :project="currentStepProject" @update="handleProjectUpdate" />
              </div>

              <!-- 其他步骤的占位内容 -->
              <div v-else class="step-content-placeholder">
                <div class="placeholder-icon">
                  <el-icon size="64"><component :is="getStepIcon(currentStepDetail.key)" /></el-icon>
                </div>
                <h3>{{ currentStepDetail.title }}</h3>
                <p>{{ currentStepDetail.description }}</p>
                <el-button type="primary" @click="goToFunction(currentStepDetail.key)">
                  <el-icon><Right /></el-icon>
                  前往功能模块
                </el-button>
              </div>
            </div>
          </div>
        </div>

        <!-- 文件智能识别 -->
        <div v-if="activeNav === 'file-import'" class="panel">
          <div class="panel-header">
            <h3>文件智能识别</h3>
            <div class="header-actions" v-if="biddingFileData">
              <el-button type="primary" @click="createProjectFromRecognition">
                <el-icon><Plus /></el-icon>
                新建项目
              </el-button>
              <el-button @click="exportExtractedInfo">
                <el-icon><Download /></el-icon>
                导出提取信息
              </el-button>
              <el-button type="success" @click="showBidTypeDialog = true">
                <el-icon><Edit /></el-icon>
                开始生成标书
              </el-button>
            </div>
          </div>

          <!-- 选择标书类型对话框 -->
          <el-dialog v-model="showBidTypeDialog" title="选择生成标书类型" width="450px" center>
            <div class="bid-type-select">
              <div 
                class="bid-type-card" 
                :class="{ active: selectedBidType === 'business' }"
                @click="selectedBidType = 'business'"
              >
                <el-icon size="40" color="#f59e0b"><Suitcase /></el-icon>
                <h4>商务标</h4>
                <p>生成商务标书大纲，包含企业资质、业绩、报价等内容</p>
              </div>
              <div 
                class="bid-type-card" 
                :class="{ active: selectedBidType === 'technical' }"
                @click="selectedBidType = 'technical'"
              >
                <el-icon size="40" color="#3b82f6"><Cpu /></el-icon>
                <h4>技术标</h4>
                <p>生成技术标书大纲，包含技术方案、实施计划等内容</p>
              </div>
            </div>
            <template #footer>
              <el-button @click="showBidTypeDialog = false">取消</el-button>
              <el-button type="primary" :disabled="!selectedBidType" @click="goToGenerateBid">
                确认生成
              </el-button>
            </template>
          </el-dialog>

          <!-- 未上传文件时的上传区域 -->
          <div v-if="!biddingFileData" class="file-recognition-empty">
            <div class="upload-card-full">
              <el-upload
                ref="biddingUploadRef"
                :auto-upload="false"
                :on-change="handleFileSelect"
                :show-file-list="false"
                accept=".pdf,.doc,.docx,.xls,.xlsx"
                class="upload-dragger"
                drag
              >
                <div class="upload-icon-area">
                  <el-icon size="48" color="#8b5cf6"><UploadFilled /></el-icon>
                </div>
                <p class="upload-title">点击或将文件拖拽到这里上传</p>
                <p class="upload-hint">支持格式：doc, docx, xls, xlsx, pdf，单个文件不能超过20MB</p>
              </el-upload>
              
              <!-- 已选择文件显示 -->
              <div v-if="pendingBiddingFile" class="selected-file-info">
                <el-icon size="20" color="#8b5cf6"><Document /></el-icon>
                <span class="file-name">{{ pendingBiddingFile.name }}</span>
                <el-button text type="danger" size="small" @click="clearPendingFile">
                  <el-icon><Close /></el-icon>
                </el-button>
              </div>
              
              <el-button 
                type="primary" 
                class="analyze-btn" 
                :disabled="!pendingBiddingFile"
                :loading="analyzingFile"
                @click="startAnalyze"
              >
                <el-icon v-if="!analyzingFile"><MagicStick /></el-icon>
                {{ analyzingFile ? '正在分析...' : '开始分析' }}
              </el-button>
            </div>
          </div>

          <!-- 已上传文件后的双栏布局 -->
          <div v-else-if="!bidGenerationMode" class="file-recognition-layout">
            <!-- 左侧：招标信息提取 - 标签页布局 -->
            <div class="extraction-panel-new">
              <!-- 标签导航 -->
              <div class="extraction-tabs">
                <div 
                  v-for="tab in extractionTabs" 
                  :key="tab.key"
                  class="tab-item"
                  :class="{ active: activeExtractionTab === tab.key }"
                  @click="activeExtractionTab = tab.key"
                >
                  {{ tab.label }}
                </div>
              </div>

              <!-- 标签内容区域 -->
              <div class="extraction-content">
                <!-- 总体分析 -->
                <div v-if="activeExtractionTab === 'overview'" class="tab-content">
                  <!-- 文件信息头部 -->
                  <div class="file-info-header">
                    <div class="file-info-left">
                      <div class="file-icon-box">
                        <el-icon size="24" color="#3b82f6"><Document /></el-icon>
                      </div>
                      <div class="file-details">
                        <div class="file-name">{{ biddingFileData?.name || '智慧园区建设项目招标文件' }}</div>
                        <div class="file-meta">上传时间：{{ biddingFileData?.uploadTime || '2025-06-29 18:23' }} &nbsp; 文件大小 4.5MB</div>
                      </div>
                    </div>
                    <div class="file-stats">
                      <div class="stat-item">
                        <div class="stat-value">28</div>
                        <div class="stat-label">关键条款</div>
                      </div>
                      <div class="stat-item">
                        <div class="stat-value">92%</div>
                        <div class="stat-label">解析完成度</div>
                      </div>
                      <div class="stat-item">
                        <div class="stat-value">76%</div>
                        <div class="stat-label">中标概率</div>
                      </div>
                    </div>
                  </div>

                  <!-- 评分权重与报价策略 -->
                  <div class="charts-row">
                    <div class="chart-card">
                      <div class="card-title"><el-icon><Star /></el-icon> 评分权重分布</div>
                      <div class="pie-chart-placeholder">
                        <div class="pie-legend">
                          <div class="legend-item"><span class="dot" style="background:#3b82f6"></span>技术评分</div>
                          <div class="legend-item"><span class="dot" style="background:#10b981"></span>商务评分</div>
                          <div class="legend-item"><span class="dot" style="background:#f59e0b"></span>报价评分</div>
                        </div>
                        <div class="pie-visual">
                          <svg viewBox="0 0 100 100">
                            <circle cx="50" cy="50" r="40" fill="none" stroke="#3b82f6" stroke-width="20" stroke-dasharray="100 151" transform="rotate(-90 50 50)"/>
                            <circle cx="50" cy="50" r="40" fill="none" stroke="#10b981" stroke-width="20" stroke-dasharray="80 171" stroke-dashoffset="-100" transform="rotate(-90 50 50)"/>
                            <circle cx="50" cy="50" r="40" fill="none" stroke="#f59e0b" stroke-width="20" stroke-dasharray="71 180" stroke-dashoffset="-180" transform="rotate(-90 50 50)"/>
                          </svg>
                        </div>
                      </div>
                    </div>
                    <div class="chart-card">
                      <div class="card-title"><el-icon><TrendCharts /></el-icon> 报价策略建议</div>
                      <div class="line-chart-hint">基于历史数据分析，建议报价在预算的92%-95%区间</div>
                      <div class="line-chart-placeholder">
                        <svg viewBox="0 0 200 80" preserveAspectRatio="none">
                          <polyline points="10,60 40,50 70,35 100,30 130,38 160,45 190,55" fill="none" stroke="#3b82f6" stroke-width="2"/>
                          <g fill="#3b82f6" font-size="6">
                            <text x="10" y="75">投标价</text>
                            <text x="40" y="75">90%</text>
                            <text x="70" y="75">92%</text>
                            <text x="100" y="75">94%</text>
                            <text x="130" y="75">96%</text>
                            <text x="160" y="75">98%</text>
                            <text x="185" y="75">100%</text>
                          </g>
                          <g fill="#6b7280" font-size="5">
                            <text x="45" y="48">65%</text>
                            <text x="75" y="33">75%</text>
                            <text x="105" y="28">83%</text>
                            <text x="135" y="36">76%</text>
                            <text x="165" y="43">68%</text>
                          </g>
                        </svg>
                      </div>
                    </div>
                  </div>

                  <!-- 关键时间节点规划 -->
                  <div class="info-card">
                    <div class="card-title"><el-icon><Clock /></el-icon> 关键时间节点规划</div>
                    <div class="timeline-bar">
                      <div class="timeline-item highlight">
                        <div class="timeline-value">28</div>
                        <div class="timeline-label">剩余天数</div>
                      </div>
                      <div class="timeline-item">
                        <div class="timeline-date">2025-07-01</div>
                        <div class="timeline-label">投标截止日期</div>
                      </div>
                      <div class="timeline-item">
                        <div class="timeline-date">2025-06-15</div>
                        <div class="timeline-label">保证金截止日</div>
                      </div>
                      <div class="timeline-item">
                        <div class="timeline-date">2025-07-01</div>
                        <div class="timeline-label">开标日期</div>
                      </div>
                    </div>
                    <div class="gantt-placeholder">
                      <div class="gantt-row"><span class="gantt-label">最终审核</span><div class="gantt-bar" style="width:30%;margin-left:60%"></div></div>
                      <div class="gantt-row"><span class="gantt-label">报价策略</span><div class="gantt-bar" style="width:25%;margin-left:50%"></div></div>
                      <div class="gantt-row"><span class="gantt-label">商务文件</span><div class="gantt-bar" style="width:35%;margin-left:35%"></div></div>
                      <div class="gantt-row"><span class="gantt-label">技术方案</span><div class="gantt-bar" style="width:45%;margin-left:20%"></div></div>
                      <div class="gantt-row"><span class="gantt-label">文件准备</span><div class="gantt-bar" style="width:50%;margin-left:5%"></div></div>
                    </div>
                  </div>

                  <!-- 关键注意事项与智能建议 -->
                  <div class="tips-row">
                    <div class="tips-card warning">
                      <div class="card-title"><el-icon color="#f59e0b"><Warning /></el-icon> 关键注意事项</div>
                      <div class="tip-item"><el-icon><Warning /></el-icon> 投标保证金：80,000元，需在开标前20日前到账</div>
                      <div class="tip-item"><el-icon><Warning /></el-icon> 技术方案需包含详细的施工组织设计</div>
                      <div class="tip-item"><el-icon><Warning /></el-icon> 授权代表必须携带身份证原件参加开标</div>
                    </div>
                    <div class="tips-card success">
                      <div class="card-title"><el-icon color="#3b82f6"><Checked /></el-icon> 智能建议</div>
                      <div class="tip-item success"><el-icon><Check /></el-icon> 重点突出智慧园区智能化系统集成经验</div>
                      <div class="tip-item success"><el-icon><Check /></el-icon> 在施工组织设计中增加BIM技术应用细节</div>
                      <div class="tip-item success"><el-icon><Check /></el-icon> 强化网络安全和数据保护措施</div>
                    </div>
                  </div>
                </div>

                <!-- 资格要求 -->
                <div v-if="activeExtractionTab === 'qualification'" class="tab-content">
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><OfficeBuilding /></el-icon> 企业资质要求</div>
                      <el-tag type="primary" size="small">必须满足</el-tag>
                    </div>
                    <div class="requirement-list">
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">注册资本：</span><span class="req-value">不低于5000万元人民币</span></div>
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">行业资质：</span><span class="req-value">具备建筑智能化工程专业承包壹级资质</span></div>
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">ISO认证：</span><span class="req-value">需提供ISO 9001质量管理体系认证</span></div>
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">业绩要求：</span><span class="req-value">近三年完成过3个及以上类似项目</span></div>
                    </div>
                  </div>
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><User /></el-icon> 人员资格要求</div>
                      <el-tag type="primary" size="small">必须满足</el-tag>
                    </div>
                    <div class="requirement-list">
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">项目经理：</span><span class="req-value">具备一级建造师资格（机电工程专业）</span></div>
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">技术负责人：</span><span class="req-value">高级工程师职称，8年以上相关经验</span></div>
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">安全员：</span><span class="req-value">持有有效的安全生产考核合格证</span></div>
                      <div class="req-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="req-label">员工人数：</span><span class="req-value">企业员工人数不少于500人</span></div>
                    </div>
                  </div>
                </div>

                <!-- 商务评分 -->
                <div v-if="activeExtractionTab === 'business'" class="tab-content">
                  <div class="info-section-new">
                    <div class="section-title-new">
                      <el-icon><Document /></el-icon>
                      商务关键信息
                    </div>
                    <el-table :data="businessKeyInfo" border stripe>
                      <el-table-column prop="field" label="信息项" width="150" />
                      <el-table-column prop="content" label="信息内容" min-width="200" />
                      <el-table-column prop="source" label="提取来源" width="150">
                        <template #default="{ row }">
                          <el-link type="primary" @click="locateInPreview(row.pageNum, row.lineNum)">
                            第{{ row.pageNum }}页 第{{ row.lineNum }}行
                          </el-link>
                        </template>
                      </el-table-column>
                      <el-table-column label="AI核实分析" width="220">
                        <template #default="{ row }">
                          <div :class="['verify-status', `status-${row.verifyStatus}`]">
                            <el-icon v-if="row.verifyStatus === 'no-need'"><Check /></el-icon>
                            <el-icon v-else-if="row.verifyStatus === 'need'"><Warning /></el-icon>
                            <el-icon v-else><Close /></el-icon>
                            <span>{{ getVerifyStatusText(row.verifyStatus) }}</span>
                          </div>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </div>

                <!-- 技术评分 -->
                <div v-if="activeExtractionTab === 'technical'" class="tab-content">
                  <div class="info-section-new">
                    <div class="section-title-new">
                      <el-icon><MagicStick /></el-icon>
                      技术关键信息
                    </div>
                    <el-table :data="techKeyInfo" border stripe>
                      <el-table-column prop="field" label="信息项" width="150" />
                      <el-table-column prop="content" label="信息内容" min-width="200" />
                      <el-table-column prop="source" label="提取来源" width="150">
                        <template #default="{ row }">
                          <el-link type="primary" @click="locateInPreview(row.pageNum, row.lineNum)">
                            第{{ row.pageNum }}页 第{{ row.lineNum }}行
                          </el-link>
                        </template>
                      </el-table-column>
                      <el-table-column label="AI核实分析" width="220">
                        <template #default="{ row }">
                          <div :class="['verify-status', `status-${row.verifyStatus}`]">
                            <el-icon v-if="row.verifyStatus === 'no-need'"><Check /></el-icon>
                            <el-icon v-else-if="row.verifyStatus === 'need'"><Warning /></el-icon>
                            <el-icon v-else><Close /></el-icon>
                            <span>{{ getVerifyStatusText(row.verifyStatus) }}</span>
                          </div>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </div>

                <!-- 投标要求 -->
                <div v-if="activeExtractionTab === 'bidding'" class="tab-content">
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><Folder /></el-icon> 文件格式要求</div>
                      <el-button type="primary" size="small" link>下载投标要求</el-button>
                      <el-tag type="primary" size="small">必须满足</el-tag>
                    </div>
                    <div class="requirement-list">
                      <div class="req-item"><el-icon color="#3b82f6"><Document /></el-icon><span class="req-label">文件构成：</span><span class="req-value">投标文件须包含商务标书、技术标书和报价单三部分，分别装订</span></div>
                      <div class="req-item"><el-icon color="#3b82f6"><Document /></el-icon><span class="req-label">文件格式：</span><span class="req-value">正本1份(需逐页小签)，副本6份，电子版1份(PDF+WORD)</span></div>
                      <div class="req-item"><el-icon color="#3b82f6"><Document /></el-icon><span class="req-label">装订要求：</span><span class="req-value">采用胶装方式，不得使用活页夹或文件夹</span></div>
                    </div>
                  </div>
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><Stamp /></el-icon> 签名与盖章要求</div>
                      <el-tag type="primary" size="small">必须满足</el-tag>
                    </div>
                    <div class="requirement-list">
                      <div class="req-item"><el-icon color="#3b82f6"><EditPen /></el-icon><span class="req-label">法定代表人签名：</span><span class="req-value">授权委托书、投标函等重要文件需法定代表人亲笔签名</span></div>
                      <div class="req-item"><el-icon color="#3b82f6"><Stamp /></el-icon><span class="req-label">公章要求：</span><span class="req-value">所有复印件需加盖公司公章，正本需加盖骑缝章</span></div>
                      <div class="req-item"><el-icon color="#3b82f6"><Postcard /></el-icon><span class="req-label">授权代表：</span><span class="req-value">授权代表需携带身份证原件及授权委托书参加开标</span></div>
                    </div>
                  </div>
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><Box /></el-icon> 封装与递交要求</div>
                      <el-tag type="primary" size="small">必须满足</el-tag>
                    </div>
                    <div class="requirement-list">
                      <div class="req-item"><el-icon color="#3b82f6"><Box /></el-icon><span class="req-label">封装方式：</span><span class="req-value">正本和副本分开包装，再封装于一个大密封袋内</span></div>
                      <div class="req-item"><el-icon color="#3b82f6"><Tickets /></el-icon><span class="req-label">标签要求：</span><span class="req-value">外层包装需注明：项目名称、招标编号、投标单位名称</span></div>
                    </div>
                  </div>
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><Wallet /></el-icon> 投标保证金要求</div>
                      <el-tag type="primary" size="small">必须满足</el-tag>
                    </div>
                    <div class="requirement-list">
                      <div class="req-item"><el-icon color="#f59e0b"><Money /></el-icon><span class="req-label">金额要求：</span><span class="req-value">人民币捌万元整(¥80,000)</span></div>
                      <div class="req-item"><el-icon color="#3b82f6"><CreditCard /></el-icon><span class="req-label">缴纳方式：</span><span class="req-value">银行电汇或保函形式，不接受现金</span></div>
                    </div>
                  </div>
                </div>

                <!-- 开标流程 -->
                <div v-if="activeExtractionTab === 'process'" class="tab-content">
                  <div class="requirement-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#3b82f6"><List /></el-icon> 开标评标流程</div>
                      <el-tag type="info" size="small">时间节点</el-tag>
                    </div>
                    <div class="process-timeline">
                      <div class="timeline-node">
                        <div class="node-dot active"></div>
                        <div class="node-content">
                          <div class="node-date">2025-07-01</div>
                          <div class="node-events">
                            <div class="event-item">
                              <div class="event-time">09:30 投标文件递交截止</div>
                              <div class="event-desc">邮寄地点：公共资源交易中心三楼开标室</div>
                            </div>
                            <div class="event-item">
                              <div class="event-time">10:00 开标仪式</div>
                              <div class="event-desc">公开唱标：公布投标人名单</div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="timeline-node">
                        <div class="node-dot"></div>
                        <div class="node-content">
                          <div class="node-date">2025-07-02 至 2025-07-05</div>
                          <div class="node-events">
                            <div class="event-item">
                              <div class="event-time">评标阶段</div>
                              <div class="event-desc">评标委员会封闭评标</div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="timeline-node">
                        <div class="node-dot"></div>
                        <div class="node-content">
                          <div class="node-date">2025-07-06</div>
                          <div class="node-events">
                            <div class="event-item">
                              <div class="event-time">结果公示</div>
                              <div class="event-desc">在公共资源交易网公示3个工作日</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- 风险分析 -->
                <div v-if="activeExtractionTab === 'risk'" class="tab-content">
                  <div class="requirement-card risk-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#ef4444"><Warning /></el-icon> 高风险项目</div>
                      <el-tag type="danger" size="small">需重点关注</el-tag>
                    </div>
                    <div class="risk-list">
                      <div class="risk-item high">
                        <el-icon color="#ef4444"><CircleClose /></el-icon>
                        <span class="risk-label">业绩要求：</span>
                        <el-tag type="danger" size="small">高风险</el-tag>
                        <span class="risk-desc">缺少1个类似项目业绩证明</span>
                      </div>
                      <div class="risk-item high">
                        <el-icon color="#ef4444"><CircleClose /></el-icon>
                        <span class="risk-label">项目经理：</span>
                        <el-tag type="danger" size="small">高风险</el-tag>
                        <span class="risk-desc">拟派项目经理注册专业不符要求</span>
                      </div>
                      <div class="risk-item medium">
                        <el-icon color="#f59e0b"><Warning /></el-icon>
                        <span class="risk-label">技术方案：</span>
                        <el-tag type="warning" size="small">中风险</el-tag>
                        <span class="risk-desc">BIM技术应用方案不够详细</span>
                      </div>
                    </div>
                  </div>
                  <div class="requirement-card suggestion-card">
                    <div class="card-header">
                      <div class="header-left"><el-icon color="#10b981"><CircleCheck /></el-icon> 改进意见</div>
                      <el-tag type="success" size="small">优化建议</el-tag>
                    </div>
                    <div class="suggestion-list">
                      <div class="suggestion-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="sug-label">业绩要求：</span><span class="sug-value">补充提供智慧城市类项目业绩证明</span></div>
                      <div class="suggestion-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="sug-label">项目经理：</span><span class="sug-value">更换机电工程专业一级建造师担任项目经理</span></div>
                      <div class="suggestion-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="sug-label">技术方案：</span><span class="sug-value">增加BIM技术在施工阶段的应用细节</span></div>
                      <div class="suggestion-item"><el-icon color="#10b981"><CircleCheck /></el-icon><span class="sug-label">业务要求：</span><span class="sug-value">提供近三年同类项目审计报告增强商务评分</span></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 右侧：原文预览 -->
            <div class="preview-panel">
              <div class="preview-header">
                <h4>原文预览</h4>
                <div class="preview-tools">
                  <el-button 
                    size="small" 
                    :type="isTranslated ? 'primary' : 'default'"
                    @click="toggleTranslation"
                    :loading="translatingDocument"
                  >
                    <el-icon><Grid /></el-icon>
                    {{ isTranslated ? '显示原文' : '翻译全文' }}
                  </el-button>
                  <el-button-group style="margin-left: 8px;">
                    <el-button size="small" @click="zoomOut">
                      <el-icon><ZoomOut /></el-icon>
                    </el-button>
                    <el-button size="small" @click="zoomIn">
                      <el-icon><ZoomIn /></el-icon>
                    </el-button>
                    <el-button size="small" @click="resetZoom">
                      <el-icon><Refresh /></el-icon>
                    </el-button>
                  </el-button-group>
                </div>
              </div>
              <div class="preview-content" ref="previewContentRef" :style="{ transform: `scale(${previewZoom})` }">
                <div class="file-info-bar">
                  <span>文件名：{{ biddingFileData.name }}</span>
                  <span>页数：{{ biddingFileData.pages }} 页</span>
                </div>
                <div class="preview-pages">
                  <div 
                    v-for="page in biddingFileData.pages" 
                    :key="page" 
                    :id="`page-${page}`"
                    class="preview-page"
                  >
                    <div class="page-number">第 {{ page }} 页</div>
                    <div class="page-content">
                      <!-- 这里显示PDF/文档预览内容 -->
                      <p class="preview-text" v-html="getPageContentWithLines(page)"></p>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 标书生成向导流程 -->
          <div v-else class="bid-generation-wizard">
            <!-- 向导步骤条 -->
            <div class="wizard-header">
              <el-button text @click="exitBidGeneration" class="back-btn">
                <el-icon><ArrowLeft /></el-icon>
                返回文件识别
              </el-button>
              <div class="wizard-title">
                <el-icon v-if="selectedBidType === 'business'" color="#f59e0b"><Suitcase /></el-icon>
                <el-icon v-else color="#3b82f6"><Cpu /></el-icon>
                {{ selectedBidType === 'business' ? '商务标' : '技术标' }}生成向导
              </div>
              <div class="wizard-steps">
                <el-steps :active="bidWizardStep" align-center finish-status="success">
                  <el-step title="大纲生成" />
                  <el-step title="材料匹配填充" />
                  <el-step title="标书生成" />
                </el-steps>
              </div>
            </div>

            <!-- 步骤1：大纲生成 -->
            <div v-if="bidWizardStep === 0" class="wizard-content">
              <div class="outline-generation-layout">
                <!-- 左侧：标书大纲 -->
                <div class="outline-panel">
                  <div class="outline-header">
                    <h4>{{ selectedBidType === 'business' ? '商务标书' : '技术标书' }}大纲</h4>
                    <div class="outline-actions">
                      <el-button type="primary" size="small" @click="generateOutline" :loading="generatingOutline">
                        <el-icon><MagicStick /></el-icon>
                        AI智能生成大纲
                      </el-button>
                      <el-button size="small" @click="addOutlineItem">
                        <el-icon><Plus /></el-icon>
                        添加章节
                      </el-button>
                    </div>
                  </div>
                  
                  <div class="outline-content" v-if="currentOutline.length">
                    <div v-for="(chapter, cIndex) in currentOutline" :key="cIndex" class="outline-chapter">
                      <div class="chapter-header">
                        <el-icon class="drag-handle"><Grid /></el-icon>
                        <span class="chapter-number">第{{ cIndex + 1 }}章</span>
                        <el-input v-model="chapter.title" size="small" style="flex: 1;" />
                        <el-button text type="danger" size="small" @click="removeOutlineItem(cIndex)">
                          <el-icon><Delete /></el-icon>
                        </el-button>
                      </div>
                      <div class="chapter-sections">
                        <div v-for="(section, sIndex) in chapter.sections" :key="sIndex" class="section-item">
                          <span class="section-number">{{ cIndex + 1 }}.{{ sIndex + 1 }}</span>
                          <el-input v-model="section.title" size="small" style="flex: 1;" />
                          <el-button text type="danger" size="small" @click="removeSection(cIndex, sIndex)">
                            <el-icon><Delete /></el-icon>
                          </el-button>
                        </div>
                        <el-button text size="small" class="add-section-btn" @click="addSection(cIndex)">
                          <el-icon><Plus /></el-icon>添加小节
                        </el-button>
                      </div>
                    </div>
                  </div>
                  
                  <div v-else class="outline-empty">
                    <el-icon size="48" color="#d1d5db"><Document /></el-icon>
                    <p>点击"AI智能生成大纲"按钮，根据招标文件自动生成标书大纲</p>
                  </div>
                </div>

                <!-- 右侧：招标原文预览 -->
                <div class="source-preview-panel">
                  <div class="preview-header">
                    <h4>招标原文预览</h4>
                    <div class="preview-tools">
                      <el-button-group size="small">
                        <el-button @click="outlinePreviewZoom = Math.max(50, outlinePreviewZoom - 10)">
                          <el-icon><ZoomOut /></el-icon>
                        </el-button>
                        <el-button>{{ outlinePreviewZoom }}%</el-button>
                        <el-button @click="outlinePreviewZoom = Math.min(200, outlinePreviewZoom + 10)">
                          <el-icon><ZoomIn /></el-icon>
                        </el-button>
                      </el-button-group>
                    </div>
                  </div>
                  <div class="preview-body">
                    <div class="file-info-bar" v-if="biddingFileData">
                      <el-icon><Document /></el-icon>
                      <span>{{ biddingFileData.name }}</span>
                      <el-tag size="small" type="info">共 {{ biddingFileData.pages }} 页</el-tag>
                    </div>
                    <div class="preview-document-area" :style="{ transform: `scale(${outlinePreviewZoom / 100})` }">
                      <div v-for="page in (biddingFileData?.pages || 15)" :key="page" class="preview-page">
                        <div class="page-number">第 {{ page }} 页</div>
                        <div class="page-content">
                          <p class="preview-text" v-html="getPageContentWithLines(page)"></p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 步骤2：材料智能匹配填充 -->
            <div v-if="bidWizardStep === 1" class="wizard-content">
              <div class="material-matching">
                <div class="matching-header">
                  <h4>材料智能匹配填充</h4>
                  <p class="matching-desc">自动检索知识库中企业资质、财务报表等资料，自动提取并适应模板并填充全部信息</p>
                </div>
                
                <!-- 应用资料范围筛选 -->
                <div class="filter-section">
                  <div class="filter-title">
                    <el-icon><Filter /></el-icon>
                    应用资料范围
                  </div>
                  <div class="filter-controls">
                    <el-select v-model="materialFilter.region" placeholder="选择地域" style="width: 150px;" clearable>
                      <el-option label="江西省" value="jiangxi" />
                      <el-option label="广东省" value="guangdong" />
                      <el-option label="浙江省" value="zhejiang" />
                    </el-select>
                    <el-select v-model="materialFilter.industry" placeholder="选择行业" style="width: 150px;" clearable>
                      <el-option label="智慧城市" value="smart-city" />
                      <el-option label="信息化" value="it" />
                      <el-option label="工程建设" value="construction" />
                    </el-select>
                    <el-select v-model="materialFilter.year" placeholder="选择年份" style="width: 150px;" clearable>
                      <el-option label="2024" value="2024" />
                      <el-option label="2023" value="2023" />
                      <el-option label="2022" value="2022" />
                    </el-select>
                    <el-button type="primary" @click="smartMatchAll">
                      <el-icon><MagicStick /></el-icon>
                      智能匹配
                    </el-button>
                    <el-button type="success" @click="applyAllMaterials">
                      <el-icon><Check /></el-icon>
                      一键应用
                    </el-button>
                  </div>
                </div>
                
                <!-- 按章节显示匹配材料 -->
                <div class="material-sections">
                  <div v-for="(chapter, cIndex) in currentOutline" :key="cIndex" class="material-chapter">
                    <div class="chapter-title-bar">
                      <span class="chapter-title">{{ cIndex + 1 }}. {{ chapter.title }}</span>
                      <div class="chapter-actions">
                        <el-button size="small" @click="smartMatchChapter(cIndex)">
                          <el-icon><MagicStick /></el-icon>
                          智能匹配
                        </el-button>
                        <el-button size="small" @click="openAddFileDialog(cIndex)">
                          <el-icon><Plus /></el-icon>
                          添加文件
                        </el-button>
                        <el-button 
                          size="small" 
                          :type="isChapterAllApplied(cIndex) ? 'danger' : 'success'" 
                          @click="applyChapterMaterials(cIndex)"
                        >
                          <el-icon><Check v-if="!isChapterAllApplied(cIndex)" /><Close v-else /></el-icon>
                          {{ isChapterAllApplied(cIndex) ? '取消应用' : '一键应用' }}
                        </el-button>
                      </div>
                    </div>
                    
                    <!-- 匹配到的材料文件列表 -->
                    <div class="matched-materials" v-if="chapter.materials && chapter.materials.length">
                      <div v-for="(material, mIndex) in chapter.materials" :key="mIndex" class="material-item" :class="{ applied: material.applied }">
                        <el-icon class="file-icon" :color="getFileIconColor(material.type)"><Document /></el-icon>
                        <div class="material-info">
                          <div class="material-name">{{ material.name }}</div>
                          <div class="material-meta">
                            <el-tag size="small" type="info">{{ material.category }}</el-tag>
                            <span class="match-score" :class="{ high: material.matchScore >= 90 }">
                              匹配度: {{ material.matchScore }}%
                            </span>
                          </div>
                        </div>
                        <div class="material-actions">
                          <el-button text size="small" @click="previewOutlineMaterial(material)">
                            <el-icon><View /></el-icon>
                            预览
                          </el-button>
                          <el-button 
                            text 
                            size="small" 
                            :type="material.applied ? 'danger' : 'primary'" 
                            @click="applyMaterial(cIndex, mIndex)"
                          >
                            <el-icon><Check v-if="!material.applied" /><Close v-else /></el-icon>
                            {{ material.applied ? '取消应用' : '应用' }}
                          </el-button>
                        </div>
                      </div>
                    </div>
                    <div v-else class="no-materials">
                      <span>暂无匹配材料，请点击"智能匹配"或"添加文件"</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 添加文件弹窗 -->
            <el-dialog v-model="showAddFileDialog" title="添加文件" width="800px">
              <div class="add-file-dialog">
                <div class="dialog-subtitle">为 "{{ currentAddFileChapter?.title }}" 选择文件</div>
                
                <!-- 文件上传区 -->
                <el-upload
                  class="file-upload-area"
                  drag
                  :auto-upload="false"
                  :on-change="handleMaterialUpload"
                  :show-file-list="false"
                >
                  <el-icon size="40" color="#8b5cf6"><UploadFilled /></el-icon>
                  <div class="upload-text">拖拽文件到此处或 <em>点击上传</em></div>
                  <div class="upload-tip">支持 PDF、Word、Excel、图片等格式，可同时上传多个文件</div>
                </el-upload>
                
                <!-- 文件筛选 -->
                <div class="file-filter-bar">
                  <el-select v-model="fileDialogFilter.region" placeholder="地域" size="small" clearable style="width: 120px;">
                    <el-option label="江西省" value="jiangxi" />
                    <el-option label="广东省" value="guangdong" />
                  </el-select>
                  <el-select v-model="fileDialogFilter.industry" placeholder="行业" size="small" clearable style="width: 120px;">
                    <el-option label="智慧城市" value="smart-city" />
                    <el-option label="信息化" value="it" />
                  </el-select>
                  <el-select v-model="fileDialogFilter.year" placeholder="年份" size="small" clearable style="width: 100px;">
                    <el-option label="2024" value="2024" />
                    <el-option label="2023" value="2023" />
                  </el-select>
                  <el-button type="primary" size="small" @click="searchKnowledgeFiles">
                    <el-icon><Search /></el-icon>
                    检索
                  </el-button>
                </div>
                
                <!-- 知识库文件列表 -->
                <el-table :data="knowledgeFileList" style="width: 100%;" max-height="300" @selection-change="handleFileSelectionChange">
                  <el-table-column type="selection" width="50" />
                  <el-table-column prop="name" label="文件名" min-width="200">
                    <template #default="{ row }">
                      <div class="file-name-cell">
                        <el-icon><Document /></el-icon>
                        <span>{{ row.name }}</span>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="category" label="分类" width="100">
                    <template #default="{ row }">
                      <el-tag size="small" :type="row.categoryType">{{ row.category }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column prop="region" label="地域" width="80" />
                  <el-table-column prop="year" label="年份" width="80" />
                  <el-table-column label="操作" width="80">
                    <template #default="{ row }">
                      <el-button text size="small" @click="previewOutlineMaterial(row)">查阅</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
              <template #footer>
                <el-button @click="showAddFileDialog = false">取消</el-button>
                <el-button type="primary" @click="confirmAddFiles" :disabled="!selectedFiles.length">
                  添加选中文件 ({{ selectedFiles.length }})
                </el-button>
              </template>
            </el-dialog>

            <!-- 预览文件弹窗 -->
            <el-dialog v-model="showPreviewDialog" :title="'预览: ' + (previewingFile?.name || '')" width="700px">
              <div class="file-preview-dialog">
                <div class="preview-file-info">
                  <el-tag>{{ previewingFile?.category }}</el-tag>
                  <span>文件大小: {{ previewingFile?.size || '2.5 MB' }}</span>
                  <span>上传时间: {{ previewingFile?.uploadTime || '2024-11-20' }}</span>
                  <div class="preview-tools">
                    <el-button-group size="small">
                      <el-button><el-icon><ZoomOut /></el-icon></el-button>
                      <el-button>100%</el-button>
                      <el-button><el-icon><ZoomIn /></el-icon></el-button>
                    </el-button-group>
                    <el-button size="small"><el-icon><Download /></el-icon> 下载</el-button>
                  </div>
                </div>
                <div class="preview-content-area">
                  <div class="preview-document-mock">
                    <el-icon size="60" color="#ef4444"><Document /></el-icon>
                    <h3>{{ previewingFile?.displayTitle || '营业执照' }}</h3>
                    <div class="mock-content">
                      <p><strong>统一社会信用代码：</strong>91360000MA35XXXX1X</p>
                      <p><strong>名称：</strong>江西XX科技有限公司</p>
                      <p><strong>类型：</strong>有限责任公司（自然人投资或控股）</p>
                      <p><strong>法定代表人：</strong>张三</p>
                      <p><strong>注册资本：</strong>5000万元人民币</p>
                      <p><strong>成立日期：</strong>2015年03月15日</p>
                      <p><strong>营业期限：</strong>2015年03月15日至无固定期限</p>
                    </div>
                  </div>
                </div>
              </div>
              <template #footer>
                <el-button @click="showPreviewDialog = false">关闭</el-button>
                <el-button type="primary" @click="downloadPreviewFile">
                  <el-icon><Download /></el-icon>
                  下载文件
                </el-button>
              </template>
            </el-dialog>

            <!-- 步骤3：标书生成 -->
            <div v-if="bidWizardStep === 2" class="wizard-content">
              <div class="bid-generation">
                <div class="generation-header">
                  <h4>标书生成</h4>
                  <p class="generation-desc">系统将根据大纲和关联项目内容，自动生成标书文档</p>
                </div>
                
                <div class="generation-content">
                  <div class="generation-preview">
                    <div class="preview-sidebar">
                      <div class="sidebar-title">文档目录</div>
                      <div class="toc-list">
                        <div v-for="(chapter, index) in currentOutline" :key="index" class="toc-item" :class="{ active: previewChapter === index }" @click="previewChapter = index">
                          <span class="toc-number">{{ index + 1 }}</span>
                          <span class="toc-title">{{ chapter.title }}</span>
                          <el-icon v-if="chapter.generated" color="#10b981"><CircleCheck /></el-icon>
                          <el-icon v-else color="#d1d5db"><Clock /></el-icon>
                        </div>
                      </div>
                    </div>
                    
                    <div class="preview-main">
                      <div class="preview-toolbar">
                        <el-button-group>
                          <el-button size="small"><el-icon><ZoomOut /></el-icon></el-button>
                          <el-button size="small">100%</el-button>
                          <el-button size="small"><el-icon><ZoomIn /></el-icon></el-button>
                        </el-button-group>
                        <el-button size="small" type="primary" @click="generateCurrentChapter" :loading="generatingChapter">
                          <el-icon><MagicStick /></el-icon>
                          生成当前章节
                        </el-button>
                      </div>
                      <div class="preview-document">
                        <div v-if="currentOutline[previewChapter]" class="document-content">
                          <h2>{{ currentOutline[previewChapter].title }}</h2>
                          <div v-if="currentOutline[previewChapter].content" v-html="currentOutline[previewChapter].content"></div>
                          <div v-else class="content-placeholder">
                            <el-icon size="32" color="#d1d5db"><Document /></el-icon>
                            <p>点击"生成当前章节"按钮生成内容</p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  
                  <div class="generation-progress" v-if="generatingBid">
                    <el-progress :percentage="bidGenerationProgress" :stroke-width="8" />
                    <span class="progress-text">正在生成标书... {{ bidGenerationProgress }}%</span>
                  </div>
                </div>
              </div>
            </div>

            <!-- 向导底部操作栏 -->
            <div class="wizard-footer">
              <el-button v-if="bidWizardStep > 0" @click="bidWizardStep--">
                <el-icon><ArrowLeft /></el-icon>
                上一步
              </el-button>
              <div class="footer-right">
                <el-button v-if="bidWizardStep < 2" type="primary" @click="bidWizardStep++">
                  下一步
                  <el-icon><ArrowRight /></el-icon>
                </el-button>
                <el-button v-else type="success" @click="completeBidGeneration">
                  <el-icon><Download /></el-icon>
                  导出标书
                </el-button>
              </div>
            </div>
          </div>
        </div>

        <!-- 多语言翻译 -->
        <div v-if="activeNav === 'file-translate'" class="panel">
          <div class="panel-header">
            <h3>多语言翻译</h3>
            <el-button @click="showTermDialog = true">
              <el-icon><Grid /></el-icon>
              术语表管理
            </el-button>
          </div>
          
          <div class="translate-layout">
            <div class="translate-controls">
              <el-radio-group v-model="translateDirection">
                <el-radio label="zh-en">中文 → 英文</el-radio>
                <el-radio label="en-zh">英文 → 中文</el-radio>
              </el-radio-group>
            </div>

            <div class="translate-panels">
              <div class="translate-panel">
                <div class="panel-title">源文本</div>
                <el-input
                  v-model="sourceText"
                  type="textarea"
                  :rows="15"
                  placeholder="粘贴或输入需要翻译的文本..."
                />
              </div>
              <div class="translate-panel">
                <div class="panel-title">翻译结果</div>
                <el-input
                  v-model="translatedText"
                  type="textarea"
                  :rows="15"
                  placeholder="翻译结果将显示在这里..."
                  readonly
                />
                <div class="panel-actions">
                  <el-button size="small" @click="copyTranslation">
                    <el-icon><Document /></el-icon>
                    复制
                  </el-button>
                  <el-button size="small" @click="exportTranslation">
                    <el-icon><Download /></el-icon>
                    导出
                  </el-button>
                </div>
              </div>
            </div>

            <div class="translate-actions">
              <el-button type="primary" @click="startTranslate" :loading="translating">
                <el-icon><MagicStick /></el-icon>
                开始翻译
              </el-button>
              <el-button @click="clearTranslate">清空</el-button>
            </div>
          </div>
        </div>

        <!-- 商务要素提取 -->
        <div v-if="activeNav === 'parse-business'" class="panel">
          <div class="panel-header">
            <h3>商务要素精准提取</h3>
            <div class="header-actions">
              <el-select v-model="selectedBidFile" placeholder="选择招标文件" style="width: 300px; margin-right: 12px;">
                <el-option label="招标文件.pdf" value="1" />
                <el-option label="补充文件.pdf" value="2" />
              </el-select>
              <el-button type="primary" @click="startBusinessExtract" :loading="extracting">
                <el-icon><MagicStick /></el-icon>
                开始提取
              </el-button>
            </div>
          </div>

          <el-progress v-if="extracting" :percentage="extractProgress" />

          <div v-if="businessElements.length > 0" class="extract-result">
            <el-table :data="businessElements" stripe border>
              <el-table-column prop="element" label="信息项" width="150" />
              <el-table-column prop="value" label="提取内容" min-width="200" />
              <el-table-column prop="source" label="来源" width="100" />
              <el-table-column label="状态" width="120">
                <template #default="{ row }">
                  <el-tag :type="row.needConfirm ? 'warning' : 'success'" size="small">
                    {{ row.needConfirm ? '⚠️需确认' : '✅已确认' }}
                  </el-tag>
                </template>
              </el-table-column>
              <el-table-column label="备注" min-width="150">
                <template #default="{ row }">
                  <span v-if="row.note" class="note-text">{{ row.note }}</span>
                </template>
              </el-table-column>
            </el-table>

            <div class="extract-actions">
              <el-button @click="exportBusinessElements">
                <el-icon><Download /></el-icon>
                导出Excel
              </el-button>
              <el-button type="primary" @click="saveBusinessElements">
                <el-icon><Check /></el-icon>
                保存到知识库
              </el-button>
            </div>
          </div>
        </div>

        <!-- 否决项识别 -->
        <div v-if="activeNav === 'parse-reject'" class="panel rejection-panel">
          <div class="panel-header">
            <h3>否决项识别</h3>
            <div class="header-actions">
              <el-select v-model="selectedBidFile" placeholder="选择招标文件" style="width: 300px; margin-right: 12px;">
                <el-option label="招标文件.pdf" value="1" />
              </el-select>
              <el-button type="primary" @click="startRejectRecognition" :loading="recognizing">
                <el-icon><MagicStick /></el-icon>
                开始识别
              </el-button>
            </div>
          </div>

          <el-progress v-if="recognizing" :percentage="recognizeProgress" />

          <!-- 否决项 -->
          <div class="rejection-section">
            <div class="section-header">
              <h4>
                <el-icon color="#ef4444"><CircleClose /></el-icon>
                否决项
                <el-badge :value="rejectionItems.length" type="danger" />
              </h4>
            </div>
            <div class="items-list">
              <div 
                v-for="item in rejectionItems" 
                :key="item.id"
                class="rejection-item critical"
              >
                <div class="item-icon">{{ item.marker }}</div>
                <div class="item-content">
                  <div class="item-text">{{ item.content }}</div>
                  <div class="item-meta">
                    <el-tag size="small" type="info">{{ item.source }}</el-tag>
                    <el-tag size="small" type="danger">高危</el-tag>
                  </div>
                </div>
                <div class="item-actions">
                  <el-checkbox v-model="item.checked">已确认</el-checkbox>
                </div>
              </div>
            </div>
          </div>

          <!-- 扣分项 -->
          <div class="deduction-section">
            <div class="section-header">
              <h4>
                <el-icon color="#f59e0b"><Remove /></el-icon>
                扣分项
                <el-badge :value="deductionItems.length" type="warning" />
              </h4>
              <span class="total-score">总扣分: {{ totalDeduction }}分</span>
            </div>
            <div class="items-list">
              <div 
                v-for="item in deductionItems" 
                :key="item.id"
                class="deduction-item"
              >
                <div class="item-icon">•</div>
                <div class="item-content">
                  <div class="item-text">{{ item.content }}</div>
                  <div class="item-meta">
                    <el-tag size="small" type="info">{{ item.source }}</el-tag>
                    <el-tag size="small" type="warning">{{ item.score }}分</el-tag>
                  </div>
                </div>
                <div class="item-actions">
                  <el-checkbox v-model="item.checked">已确认</el-checkbox>
                </div>
              </div>
            </div>
          </div>

          <!-- 加分项 -->
          <div class="bonus-section">
            <div class="section-header">
              <h4>
                <el-icon color="#10b981"><CirclePlus /></el-icon>
                加分项
                <el-badge :value="bonusItems.length" type="success" />
              </h4>
              <span class="total-score">总加分: +{{ totalBonus }}分</span>
            </div>
            <div class="items-list">
              <div 
                v-for="item in bonusItems" 
                :key="item.id"
                class="bonus-item"
              >
                <div class="item-icon">•</div>
                <div class="item-content">
                  <div class="item-text">{{ item.content }}</div>
                  <div class="item-meta">
                    <el-tag size="small" type="info">{{ item.source }}</el-tag>
                    <el-tag size="small" type="success">+{{ item.score }}分</el-tag>
                  </div>
                </div>
                <div class="item-actions">
                  <el-checkbox v-model="item.checked">已确认</el-checkbox>
                </div>
              </div>
            </div>
          </div>

          <div class="action-buttons">
            <el-button @click="generateChecklist">
              <el-icon><Document /></el-icon>
              生成检查清单
            </el-button>
            <el-button @click="exportRejectReport">
              <el-icon><Download /></el-icon>
              导出报告
            </el-button>
          </div>
        </div>

        <!-- 技术参数解析 -->
        <div v-if="activeNav === 'parse-tech'" class="panel">
          <div class="panel-header">
            <h3>技术参数解析</h3>
            <div class="header-actions">
              <el-select v-model="selectedTechFile" placeholder="选择招标文件" style="width: 300px; margin-right: 12px;">
                <el-option label="技术规格书.pdf" value="1" />
                <el-option label="技术要求.pdf" value="2" />
              </el-select>
              <el-button type="primary" @click="startTechParse" :loading="techParsing">
                <el-icon><MagicStick /></el-icon>
                开始解析
              </el-button>
            </div>
          </div>

          <el-progress v-if="techParsing" :percentage="techParseProgress" />

          <div v-if="techParams.length > 0" class="tech-params-result">
            <el-table :data="techParams" stripe border>
              <el-table-column prop="category" label="参数类别" width="150" />
              <el-table-column prop="param" label="参数名称" width="200" />
              <el-table-column prop="requirement" label="要求" min-width="200" />
              <el-table-column prop="ourValue" label="我方参数" width="150">
                <template #default="{ row }">
                  <el-input v-model="row.ourValue" size="small" placeholder="填写参数" />
                </template>
              </el-table-column>
              <el-table-column label="符合性" width="120">
                <template #default="{ row }">
                  <el-tag :type="checkCompliance(row) ? 'success' : 'danger'" size="small">
                    {{ checkCompliance(row) ? '✓ 符合' : '✗ 不符合' }}
                  </el-tag>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>

        <!-- 图纸识别 -->
        <div v-if="activeNav === 'parse-drawing'" class="panel">
          <div class="panel-header">
            <h3>图纸智能识别</h3>
            <div class="header-actions">
              <el-button type="primary" @click="uploadDrawing">
                <el-icon><Upload /></el-icon>
                上传图纸
              </el-button>
            </div>
          </div>

          <div class="drawing-workspace">
            <div class="drawing-preview">
              <div v-if="!currentDrawing" class="empty-state">
                <el-icon class="empty-icon"><Picture /></el-icon>
                <p>请上传CAD图纸或图片</p>
              </div>
              <div v-else class="drawing-viewer">
                <img :src="currentDrawing.preview" alt="图纸预览" />
                <div class="drawing-tools">
                  <el-button-group>
                    <el-button size="small"><el-icon><ZoomIn /></el-icon></el-button>
                    <el-button size="small"><el-icon><ZoomOut /></el-icon></el-button>
                    <el-button size="small"><el-icon><Refresh /></el-icon></el-button>
                  </el-button-group>
                </div>
              </div>
            </div>
            <div class="drawing-info">
              <h4>识别结果</h4>
              <div v-if="drawingInfo" class="info-list">
                <div class="info-item">
                  <span class="label">图纸名称：</span>
                  <span class="value">{{ drawingInfo.name }}</span>
                </div>
                <div class="info-item">
                  <span class="label">图纸类型：</span>
                  <span class="value">{{ drawingInfo.type }}</span>
                </div>
                <div class="info-item">
                  <span class="label">尺寸标注：</span>
                  <span class="value">{{ drawingInfo.dimensions }}</span>
                </div>
                <div class="info-item">
                  <span class="label">关键要素：</span>
                  <div class="tags">
                    <el-tag v-for="tag in drawingInfo.tags" :key="tag" size="small">{{ tag }}</el-tag>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 商务文件撰写 -->
        <div v-if="activeNav === 'write-business'" class="panel business-write-panel">
          <div class="panel-header">
            <h3>商务文件撰写</h3>
          </div>

          <!-- 流程步骤条 -->
          <div class="business-steps-container">
            <el-steps :active="businessWriteStep" align-center finish-status="success">
              <el-step title="项目选择" description="选择要撰写的项目" />
              <el-step title="商务标大纲生成" description="自动生成文档大纲" />
              <el-step title="材料智能匹配填充" description="智能匹配知识库资料" />
              <el-step title="自动格式排版" description="生成正式商务文件" />
            </el-steps>
          </div>

          <!-- 步骤1: 项目选择 -->
          <div v-if="businessWriteStep === 0" class="step-content">
            <div class="project-selection">
              <div class="step-title-section">
                <h4>选择项目</h4>
                <p class="step-desc-highlight">请选择需要撰写商务文件的项目，系统将自动同步项目标书文件和招标信息提取结果</p>
              </div>
              
              <div class="project-cards">
                <div 
                  v-for="project in ongoingProjects" 
                  :key="project.id"
                  class="project-card"
                  :class="{ selected: selectedBusinessProject?.id === project.id }"
                  @click="selectBusinessProject(project)"
                >
                  <div class="project-card-header">
                    <h5>{{ project.name }}</h5>
                    <el-tag :type="getProgressTagType(project.progress)" size="small">
                      {{ project.progress }}
                    </el-tag>
                  </div>
                  <div class="project-card-body">
                    <div class="project-info-item">
                      <span class="label">创建时间：</span>
                      <span class="value">{{ project.createTime }}</span>
                    </div>
                    <div v-if="project.extractedInfo" class="project-info-item">
                      <el-icon color="#10b981"><CircleCheck /></el-icon>
                      <span class="value">已完成招标信息提取</span>
                    </div>
                  </div>
                  <div v-if="selectedBusinessProject?.id === project.id" class="selected-badge">
                    <el-icon><CircleCheckFilled /></el-icon>
                    已选择
                  </div>
                </div>
              </div>

              <div class="step-actions">
                <el-button 
                  type="primary" 
                  size="large"
                  :disabled="!selectedBusinessProject"
                  @click="confirmProjectSelection"
                >
                  下一步：生成商务标大纲
                  <el-icon><Right /></el-icon>
                </el-button>
              </div>
            </div>
          </div>

          <!-- 步骤2: 商务标大纲生成 -->
          <div v-if="businessWriteStep === 1" class="step-content">
            <div class="outline-generation">
              <div class="step-header-bar">
                <div class="project-badge">
                  <el-icon><Document /></el-icon>
                  {{ selectedBusinessProject?.name }}
                </div>
                <el-button @click="businessWriteStep = 0" link>
                  <el-icon><ArrowLeft /></el-icon>
                  返回项目选择
                </el-button>
              </div>

              <h4>商务标大纲生成</h4>
              <p class="step-desc">基于招标文件格式要求自动生成商务标大纲，支持人工修改目录层级、新增章节</p>

              <div class="outline-actions">
                <el-button type="primary" @click="generateBusinessOutline" :loading="generatingBusinessOutline">
                  <el-icon><MagicStick /></el-icon>
                  自动生成大纲
                </el-button>
                <el-button @click="addOutlineSection">
                  <el-icon><Plus /></el-icon>
                  新增章节
                </el-button>
              </div>

              <div class="outline-content-layout">
                <!-- 左侧：大纲编辑器 -->
                <div class="outline-editor-panel">
                  <div class="panel-title">
                    <el-icon><Document /></el-icon>
                    商务标大纲
                  </div>
                  <div v-if="businessOutlineData.length > 0" class="outline-editor">
                    <el-tree
                      :data="businessOutlineData"
                      node-key="id"
                      default-expand-all
                      :props="{ label: 'title', children: 'children' }"
                      draggable
                      :allow-drop="allowDrop"
                    >
                      <template #default="{ node, data }">
                        <div class="custom-tree-node">
                          <span class="node-title">{{ data.title }}</span>
                          <div class="node-actions">
                            <el-button size="small" text @click.stop="editOutlineNode(data)">
                              <el-icon><Edit /></el-icon>
                            </el-button>
                            <el-button size="small" text @click.stop="addChildNode(data)">
                              <el-icon><Plus /></el-icon>
                            </el-button>
                            <el-button size="small" text type="danger" @click.stop="deleteOutlineNode(data)">
                              <el-icon><Delete /></el-icon>
                            </el-button>
                          </div>
                        </div>
                      </template>
                    </el-tree>
                  </div>
                  <div v-else class="outline-empty">
                    <el-empty description="点击【自动生成大纲】开始" :image-size="100" />
                  </div>
                </div>

                <!-- 右侧：招标文件浏览 -->
                <div class="bidding-document-viewer">
                  <div class="viewer-header">
                    <div class="viewer-title">
                      <el-icon><Reading /></el-icon>
                      招标文件正文
                    </div>
                    <div class="viewer-tools">
                      <el-button-group size="small">
                        <el-button @click="documentZoomOut">
                          <el-icon><ZoomOut /></el-icon>
                        </el-button>
                        <el-button>{{ documentZoom }}%</el-button>
                        <el-button @click="documentZoomIn">
                          <el-icon><ZoomIn /></el-icon>
                        </el-button>
                      </el-button-group>
                      <el-button size="small" @click="downloadDocument">
                        <el-icon><Download /></el-icon>
                        下载
                      </el-button>
                    </div>
                  </div>
                  <div class="viewer-content" :style="{ transform: `scale(${documentZoom / 100})` }">
                    <div class="document-page">
                      <h2 style="text-align: center; margin-bottom: 24px;">某数据中心发电机组采购项目</h2>
                      <h3 style="margin-top: 20px;">一、项目概况</h3>
                      <p>1.1 项目名称：某数据中心发电机组采购项目</p>
                      <p>1.2 招标单位：XX数据中心有限公司</p>
                      <p>1.3 项目地点：江西省南昌市</p>
                      <p>1.4 招标方式：公开招标</p>
                      
                      <h3 style="margin-top: 20px;">二、投标文件编制要求</h3>
                      <p>2.1 投标文件应包括商务标和技术标两部分</p>
                      <p>2.2 商务标应包含以下内容：</p>
                      <p style="padding-left: 20px;">（1）投标函</p>
                      <p style="padding-left: 20px;">（2）法定代表人身份证明</p>
                      <p style="padding-left: 20px;">（3）授权委托书</p>
                      <p style="padding-left: 20px;">（4）投标保证金</p>
                      <p style="padding-left: 20px;">（5）资格证明文件</p>
                      <p style="padding-left: 40px;">① 营业执照副本</p>
                      <p style="padding-left: 40px;">② 资质证书</p>
                      <p style="padding-left: 40px;">③ 安全生产许可证</p>
                      <p style="padding-left: 20px;">（6）财务状况</p>
                      <p style="padding-left: 40px;">① 近三年财务审计报告</p>
                      <p style="padding-left: 40px;">② 银行资信证明</p>
                      <p style="padding-left: 20px;">（7）业绩证明</p>
                      
                      <h3 style="margin-top: 20px;">三、技术要求</h3>
                      <p>3.1 设备类型：柴油发电机组</p>
                      <p>3.2 额定功率：≥500kW</p>
                      <p>3.3 额定电压：400V/230V</p>
                      <p>3.4 频率：50Hz</p>
                      <p>3.5 启动方式：电启动</p>
                      <p>3.6 冷却方式：水冷</p>
                      <p>3.7 噪音要求：≤85dB(A)</p>
                      <p>3.8 防护等级：IP54</p>
                      
                      <h3 style="margin-top: 20px;">四、投标截止时间和开标时间</h3>
                      <p>4.1 投标截止时间：2024年12月14日 17:00</p>
                      <p>4.2 开标时间：2024年12月15日 09:30</p>
                      <p>4.3 开标地点：XX数据中心会议室</p>
                      
                      <h3 style="margin-top: 20px;">五、其他要求</h3>
                      <p>5.1 投标保证金：人民币50,000元</p>
                      <p>5.2 投标有效期：90天</p>
                      <p>5.3 联系人：张工</p>
                      <p>5.4 联系电话：0791-88888888</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="step-actions">
                <el-button @click="businessWriteStep = 0">
                  <el-icon><ArrowLeft /></el-icon>
                  上一步
                </el-button>
                <el-button 
                  type="primary" 
                  size="large"
                  :disabled="businessOutlineData.length === 0"
                  @click="businessWriteStep = 2"
                >
                  下一步：材料智能匹配
                  <el-icon><Right /></el-icon>
                </el-button>
              </div>
            </div>
          </div>

          <!-- 步骤3: 材料智能匹配填充 -->
          <div v-if="businessWriteStep === 2" class="step-content">
            <div class="material-matching">
              <div class="step-header-bar">
                <div class="project-badge">
                  <el-icon><Document /></el-icon>
                  {{ selectedBusinessProject?.name }}
                </div>
                <el-button @click="businessWriteStep = 1" link>
                  <el-icon><ArrowLeft /></el-icon>
                  返回大纲编辑
                </el-button>
              </div>

              <h4>材料智能匹配填充</h4>
              <p class="step-desc">自动检索知识库中企业资质、财务报表等资料，自动提取承诺函模板并填充企业信息</p>

              <div class="material-filter">
                <div class="filter-title">
                  <el-icon><Filter /></el-icon>
                  应用资料范围
                </div>
                <el-form :inline="true">
                  <el-form-item label="地域">
                    <el-select v-model="materialFilter.region" placeholder="选择地域" style="width: 150px">
                      <el-option label="全部" value="" />
                      <el-option label="江西省" value="jiangxi" />
                      <el-option label="南昌市" value="nanchang" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="行业">
                    <el-select v-model="materialFilter.industry" placeholder="选择行业" style="width: 150px">
                      <el-option label="全部" value="" />
                      <el-option label="电力工程" value="power" />
                      <el-option label="建筑工程" value="construction" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年份">
                    <el-select v-model="materialFilter.year" placeholder="选择年份" style="width: 120px">
                      <el-option label="全部" value="" />
                      <el-option label="2024" value="2024" />
                      <el-option label="2023" value="2023" />
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="autoMatchAllMaterials" :loading="matchingAllMaterials">
                      <el-icon><MagicStick /></el-icon>
                      智能匹配
                    </el-button>
                    <el-button 
                      :type="allMaterialsApplied ? 'info' : 'success'" 
                      @click="toggleApplyAllMaterials" 
                      :loading="applyingAllMaterials"
                    >
                      <el-icon v-if="allMaterialsApplied"><CircleClose /></el-icon>
                      <el-icon v-else><CircleCheck /></el-icon>
                      {{ allMaterialsApplied ? '取消应用' : '一键应用' }}
                    </el-button>
                  </el-form-item>
                </el-form>
              </div>

              <div class="material-sections">
                <div v-for="section in businessOutlineData" :key="section.id" class="material-section">
                  <div class="section-header">
                    <h5>{{ section.title }}</h5>
                    <div class="section-actions">
                      <el-button size="small" type="primary" @click="autoMatchMaterial(section)">
                        <el-icon><MagicStick /></el-icon>
                        智能匹配
                      </el-button>
                      <el-button size="small" @click="openChangeMaterialDialog(section)">
                        <el-icon><Plus /></el-icon>
                        增加文件
                      </el-button>
                      <el-button 
                        size="small" 
                        :type="isSectionAllApplied(section) ? 'info' : 'success'" 
                        @click="toggleApplySectionMaterials(section)"
                      >
                        <el-icon v-if="isSectionAllApplied(section)"><CircleClose /></el-icon>
                        <el-icon v-else><CircleCheck /></el-icon>
                        {{ isSectionAllApplied(section) ? '取消应用' : '一键应用' }}
                      </el-button>
                    </div>
                  </div>
                  
                  <div v-if="section.matchedMaterials && section.matchedMaterials.length > 0" class="matched-materials">
                    <div v-for="material in section.matchedMaterials" :key="material.id" class="material-item">
                      <div class="material-info">
                        <el-icon><Document /></el-icon>
                        <div class="material-details">
                          <div class="material-name">{{ material.name }}</div>
                          <div class="material-meta">
                            <el-tag size="small">{{ material.category }}</el-tag>
                            <span class="match-score">匹配度: {{ material.matchScore }}%</span>
                          </div>
                        </div>
                      </div>
                      <div class="material-actions">
                        <el-button size="small" @click="previewMaterial(material)">
                          <el-icon><View /></el-icon>
                          预览
                        </el-button>
                        <el-button 
                          size="small" 
                          :type="material.applied ? 'success' : 'primary'" 
                          @click="toggleApplyMaterial(section, material)"
                        >
                          <el-icon v-if="material.applied"><CircleCheck /></el-icon>
                          <el-icon v-else><Check /></el-icon>
                          {{ material.applied ? '已应用' : '应用' }}
                        </el-button>
                      </div>
                    </div>
                  </div>
                  
                  <div v-else class="no-materials">
                    <el-empty description="暂无匹配的材料，点击【智能匹配】自动检索" :image-size="80" />
                  </div>
                </div>
              </div>

              <div class="step-actions">
                <el-button @click="businessWriteStep = 1">
                  <el-icon><ArrowLeft /></el-icon>
                  上一步
                </el-button>
                <el-button 
                  type="primary" 
                  size="large"
                  @click="businessWriteStep = 3"
                >
                  生成标书文件
                  <el-icon><Right /></el-icon>
                </el-button>
              </div>
            </div>
          </div>

          <!-- 文件预览弹窗 -->
          <el-dialog
            v-model="previewMaterialDialogVisible"
            :title="`预览：${previewingMaterial?.name || ''}`"
            width="1000px"
            :close-on-click-modal="false"
          >
            <div class="material-preview-dialog">
              <div class="preview-toolbar">
                <div class="file-info">
                  <el-tag>{{ previewingMaterial?.category }}</el-tag>
                  <span class="file-size">文件大小: 2.5 MB</span>
                  <span class="file-date">上传时间: 2024-11-20</span>
                </div>
                <div class="preview-actions">
                  <el-button-group size="small">
                    <el-button @click="zoomOut">
                      <el-icon><ZoomOut /></el-icon>
                    </el-button>
                    <el-button>{{ Math.round(previewZoom * 100) }}%</el-button>
                    <el-button @click="zoomIn">
                      <el-icon><ZoomIn /></el-icon>
                    </el-button>
                  </el-button-group>
                  <el-button size="small" @click="downloadPreviewFile">
                    <el-icon><Download /></el-icon>
                    下载
                  </el-button>
                </div>
              </div>

              <div class="preview-content-area">
                <div class="preview-document" :style="{ transform: `scale(${previewZoom})` }">
                  <!-- PDF/图片预览区域 -->
                  <div v-if="previewingMaterial?.name.endsWith('.pdf')" class="pdf-preview">
                    <div class="document-page">
                      <div class="page-header">
                        <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 24 24'%3E%3Cpath fill='%23dc2626' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z'/%3E%3Cpath fill='%23fff' d='M14 2v6h6'/%3E%3C/svg%3E" alt="PDF" style="width: 60px; margin: 20px auto; display: block;">
                        <h3 style="text-align: center; color: #1f2937; margin: 20px 0;">{{ previewingMaterial?.name }}</h3>
                      </div>
                      
                      <!-- 根据文件类型显示不同内容 -->
                      <div v-if="previewingMaterial?.name.includes('营业执照')" class="document-content">
                        <h2 style="text-align: center; margin: 30px 0; font-size: 24px; color: #dc2626;">营业执照</h2>
                        <div style="padding: 20px 40px; line-height: 2;">
                          <p><strong>统一社会信用代码：</strong>91360000MA35XXXX1X</p>
                          <p><strong>名称：</strong>江西XX科技有限公司</p>
                          <p><strong>类型：</strong>有限责任公司（自然人投资或控股）</p>
                          <p><strong>法定代表人：</strong>张三</p>
                          <p><strong>注册资本：</strong>5000万元人民币</p>
                          <p><strong>成立日期：</strong>2015年03月15日</p>
                          <p><strong>营业期限：</strong>2015年03月15日至无固定期限</p>
                          <p><strong>住所：</strong>江西省南昌市红谷滩区XX路XX号</p>
                          <p><strong>经营范围：</strong>电力工程设计、施工；机电设备安装；建筑智能化工程；消防设施工程；安全技术防范工程；计算机系统集成；软件开发；技术咨询服务。（依法须经批准的项目，经相关部门批准后方可开展经营活动）</p>
                        </div>
                        <div style="text-align: right; padding: 40px; color: #6b7280;">
                          <p>发照日期：2024年01月10日</p>
                          <p style="margin-top: 20px;">（盖章）</p>
                        </div>
                      </div>

                      <div v-else-if="previewingMaterial?.name.includes('资质证书')" class="document-content">
                        <h2 style="text-align: center; margin: 30px 0; font-size: 24px; color: #2563eb;">建筑业企业资质证书</h2>
                        <div style="padding: 20px 40px; line-height: 2;">
                          <p><strong>企业名称：</strong>江西XX科技有限公司</p>
                          <p><strong>统一社会信用代码：</strong>91360000MA35XXXX1X</p>
                          <p><strong>资质类别及等级：</strong></p>
                          <ul style="padding-left: 40px; margin: 10px 0;">
                            <li>电力工程施工总承包 贰级</li>
                            <li>建筑机电安装工程专业承包 贰级</li>
                            <li>消防设施工程专业承包 贰级</li>
                          </ul>
                          <p><strong>法定代表人：</strong>张三</p>
                          <p><strong>企业负责人：</strong>张三</p>
                          <p><strong>技术负责人：</strong>李四</p>
                          <p><strong>注册资本：</strong>5000万元</p>
                          <p><strong>证书编号：</strong>A236XXXXXXXX</p>
                          <p><strong>有效期至：</strong>2029年12月31日</p>
                        </div>
                        <div style="text-align: right; padding: 40px; color: #6b7280;">
                          <p>发证机关：江西省住房和城乡建设厅</p>
                          <p>发证日期：2024年01月15日</p>
                        </div>
                      </div>

                      <div v-else-if="previewingMaterial?.name.includes('财务审计')" class="document-content">
                        <h2 style="text-align: center; margin: 30px 0; font-size: 22px;">审计报告</h2>
                        <div style="padding: 20px 40px; line-height: 1.8;">
                          <h3 style="margin: 20px 0; color: #1f2937;">一、审计意见</h3>
                          <p style="text-indent: 2em;">我们审计了江西XX科技有限公司（以下简称"贵公司"）财务报表，包括2024年12月31日的资产负债表，2024年度的利润表、现金流量表、所有者权益变动表以及相关财务报表附注。</p>
                          
                          <h3 style="margin: 20px 0; color: #1f2937;">二、主要财务数据</h3>
                          <table style="width: 100%; border-collapse: collapse; margin: 20px 0;">
                            <tr style="background: #f3f4f6;">
                              <th style="border: 1px solid #e5e7eb; padding: 12px; text-align: left;">项目</th>
                              <th style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">2024年度（万元）</th>
                              <th style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">2023年度（万元）</th>
                            </tr>
                            <tr>
                              <td style="border: 1px solid #e5e7eb; padding: 12px;">营业收入</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">12,580</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">10,230</td>
                            </tr>
                            <tr>
                              <td style="border: 1px solid #e5e7eb; padding: 12px;">净利润</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">1,856</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">1,523</td>
                            </tr>
                            <tr>
                              <td style="border: 1px solid #e5e7eb; padding: 12px;">资产总额</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">25,600</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">22,100</td>
                            </tr>
                            <tr>
                              <td style="border: 1px solid #e5e7eb; padding: 12px;">负债总额</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">15,200</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">13,800</td>
                            </tr>
                            <tr>
                              <td style="border: 1px solid #e5e7eb; padding: 12px;">所有者权益</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">10,400</td>
                              <td style="border: 1px solid #e5e7eb; padding: 12px; text-align: right;">8,300</td>
                            </tr>
                          </table>
                          
                          <div style="margin-top: 40px; text-align: right;">
                            <p>XX会计师事务所（特殊普通合伙）</p>
                            <p>中国注册会计师：王五</p>
                            <p>中国注册会计师：赵六</p>
                            <p style="margin-top: 20px;">2024年3月15日</p>
                          </div>
                        </div>
                      </div>

                      <div v-else class="document-content">
                        <div style="padding: 60px; text-align: center; color: #6b7280;">
                          <el-icon style="font-size: 80px; margin-bottom: 20px;"><Document /></el-icon>
                          <p style="font-size: 16px;">{{ previewingMaterial?.name }}</p>
                          <p style="margin-top: 10px;">文件预览</p>
                        </div>
                      </div>
                    </div>
                  </div>

                  <div v-else class="other-file-preview">
                    <el-empty description="暂不支持该文件格式的在线预览" :image-size="120">
                      <el-button type="primary" @click="downloadPreviewFile">
                        <el-icon><Download /></el-icon>
                        下载文件查看
                      </el-button>
                    </el-empty>
                  </div>
                </div>
              </div>
            </div>

            <template #footer>
              <el-button @click="previewMaterialDialogVisible = false">关闭</el-button>
              <el-button type="primary" @click="downloadPreviewFile">
                <el-icon><Download /></el-icon>
                下载文件
              </el-button>
            </template>
          </el-dialog>

          <!-- 增加文件弹窗 -->
          <el-dialog
            v-model="changeMaterialDialogVisible"
            title="增加文件"
            width="900px"
            :close-on-click-modal="false"
          >
            <div class="change-material-dialog">
              <div class="dialog-section-title">
                <el-icon><Folder /></el-icon>
                <span>为 "{{ currentChangingSection?.title || '当前章节' }}" 选择文件</span>
              </div>

              <!-- 上传文件区域 -->
              <div class="dialog-upload-area">
                <!-- 自定义上传触发区域 -->
                <div class="custom-upload-trigger" @click="triggerFileUpload">
                  <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
                  <div class="el-upload__text">
                    拖拽文件到此处或 <em>点击上传</em>
                  </div>
                  <div class="el-upload__tip">
                    支持 PDF、Word、Excel、图片等格式，可同时上传多个文件
                  </div>
                </div>
                
                <!-- 隐藏的文件输入框 -->
                <input
                  ref="fileInputRef"
                  type="file"
                  accept=".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png"
                  multiple
                  style="display: none;"
                  @change="handleFileInputChange"
                />
              </div>

              <!-- 已上传文件列表 -->
              <div v-if="uploadedFiles.length > 0" class="uploaded-files-section">
                <div class="section-title">
                  <el-icon><Files /></el-icon>
                  已上传文件 ({{ uploadedFiles.length }})
                </div>
                <div class="uploaded-files-list">
                  <div v-for="file in uploadedFiles" :key="file.id" class="uploaded-file-item">
                    <div class="file-info">
                      <el-icon><Document /></el-icon>
                      <div class="file-details">
                        <div class="file-name">{{ file.name }}</div>
                        <div class="file-meta">
                          <span class="file-size">{{ formatFileSize(file.size) }}</span>
                          <el-tag size="small" type="success">新上传</el-tag>
                        </div>
                      </div>
                    </div>
                    <div class="file-actions">
                      <el-button size="small" text @click="previewUploadedFile(file)">
                        <el-icon><View /></el-icon>
                        浏览
                      </el-button>
                      <el-button size="small" text type="danger" @click="removeUploadedFile(file)">
                        <el-icon><Delete /></el-icon>
                        删除
                      </el-button>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 筛选条件 -->
              <div class="dialog-filter">
                <el-form :inline="true">
                  <el-form-item label="地域">
                    <el-select v-model="dialogMaterialFilter.region" placeholder="选择地域" style="width: 150px">
                      <el-option label="全部" value="" />
                      <el-option label="江西省" value="jiangxi" />
                      <el-option label="南昌市" value="nanchang" />
                      <el-option label="赣州市" value="ganzhou" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="行业">
                    <el-select v-model="dialogMaterialFilter.industry" placeholder="选择行业" style="width: 150px">
                      <el-option label="全部" value="" />
                      <el-option label="电力工程" value="power" />
                      <el-option label="建筑工程" value="construction" />
                      <el-option label="市政工程" value="municipal" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年份">
                    <el-select v-model="dialogMaterialFilter.year" placeholder="选择年份" style="width: 120px">
                      <el-option label="全部" value="" />
                      <el-option label="2024" value="2024" />
                      <el-option label="2023" value="2023" />
                      <el-option label="2022" value="2022" />
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="searchDialogMaterials">
                      <el-icon><Search /></el-icon>
                      检索
                    </el-button>
                  </el-form-item>
                </el-form>
              </div>

              <!-- 文件列表 -->
              <div class="dialog-file-list">
                <el-table
                  :data="availableMaterials"
                  @selection-change="handleMaterialSelectionChange"
                  max-height="400"
                >
                  <el-table-column type="selection" width="55" />
                  <el-table-column label="文件名" min-width="200">
                    <template #default="{ row }">
                      <div class="file-name-cell">
                        <el-icon><Document /></el-icon>
                        <span>{{ row.name }}</span>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="category" label="分类" width="120">
                    <template #default="{ row }">
                      <el-tag size="small">{{ row.category }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column prop="region" label="地域" width="100" />
                  <el-table-column prop="year" label="年份" width="80" />
                  <el-table-column label="操作" width="100">
                    <template #default="{ row }">
                      <el-button size="small" text @click="previewDialogMaterial(row)">
                        <el-icon><View /></el-icon>
                        浏览
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </div>

              <div class="dialog-selected-info">
                <el-tag v-if="selectedMaterials.length > 0" type="info">
                  已选择 {{ selectedMaterials.length }} 个文件
                </el-tag>
              </div>
            </div>

            <template #footer>
              <div class="dialog-footer-info">
                <span v-if="selectedMaterials.length > 0 || uploadedFiles.length > 0">
                  已选择 {{ selectedMaterials.length }} 个知识库文件，{{ uploadedFiles.length }} 个上传文件
                </span>
              </div>
              <el-button @click="cancelChangeMaterial">取消</el-button>
              <el-button 
                type="primary" 
                @click="confirmChangeMaterial" 
                :disabled="selectedMaterials.length === 0 && uploadedFiles.length === 0"
              >
                确定添加 ({{ selectedMaterials.length + uploadedFiles.length }})
              </el-button>
            </template>
          </el-dialog>

          <!-- 步骤4: 自动格式排版 -->
          <div v-if="businessWriteStep === 3" class="step-content">
            <div class="document-editor-layout">
              <div class="step-header-bar">
                <div class="project-badge">
                  <el-icon><Document /></el-icon>
                  {{ selectedBusinessProject?.name }}
                </div>
                <div class="header-actions">
                  <el-button @click="businessWriteStep = 2" link>
                    <el-icon><ArrowLeft /></el-icon>
                    返回材料匹配
                  </el-button>
                  <el-button type="success" @click="saveBusinessDocument">
                    <el-icon><Check /></el-icon>
                    保存文档
                  </el-button>
                  <el-button @click="exportBusinessDocument">
                    <el-icon><Download /></el-icon>
                    导出
                  </el-button>
                </div>
              </div>

              <div class="editor-container">
                <!-- 左侧：文档编辑器 -->
                <div class="document-editor">
                  <div class="editor-toolbar">
                    <el-button-group size="small">
                      <el-button @click="formatText('bold')">
                        <strong>B</strong>
                      </el-button>
                      <el-button @click="formatText('italic')">
                        <em>I</em>
                      </el-button>
                      <el-button @click="formatText('underline')">
                        <u>U</u>
                      </el-button>
                    </el-button-group>
                    
                    <el-divider direction="vertical" />
                    
                    <el-select v-model="editorFormat.fontFamily" size="small" style="width: 120px">
                      <el-option label="宋体" value="SimSun" />
                      <el-option label="黑体" value="SimHei" />
                      <el-option label="微软雅黑" value="Microsoft YaHei" />
                      <el-option label="楷体" value="KaiTi" />
                    </el-select>
                    
                    <el-select v-model="editorFormat.fontSize" size="small" style="width: 100px">
                      <el-option label="小四" value="12pt" />
                      <el-option label="四号" value="14pt" />
                      <el-option label="小三" value="15pt" />
                      <el-option label="三号" value="16pt" />
                      <el-option label="小二" value="18pt" />
                      <el-option label="二号" value="22pt" />
                    </el-select>
                    
                    <el-divider direction="vertical" />
                    
                    <el-button-group size="small">
                      <el-button @click="formatText('alignLeft')">左对齐</el-button>
                      <el-button @click="formatText('alignCenter')">居中</el-button>
                      <el-button @click="formatText('alignRight')">右对齐</el-button>
                    </el-button-group>
                    
                    <el-divider direction="vertical" />
                    
                    <el-select v-model="editorFormat.heading" size="small" style="width: 120px" placeholder="标题样式">
                      <el-option label="正文" value="normal" />
                      <el-option label="一级标题" value="h1" />
                      <el-option label="二级标题" value="h2" />
                      <el-option label="三级标题" value="h3" />
                    </el-select>
                  </div>
                  
                  <div 
                    class="editor-content" 
                    contenteditable="true"
                    :style="{
                      fontFamily: editorFormat.fontFamily,
                      fontSize: editorFormat.fontSize
                    }"
                    v-html="businessDocumentContent"
                    @input="updateBusinessDocContent"
                  >
                  </div>
                </div>

                <!-- 右侧：智能对话助手 -->
                <div class="ai-assistant">
                  <div class="assistant-header">
                    <el-icon><MagicStick /></el-icon>
                    <span>智能对话助手</span>
                  </div>
                  
                  <div class="chat-messages" ref="outlineChatMessagesRef">
                    <div v-for="msg in chatMessages" :key="msg.id" class="chat-message" :class="msg.role">
                      <div class="message-avatar">
                        <el-icon v-if="msg.role === 'assistant'"><MagicStick /></el-icon>
                        <el-icon v-else><User /></el-icon>
                      </div>
                      <div class="message-content">
                        <div class="message-text">{{ msg.content }}</div>
                        <div class="message-time">{{ msg.time }}</div>
                      </div>
                    </div>
                  </div>
                  
                  <div class="chat-input">
                    <el-input
                      v-model="chatInput"
                      type="textarea"
                      :rows="3"
                      placeholder="输入您的问题或需求，AI助手将帮助您优化文档内容..."
                      @keydown.ctrl.enter="sendBusinessChatMessage"
                    />
                    <el-button type="primary" @click="sendBusinessChatMessage" :loading="chatSending">
                      <el-icon><Promotion /></el-icon>
                      发送
                    </el-button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 技术标撰写 -->
        <div v-if="activeNav === 'write-tech'" class="panel business-write-panel">
          <div class="panel-header">
            <h3>技术标智能撰写</h3>
          </div>

          <!-- 步骤指示器 -->
          <div class="business-write-steps">
            <el-steps :active="techWriteStep" align-center>
              <el-step title="选择项目" description="选择要撰写技术标的项目" />
              <el-step title="生成大纲" description="AI智能生成技术标大纲" />
              <el-step title="技术方案" description="填充技术方案和参数" />
              <el-step title="生成文件" description="自动排版生成技术标" />
            </el-steps>
          </div>

          <!-- 步骤1: 选择项目 -->
          <div v-if="techWriteStep === 0" class="step-content">
            <div class="project-selection">
              <div class="step-title-section">
                <h4>选择项目</h4>
                <p class="step-desc-highlight">请选择需要撰写技术文件的项目，系统将自动同步项目标书文件和招标信息提取结果</p>
              </div>
              
              <div class="project-cards">
                <div 
                  v-for="project in ongoingProjects" 
                  :key="project.id"
                  class="project-card"
                  :class="{ selected: selectedTechProject?.id === project.id }"
                  @click="selectTechProject(project)"
                >
                  <div class="project-card-header">
                    <h5>{{ project.name }}</h5>
                    <el-tag :type="getProgressTagType(project.progress)" size="small">
                      {{ project.progress }}
                    </el-tag>
                  </div>
                  <div class="project-card-body">
                    <div class="project-info-item">
                      <span class="label">创建时间：</span>
                      <span class="value">{{ project.createTime }}</span>
                    </div>
                    <div v-if="project.extractedInfo" class="project-info-item">
                      <el-icon color="#10b981"><CircleCheck /></el-icon>
                      <span class="value">已完成招标信息提取</span>
                    </div>
                  </div>
                  <div v-if="selectedTechProject?.id === project.id" class="selected-badge">
                    <el-icon><CircleCheckFilled /></el-icon>
                    已选择
                  </div>
                </div>
              </div>

              <div class="step-actions">
                <el-button 
                  type="primary" 
                  size="large"
                  :disabled="!selectedTechProject"
                  @click="techWriteStep = 1"
                >
                  下一步：生成技术标大纲
                  <el-icon><Right /></el-icon>
                </el-button>
              </div>
            </div>
          </div>

          <!-- 步骤2: 生成技术标大纲 -->
          <div v-if="techWriteStep === 1" class="step-content">
            <div class="outline-generation-layout">
              <div class="step-header-bar">
                <div class="project-badge">
                  <el-icon><Document /></el-icon>
                  {{ selectedTechProject?.name }}
                </div>
                <el-button @click="techWriteStep = 0" link>
                  <el-icon><ArrowLeft /></el-icon>
                  返回项目选择
                </el-button>
              </div>

              <div class="outline-split-view">
                <!-- 左侧：大纲编辑器 -->
                <div class="outline-editor-section">
                  <h4>技术标大纲生成</h4>
                  <p class="step-desc">基于招标文件格式要求自动生成技术标大纲，支持人工修改目录层级、新增章节</p>

                  <div class="outline-actions">
                    <el-button type="primary" @click="generateTechOutline" :loading="generatingTechOutline">
                      <el-icon><MagicStick /></el-icon>
                      {{ generatingTechOutline ? '正在生成...' : 'AI生成大纲' }}
                    </el-button>
                    <el-button @click="addTechSection">
                      <el-icon><Plus /></el-icon>
                      添加章节
                    </el-button>
                  </div>

                  <div v-if="techOutlineData.length > 0" class="outline-tree">
                    <el-tree
                      :data="techOutlineData"
                      node-key="id"
                      default-expand-all
                      draggable
                      :allow-drop="allowDrop"
                    >
                      <template #default="{ node, data }">
                        <div class="tree-node-content">
                          <span class="node-title">{{ data.title }}</span>
                          <div class="node-actions">
                            <el-button size="small" text @click.stop="editTechSection(data)">
                              <el-icon><Edit /></el-icon>
                            </el-button>
                            <el-button size="small" text type="danger" @click.stop="deleteTechSection(data)">
                              <el-icon><Delete /></el-icon>
                            </el-button>
                          </div>
                        </div>
                      </template>
                    </el-tree>
                  </div>

                  <el-empty v-else description="点击【AI生成大纲】开始" :image-size="120" />
                </div>

                <!-- 右侧：招标文件浏览 -->
                <div class="bidding-document-viewer">
                  <div class="viewer-header">
                    <div class="viewer-title">
                      <el-icon><Reading /></el-icon>
                      招标文件正文
                    </div>
                    <div class="viewer-tools">
                      <el-button-group size="small">
                        <el-button @click="documentZoomOut">
                          <el-icon><ZoomOut /></el-icon>
                        </el-button>
                        <el-button>{{ documentZoom }}%</el-button>
                        <el-button @click="documentZoomIn">
                          <el-icon><ZoomIn /></el-icon>
                        </el-button>
                      </el-button-group>
                      <el-button size="small" @click="downloadDocument">
                        <el-icon><Download /></el-icon>
                        下载
                      </el-button>
                    </div>
                  </div>
                  <div class="viewer-content" :style="{ transform: `scale(${documentZoom / 100})` }">
                    <div class="document-page">
                      <h2 style="text-align: center; margin-bottom: 24px;">某数据中心发电机组采购项目</h2>
                      <h3 style="margin-top: 20px;">三、技术要求</h3>
                      <p>3.1 设备类型：柴油发电机组</p>
                      <p>3.2 额定功率：≥500kW</p>
                      <p>3.3 额定电压：400V/230V</p>
                      <p>3.4 频率：50Hz</p>
                      <p>3.5 启动方式：电启动</p>
                      <p>3.6 冷却方式：水冷</p>
                      <p>3.7 噪音要求：≤85dB(A)</p>
                      <p>3.8 防护等级：IP54</p>
                      <p>3.9 燃油类型：0#柴油</p>
                      <p>3.10 控制系统：自动化控制系统，具备远程监控功能</p>
                      
                      <h3 style="margin-top: 20px;">四、技术标编制要求</h3>
                      <p>4.1 技术标应包含以下内容：</p>
                      <p style="padding-left: 20px;">（1）技术方案总体说明</p>
                      <p style="padding-left: 20px;">（2）技术参数响应表</p>
                      <p style="padding-left: 20px;">（3）设备选型说明</p>
                      <p style="padding-left: 20px;">（4）施工组织设计</p>
                      <p style="padding-left: 40px;">① 施工方案</p>
                      <p style="padding-left: 40px;">② 施工进度计划</p>
                      <p style="padding-left: 40px;">③ 质量保证措施</p>
                      <p style="padding-left: 40px;">④ 安全文明施工措施</p>
                      <p style="padding-left: 20px;">（5）项目管理方案</p>
                      <p style="padding-left: 20px;">（6）售后服务方案</p>
                      <p style="padding-left: 20px;">（7）培训方案</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="step-actions">
                <el-button @click="techWriteStep = 0">
                  <el-icon><ArrowLeft /></el-icon>
                  上一步
                </el-button>
                <el-button 
                  type="primary" 
                  size="large"
                  :disabled="techOutlineData.length === 0"
                  @click="techWriteStep = 2"
                >
                  下一步：技术方案填充
                  <el-icon><Right /></el-icon>
                </el-button>
              </div>
            </div>
          </div>

          <!-- 步骤3: 技术资料智能匹配填充 -->
          <div v-if="techWriteStep === 2" class="step-content">
            <div class="material-matching">
              <div class="step-header-bar">
                <div class="project-badge">
                  <el-icon><Document /></el-icon>
                  {{ selectedTechProject?.name }}
                </div>
                <el-button @click="techWriteStep = 1" link>
                  <el-icon><ArrowLeft /></el-icon>
                  返回大纲编辑
                </el-button>
              </div>

              <h4>技术资料智能匹配填充</h4>
              <p class="step-desc">自动检索知识库中技术方案、设备参数等资料，智能匹配并填充到对应章节</p>

              <div class="material-filter">
                <div class="filter-title">
                  <el-icon><Filter /></el-icon>
                  应用资料范围
                </div>
                <el-form :inline="true">
                  <el-form-item label="地域">
                    <el-select v-model="techMaterialFilter.region" placeholder="选择地域" style="width: 150px">
                      <el-option label="全部" value="" />
                      <el-option label="江西省" value="jiangxi" />
                      <el-option label="南昌市" value="nanchang" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="行业">
                    <el-select v-model="techMaterialFilter.industry" placeholder="选择行业" style="width: 150px">
                      <el-option label="全部" value="" />
                      <el-option label="电力工程" value="power" />
                      <el-option label="建筑工程" value="construction" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年份">
                    <el-select v-model="techMaterialFilter.year" placeholder="选择年份" style="width: 120px">
                      <el-option label="全部" value="" />
                      <el-option label="2024" value="2024" />
                      <el-option label="2023" value="2023" />
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="autoMatchAllTechMaterials" :loading="matchingAllTechMaterials">
                      <el-icon><MagicStick /></el-icon>
                      智能匹配
                    </el-button>
                    <el-button 
                      :type="allTechMaterialsApplied ? 'info' : 'success'" 
                      @click="toggleApplyAllTechMaterials" 
                      :loading="applyingAllTechMaterials"
                    >
                      <el-icon v-if="allTechMaterialsApplied"><CircleClose /></el-icon>
                      <el-icon v-else><CircleCheck /></el-icon>
                      {{ allTechMaterialsApplied ? '取消应用' : '一键应用' }}
                    </el-button>
                  </el-form-item>
                </el-form>
              </div>

              <div class="material-sections">
                <div v-for="section in techOutlineData" :key="section.id" class="material-section">
                  <div class="section-header">
                    <h5>{{ section.title }}</h5>
                    <div class="section-actions">
                      <el-button size="small" type="primary" @click="autoMatchTechMaterial(section)">
                        <el-icon><MagicStick /></el-icon>
                        智能匹配
                      </el-button>
                      <el-button size="small" @click="openChangeTechMaterialDialog(section)">
                        <el-icon><Plus /></el-icon>
                        增加文件
                      </el-button>
                      <el-button 
                        size="small" 
                        :type="isTechSectionAllApplied(section) ? 'info' : 'success'" 
                        @click="toggleApplyTechSectionMaterials(section)"
                      >
                        <el-icon v-if="isTechSectionAllApplied(section)"><CircleClose /></el-icon>
                        <el-icon v-else><CircleCheck /></el-icon>
                        {{ isTechSectionAllApplied(section) ? '取消应用' : '一键应用' }}
                      </el-button>
                    </div>
                  </div>
                  
                  <div v-if="section.matchedMaterials && section.matchedMaterials.length > 0" class="matched-materials">
                    <div v-for="material in section.matchedMaterials" :key="material.id" class="material-item">
                      <div class="material-info">
                        <el-icon><Document /></el-icon>
                        <div class="material-details">
                          <div class="material-name">{{ material.name }}</div>
                          <div class="material-meta">
                            <el-tag size="small">{{ material.category }}</el-tag>
                            <span class="match-score">匹配度: {{ material.matchScore }}%</span>
                          </div>
                        </div>
                      </div>
                      <div class="material-actions">
                        <el-button size="small" @click="previewMaterial(material)">
                          <el-icon><View /></el-icon>
                          预览
                        </el-button>
                        <el-button 
                          size="small" 
                          :type="material.applied ? 'success' : 'primary'" 
                          @click="toggleApplyTechMaterial(section, material)"
                        >
                          <el-icon v-if="material.applied"><CircleCheck /></el-icon>
                          <el-icon v-else><Check /></el-icon>
                          {{ material.applied ? '已应用' : '应用' }}
                        </el-button>
                      </div>
                    </div>
                  </div>
                  
                  <div v-else class="no-materials">
                    <el-empty description="暂无匹配的资料，点击【智能匹配】自动检索" :image-size="80" />
                  </div>
                </div>
              </div>

              <div class="step-actions">
                <el-button @click="techWriteStep = 1">
                  <el-icon><ArrowLeft /></el-icon>
                  上一步
                </el-button>
                <el-button 
                  type="primary" 
                  size="large"
                  @click="techWriteStep = 3"
                >
                  生成技术标文件
                  <el-icon><Right /></el-icon>
                </el-button>
              </div>
            </div>
          </div>

          <!-- 步骤4: 自动排版生成 -->
          <div v-if="techWriteStep === 3" class="step-content">
            <div class="document-editor-layout">
              <div class="step-header-bar">
                <div class="project-badge">
                  <el-icon><Document /></el-icon>
                  {{ selectedTechProject?.name }}
                </div>
                <el-button @click="techWriteStep = 2" link>
                  <el-icon><ArrowLeft /></el-icon>
                  返回方案填充
                </el-button>
              </div>

              <h4>技术标文件生成</h4>
              <p class="step-desc">自动排版生成完整的技术标文件，支持在线编辑和导出</p>

              <div class="editor-layout">
                <!-- 左侧：文档编辑器 -->
                <div class="document-editor">
                  <div class="editor-toolbar">
                    <el-button-group size="small">
                      <el-button @click="formatText('bold')">
                        <strong>B</strong>
                      </el-button>
                      <el-button @click="formatText('italic')">
                        <em>I</em>
                      </el-button>
                      <el-button @click="formatText('underline')">
                        <u>U</u>
                      </el-button>
                    </el-button-group>
                    
                    <el-divider direction="vertical" />
                    
                    <el-select v-model="editorFormat.fontFamily" size="small" style="width: 120px">
                      <el-option label="宋体" value="SimSun" />
                      <el-option label="黑体" value="SimHei" />
                      <el-option label="微软雅黑" value="Microsoft YaHei" />
                      <el-option label="楷体" value="KaiTi" />
                    </el-select>
                    
                    <el-select v-model="editorFormat.fontSize" size="small" style="width: 100px">
                      <el-option label="小四" value="12pt" />
                      <el-option label="四号" value="14pt" />
                      <el-option label="小三" value="15pt" />
                      <el-option label="三号" value="16pt" />
                      <el-option label="小二" value="18pt" />
                      <el-option label="二号" value="22pt" />
                    </el-select>
                    
                    <el-divider direction="vertical" />
                    
                    <el-button-group size="small">
                      <el-button @click="formatText('alignLeft')">左对齐</el-button>
                      <el-button @click="formatText('alignCenter')">居中</el-button>
                      <el-button @click="formatText('alignRight')">右对齐</el-button>
                    </el-button-group>
                    
                    <el-divider direction="vertical" />
                    
                    <el-select v-model="editorFormat.heading" size="small" style="width: 120px" placeholder="标题样式">
                      <el-option label="正文" value="normal" />
                      <el-option label="一级标题" value="h1" />
                      <el-option label="二级标题" value="h2" />
                      <el-option label="三级标题" value="h3" />
                    </el-select>
                  </div>

                  <div 
                    class="editor-content" 
                    contenteditable="true"
                    :style="{ fontFamily: editorFormat.fontFamily, fontSize: editorFormat.fontSize }"
                    v-html="techDocumentContent"
                    @input="updateTechDocumentContent"
                  ></div>
                </div>

                <!-- 右侧：AI助手 -->
                <div class="ai-assistant">
                  <div class="assistant-header">
                    <el-icon><User /></el-icon>
                    <span>AI写作助手</span>
                  </div>

                  <div class="chat-messages" ref="chatMessagesRef">
                    <div 
                      v-for="message in chatMessages" 
                      :key="message.id"
                      class="chat-message"
                      :class="message.role"
                    >
                      <div class="message-avatar">
                        <el-icon v-if="message.role === 'assistant'"><User /></el-icon>
                        <el-icon v-else><User /></el-icon>
                      </div>
                      <div class="message-content">
                        <div class="message-text">{{ message.content }}</div>
                        <div class="message-time">{{ message.time }}</div>
                      </div>
                    </div>
                  </div>

                  <div class="chat-input">
                    <el-input
                      v-model="chatInput"
                      type="textarea"
                      :rows="3"
                      placeholder="输入您的问题或需求，AI助手将帮助您优化文档内容..."
                      @keydown.ctrl.enter="sendBusinessChatMessage"
                    />
                    <el-button type="primary" @click="sendBusinessChatMessage" :loading="chatSending">
                      <el-icon><Promotion /></el-icon>
                      发送
                    </el-button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 共享对话框：文件预览和增加文件（商务标和技术标共用） -->
        <!-- 文件预览弹窗 -->
        <el-dialog
          v-model="previewMaterialDialogVisible"
          :title="`预览：${previewingMaterial?.name || ''}`"
          width="1000px"
          :close-on-click-modal="false"
        >
          <div class="material-preview-dialog">
            <div class="preview-toolbar">
              <div class="file-info">
                <el-tag>{{ previewingMaterial?.category }}</el-tag>
                <span class="file-size">文件大小: 2.5 MB</span>
                <span class="file-date">上传时间: 2024-11-20</span>
              </div>
              <div class="preview-actions">
                <el-button-group size="small">
                  <el-button @click="zoomOut">
                    <el-icon><ZoomOut /></el-icon>
                  </el-button>
                  <el-button>{{ Math.round(previewZoom * 100) }}%</el-button>
                  <el-button @click="zoomIn">
                    <el-icon><ZoomIn /></el-icon>
                  </el-button>
                </el-button-group>
                <el-button size="small" @click="downloadPreviewFile">
                  <el-icon><Download /></el-icon>
                  下载
                </el-button>
              </div>
            </div>

            <div class="preview-content-area">
              <div class="preview-document" :style="{ transform: `scale(${previewZoom})` }">
                <div v-if="previewingMaterial?.name.endsWith('.pdf')" class="pdf-preview">
                  <div class="document-page">
                    <div class="page-header">
                      <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 24 24'%3E%3Cpath fill='%23dc2626' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z'/%3E%3Cpath fill='%23fff' d='M14 2v6h6'/%3E%3C/svg%3E" alt="PDF" style="width: 60px; margin: 20px auto; display: block;">
                      <h3 style="text-align: center; color: #1f2937; margin: 20px 0;">{{ previewingMaterial?.name }}</h3>
                    </div>
                    <div class="document-content">
                      <p style="padding: 60px; text-align: center; color: #6b7280;">文件预览内容...</p>
                    </div>
                  </div>
                </div>
                <div v-else class="other-file-preview">
                  <el-empty description="暂不支持该文件格式的在线预览" :image-size="120">
                    <el-button type="primary" @click="downloadPreviewFile">
                      <el-icon><Download /></el-icon>
                      下载文件查看
                    </el-button>
                  </el-empty>
                </div>
              </div>
            </div>
          </div>

          <template #footer>
            <el-button @click="previewMaterialDialogVisible = false">关闭</el-button>
            <el-button type="primary" @click="downloadPreviewFile">
              <el-icon><Download /></el-icon>
              下载文件
            </el-button>
          </template>
        </el-dialog>

        <!-- 格式统一 -->
        <div v-if="activeNav === 'merge-format'" class="panel">
          <div class="panel-header">
            <h3>文件格式统一</h3>
            <div class="header-actions">
              <el-button type="primary" @click="startFormatUnify">
                <el-icon><MagicStick /></el-icon>
                开始统一
              </el-button>
            </div>
          </div>

          <div class="format-settings">
            <el-form label-width="120px">
              <el-form-item label="页面设置">
                <el-select v-model="formatConfig.pageSize" style="width: 200px;">
                  <el-option label="A4" value="A4" />
                  <el-option label="A3" value="A3" />
                </el-select>
              </el-form-item>
              <el-form-item label="页边距">
                <el-input-number v-model="formatConfig.margin" :min="10" :max="50" /> mm
              </el-form-item>
              <el-form-item label="字体">
                <el-select v-model="formatConfig.font" style="width: 200px;">
                  <el-option label="宋体" value="宋体" />
                  <el-option label="黑体" value="黑体" />
                  <el-option label="仿宋" value="仿宋" />
                </el-select>
              </el-form-item>
              <el-form-item label="字号">
                <el-select v-model="formatConfig.fontSize" style="width: 200px;">
                  <el-option label="小四" value="12" />
                  <el-option label="四号" value="14" />
                  <el-option label="小三" value="15" />
                </el-select>
              </el-form-item>
              <el-form-item label="行距">
                <el-select v-model="formatConfig.lineHeight" style="width: 200px;">
                  <el-option label="单倍行距" value="1" />
                  <el-option label="1.5倍行距" value="1.5" />
                  <el-option label="2倍行距" value="2" />
                </el-select>
              </el-form-item>
            </el-form>
          </div>

          <div class="file-list-panel">
            <h4>待处理文件</h4>
            <el-table :data="mergeFiles" stripe>
              <el-table-column prop="name" label="文件名" min-width="200" />
              <el-table-column prop="type" label="类型" width="100" />
              <el-table-column label="状态" width="120">
                <template #default="{ row }">
                  <el-tag :type="row.formatted ? 'success' : 'info'" size="small">
                    {{ row.formatted ? '已统一' : '待处理' }}
                  </el-tag>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>

        <!-- 索引生成 -->
        <div v-if="activeNav === 'merge-index'" class="panel">
          <div class="panel-header">
            <h3>目录索引生成</h3>
            <div class="header-actions">
              <el-button type="primary" @click="generateIndex">
                <el-icon><MagicStick /></el-icon>
                生成目录
              </el-button>
              <el-button @click="previewIndex">
                <el-icon><View /></el-icon>
                预览
              </el-button>
            </div>
          </div>

          <div class="index-config">
            <el-form label-width="120px">
              <el-form-item label="目录级别">
                <el-radio-group v-model="indexConfig.level">
                  <el-radio :label="2">二级目录</el-radio>
                  <el-radio :label="3">三级目录</el-radio>
                  <el-radio :label="4">四级目录</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="页码格式">
                <el-radio-group v-model="indexConfig.pageFormat">
                  <el-radio label="arabic">阿拉伯数字</el-radio>
                  <el-radio label="roman">罗马数字</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="自动更新">
                <el-switch v-model="indexConfig.autoUpdate" />
              </el-form-item>
            </el-form>
          </div>

          <div v-if="generatedIndex" class="index-preview">
            <h4>目录预览</h4>
            <div class="index-tree">
              <div v-for="item in generatedIndex" :key="item.id" class="index-item">
                <span class="index-title">{{ item.title }}</span>
                <span class="index-dots"></span>
                <span class="index-page">{{ item.page }}</span>
              </div>
            </div>
          </div>
        </div>

        <!-- 智能审核 -->
        <div v-if="activeNav === 'review'" class="panel">
          <div class="panel-header">
            <h3>智能审核</h3>
          </div>

          <!-- 步骤1: 选择项目 -->
          <div v-if="reviewStep === 0" class="review-step-content">
            <h4>选择审核项目</h4>
            <p class="step-desc">请选择需要审核的项目，或上传标书文件进行审核</p>

            <el-tabs v-model="reviewProjectTab">
              <el-tab-pane label="进行中项目" name="ongoing">
                <div class="project-cards">
                  <div 
                    v-for="project in ongoingProjects" 
                    :key="project.id"
                    class="project-card"
                    :class="{ selected: selectedReviewProject?.id === project.id }"
                    @click="selectReviewProject(project)"
                  >
                    <div class="project-card-header">
                      <h5>{{ project.name }}</h5>
                      <el-tag :type="getProgressTagType(project.progress)" size="small">{{ project.progress }}</el-tag>
                    </div>
                    <div class="project-card-body">
                      <div class="project-info-item">
                        <span class="label">创建时间：</span>
                        <span class="value">{{ project.createTime }}</span>
                      </div>
                      <div v-if="project.extractedInfo" class="project-info-item">
                        <el-icon color="#10b981"><CircleCheck /></el-icon>
                        <span class="value">已完成招标信息提取</span>
                      </div>
                    </div>
                    <div v-if="selectedReviewProject?.id === project.id" class="selected-badge">
                      <el-icon><CircleCheckFilled /></el-icon>
                      已选择
                    </div>
                  </div>
                </div>
              </el-tab-pane>

              <el-tab-pane label="上传标书审核" name="upload">
                <div class="upload-review-area">
                  <el-upload
                    ref="reviewUploadRef"
                    :auto-upload="false"
                    :on-change="handleReviewFileUpload"
                    :show-file-list="false"
                    accept=".pdf,.doc,.docx"
                    drag
                  >
                    <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
                    <div class="el-upload__text">
                      拖拽标书文件到此处或 <em>点击上传</em>
                    </div>
                    <template #tip>
                      <div class="el-upload__tip">
                        支持 PDF、Word 格式，文件大小不超过 100MB
                      </div>
                    </template>
                  </el-upload>

                  <div v-if="uploadedReviewFile" class="uploaded-review-file">
                    <el-icon><Document /></el-icon>
                    <span class="file-name">{{ uploadedReviewFile.name }}</span>
                    <span class="file-size">{{ (uploadedReviewFile.size / 1024 / 1024).toFixed(2) }} MB</span>
                    <el-button size="small" text type="danger" @click="removeReviewFile">
                      <el-icon><Delete /></el-icon>
                    </el-button>
                  </div>
                </div>
              </el-tab-pane>
            </el-tabs>

            <div class="step-actions">
              <el-button 
                type="primary" 
                size="large"
                :disabled="!selectedReviewProject && !uploadedReviewFile"
                @click="reviewStep = 1"
              >
                下一步：选择评分表
                <el-icon><Right /></el-icon>
              </el-button>
            </div>
          </div>

          <!-- 步骤2: 选择评分表 -->
          <div v-if="reviewStep === 1" class="review-step-content">
            <h4>选择评分表</h4>
            <p class="step-desc">请选择适用的评分表模板，系统将按照评分标准进行智能审核</p>

            <div class="scoring-templates">
              <div 
                v-for="template in scoringTemplates" 
                :key="template.id"
                class="template-card"
                :class="{ selected: selectedTemplate?.id === template.id }"
                @click="selectTemplate(template)"
              >
                <div class="template-header">
                  <el-icon :color="template.color"><Document /></el-icon>
                  <h5>{{ template.name }}</h5>
                </div>
                <div class="template-body">
                  <p class="template-desc">{{ template.description }}</p>
                  <div class="template-info">
                    <span class="info-item">
                      <el-icon><TrendCharts /></el-icon>
                      {{ template.itemCount }} 个评分项
                    </span>
                    <span class="info-item">
                      <el-icon><Clock /></el-icon>
                      {{ template.totalScore }} 分
                    </span>
                  </div>
                </div>
                <div v-if="selectedTemplate?.id === template.id" class="selected-badge">
                  <el-icon><CircleCheckFilled /></el-icon>
                  已选择
                </div>
              </div>
            </div>

            <div class="step-actions">
              <el-button @click="reviewStep = 0">
                <el-icon><ArrowLeft /></el-icon>
                上一步
              </el-button>
              <el-button 
                type="primary" 
                size="large"
                :disabled="!selectedTemplate"
                :loading="startingReview"
                @click="startReview"
              >
                开始智能审核
                <el-icon><MagicStick /></el-icon>
              </el-button>
            </div>
          </div>

          <!-- 步骤3: 审核结果 -->
          <div v-if="reviewStep === 2" class="review-result-layout">
            <div class="result-header">
              <div class="project-info">
                <h4>{{ selectedReviewProject?.name || uploadedReviewFile?.name }}</h4>
                <el-tag>{{ selectedTemplate?.name }}</el-tag>
              </div>
              <div class="result-actions">
                <el-button size="small" @click="exportReviewTable">
                  <el-icon><Download /></el-icon>
                  导出评审表
                </el-button>
                <el-button size="small" @click="exportReviewResult">
                  <el-icon><Download /></el-icon>
                  导出评审结果
                </el-button>
                <el-button size="small" type="primary" @click="exportModifiedDocument">
                  <el-icon><Download /></el-icon>
                  导出修改后标书
                </el-button>
                <el-button size="small" @click="reviewStep = 0">
                  <el-icon><Refresh /></el-icon>
                  重新审核
                </el-button>
              </div>
            </div>

            <div class="review-content-split">
              <!-- 左侧：审核结果 -->
              <div class="review-results-panel">
                <div class="results-summary">
                  <div class="summary-card">
                    <div class="summary-label">综合得分</div>
                    <div class="summary-value">{{ reviewResult.totalScore }}</div>
                    <div class="summary-max">/ {{ reviewResult.maxScore }}</div>
                  </div>
                  <div class="summary-card">
                    <div class="summary-label">缺项数量</div>
                    <div class="summary-value error">{{ reviewResult.missingCount }}</div>
                  </div>
                  <div class="summary-card">
                    <div class="summary-label">需要修改</div>
                    <div class="summary-value warning">{{ reviewResult.warningCount }}</div>
                  </div>
                </div>

                <el-tabs v-model="resultTab">
                  <el-tab-pane label="评分项" name="scoring">
                    <div class="scoring-items">
                      <div 
                        v-for="item in reviewResult.scoringItems" 
                        :key="item.id"
                        class="scoring-item"
                        :class="{ active: activeResultItem?.id === item.id }"
                        @click="locateInDocument(item)"
                      >
                        <div class="item-header">
                          <span class="item-name">{{ item.name }}</span>
                          <span class="item-score">{{ item.score }} / {{ item.maxScore }}</span>
                        </div>
                        <div class="item-location">
                          <el-icon><Link /></el-icon>
                          <span class="page-ref" @click.stop="jumpToPage(item.page)">第 {{ item.page }} 页</span>
                        </div>
                        <div v-if="item.note" class="item-note">
                          <el-icon color="#f59e0b"><Warning /></el-icon>
                          {{ item.note }}
                        </div>
                      </div>
                    </div>
                  </el-tab-pane>

                  <el-tab-pane label="缺项提示" name="missing">
                    <div class="missing-items">
                      <div 
                        v-for="item in reviewResult.missingItems" 
                        :key="item.id"
                        class="missing-item"
                      >
                        <el-icon color="#ef4444"><CircleClose /></el-icon>
                        <div class="missing-content">
                          <div class="missing-name">{{ item.name }}</div>
                          <div class="missing-desc">{{ item.description }}</div>
                          <el-tag type="danger" size="small">必选项缺失</el-tag>
                        </div>
                      </div>
                    </div>
                  </el-tab-pane>

                  <el-tab-pane label="改进建议" name="suggestions">
                    <div class="suggestion-items">
                      <div 
                        v-for="suggestion in reviewResult.suggestions" 
                        :key="suggestion.id"
                        class="suggestion-item"
                      >
                        <el-icon color="#f59e0b"><Warning /></el-icon>
                        <div class="suggestion-content">
                          <div class="suggestion-title">{{ suggestion.title }}</div>
                          <div class="suggestion-desc">{{ suggestion.description }}</div>
                          <div class="suggestion-impact">预计提升：+{{ suggestion.impact }}分</div>
                        </div>
                      </div>
                    </div>
                  </el-tab-pane>
                </el-tabs>
              </div>

              <!-- 右侧：原文内容 -->
              <div class="document-viewer-panel">
                <div class="viewer-toolbar">
                  <el-button-group size="small">
                    <el-button @click="zoomOut">
                      <el-icon><ZoomOut /></el-icon>
                    </el-button>
                    <el-button>{{ Math.round(documentZoom * 100) }}%</el-button>
                    <el-button @click="zoomIn">
                      <el-icon><ZoomIn /></el-icon>
                    </el-button>
                  </el-button-group>
                  <span class="page-indicator">第 {{ currentPage }} / {{ totalPages }} 页</span>
                  <el-switch v-model="editMode" active-text="编辑模式" inactive-text="查看模式" />
                </div>

                <div class="document-content" :class="{ 'edit-mode': editMode }">
                  <div 
                    class="document-page"
                    :style="{ transform: `scale(${documentZoom})` }"
                    contenteditable="editMode"
                    @input="onDocumentEdit"
                  >
                    <div class="page-content" v-html="documentContent"></div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 文件上传对话框 -->
    <el-dialog 
      v-model="showUploadDialog" 
      title="上传文件" 
      width="600px"
      :close-on-click-modal="false"
    >
      <el-form :model="uploadForm" label-width="100px">
        <el-form-item label="选择文件">
          <el-upload
            ref="uploadRef"
            :auto-upload="false"
            :on-change="handleFileChange"
            :file-list="fileList"
            :limit="1"
            drag
          >
            <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
            <div class="el-upload__text">
              拖拽文件到此处或<em>点击上传</em>
            </div>
            <template #tip>
              <div class="el-upload__tip">
                支持 PDF、Word、Excel 等格式，文件大小不超过 50MB
              </div>
            </template>
          </el-upload>
        </el-form-item>
        
        <el-form-item label="文件名称">
          <el-input v-model="uploadForm.name" placeholder="请输入文件名称" />
        </el-form-item>
        
        <el-form-item label="文件分类">
          <el-select v-model="uploadForm.category" placeholder="请选择文件分类" style="width: 100%">
            <el-option label="资质文件" value="qualification" />
            <el-option label="技术模块文件" value="technical" />
            <el-option label="项目案例" value="case" />
            <el-option label="其他资料" value="other" />
          </el-select>
        </el-form-item>
        
        <el-form-item label="文件描述">
          <el-input 
            v-model="uploadForm.description" 
            type="textarea" 
            :rows="3"
            placeholder="请输入文件描述"
          />
        </el-form-item>
        
        <el-form-item>
          <el-button 
            type="success" 
            :loading="aiRecognizing"
            @click="aiRecognizeFile"
            :disabled="!fileList.length"
          >
            <el-icon><MagicStick /></el-icon>
            AI自动识别
          </el-button>
          <span style="margin-left: 12px; color: #909399; font-size: 13px;">
            AI将自动识别文件信息并填充表单
          </span>
        </el-form-item>
      </el-form>
      
      <template #footer>
        <el-button @click="showUploadDialog = false">取消</el-button>
        <el-button type="primary" @click="confirmUpload" :loading="uploading">
          确认上传
        </el-button>
      </template>
    </el-dialog>

    <!-- 创建项目对话框 -->
    <el-dialog 
      v-model="showCreateProjectDialog" 
      title="创建新项目" 
      width="600px"
      :close-on-click-modal="false"
    >
      <el-form :model="createProjectForm" label-width="100px">
        <el-form-item label="项目名称" required>
          <el-input 
            v-model="createProjectForm.name" 
            placeholder="请输入项目名称"
            maxlength="100"
            show-word-limit
          />
        </el-form-item>
        
        <el-form-item label="项目描述">
          <el-input 
            v-model="createProjectForm.description" 
            type="textarea" 
            :rows="3"
            placeholder="请输入项目描述（可选）"
            maxlength="500"
            show-word-limit
          />
        </el-form-item>
        
        <el-form-item label="初始阶段" required>
          <el-select v-model="createProjectForm.initialStep" placeholder="请选择初始阶段" style="width: 100%">
            <el-option 
              v-for="step in projectSteps" 
              :key="step.key" 
              :label="step.title" 
              :value="step.title" 
            />
          </el-select>
        </el-form-item>
      </el-form>
      
      <template #footer>
        <el-button @click="showCreateProjectDialog = false">取消</el-button>
        <el-button 
          type="primary" 
          @click="confirmCreateProject"
          :disabled="!createProjectForm.name || !createProjectForm.initialStep"
        >
          创建项目
        </el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, computed, watch } from 'vue'
import { 
  ArrowDown, ArrowRight, ArrowLeft, Right, Upload, UploadFilled, WarningFilled, Search, Download, 
  MagicStick, Refresh, Document, Delete, View, Loading, CircleCheck, Clock, 
  Picture, Grid, FolderOpened, Plus, Edit, Check, Link, CircleClose, Remove, 
  CirclePlus, Flag, Bell, ZoomIn, ZoomOut, Sunny, Warning, InfoFilled, Close,
  Files, Folder, TrendCharts, DocumentCopy, Promotion, Reading, Memo, 
  Box, CircleCheckFilled, Management, User, Filter, MoreFilled, Calendar,
  Star, Coin, Money, Checked, Suitcase, Medal, Trophy, DataLine, Cpu, Setting,
  Stamp, EditPen, Postcard, Tickets, Wallet, CreditCard, List, OfficeBuilding,
  ChatDotRound, Service, Minus
} from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'

// 导入项目管理组件
import FileSubmission from '@/components/project/FileSubmission.vue'
import BiddingInfo from '@/components/project/BiddingInfo.vue'
import ResultAnnouncement from '@/components/project/ResultAnnouncement.vue'

const navItems = ref([
  { 
    key: 'knowledge', 
    icon: Folder, 
    label: '知识库管理', 
    expanded: true, 
    children: [
      { key: 'kb-overview', label: '知识库总览' },
      { key: 'kb-category', label: '分类管理' },
      { key: 'kb-history', label: '历史文件' }
    ]
  },
  { 
    key: 'project-mgmt', 
    icon: Suitcase, 
    label: '项目管理', 
    expanded: false, 
    children: [
      { key: 'pm-ongoing', label: '进行中项目' },
      { key: 'pm-completed', label: '已完结项目' }
    ]
  },
  { 
    key: 'file', 
    icon: DocumentCopy, 
    label: '招标文件识别与预处理', 
    expanded: false, 
    children: [
      { key: 'file-import', label: '文件智能识别' },
      { key: 'file-translate', label: '多语言翻译' }
    ]
  },
  { 
    key: 'write', 
    icon: Edit, 
    label: '文件撰写', 
    expanded: false, 
    children: [
      { key: 'write-business', label: '商务标撰写' },
      { key: 'write-tech', label: '技术标撰写' }
    ]
  },
  { 
    key: 'review', 
    icon: CircleCheckFilled, 
    label: '智能审核', 
    expanded: false
  }
])

const activeNav = ref('kb-overview')
const currentNavLabel = computed(() => {
  for (const item of navItems.value) {
    if (item.key === activeNav.value) return item.label
    if (item.children) { const c = item.children.find(c => c.key === activeNav.value); if (c) return c.label }
  }
  return ''
})
const handleNavClick = (item) => { if (item.children) item.expanded = !item.expanded; else activeNav.value = item.key }

// 知识库分类
const kbCategories = ref([
  { key: 'qualification', name: '资质文件', count: 328, icon: Document, color: '#7c3aed' },
  { key: 'technical', name: '技术模块文件', count: 456, icon: MagicStick, color: '#3b82f6' },
  { key: 'case', name: '项目案例', count: 289, icon: FolderOpened, color: '#10b981' },
  { key: 'other', name: '其他资料', count: 213, icon: Memo, color: '#f59e0b' }
])

// 文件列表数据
const allFiles = ref([
  { id: 1, name: '营业执照.pdf', category: 'qualification', description: '公司营业执照副本', uploadTime: '2024-12-01 10:30:00', size: '2.3MB' },
  { id: 2, name: '资质证书.pdf', category: 'qualification', description: '建筑工程施工总承包资质', uploadTime: '2024-12-02 14:20:00', size: '1.8MB' },
  { id: 3, name: '安全生产许可证.pdf', category: 'qualification', description: '安全生产许可证扫描件', uploadTime: '2024-12-03 09:15:00', size: '1.5MB' },
  { id: 4, name: '技术方案模板.docx', category: 'technical', description: '标准技术方案模板', uploadTime: '2024-11-28 16:45:00', size: '856KB' },
  { id: 5, name: '施工组织设计.docx', category: 'technical', description: '施工组织设计标准文档', uploadTime: '2024-11-25 11:20:00', size: '3.2MB' },
  { id: 6, name: '质量保证体系.pdf', category: 'technical', description: '质量保证体系说明', uploadTime: '2024-11-20 15:30:00', size: '2.1MB' },
  { id: 7, name: 'XX项目中标案例.pdf', category: 'case', description: '2023年XX项目中标案例', uploadTime: '2024-11-15 10:00:00', size: '4.5MB' },
  { id: 8, name: 'XX工程业绩证明.pdf', category: 'case', description: 'XX工程项目业绩证明材料', uploadTime: '2024-11-10 14:30:00', size: '3.8MB' },
  { id: 9, name: '财务审计报告.pdf', category: 'other', description: '2023年度财务审计报告', uploadTime: '2024-10-28 09:45:00', size: '5.2MB' },
  { id: 10, name: '银行资信证明.pdf', category: 'other', description: '银行出具的资信证明', uploadTime: '2024-10-20 16:20:00', size: '1.2MB' }
])

// 统计数据
const totalFiles = computed(() => allFiles.value.length)
const monthlyFiles = computed(() => {
  const now = new Date()
  const currentMonth = now.getMonth()
  return allFiles.value.filter(file => {
    const uploadDate = new Date(file.uploadTime)
    return uploadDate.getMonth() === currentMonth
  }).length
})

// 新项目管理
const pmProjectSearch = ref('')
const pmResultFilter = ref('')
const showPmCreateDialog = ref(false)

// 新建项目表单
const newPmProject = ref({
  name: '',
  projectNo: '',
  tenderUnit: '',
  budget: '',
  deadline: ''
})

// 创建新项目
const createPmProject = () => {
  if (!newPmProject.value.name || !newPmProject.value.tenderUnit || !newPmProject.value.deadline) {
    ElMessage.warning('请填写必填信息')
    return
  }
  
  const newProject = {
    id: Date.now(),
    name: newPmProject.value.name,
    projectNo: newPmProject.value.projectNo || `JXZB-${new Date().getFullYear()}-${String(pmOngoingProjects.value.length + 1).padStart(3, '0')}`,
    tenderUnit: newPmProject.value.tenderUnit,
    budget: newPmProject.value.budget ? `${newPmProject.value.budget}万元` : '待定',
    bidMethod: '综合评分法',
    deposit: '',
    deadline: newPmProject.value.deadline,
    openBidTime: '',
    depositDeadline: '',
    qualificationReq: '',
    performanceReq: '',
    personnelReq: '',
    createTime: new Date().toLocaleDateString('zh-CN'),
    lastModified: new Date().toLocaleString('zh-CN'),
    creator: '当前用户',
    progress: 0
  }
  
  pmOngoingProjects.value.unshift(newProject)
  showPmCreateDialog.value = false
  
  // 重置表单
  newPmProject.value = {
    name: '',
    projectNo: '',
    tenderUnit: '',
    budget: '',
    deadline: ''
  }
  
  ElMessage.success('项目创建成功')
}

// 项目信息编辑模式
const pmInfoEditMode = ref(false)

// 切换编辑模式
const togglePmInfoEditMode = () => {
  pmInfoEditMode.value = !pmInfoEditMode.value
  if (!pmInfoEditMode.value) {
    // 保存时更新最近修改时间
    if (selectedPmProject.value) {
      selectedPmProject.value.lastModified = new Date().toLocaleString('zh-CN')
    }
    ElMessage.success('信息已保存')
  }
}

// 模拟招标文件提取后更新项目信息
const updateProjectFromExtraction = (extractedData) => {
  if (selectedPmProject.value && extractedData) {
    selectedPmProject.value.tenderUnit = extractedData.tenderUnit || selectedPmProject.value.tenderUnit
    selectedPmProject.value.budget = extractedData.budget || selectedPmProject.value.budget
    selectedPmProject.value.bidMethod = extractedData.bidMethod || selectedPmProject.value.bidMethod
    selectedPmProject.value.projectNo = extractedData.projectNo || selectedPmProject.value.projectNo
    selectedPmProject.value.deadline = extractedData.deadline || selectedPmProject.value.deadline
    selectedPmProject.value.openBidTime = extractedData.openBidTime || selectedPmProject.value.openBidTime
    selectedPmProject.value.depositDeadline = extractedData.depositDeadline || selectedPmProject.value.depositDeadline
    selectedPmProject.value.deposit = extractedData.deposit || selectedPmProject.value.deposit
    selectedPmProject.value.qualificationReq = extractedData.qualificationReq || selectedPmProject.value.qualificationReq
    selectedPmProject.value.performanceReq = extractedData.performanceReq || selectedPmProject.value.performanceReq
    selectedPmProject.value.personnelReq = extractedData.personnelReq || selectedPmProject.value.personnelReq
    selectedPmProject.value.lastModified = new Date().toLocaleString('zh-CN')
  }
}

const pmOngoingProjects = ref([
  { 
    id: 1, 
    name: '智慧园区综合管理平台建设项目', 
    projectNo: 'JXZB-2025-001',
    tenderUnit: '江西省城市管理中心',
    budget: '1280万元',
    bidMethod: '综合评分法',
    deposit: '25万元',
    deadline: '2025-07-01',
    openBidTime: '2025-07-01 10:00',
    depositDeadline: '2025-06-28',
    qualificationReq: '市政工程二级及以上',
    performanceReq: '3个类似项目',
    personnelReq: '一级建造师',
    createTime: '2025-06-01', 
    lastModified: '2025-06-09 14:30', 
    creator: '张三', 
    progress: 65 
  },
  { 
    id: 2, 
    name: '城市生命线监测系统采购项目', 
    projectNo: 'JXZB-2025-002',
    tenderUnit: '南昌市住建局',
    budget: '580万元',
    bidMethod: '最低价法',
    deposit: '10万元',
    deadline: '2025-07-15',
    openBidTime: '2025-07-15 14:00',
    depositDeadline: '2025-07-12',
    qualificationReq: '安防工程三级',
    performanceReq: '2个类似项目',
    personnelReq: '项目经理5年经验',
    createTime: '2025-05-20', 
    lastModified: '2025-06-08 16:45', 
    creator: '李四', 
    progress: 45 
  },
  { 
    id: 3, 
    name: '数据中心基础设施建设项目', 
    projectNo: 'JXZB-2025-003',
    tenderUnit: '江西省大数据中心',
    budget: '2150万元',
    bidMethod: '综合评分法',
    deposit: '50万元',
    deadline: '2025-08-01',
    openBidTime: '2025-08-01 09:30',
    depositDeadline: '2025-07-28',
    qualificationReq: '系统集成二级',
    performanceReq: '5个类似项目',
    personnelReq: '高级工程师',
    createTime: '2025-06-05', 
    lastModified: '2025-06-09 09:20', 
    creator: '王五', 
    progress: 85 
  },
  { 
    id: 4, 
    name: '智慧交通信号控制系统项目', 
    projectNo: 'JXZB-2025-004',
    tenderUnit: '南昌市交通管理局',
    budget: '890万元',
    bidMethod: '综合评分法',
    deposit: '18万元',
    deadline: '2025-07-20',
    openBidTime: '2025-07-20 10:00',
    depositDeadline: '2025-07-17',
    qualificationReq: '电子工程二级',
    performanceReq: '3个类似项目',
    personnelReq: '一级建造师',
    createTime: '2025-05-28', 
    lastModified: '2025-06-07 11:15', 
    creator: '张三', 
    progress: 30 
  }
])

// 选中的项目
const selectedPmProject = ref(null)

// 招标信息提取相关
const pmExtractUploadRef = ref(null)
const pmPendingExtractFile = ref(null)
const pmExtractAnalyzing = ref(false)
const pmExtractFileData = ref(null)
const pmBusinessKeyInfo = ref([])
const pmTechKeyInfo = ref([])
const pmRejectItems = ref([
  { name: '投标保证金', type: 'business', content: '未按规定金额缴纳投标保证金', pageNum: 15, aiLoading: false },
  { name: '资质证书', type: 'qualification', content: '投标人未提供有效的建筑智能化工程专业承包资质证书', pageNum: 8, aiLoading: false },
  { name: '项目经理资格', type: 'qualification', content: '项目经理未持有有效的一级建造师资格证书', pageNum: 12, aiLoading: false }
])

// 文件预览相关
const pmPreviewZoom = ref(1)
const pmIsTranslated = ref(false)
const pmTranslating = ref(false)
const pmPreviewContentRef = ref(null)

// 左侧选项卡
const pmActiveExtractTab = ref('overview')
const pmExtractTabs = ref([
  { key: 'overview', label: '总体分析' },
  { key: 'business', label: '商务信息提取' },
  { key: 'technical', label: '技术信息提取' },
  { key: 'bidding', label: '招标要求' },
  { key: 'reject', label: '否决项识别' },
  { key: 'process', label: '开标流程' },
  { key: 'risk', label: '风险分析' }
])

// ========== 撰写招标文件相关 ==========
const pmWriteType = ref(null) // 'business' | 'technical'
const pmWriteStepIndex = ref(0)
const pmWritePreviewZoom = ref(1)
const pmWritePreviewTranslated = ref(false)
const outlineTreeRef = ref(null)

// 三分栏布局相关变量
const pmCurrentOutlineId = ref(1)
const pmEditorFontFamily = ref('SimSun')
const pmEditorFontSize = ref(14)
const pmEditorBold = ref(false)
const pmEditorItalic = ref(false)
const pmEditorUnderline = ref(false)
const pmEditorAlign = ref('left')
const pmDocumentTitle = ref('智慧园区综合管理平台建设项目投标文件')
const pmDocumentContent = ref(`一、项目概述

本项目旨在建设一套智慧园区综合管理平台，实现园区的智能化管理和服务。平台将整合园区内各类智能设备和系统，提供统一的管理界面和数据分析功能。

二、技术方案

2.1 系统架构
采用微服务架构设计，确保系统的可扩展性和可维护性。主要包括：
- 数据采集层：负责各类传感器和设备的数据采集
- 数据处理层：实现数据清洗、存储和分析
- 应用服务层：提供业务逻辑处理
- 展示层：提供Web端和移动端的用户界面

2.2 核心功能
- 设备监控管理
- 能耗分析优化
- 安防监控集成
- 访客管理系统
- 停车场管理

三、实施计划

项目预计分三期实施，总工期为12个月...`)

const chatMessagesRef = ref(null)
const pmChatInput = ref('')
const pmAiTyping = ref(false)
const pmChatMessages = ref([
  {
    role: 'assistant',
    content: '您好！我是AI标书助手，可以帮您优化标书内容、回答招标相关问题、提供写作建议。请问有什么可以帮您的？',
    time: '10:00'
  }
])

// 商务标步骤
const businessWriteSteps = [
  { key: 'outline', title: '大纲生成' },
  { key: 'match', title: '关联项目匹配' },
  { key: 'style', title: '标书样式' },
  { key: 'generate', title: '标书生成' }
]

// 技术标步骤
const technicalWriteSteps = [
  { key: 'outline', title: '大纲生成' },
  { key: 'match', title: '关联项目匹配' },
  { key: 'techGen', title: '技术项生成' },
  { key: 'style', title: '标书样式' },
  { key: 'generate', title: '标书生成' }
]

// 标书样式 - 标题层级
const pmTitleStyles = ref([
  { level: '封面标题', font: '方正小标宋', size: '小一', align: '居中', bold: '是', special: '-' },
  { level: '一级标题（第一章）', font: '黑体', size: '小二', align: '居中', bold: '是', special: '段前段后各1行' },
  { level: '二级标题（1.1）', font: '黑体', size: '小三', align: '左对齐', bold: '是', special: '段前0.5行' },
  { level: '三级标题（1.1.1）', font: '黑体', size: '四号', align: '左对齐', bold: '是', special: '-' },
  { level: '四级标题（1.）', font: '仿宋', size: '小四', align: '左对齐', bold: '是', special: '-' }
])

// 标书样式 - 正文内容
const pmContentStyles = ref([
  { type: '正文', font: '仿宋_GB2312', size: '小四', align: '两端对齐', bold: '否', special: '首行缩进2字符' },
  { type: '表格内容', font: '仿宋', size: '五号', align: '居中', bold: '否', special: '-' },
  { type: '页眉', font: '宋体', size: '小五', align: '居中', bold: '否', special: '-' },
  { type: '页脚/页码', font: '宋体', size: '小五', align: '居中', bold: '否', special: '-' },
  { type: '图表标题', font: '黑体', size: '五号', align: '居中', bold: '是', special: '图下表上' },
  { type: '注释/备注', font: '仿宋', size: '小五', align: '左对齐', bold: '否', special: '-' }
])

// 当前步骤列表
const currentWriteSteps = computed(() => {
  return pmWriteType.value === 'business' ? businessWriteSteps : technicalWriteSteps
})

// 大纲数据
const pmOutlineData = ref([
  {
    id: 1,
    title: '第一章 投标函及投标函附录',
    children: [
      { id: 11, title: '1.1 投标函' },
      { id: 12, title: '1.2 投标函附录' },
      { id: 13, title: '1.3 法定代表人身份证明' }
    ]
  },
  {
    id: 2,
    title: '第二章 商务条款响应表',
    children: [
      { id: 21, title: '2.1 商务条款响应' },
      { id: 22, title: '2.2 合同条款响应' }
    ]
  },
  {
    id: 3,
    title: '第三章 投标报价',
    children: [
      { id: 31, title: '3.1 投标总价' },
      { id: 32, title: '3.2 分项报价清单' },
      { id: 33, title: '3.3 报价说明' }
    ]
  },
  {
    id: 4,
    title: '第四章 资格证明文件',
    children: [
      { id: 41, title: '4.1 企业营业执照' },
      { id: 42, title: '4.2 资质证书' },
      { id: 43, title: '4.3 业绩证明' }
    ]
  }
])

// 关联项目匹配状态
const pmMatchingStatus = ref('done') // 'matching' | 'done'
const pmMatchedProjects = ref([
  { name: '智慧城市综合管理平台项目', year: '2024', amount: '1,200万', matchRate: 92, selected: true },
  { name: '智慧园区安防监控系统', year: '2023', amount: '680万', matchRate: 85, selected: true },
  { name: '城市生命线监测平台', year: '2023', amount: '950万', matchRate: 78, selected: false },
  { name: '数字化城管系统建设', year: '2022', amount: '520万', matchRate: 65, selected: false }
])

// 技术项生成进度
const pmTechSections = ref([
  { title: '技术方案总体设计', status: 'done', progress: 100 },
  { title: '系统架构设计', status: 'done', progress: 100 },
  { title: '功能模块设计', status: 'generating', progress: 65 },
  { title: '施工组织设计', status: 'pending', progress: 0 },
  { title: '质量保证措施', status: 'pending', progress: 0 }
])

// ========== 材料智能匹配填充相关 ==========
const pmMaterialRegion = ref('')
const pmMaterialIndustry = ref('')
const pmMaterialYear = ref('')
const pmAddFileDialogVisible = ref(false)
const pmCurrentMaterialItem = ref(null)
const pmFileFilterRegion = ref('')
const pmFileFilterIndustry = ref('')
const pmFileFilterYear = ref('')

// 材料项列表
const pmMaterialItems = ref([
  { id: 1, title: '投标函及投标函附录', files: [] },
  { id: 2, title: '资格审查文件', files: [] },
  { id: 3, title: '商务条款响应表', files: [] },
  { id: 4, title: '技术方案', files: [] },
  { id: 5, title: '项目业绩证明', files: [] },
  { id: 6, title: '企业资质证书', files: [] },
  { id: 7, title: '财务报表', files: [] }
])

// 知识库文件列表
const pmKnowledgeFiles = ref([
  { id: 1, name: '营业执照.pdf', category: '资质文件', categoryType: 'danger', region: '江西省', year: '2024' },
  { id: 2, name: '资质证书.pdf', category: '资质文件', categoryType: 'danger', region: '江西省', year: '2024' },
  { id: 3, name: '安全生产许可证.pdf', category: '资质文件', categoryType: 'danger', region: '江西省', year: '2024' },
  { id: 4, name: '电力工程施工总承包资质.pdf', category: '资质文件', categoryType: 'danger', region: '江西省', year: '2024' },
  { id: 5, name: '建筑机电安装工程资质.pdf', category: '资质文件', categoryType: 'danger', region: '江西省', year: '2024' },
  { id: 6, name: '2023年财务审计报告.pdf', category: '财务文件', categoryType: 'warning', region: '江西省', year: '2023' }
])

// 五大进度流程
const pmProjectSteps = ref([
  { key: 'extract', title: '招标信息提取', description: '解析招标文件', detail: '上传并解析招标文件，提取关键信息如项目名称、预算、截止时间、资质要求等。' },
  { key: 'write', title: '撰写招标文件', description: '编写投标文件', detail: '根据提取的招标要求，撰写技术方案、商务报价等投标文件内容。' },
  { key: 'submit', title: '文件提交', description: '提交投标文件', detail: '整理并提交投标文件，确保文件完整性和合规性。' },
  { key: 'open', title: '开标', description: '等待开标结果', detail: '等待招标单位开标，关注开标时间和地点。' },
  { key: 'result', title: '结果公示', description: '查看中标结果', detail: '查看中标结果公示，了解项目最终归属。' }
])

// 开标信息
const bidOpeningInfo = ref({
  openTime: '2025-07-01 10:00',
  status: 'waiting', // waiting, ongoing, completed
  location: '南昌市公共资源交易中心 3楼开标室',
  onlineLink: 'https://ggzy.jiangxi.gov.cn/meeting/123456',
  representative: '张三',
  authUploaded: true,
  // 开标结果（开标完成后显示）
  results: [
    { company: '江西XX科技有限公司', price: '1,156万', status: 'valid', isOur: true },
    { company: '南昌YY信息技术公司', price: '1,180万', status: 'valid', isOur: false },
    { company: '赣州ZZ系统集成有限公司', price: '1,220万', status: 'invalid', isOur: false }
  ]
})

// 计算开标倒计时
const bidOpeningCountdown = computed(() => {
  const openTime = new Date(bidOpeningInfo.value.openTime)
  const now = new Date()
  const diff = openTime - now
  if (diff <= 0) return '已开标'
  const days = Math.floor(diff / (1000 * 60 * 60 * 24))
  const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
  if (days > 0) return `${days}天${hours}小时后`
  return `${hours}小时后`
})

// 结果公示信息
const resultAnnouncementInfo = ref({
  // 基础信息
  publishDate: '',
  endDate: '',
  result: '', // win, lose, invalid
  winnerCompany: '',
  winnerAmount: '',
  ourAmount: '',
  ourRank: '',
  totalBidders: '',
  // 评分信息
  scoreItems: [
    { name: '技术方案', fullScore: 40, ourScore: '', winnerScore: '' },
    { name: '商务报价', fullScore: 35, ourScore: '', winnerScore: '' },
    { name: '业绩资质', fullScore: 15, ourScore: '', winnerScore: '' },
    { name: '服务承诺', fullScore: 10, ourScore: '', winnerScore: '' }
  ],
  // 附件
  attachments: [],
  // 补充说明
  remarks: '',
  // AI分析报告
  aiReport: null,
  aiReportGenerating: false
})

// 添加评分项
const addScoreItem = () => {
  resultAnnouncementInfo.value.scoreItems.push({
    name: '',
    fullScore: 0,
    ourScore: '',
    winnerScore: ''
  })
}

// 删除评分项
const removeScoreItem = (index) => {
  resultAnnouncementInfo.value.scoreItems.splice(index, 1)
}

// 计算总分
const calculateTotalScore = computed(() => {
  const items = resultAnnouncementInfo.value.scoreItems
  const fullScore = items.reduce((sum, item) => sum + (Number(item.fullScore) || 0), 0)
  const ourScore = items.reduce((sum, item) => sum + (Number(item.ourScore) || 0), 0)
  const winnerScore = items.reduce((sum, item) => sum + (Number(item.winnerScore) || 0), 0)
  return { fullScore, ourScore, winnerScore }
})

// 生成AI分析报告
const generateAIReport = () => {
  resultAnnouncementInfo.value.aiReportGenerating = true
  
  // 模拟AI生成
  setTimeout(() => {
    const info = resultAnnouncementInfo.value
    const isWin = info.result === 'win'
    
    resultAnnouncementInfo.value.aiReport = {
      generatedTime: new Date().toLocaleString('zh-CN'),
      summary: isWin 
        ? `恭喜！本次投标成功中标，中标金额￥${info.ourAmount}万元，在${info.totalBidders}家投标单位中排名第${info.ourRank}。`
        : `本次投标最终排名第${info.ourRank}位（共${info.totalBidders}家），与中标方差距${(calculateTotalScore.value.winnerScore - calculateTotalScore.value.ourScore).toFixed(1)}分。`,
      reasons: isWin ? [
        { title: '技术方案优势', content: '技术架构设计合理，实施方案详细可行' },
        { title: '价格竞争力', content: '报价在合理区间，性价比突出' },
        { title: '业绩支撑', content: '类似项目经验丰富，案例说服力强' }
      ] : [
        { title: '技术方案', score: -1.5, content: '技术架构描述不够详细，缺少具体实现细节' },
        { title: '商务报价', score: -1.5, content: `报价高于中标方${((Number(info.ourAmount) - Number(info.winnerAmount)) / Number(info.winnerAmount) * 100).toFixed(1)}%` },
        { title: '业绩资质', score: -1.0, content: '类似项目业绩数量少于竞争对手' }
      ],
      suggestions: isWin ? [
        '及时跟进合同签订流程',
        '做好项目启动准备工作',
        '总结成功经验，形成标准化投标模板'
      ] : [
        '技术方案：增加技术架构图、详细实施步骤',
        '报价策略：参考市场价格，合理压缩利润空间',
        '业绩积累：重点拓展智慧园区、城市管理类项目'
      ]
    }
    
    resultAnnouncementInfo.value.aiReportGenerating = false
  }, 2000)
}

// 保存结果公示信息
const saveResultAnnouncement = () => {
  ElMessage.success('结果公示信息已保存')
}

// 过滤进行中项目
const filteredPmOngoingProjects = computed(() => {
  if (!pmProjectSearch.value) return pmOngoingProjects.value
  return pmOngoingProjects.value.filter(p => 
    p.name.toLowerCase().includes(pmProjectSearch.value.toLowerCase())
  )
})
const pmCompletedProjects = ref([
  { 
    id: 4, 
    name: '智慧交通管理系统项目', 
    client: '南昌市交通局', 
    budget: '1,500万', 
    completeTime: '2025-05-20', 
    result: '中标',
    ourAmount: '1,380万',
    bidAmount: '1,380万',
    ourRank: 1,
    totalBidders: 5,
    failReason: ''
  },
  { 
    id: 5, 
    name: '智慧水务监测平台项目', 
    client: '九江市水利局', 
    budget: '680万', 
    completeTime: '2025-04-15', 
    result: '未中标',
    ourAmount: '720万',
    bidAmount: '650万',
    ourRank: 3,
    totalBidders: 6,
    failReason: '价格偏高、业绩不足'
  },
  { 
    id: 6, 
    name: '城市综合管廊管理系统', 
    client: '赣州市城管局', 
    budget: '920万', 
    completeTime: '2025-03-28', 
    result: '中标',
    ourAmount: '895万',
    bidAmount: '895万',
    ourRank: 1,
    totalBidders: 4,
    failReason: ''
  },
  { 
    id: 7, 
    name: '智慧园区安防监控项目', 
    client: '南昌高新区管委会', 
    budget: '450万', 
    completeTime: '2025-02-18', 
    result: '未中标',
    ourAmount: '480万',
    bidAmount: '420万',
    ourRank: 2,
    totalBidders: 4,
    failReason: '技术方案细节不足'
  },
  { 
    id: 8, 
    name: '城市照明智能控制系统', 
    client: '景德镇市城管局', 
    budget: '320万', 
    completeTime: '2025-01-25', 
    result: '中标',
    ourAmount: '305万',
    bidAmount: '305万',
    ourRank: 1,
    totalBidders: 3,
    failReason: ''
  }
])

// 已完结项目统计
const completedProjectStats = computed(() => {
  const total = pmCompletedProjects.value.length
  const won = pmCompletedProjects.value.filter(p => p.result === '中标').length
  const lost = pmCompletedProjects.value.filter(p => p.result === '未中标').length
  const rate = total > 0 ? ((won / total) * 100).toFixed(1) : 0
  return { total, won, lost, rate }
})

// 过滤已完结项目
const filteredCompletedProjects = computed(() => {
  let projects = pmCompletedProjects.value
  if (pmProjectSearch.value) {
    projects = projects.filter(p => 
      p.name.toLowerCase().includes(pmProjectSearch.value.toLowerCase())
    )
  }
  if (pmResultFilter.value) {
    projects = projects.filter(p => p.result === pmResultFilter.value)
  }
  return projects
})

// 分类管理
const activeCategoryTab = ref('qualification')
const categorySearch = ref('')

// 历史文件
const historySearch = ref('')
const historyFilter = ref('')

// 文件上传
const showUploadDialog = ref(false)
const uploadRef = ref(null)
const fileList = ref([])
const uploadForm = ref({
  name: '',
  category: '',
  description: ''
})
const aiRecognizing = ref(false)
const uploading = ref(false)

// 文件智能识别
const biddingFileData = ref(null)
const pendingBiddingFile = ref(null)
const analyzingFile = ref(false)
const biddingUploadRef = ref(null)
const businessKeyInfo = ref([])
const techKeyInfo = ref([])
const previewZoom = ref(1)

// 招标信息提取标签页
const activeExtractionTab = ref('overview')
const extractionTabs = ref([
  { key: 'overview', label: '总体分析' },
  { key: 'qualification', label: '资格要求' },
  { key: 'business', label: '商务评分' },
  { key: 'technical', label: '技术评分' },
  { key: 'bidding', label: '投标要求' },
  { key: 'process', label: '开标流程' },
  { key: 'risk', label: '风险分析' }
])

// 生成标书相关
const showBidTypeDialog = ref(false)
const selectedBidType = ref('')
const bidGenerationMode = ref(false)
const bidWizardStep = ref(0)
const generatingOutline = ref(false)
const generatingChapter = ref(false)
const generatingBid = ref(false)
const bidGenerationProgress = ref(0)
const previewChapter = ref(0)
const currentOutline = ref([])
const outlinePreviewZoom = ref(100)

// 材料智能匹配
const materialFilter = ref({
  region: '',
  industry: '',
  year: ''
})
const showAddFileDialog = ref(false)
const showPreviewDialog = ref(false)
const currentAddFileChapter = ref(null)
const currentAddFileChapterIndex = ref(-1)
const previewingFile = ref(null)
const selectedFiles = ref([])
const fileDialogFilter = ref({
  region: '',
  industry: '',
  year: ''
})
const knowledgeFileList = ref([
  { id: 1, name: '营业执照.pdf', category: '资质文件', categoryType: 'warning', region: '江西省', year: '2024' },
  { id: 2, name: '资质证书.pdf', category: '资质文件', categoryType: 'warning', region: '江西省', year: '2024' },
  { id: 3, name: '安全生产许可证.pdf', category: '资质文件', categoryType: 'warning', region: '江西省', year: '2024' },
  { id: 4, name: '电力工程施工总承包资质.pdf', category: '资质文件', categoryType: 'warning', region: '江西省', year: '2024' },
  { id: 5, name: '建筑机电安装工程资质.pdf', category: '资质文件', categoryType: 'warning', region: '江西省', year: '2024' },
  { id: 6, name: '2023年财务审计报告.pdf', category: '财务文件', categoryType: 'success', region: '江西省', year: '2023' },
  { id: 7, name: '2024年财务审计报告.pdf', category: '财务文件', categoryType: 'success', region: '江西省', year: '2024' }
])

const previewContentRef = ref(null)
const isTranslated = ref(false)
const translatingDocument = ref(false)
const translatedContent = ref({})

// 多语言翻译
const translateDirection = ref('zh-en')
const sourceText = ref('')
const translatedText = ref('')
const translating = ref(false)
const showTermDialog = ref(false)

// 商务要素提取
const selectedBidFile = ref('')
const extracting = ref(false)
const extractProgress = ref(0)
const businessElements = ref([
  { element: '开标时间', value: '2024-12-15 09:30', source: 'P.3', needConfirm: true, note: '需确认具体截止时间' },
  { element: '投标截止', value: '2024-12-14 17:00', source: 'P.3', needConfirm: false },
  { element: '投标保证金', value: '50,000元', source: 'P.5', needConfirm: false },
  { element: '有效期', value: '90天', source: 'P.5', needConfirm: false }
])

// 否决项识别
const recognizing = ref(false)
const recognizeProgress = ref(0)
const rejectionItems = ref([
  { id: 1, marker: '★', content: '投标保证金未按时缴纳', source: 'P.5', checked: false },
  { id: 2, marker: '★', content: '资质证书不符合要求', source: 'P.8', checked: false },
  { id: 3, marker: '▲', content: '技术参数低于最低要求', source: 'P.12', checked: false }
])
const deductionItems = ref([
  { id: 1, content: '业绩不足3个', source: 'P.15', score: -2, checked: false },
  { id: 2, content: '无本地服务网点', source: 'P.18', score: -3, checked: false },
  { id: 3, content: '交货期超过60天', source: 'P.20', score: -1, checked: false }
])
const bonusItems = ref([
  { id: 1, content: '业绩超过5个', source: 'P.15', score: 3, checked: false },
  { id: 2, content: '有本地服务网点', source: 'P.18', score: 2, checked: false }
])

const totalDeduction = computed(() => {
  return Math.abs(deductionItems.value.reduce((sum, item) => sum + item.score, 0))
})

const totalBonus = computed(() => {
  return bonusItems.value.reduce((sum, item) => sum + item.score, 0)
})

// 项目管理
const projectSearch = ref('')
const selectedProject = ref(null)
const showCreateProjectDialog = ref(false)
const createProjectForm = ref({
  name: '',
  description: '',
  initialStep: '招标信息提取'
})

// 项目流程步骤
const projectSteps = [
  { key: 'get-file', title: '招标信息提取', description: '下载并解析招标文件' },
  { key: 'write-file', title: '撰写投标文件', description: '编写商务标和技术标' },
  { key: 'submit', title: '文件提交', description: '提交投标文件' },
  { key: 'open-bid', title: '开标', description: '参与开标会议' },
  { key: 'result', title: '结果公示', description: '查看中标结果' }
]

// 当前查看的项目步骤详情
const currentStepDetail = ref(null)
const currentStepProject = ref(null)

// 进行中的项目
const ongoingProjects = ref([
  { 
    id: 1, 
    name: '某数据中心发电机组采购项目', 
    createTime: '2024-11-20 09:30:00', 
    progress: '招标信息提取',
    extractedInfo: {
      businessInfo: [
        { field: '项目名称', content: '某数据中心发电机组采购项目', source: 'P.1', verifyStatus: 'no-need' },
        { field: '招标单位', content: 'XX数据中心有限公司', source: 'P.1', verifyStatus: 'no-need' },
        { field: '开标时间', content: '2024-12-15 09:30', source: 'P.3', verifyStatus: 'need' },
        { field: '投标截止时间', content: '2024-12-14 17:00', source: 'P.3', verifyStatus: 'no-need' },
        { field: '投标保证金', content: '50,000元', source: 'P.5', verifyStatus: 'no-need' },
        { field: '投标有效期', content: '90天', source: 'P.5', verifyStatus: 'no-need' },
        { field: '联系人', content: '张工', source: 'P.2', verifyStatus: 'no-need' },
        { field: '联系电话', content: '0791-88888888', source: 'P.2', verifyStatus: 'no-need' }
      ],
      techInfo: [
        { field: '设备类型', content: '柴油发电机组', source: 'P.8', verifyStatus: 'no-need' },
        { field: '额定功率', content: '≥500kW', source: 'P.10', verifyStatus: 'no-need' },
        { field: '额定电压', content: '400V/230V', source: 'P.10', verifyStatus: 'no-need' },
        { field: '频率', content: '50Hz', source: 'P.10', verifyStatus: 'no-need' },
        { field: '启动方式', content: '电启动', source: 'P.11', verifyStatus: 'no-need' },
        { field: '冷却方式', content: '水冷', source: 'P.11', verifyStatus: 'no-need' },
        { field: '噪音要求', content: '≤85dB(A)', source: 'P.12', verifyStatus: 'need' },
        { field: '防护等级', content: 'IP54', source: 'P.12', verifyStatus: 'no-need' }
      ]
    }
  },
  { 
    id: 2, 
    name: '医院备用电源系统改造工程', 
    createTime: '2024-11-25 14:20:00', 
    progress: '撰写投标文件',
    extractedInfo: {
      businessInfo: [
        { field: '项目名称', content: '医院备用电源系统改造工程', source: 'P.1', verifyStatus: 'no-need' },
        { field: '招标单位', content: 'XX市人民医院', source: 'P.1', verifyStatus: 'no-need' },
        { field: '开标时间', content: '2024-12-10 14:00', source: 'P.2', verifyStatus: 'no-need' },
        { field: '投标截止时间', content: '2024-12-09 16:00', source: 'P.2', verifyStatus: 'no-need' },
        { field: '投标保证金', content: '80,000元', source: 'P.4', verifyStatus: 'no-need' },
        { field: '投标有效期', content: '60天', source: 'P.4', verifyStatus: 'no-need' }
      ],
      techInfo: [
        { field: '设备类型', content: 'UPS不间断电源系统', source: 'P.7', verifyStatus: 'no-need' },
        { field: '容量要求', content: '≥200kVA', source: 'P.8', verifyStatus: 'no-need' },
        { field: '备电时间', content: '≥2小时', source: 'P.8', verifyStatus: 'need' },
        { field: '输入电压', content: '380V±15%', source: 'P.9', verifyStatus: 'no-need' },
        { field: '输出电压', content: '220V±2%', source: 'P.9', verifyStatus: 'no-need' }
      ]
    }
  },
  { 
    id: 3, 
    name: '工业园区智能供电项目', 
    createTime: '2024-12-01 10:15:00', 
    progress: '文件提交'
  },
  { 
    id: 4, 
    name: '城市轨道交通供电设备采购', 
    createTime: '2024-12-03 16:45:00', 
    progress: '开标'
  },
  { 
    id: 5, 
    name: '学校配电房升级改造项目', 
    createTime: '2024-12-05 11:00:00', 
    progress: '撰写投标文件'
  }
])

// 已完结的项目
const completedProjects = ref([
  { 
    id: 101, 
    name: '市政道路照明工程', 
    createTime: '2024-10-15 09:00:00',
    completeTime: '2024-11-20 15:30:00',
    progress: '结果公示',
    result: '中标',
    bidAmount: '328万元'
  },
  { 
    id: 102, 
    name: '商业综合体配电项目', 
    createTime: '2024-10-20 14:30:00',
    completeTime: '2024-11-25 10:20:00',
    progress: '结果公示',
    result: '未中标',
    failReason: '报价过高'
  },
  { 
    id: 103, 
    name: '工厂变压器更换工程', 
    createTime: '2024-09-28 10:45:00',
    completeTime: '2024-11-10 16:00:00',
    progress: '结果公示',
    result: '中标',
    bidAmount: '156万元'
  },
  { 
    id: 104, 
    name: '住宅小区充电桩建设项目', 
    createTime: '2024-09-15 13:20:00',
    completeTime: '2024-10-30 14:45:00',
    progress: '结果公示',
    result: '中标',
    bidAmount: '89万元'
  },
  { 
    id: 105, 
    name: '办公楼应急电源系统', 
    createTime: '2024-09-05 09:30:00',
    completeTime: '2024-10-15 11:20:00',
    progress: '结果公示',
    result: '未中标',
    failReason: '技术参数不满足'
  }
])

// 筛选进行中的项目
const filteredOngoingProjects = computed(() => {
  if (!projectSearch.value) return ongoingProjects.value
  return ongoingProjects.value.filter(p => 
    p.name.toLowerCase().includes(projectSearch.value.toLowerCase())
  )
})

// 筛选已完结的项目（旧版）
const filteredOldCompletedProjects = computed(() => {
  if (!projectSearch.value) return completedProjects.value
  return completedProjects.value.filter(p => 
    p.name.toLowerCase().includes(projectSearch.value.toLowerCase())
  )
})

// 查看项目详情
const viewProjectDetail = (project) => {
  selectedProject.value = project
}

// 获取进度百分比
const getProgressPercentage = (progress) => {
  const progressMap = {
    '招标信息提取': 20,
    '撰写投标文件': 40,
    '文件提交': 60,
    '开标': 80,
    '结果公示': 100
  }
  return progressMap[progress] || 0
}

// 新项目管理方法
const getPmStatusType = (status) => {
  const typeMap = {
    '编写中': 'warning',
    '待提交': 'info',
    '审核中': 'primary',
    '已提交': 'success'
  }
  return typeMap[status] || 'info'
}

const viewPmProjectDetail = (project) => {
  selectedPmProject.value = project
  currentViewStepIndex.value = null  // 重置步骤索引
}

const editPmProject = (project) => {
  ElMessage.info(`编辑项目: ${project.name}`)
}

const exportPmProject = (project) => {
  ElMessage.success(`正在导出: ${project.name}`)
}

const getProgressGradient = (progress) => {
  if (progress >= 80) return '#22c55e'
  if (progress >= 50) return '#8b5cf6'
  return '#f59e0b'
}

const handlePmCardAction = (command, project) => {
  if (command === 'edit') {
    ElMessage.info(`编辑项目: ${project.name}`)
  } else if (command === 'delete') {
    ElMessageBox.confirm('确定要删除该项目吗？', '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      const index = pmOngoingProjects.value.findIndex(p => p.id === project.id)
      if (index > -1) {
        pmOngoingProjects.value.splice(index, 1)
        ElMessage.success('删除成功')
      }
    }).catch(() => {})
  }
}

// 根据进度百分比计算当前步骤
const getPmActiveStep = (progress) => {
  if (progress >= 100) return 4
  if (progress >= 80) return 3
  if (progress >= 60) return 2
  if (progress >= 30) return 1
  return 0
}

// 获取步骤状态
const getPmStepStatus = (progress, stepIndex) => {
  const activeStep = getPmActiveStep(progress)
  if (stepIndex < activeStep) return 'finish'
  if (stepIndex === activeStep) return 'process'
  return 'wait'
}

// 当前查看的步骤索引
const currentViewStepIndex = ref(null)

// 点击步骤
const handlePmStepClick = (step, index) => {
  currentViewStepIndex.value = index
}

// 当前显示的步骤索引（优先显示点击选中的，否则显示当前进行中的）
const currentStepIndex = computed(() => {
  if (currentViewStepIndex.value !== null) {
    return currentViewStepIndex.value
  }
  return selectedPmProject.value ? getPmActiveStep(selectedPmProject.value.progress) : 0
})

// 获取步骤标签类型
const getStepTagType = (stepIndex) => {
  if (!selectedPmProject.value) return 'info'
  const activeStep = getPmActiveStep(selectedPmProject.value.progress)
  if (stepIndex < activeStep) return 'success'
  if (stepIndex === activeStep) return 'warning'
  return 'info'
}

// 获取步骤标签文字
const getStepTagText = (stepIndex) => {
  if (!selectedPmProject.value) return '待开始'
  const activeStep = getPmActiveStep(selectedPmProject.value.progress)
  if (stepIndex < activeStep) return '已完成'
  if (stepIndex === activeStep) return '进行中'
  return '待开始'
}

// 进入步骤
const handleEnterStep = (stepIndex) => {
  const step = pmProjectSteps.value[stepIndex]
  ElMessage.success(`进入: ${step.title}`)
}

// 招标信息提取 - 文件选择
const handlePmExtractFileSelect = (file) => {
  pmPendingExtractFile.value = file.raw
}

// 招标信息提取 - 开始解析
const startPmExtractAnalyze = () => {
  if (!pmPendingExtractFile.value) return
  
  pmExtractAnalyzing.value = true
  
  // 模拟解析过程
  setTimeout(() => {
    pmExtractFileData.value = {
      name: pmPendingExtractFile.value.name,
      pages: 68,
      uploadTime: new Date().toLocaleString()
    }
    
    // 模拟解析结果 - 商务关键信息
    pmBusinessKeyInfo.value = [
      { field: '项目名称', content: selectedPmProject.value?.name || '智慧园区综合管理平台建设项目', pageNum: 1, verifyStatus: 'confirmed', aiLoading: false },
      { field: '招标单位', content: '江西省城市管理中心', pageNum: 1, verifyStatus: 'confirmed', aiLoading: false },
      { field: '项目预算', content: '1,280万元', pageNum: 3, verifyStatus: 'must', aiLoading: false },
      { field: '投标截止时间', content: selectedPmProject.value?.deadline || '2025-07-01 09:30', pageNum: 5, verifyStatus: 'must', aiLoading: false },
      { field: '开标时间', content: '2025-07-01 10:00', pageNum: 5, verifyStatus: 'need', aiLoading: false },
      { field: '投标保证金', content: '25万元', pageNum: 8, verifyStatus: 'need', aiLoading: false },
      { field: '履约保证金', content: '合同金额的10%', pageNum: 8, verifyStatus: 'confirmed', aiLoading: false },
      { field: '付款方式', content: '分期付款，验收后支付80%', pageNum: 12, verifyStatus: 'confirmed', aiLoading: false }
    ]
    
    // 模拟解析结果 - 技术关键信息
    pmTechKeyInfo.value = [
      { field: '资质要求', content: '软件企业认定证书、ISO9001认证', pageNum: 15, verifyStatus: 'must', aiLoading: false },
      { field: '业绩要求', content: '近3年至少2个类似项目经验', pageNum: 16, verifyStatus: 'must', aiLoading: false },
      { field: '人员要求', content: '项目经理具备PMP证书', pageNum: 18, verifyStatus: 'need', aiLoading: false },
      { field: '技术架构', content: '微服务架构，支持分布式部署', pageNum: 25, verifyStatus: 'confirmed', aiLoading: false },
      { field: '响应时间', content: '系统响应时间≤2秒', pageNum: 32, verifyStatus: 'confirmed', aiLoading: false },
      { field: '数据安全', content: '等保三级要求', pageNum: 38, verifyStatus: 'must', aiLoading: false },
      { field: '售后服务', content: '质保期3年，7×24小时响应', pageNum: 45, verifyStatus: 'need', aiLoading: false }
    ]
    
    // 提取完成后自动更新项目信息
    updateProjectFromExtraction({
      tenderUnit: '江西省城市管理中心',
      budget: '1,280万元',
      bidMethod: '综合评分法',
      deadline: '2025-07-01',
      openBidTime: '2025-07-01 10:00',
      depositDeadline: '2025-06-28',
      deposit: '25万元',
      qualificationReq: '软件企业认定证书',
      performanceReq: '近3年至少2个类似项目',
      personnelReq: '项目经理PMP证书'
    })
    
    pmExtractAnalyzing.value = false
    pmPendingExtractFile.value = null
    ElMessage.success('招标文件解析完成，项目信息已自动更新')
  }, 2500)
}

// 招标信息提取 - 重新上传
const resetPmExtract = () => {
  pmExtractFileData.value = null
  pmBusinessKeyInfo.value = []
  pmTechKeyInfo.value = []
  pmPendingExtractFile.value = null
  pmIsTranslated.value = false
  pmPreviewZoom.value = 1
}

// 商务信息提取 - 添加字段
const addBusinessKeyInfo = () => {
  pmBusinessKeyInfo.value.push({
    field: '',
    content: '',
    pageNum: 1,
    verifyStatus: 'need',
    aiLoading: false
  })
}

// 商务信息提取 - 删除字段
const removeBusinessKeyInfo = (index) => {
  pmBusinessKeyInfo.value.splice(index, 1)
}

// 商务信息提取 - AI识别
const aiRecognizeBusinessInfo = (row, index) => {
  row.aiLoading = true
  setTimeout(() => {
    const mockData = [
      { content: '1,280万元', verifyStatus: 'must' },
      { content: '江西省城市管理中心', verifyStatus: 'confirmed' },
      { content: '2025年7月1日 09:30', verifyStatus: 'need' },
      { content: '银行保函或现金', verifyStatus: 'must' },
      { content: '合同签订后30日内', verifyStatus: 'need' }
    ]
    const randomData = mockData[Math.floor(Math.random() * mockData.length)]
    row.content = randomData.content
    row.verifyStatus = randomData.verifyStatus
    row.pageNum = Math.floor(Math.random() * 60) + 1
    row.aiLoading = false
    ElMessage.success('AI识别完成')
  }, 1500)
}

// 技术信息提取 - 添加字段
const addTechKeyInfo = () => {
  pmTechKeyInfo.value.push({
    field: '',
    content: '',
    pageNum: 1,
    verifyStatus: 'need',
    aiLoading: false
  })
}

// 技术信息提取 - 删除字段
const removeTechKeyInfo = (index) => {
  pmTechKeyInfo.value.splice(index, 1)
}

// 技术信息提取 - AI识别
const aiRecognizeTechInfo = (row, index) => {
  row.aiLoading = true
  setTimeout(() => {
    const mockData = [
      { content: '微服务架构，支持分布式部署', verifyStatus: 'must' },
      { content: 'MySQL 8.0 + Redis 6.0', verifyStatus: 'confirmed' },
      { content: '99.9%系统可用性', verifyStatus: 'must' },
      { content: '支持10000并发用户', verifyStatus: 'need' },
      { content: 'AES-256加密算法', verifyStatus: 'must' }
    ]
    const randomData = mockData[Math.floor(Math.random() * mockData.length)]
    row.content = randomData.content
    row.verifyStatus = randomData.verifyStatus
    row.pageNum = Math.floor(Math.random() * 60) + 1
    row.aiLoading = false
    ElMessage.success('AI识别完成')
  }, 1500)
}

// 否决项识别 - 添加否决项
const addRejectItem = () => {
  pmRejectItems.value.push({
    name: '',
    type: 'qualification',
    content: '',
    pageNum: 1,
    aiLoading: false
  })
}

// 否决项识别 - 删除否决项
const removeRejectItem = (index) => {
  pmRejectItems.value.splice(index, 1)
}

// 否决项识别 - AI识别填充
const aiRecognizeRejectItem = (row, index) => {
  row.aiLoading = true
  // 模拟AI识别过程
  setTimeout(() => {
    const mockData = [
      { type: 'qualification', content: '投标人未提供近三年类似项目业绩证明材料' },
      { type: 'business', content: '未提供经审计的近三年财务报表' },
      { type: 'qualification', content: '未提供有效期内的安全生产许可证' },
      { type: 'technical', content: '技术方案未实质性响应招标文件要求' },
      { type: 'qualification', content: '投标人未具备相应资质等级要求' },
      { type: 'business', content: '投标保证金金额或形式不符合招标文件要求' }
    ]
    const randomData = mockData[Math.floor(Math.random() * mockData.length)]
    // 项目名称保持不变，只填充其他字段
    row.type = randomData.type
    row.content = randomData.content
    row.pageNum = Math.floor(Math.random() * 60) + 1
    row.aiLoading = false
    ElMessage.success('AI识别完成')
  }, 1500)
}

// 标书样式 - 添加标题层级
const addTitleStyle = () => {
  pmTitleStyles.value.push({
    level: '',
    font: '黑体',
    size: '四号',
    align: '左对齐',
    bold: '是',
    special: '-'
  })
}

// 标书样式 - 删除标题层级
const removeTitleStyle = (index) => {
  pmTitleStyles.value.splice(index, 1)
}

// 标书样式 - 添加正文内容样式
const addContentStyle = () => {
  pmContentStyles.value.push({
    type: '',
    font: '仿宋',
    size: '小四',
    align: '左对齐',
    bold: '否',
    special: '-'
  })
}

// 标书样式 - 删除正文内容样式
const removeContentStyle = (index) => {
  pmContentStyles.value.splice(index, 1)
}

// 文件预览 - 缩放控制
const pmZoomIn = () => {
  pmPreviewZoom.value = Math.min(pmPreviewZoom.value + 0.1, 2)
}

const pmZoomOut = () => {
  pmPreviewZoom.value = Math.max(pmPreviewZoom.value - 0.1, 0.5)
}

const pmResetZoom = () => {
  pmPreviewZoom.value = 1
}

// 文件预览 - 翻译功能
const togglePmTranslation = () => {
  if (pmIsTranslated.value) {
    pmIsTranslated.value = false
    return
  }
  
  pmTranslating.value = true
  // 模拟翻译过程
  setTimeout(() => {
    pmIsTranslated.value = true
    pmTranslating.value = false
    ElMessage.success('全文翻译完成')
  }, 1500)
}

// 文件预览 - 定位到指定页
const locatePmPreview = (pageNum) => {
  const pageElement = document.getElementById(`pm-page-${pageNum}`)
  if (pageElement) {
    pageElement.scrollIntoView({ behavior: 'smooth', block: 'start' })
  }
}

// 文件预览 - 获取页面内容
const getPmPageContent = (pageNum) => {
  // 模拟页面内容
  const pageContents = {
    1: `<strong>招标公告</strong><br/><br/>
项目名称：智慧园区综合管理平台建设项目<br/>
招标编号：JXZB-2025-0629-001<br/><br/>
一、招标条件<br/>
本招标项目智慧园区综合管理平台建设项目已由江西省城市生命线管理中心批准建设，建设资金来自财政拨款，招标人为江西省城市生命线管理中心，招标代理机构为江西华诚工程咨询有限公司。项目已具备招标条件，现对该项目进行公开招标。`,
    2: `二、项目概况与招标范围<br/><br/>
2.1 项目概况<br/>
项目预算：人民币1,280万元<br/>
最高限价：人民币1,200万元<br/>
资金来源：财政拨款<br/><br/>
2.2 招标范围<br/>
包括但不限于：智慧园区综合管理平台的设计、开发、部署、培训及一年运维服务。`,
    3: `三、投标人资格要求<br/><br/>
3.1 企业资质要求<br/>
- 注册资本：不低于5000万元人民币<br/>
- 行业资质：具备建筑智能化工程专业承包壹级资质<br/>
- ISO认证：需提供ISO 9001质量管理体系认证<br/>
- 业绩要求：近三年完成过3个及以上类似项目<br/><br/>
3.2 开标时间：2025年07月01日 10:00<br/>
投标截止时间：2025年07月01日 09:30`
  }
  
  const content = pageContents[pageNum] || `第${pageNum}页内容...<br/><br/>此处为招标文件的详细内容，包含项目要求、技术规范、评标标准等信息。`
  
  if (pmIsTranslated.value) {
    // 模拟翻译后的内容（英文）
    const translatedContents = {
      1: `<strong>Bidding Announcement</strong><br/><br/>
Project Name: Smart Park Comprehensive Management Platform Construction Project<br/>
Bidding Number: JXZB-2025-0629-001<br/><br/>
I. Bidding Conditions<br/>
This bidding project has been approved by Jiangxi Urban Lifeline Management Center. The construction fund comes from fiscal appropriation. The tenderer is Jiangxi Urban Lifeline Management Center, and the bidding agency is Jiangxi Huacheng Engineering Consulting Co., Ltd.`,
      2: `II. Project Overview and Bidding Scope<br/><br/>
2.1 Project Overview<br/>
Project Budget: RMB 12.8 million<br/>
Maximum Price: RMB 12 million<br/>
Source of Funds: Fiscal appropriation<br/><br/>
2.2 Bidding Scope<br/>
Including but not limited to: design, development, deployment, training and one-year operation and maintenance services of the smart park comprehensive management platform.`,
      3: `III. Bidder Qualification Requirements<br/><br/>
3.1 Enterprise Qualification Requirements<br/>
- Registered Capital: Not less than RMB 50 million<br/>
- Industry Qualification: Building Intelligence Engineering Professional Contracting Class A<br/>
- ISO Certification: ISO 9001 Quality Management System Certification required<br/>
- Performance Requirements: Completed 3 or more similar projects in the past three years<br/><br/>
3.2 Bid Opening Time: July 1, 2025, 10:00<br/>
Bid Submission Deadline: July 1, 2025, 09:30`
    }
    return translatedContents[pageNum] || `Page ${pageNum} content...<br/><br/>This is the detailed content of the bidding document, including project requirements, technical specifications, evaluation criteria, etc.`
  }
  
  return content
}

// 招标信息提取 - 确认并进入下一步
const confirmPmExtract = () => {
  if (selectedPmProject.value) {
    selectedPmProject.value.progress = 35
    currentStepIndex.value = 1 // 跳转到撰写招标文件步骤
    ElMessage.success('信息已确认，进入撰写招标文件阶段')
  }
}

// ========== 撰写招标文件相关方法 ==========
// 选择投标类型
const selectWriteType = (type) => {
  pmWriteType.value = type
  pmWriteStepIndex.value = 0
  ElMessage.success(`已选择${type === 'business' ? '商务标' : '技术标'}，开始编写流程`)
}

// 自动生成大纲
const autoGenerateOutline = () => {
  ElMessage.info('正在自动生成大纲...')
  setTimeout(() => {
    if (pmWriteType.value === 'technical') {
      pmOutlineData.value = [
        {
          id: 1,
          title: '第一章 技术方案总体设计',
          children: [
            { id: 11, title: '1.1 项目概述' },
            { id: 12, title: '1.2 设计原则' },
            { id: 13, title: '1.3 总体架构' }
          ]
        },
        {
          id: 2,
          title: '第二章 系统功能设计',
          children: [
            { id: 21, title: '2.1 功能模块划分' },
            { id: 22, title: '2.2 核心功能设计' },
            { id: 23, title: '2.3 接口设计' }
          ]
        },
        {
          id: 3,
          title: '第三章 施工组织设计',
          children: [
            { id: 31, title: '3.1 施工方案' },
            { id: 32, title: '3.2 进度计划' },
            { id: 33, title: '3.3 人员配置' }
          ]
        },
        {
          id: 4,
          title: '第四章 质量保证措施',
          children: [
            { id: 41, title: '4.1 质量目标' },
            { id: 42, title: '4.2 质量保证体系' },
            { id: 43, title: '4.3 验收标准' }
          ]
        }
      ]
    }
    ElMessage.success('大纲生成完成')
  }, 1000)
}

// 添加大纲项
const addOutlineItem = (parent) => {
  const newId = Date.now()
  const newItem = { id: newId, title: '新章节', children: [] }
  
  if (parent) {
    if (!parent.children) parent.children = []
    parent.children.push(newItem)
  } else {
    pmOutlineData.value.push(newItem)
  }
}

// 编辑大纲项
const editOutlineItem = (data) => {
  ElMessageBox.prompt('请输入章节标题', '编辑章节', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    inputValue: data.title
  }).then(({ value }) => {
    data.title = value
    ElMessage.success('修改成功')
  }).catch(() => {})
}

// 删除大纲项
const deleteOutlineItem = (node, data) => {
  const parent = node.parent
  const children = parent.data.children || parent.data
  const index = children.findIndex(d => d.id === data.id)
  if (index > -1) {
    children.splice(index, 1)
    ElMessage.success('删除成功')
  }
}

// 生成文档
const generateDocument = () => {
  ElMessage.success('正在生成文档，请稍候...')
  setTimeout(() => {
    ElMessage.success('文档生成完成，开始下载')
  }, 2000)
}

// 预览文档
const previewDocument = () => {
  ElMessage.info('正在打开预览...')
}

// 完成撰写步骤
const completeWriteStep = () => {
  if (selectedPmProject.value) {
    selectedPmProject.value.progress = 55
    currentStepIndex.value = 2 // 进入文件提交步骤
    pmWriteType.value = null
    pmWriteStepIndex.value = 0
    ElMessage.success('标书编写完成，进入文件提交阶段')
  }
}

// ========== 材料智能匹配填充方法 ==========
const pmSelectedFiles = ref([])
const pmFilePreviewVisible = ref(false)
const pmPreviewingFile = ref(null)
const pmMatching = ref(false)

// 智能匹配规则映射
const materialMatchRules = {
  '投标函及投标函附录': ['营业执照', '资质证书'],
  '资格审查文件': ['营业执照', '资质证书', '安全生产许可证'],
  '商务条款响应表': [],
  '技术方案': [],
  '项目业绩证明': ['电力工程施工总承包资质', '建筑机电安装工程资质'],
  '企业资质证书': ['营业执照', '资质证书', '安全生产许可证'],
  '财务报表': ['财务审计报告']
}

// 全局智能匹配
const handleMaterialMatch = () => {
  pmMatching.value = true
  ElMessage.info('正在智能匹配所有材料...')
  
  setTimeout(() => {
    // 创建新数组以确保响应式更新
    pmMaterialItems.value = pmMaterialItems.value.map(item => {
      const rules = materialMatchRules[item.title] || []
      const matchedFiles = pmKnowledgeFiles.value.filter(f => 
        rules.some(keyword => f.name.includes(keyword))
      )
      return {
        ...item,
        files: matchedFiles.map(f => ({ id: f.id, name: f.name }))
      }
    })
    pmMatching.value = false
    ElMessage.success('智能匹配完成！')
  }, 1500)
}

// 全局一键应用
const handleMaterialApplyAll = () => {
  ElMessage.success('已应用所有匹配的材料到标书')
}

// 单项智能匹配
const handleItemMatch = (item) => {
  ElMessage.info(`正在为"${item.title}"智能匹配材料...`)
  
  setTimeout(() => {
    const rules = materialMatchRules[item.title] || []
    const matchedFiles = pmKnowledgeFiles.value.filter(f => 
      rules.some(keyword => f.name.includes(keyword))
    )
    
    // 找到原始数组中的项目并更新
    const targetIndex = pmMaterialItems.value.findIndex(i => i.id === item.id)
    if (targetIndex !== -1) {
      pmMaterialItems.value[targetIndex] = {
        ...pmMaterialItems.value[targetIndex],
        files: matchedFiles.map(f => ({ id: f.id, name: f.name }))
      }
      // 触发响应式更新
      pmMaterialItems.value = [...pmMaterialItems.value]
    }
    
    if (matchedFiles.length > 0) {
      ElMessage.success(`已为"${item.title}"匹配 ${matchedFiles.length} 个文件`)
    } else {
      ElMessage.warning(`未找到与"${item.title}"相关的文件`)
    }
  }, 800)
}

// 单项一键应用
const handleItemApply = (item) => {
  if (item.files && item.files.length > 0) {
    ElMessage.success(`已应用"${item.title}"的 ${item.files.length} 个材料`)
  } else {
    ElMessage.warning('请先添加或匹配文件')
  }
}

// 打开添加文件弹窗
const handleAddFile = (item) => {
  pmCurrentMaterialItem.value = item
  pmSelectedFiles.value = []
  pmAddFileDialogVisible.value = true
}

// 移除文件
const removeFile = (item, fileIndex) => {
  const targetIndex = pmMaterialItems.value.findIndex(i => i.id === item.id)
  if (targetIndex !== -1) {
    const newFiles = [...pmMaterialItems.value[targetIndex].files]
    newFiles.splice(fileIndex, 1)
    pmMaterialItems.value[targetIndex] = {
      ...pmMaterialItems.value[targetIndex],
      files: newFiles
    }
    pmMaterialItems.value = [...pmMaterialItems.value]
    ElMessage.success('已移除文件')
  }
}

// 处理材料文件上传
const handleMaterialFileUpload = (file) => {
  if (pmCurrentMaterialItem.value) {
    const targetIndex = pmMaterialItems.value.findIndex(i => i.id === pmCurrentMaterialItem.value.id)
    if (targetIndex !== -1) {
      const newFile = { id: Date.now(), name: file.name }
      pmMaterialItems.value[targetIndex] = {
        ...pmMaterialItems.value[targetIndex],
        files: [...pmMaterialItems.value[targetIndex].files, newFile]
      }
      pmMaterialItems.value = [...pmMaterialItems.value]
      ElMessage.success(`已上传: ${file.name}`)
    }
  }
}

// 表格选择变化
const handleMaterialFileSelect = (selection) => {
  pmSelectedFiles.value = selection
}

// 确认添加材料文件
const confirmAddMaterialFiles = () => {
  if (pmSelectedFiles.value.length > 0 && pmCurrentMaterialItem.value) {
    // 找到原始数组中的项目索引
    const targetIndex = pmMaterialItems.value.findIndex(item => item.id === pmCurrentMaterialItem.value.id)
    if (targetIndex !== -1) {
      const targetItem = pmMaterialItems.value[targetIndex]
      const newFiles = pmSelectedFiles.value
        .filter(f => !targetItem.files.find(ef => ef.id === f.id))
        .map(f => ({ id: f.id, name: f.name }))
      
      // 更新并触发响应式
      pmMaterialItems.value[targetIndex] = {
        ...targetItem,
        files: [...targetItem.files, ...newFiles]
      }
      pmMaterialItems.value = [...pmMaterialItems.value]
      
      ElMessage.success(`已添加 ${newFiles.length} 个文件`)
    }
  }
  pmAddFileDialogVisible.value = false
}

// 预览材料项中的文件
const previewMaterialFile = (file) => {
  // 从知识库中查找完整的文件信息
  const fullFile = pmKnowledgeFiles.value.find(f => f.id === file.id) || file
  pmPreviewingFile.value = {
    ...fullFile,
    fileType: fullFile.category || '资质文件',
    fileSize: '2.5 MB',
    uploadTime: '2024-11-20',
    details: fullFile.name.includes('营业执照') ? {
      title: '营业执照',
      code: '91360000MA35XXXX1X',
      company: '江西XX科技有限公司',
      type: '有限责任公司（自然人投资或控股）',
      legalPerson: '张三',
      capital: '5000万元人民币',
      establishDate: '2015年03月15日',
      validPeriod: '2015年03月15日至无固定期限'
    } : fullFile.name.includes('资质证书') ? {
      title: '资质证书',
      code: 'D336000012',
      company: '江西XX科技有限公司',
      type: '电力工程施工总承包',
      level: '壹级',
      issueDate: '2020年05月10日',
      validPeriod: '2020年05月10日至2025年05月09日'
    } : fullFile.name.includes('安全生产许可证') ? {
      title: '安全生产许可证',
      code: '(赣)JZ安许证字[2020]000123',
      company: '江西XX科技有限公司',
      issueDate: '2020年06月15日',
      validPeriod: '2020年06月15日至2023年06月14日'
    } : null
  }
  pmFilePreviewVisible.value = true
}

// 预览弹窗中的文件（添加文件弹窗）
const previewFile = (file) => {
  pmPreviewingFile.value = {
    ...file,
    // 模拟文件详情
    fileType: file.category || '资质文件',
    fileSize: '2.5 MB',
    uploadTime: '2024-11-20',
    details: file.name.includes('营业执照') ? {
      title: '营业执照',
      code: '91360000MA35XXXX1X',
      company: '江西XX科技有限公司',
      type: '有限责任公司（自然人投资或控股）',
      legalPerson: '张三',
      capital: '5000万元人民币',
      establishDate: '2015年03月15日',
      validPeriod: '2015年03月15日至无固定期限'
    } : null
  }
  pmFilePreviewVisible.value = true
}

// 下载材料文件
const downloadMaterialFile = () => {
  if (pmPreviewingFile.value) {
    ElMessage.success(`正在下载: ${pmPreviewingFile.value.name}`)
  }
}

// ========== 三分栏布局相关方法 ==========
// 点击大纲节点
const handleOutlineNodeClick = (data) => {
  pmCurrentOutlineId.value = data.id
  // 可以根据大纲节点更新文档内容
  ElMessage.info(`切换到: ${data.title}`)
}

// 更新文档标题
const updateDocumentTitle = (e) => {
  pmDocumentTitle.value = e.target.innerText
}

// 更新文档内容
const updateDocumentContent = (e) => {
  pmDocumentContent.value = e.target.innerText
}

// 保存文档
const saveDocument = () => {
  ElMessage.success('文档保存成功')
}

// 导出Word文档
const exportDocument = () => {
  ElMessage.success('正在生成Word文档...')
  setTimeout(() => {
    ElMessage.success('文档导出成功')
  }, 1500)
}

// 发送聊天消息
const sendChatMessage = () => {
  if (!pmChatInput.value.trim()) return
  
  const now = new Date()
  const timeStr = `${now.getHours()}:${String(now.getMinutes()).padStart(2, '0')}`
  
  // 添加用户消息
  pmChatMessages.value.push({
    role: 'user',
    content: pmChatInput.value,
    time: timeStr
  })
  
  const userMessage = pmChatInput.value
  pmChatInput.value = ''
  pmAiTyping.value = true
  
  // 滚动到底部
  setTimeout(() => {
    if (chatMessagesRef.value) {
      chatMessagesRef.value.scrollTop = chatMessagesRef.value.scrollHeight
    }
  }, 100)
  
  // 模拟AI回复
  setTimeout(() => {
    pmAiTyping.value = false
    const responses = [
      '好的，我来帮您优化这部分内容。建议在技术方案中增加更多细节描述，突出项目的创新点和技术优势。',
      '根据招标文件要求，您需要在商务条款响应表中明确列出各项条款的响应情况。我已为您生成了参考模板。',
      '您的投标文件整体结构清晰，建议在实施计划部分增加里程碑节点和交付物清单，这样会更加专业。',
      '我注意到技术方案中的系统架构描述较为简单，建议添加架构图和详细的技术选型说明。',
      '这个问题很好，根据招标要求，您需要提供至少3个类似项目的业绩证明。我可以帮您整理相关材料。'
    ]
    
    pmChatMessages.value.push({
      role: 'assistant',
      content: responses[Math.floor(Math.random() * responses.length)],
      time: timeStr
    })
    
    setTimeout(() => {
      if (chatMessagesRef.value) {
        chatMessagesRef.value.scrollTop = chatMessagesRef.value.scrollHeight
      }
    }, 100)
  }, 1500)
}

// 获取进度标签类型
const getProgressTagType = (progress) => {
  const typeMap = {
    '招标信息提取': 'info',
    '撰写投标文件': 'warning',
    '文件提交': 'primary',
    '开标': 'success',
    '结果公示': 'success'
  }
  return typeMap[progress] || 'info'
}

// 获取进度颜色
const getProgressColor = (progress) => {
  const colorMap = {
    '招标信息提取': '#909399',
    '撰写投标文件': '#e6a23c',
    '文件提交': '#409eff',
    '开标': '#67c23a',
    '结果公示': '#67c23a'
  }
  return colorMap[progress] || '#909399'
}

// 获取当前激活的步骤
const getActiveStep = (progress) => {
  const stepMap = {
    '招标信息提取': 0,
    '撰写投标文件': 1,
    '文件提交': 2,
    '开标': 3,
    '结果公示': 4
  }
  return stepMap[progress] || 0
}

// 获取步骤状态
const getStepStatus = (currentProgress, stepKey) => {
  const currentIndex = getActiveStep(currentProgress)
  const stepIndex = projectSteps.findIndex(s => s.key === stepKey)
  
  if (stepIndex < currentIndex) return 'finish'
  if (stepIndex === currentIndex) return 'process'
  return 'wait'
}

// 创建项目
const confirmCreateProject = () => {
  const newProject = {
    id: Date.now(),
    name: createProjectForm.value.name,
    description: createProjectForm.value.description,
    createTime: new Date().toLocaleString('zh-CN', { 
      year: 'numeric', 
      month: '2-digit', 
      day: '2-digit', 
      hour: '2-digit', 
      minute: '2-digit', 
      second: '2-digit',
      hour12: false 
    }).replace(/\//g, '-'),
    progress: createProjectForm.value.initialStep
  }
  
  ongoingProjects.value.unshift(newProject)
  
  // 如果是从文件识别页面创建的项目，自动完成第一步
  if (activeNav.value === 'file-import' && biddingFileData.value) {
    newProject.progress = '撰写投标文件'
    ElMessage.success('项目创建成功！第一步“招标信息提取”已自动完成')
  } else {
    ElMessage.success('项目创建成功！')
  }
  
  // 重置表单
  createProjectForm.value = {
    name: '',
    description: '',
    initialStep: '招标信息提取'
  }
  showCreateDialog.value = false
}

// 完成当前步骤
const completeCurrentStep = (project) => {
  const currentIndex = getActiveStep(project.progress)
  if (currentIndex < projectSteps.length - 1) {
    project.progress = projectSteps[currentIndex + 1].title
    ElMessage.success(`已进入下一阶段：${project.progress}`)
  }
}

// 完结项目
const finishProject = (project) => {
  ElMessageBox.confirm(
    '确认完结此项目吗？完结后需要填写项目结果信息。',
    '完结项目',
    {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning'
    }
  ).then(() => {
    // 从进行中项目移除
    const index = ongoingProjects.value.findIndex(p => p.id === project.id)
    if (index > -1) {
      ongoingProjects.value.splice(index, 1)
    }
    
    // 添加到已完结项目（这里简化处理，实际应该弹出表单填写结果）
    const completedProject = {
      ...project,
      completeTime: new Date().toLocaleString('zh-CN', { 
        year: 'numeric', 
        month: '2-digit', 
        day: '2-digit', 
        hour: '2-digit', 
        minute: '2-digit', 
        second: '2-digit',
        hour12: false 
      }).replace(/\//g, '-'),
      result: '中标', // 默认中标，实际应该由用户选择
      bidAmount: '待填写'
    }
    
    completedProjects.value.unshift(completedProject)
    selectedProject.value = null
    activeNav.value = 'project-completed'
    
    ElMessage.success('项目已完结！')
  }).catch(() => {
    // 取消操作
  })
}

// 技术参数解析
const selectedTechFile = ref('')
const techParsing = ref(false)
const techParseProgress = ref(0)
const techParams = ref([
  { category: '性能参数', param: '额定功率', requirement: '≥500kW', ourValue: '550kW' },
  { category: '性能参数', param: '效率', requirement: '≥95%', ourValue: '96%' },
  { category: '环境参数', param: '工作温度', requirement: '-10℃~45℃', ourValue: '-15℃~50℃' },
  { category: '电气参数', param: '电压等级', requirement: '10kV', ourValue: '10kV' }
])

const startTechParse = () => {
  techParsing.value = true
  techParseProgress.value = 0
  const timer = setInterval(() => {
    techParseProgress.value += 10
    if (techParseProgress.value >= 100) {
      clearInterval(timer)
      techParsing.value = false
      ElMessage.success('技术参数解析完成！')
    }
  }, 200)
}

const checkCompliance = (row) => {
  return row.ourValue && row.ourValue.trim() !== ''
}

// 图纸识别
const currentDrawing = ref(null)
const drawingInfo = ref(null)

const uploadDrawing = () => {
  // 模拟上传
  currentDrawing.value = {
    preview: 'https://via.placeholder.com/800x600?text=CAD+Drawing'
  }
  drawingInfo.value = {
    name: '电气系统布局图',
    type: 'CAD平面图',
    dimensions: '1200mm x 800mm',
    tags: ['配电柜', '线路走向', '设备位置', '尺寸标注']
  }
  ElMessage.success('图纸上传成功！')
}

// 商务文件撰写 - 四阶段流程
const businessWriteStep = ref(0) // 当前步骤：0-项目选择, 1-大纲生成, 2-材料匹配, 3-格式排版
const selectedBusinessProject = ref(null)
const generatingBusinessOutline = ref(false)
const businessOutlineData = ref([])
const matchingAllMaterials = ref(false)
const applyingAllMaterials = ref(false)
const editorFormat = ref({
  fontFamily: 'SimSun',
  fontSize: '14pt',
  heading: 'normal'
})
const businessDocumentContent = ref(`
<h1 style="text-align: center; margin-bottom: 30px;">某数据中心发电机组采购项目</h1>
<h2 style="text-align: center; margin-bottom: 40px;">商务投标文件</h2>

<p style="text-align: right; margin-bottom: 40px;">
  投标单位：江西XX科技有限公司<br>
  投标日期：2024年12月7日
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">一、投标函</h2>
<p style="line-height: 2; text-indent: 2em;">
  致：XX数据中心有限公司
</p>
<p style="line-height: 2; text-indent: 2em;">
  我方经研究上述项目的招标文件（包括澄清和修改内容），愿意以人民币（大写）<strong>壹仟贰佰万元整</strong>（¥12,000,000.00元）的投标总价，按照招标文件的要求实施和完成承包工程，修补工程中的任何缺陷。
</p>
<p style="line-height: 2; text-indent: 2em;">
  我方承诺在投标有效期内不修改、撤销投标文件。如中标，我方将按招标文件要求与贵方签订合同，并在收到中标通知书后按规定提交履约保证金。
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">二、法定代表人身份证明</h2>
<p style="line-height: 2;">
  <strong>单位名称：</strong>江西XX科技有限公司<br>
  <strong>单位性质：</strong>有限责任公司<br>
  <strong>地址：</strong>江西省南昌市红谷滩区XX路XX号<br>
  <strong>成立时间：</strong>2015年03月15日<br>
  <strong>经营期限：</strong>长期<br>
  <strong>姓名：</strong>张三<br>
  <strong>性别：</strong>男<br>
  <strong>年龄：</strong>45岁<br>
  <strong>职务：</strong>董事长兼总经理<br>
  <strong>身份证号码：</strong>360102197901011234<br>
  系本公司的法定代表人，特此证明。
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">三、授权委托书</h2>
<p style="line-height: 2; text-indent: 2em;">
  本授权委托书声明：我<strong>张三</strong>系江西XX科技有限公司的法定代表人，现授权委托本公司的<strong>李四</strong>为我公司的合法代理人，以本公司的名义参加某数据中心发电机组采购项目的投标活动。
</p>
<p style="line-height: 2; text-indent: 2em;">
  代理人在投标、开标、评标、合同谈判过程中所签署的一切文件和处理与之有关的一切事务，我均予以承认。
</p>
<p style="line-height: 2;">
  <strong>代理人姓名：</strong>李四<br>
  <strong>性别：</strong>男<br>
  <strong>年龄：</strong>38岁<br>
  <strong>职务：</strong>项目经理<br>
  <strong>身份证号码：</strong>360102198601011234<br>
  <strong>授权期限：</strong>自2024年12月1日至2025年3月31日
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">四、投标保证金</h2>
<p style="line-height: 2;">
  我公司已按照招标文件要求，向贵方指定账户缴纳投标保证金人民币<strong>伍万元整</strong>（¥50,000.00元）。
</p>
<p style="line-height: 2;">
  <strong>缴款单位：</strong>江西XX科技有限公司<br>
  <strong>开户银行：</strong>中国工商银行南昌红谷滩支行<br>
  <strong>账号：</strong>1234 5678 0900 1234 567<br>
  <strong>缴款日期：</strong>2024年12月5日<br>
  <strong>缴款凭证号：</strong>GS20241205001234
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">五、资格证明文件</h2>

<h3 style="margin-top: 20px; margin-bottom: 15px;">5.1 营业执照</h3>
<p style="line-height: 2;">
  <strong>统一社会信用代码：</strong>91360000MA35XXXX1X<br>
  <strong>企业名称：</strong>江西XX科技有限公司<br>
  <strong>类型：</strong>有限责任公司（自然人投资或控股）<br>
  <strong>法定代表人：</strong>张三<br>
  <strong>注册资本：</strong>5000万元人民币<br>
  <strong>成立日期：</strong>2015年03月15日<br>
  <strong>营业期限：</strong>长期<br>
  <strong>经营范围：</strong>电力工程设计、施工；机电设备安装；建筑智能化工程；消防设施工程；安全技术防范工程；计算机系统集成；软件开发；技术咨询服务。
</p>

<h3 style="margin-top: 20px; margin-bottom: 15px;">5.2 资质证书</h3>
<p style="line-height: 2;">
  我公司具有以下资质证书：
</p>
<ul style="line-height: 2; padding-left: 40px;">
  <li>电力工程施工总承包 贰级</li>
  <li>建筑机电安装工程专业承包 贰级</li>
  <li>消防设施工程专业承包 贰级</li>
</ul>
<p style="line-height: 2;">
  <strong>证书编号：</strong>A236XXXXXXXX<br>
  <strong>发证机关：</strong>江西省住房和城乡建设厅<br>
  <strong>有效期至：</strong>2029年12月31日
</p>

<h3 style="margin-top: 20px; margin-bottom: 15px;">5.3 安全生产许可证</h3>
<p style="line-height: 2;">
  <strong>证书编号：</strong>(赣)JZ安许证字[2024]001234<br>
  <strong>发证机关：</strong>江西省住房和城乡建设厅<br>
  <strong>有效期：</strong>2024年01月20日至2027年01月19日
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">六、财务状况</h2>

<h3 style="margin-top: 20px; margin-bottom: 15px;">6.1 近三年财务状况</h3>
<table style="width: 100%; border-collapse: collapse; margin: 20px 0;">
  <tr style="background: #f3f4f6;">
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">项目</th>
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">2024年（万元）</th>
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">2023年（万元）</th>
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">2022年（万元）</th>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px;">营业收入</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">12,580</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">10,230</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">8,560</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px;">净利润</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">1,856</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">1,523</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">1,285</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px;">资产总额</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">25,600</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">22,100</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">19,800</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px;">负债总额</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">15,200</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">13,800</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">12,500</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px;">所有者权益</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">10,400</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">8,300</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: right;">7,300</td>
  </tr>
</table>

<h3 style="margin-top: 20px; margin-bottom: 15px;">6.2 银行资信证明</h3>
<p style="line-height: 2;">
  <strong>开户银行：</strong>中国工商银行南昌红谷滩支行<br>
  <strong>账号：</strong>1234 5678 0900 1234 567<br>
  <strong>信用等级：</strong>AAA级<br>
  <strong>授信额度：</strong>人民币3000万元<br>
  <strong>证明日期：</strong>2024年11月20日
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">七、业绩证明</h2>
<p style="line-height: 2;">
  我公司近三年完成的类似项目业绩如下：
</p>

<h3 style="margin-top: 20px; margin-bottom: 15px;">项目一：南昌高新区数据中心发电机组采购安装项目</h3>
<p style="line-height: 2;">
  <strong>建设单位：</strong>南昌高新技术产业开发区管理委员会<br>
  <strong>合同金额：</strong>人民币1050万元<br>
  <strong>建设地点：</strong>江西省南昌市高新区<br>
  <strong>完成时间：</strong>2023年6月<br>
  <strong>项目内容：</strong>500kW柴油发电机组2台，包括设备采购、安装调试、培训等<br>
  <strong>质量评价：</strong>优良
</p>

<h3 style="margin-top: 20px; margin-bottom: 15px;">项目二：赣州经开区智能制造产业园应急电源系统项目</h3>
<p style="line-height: 2;">
  <strong>建设单位：</strong>赣州经济技术开发区投资发展有限公司<br>
  <strong>合同金额：</strong>人民币880万元<br>
  <strong>建设地点：</strong>江西省赣州市经开区<br>
  <strong>完成时间：</strong>2022年12月<br>
  <strong>项目内容：</strong>400kW柴油发电机组3台，包括配电系统、自动切换系统等<br>
  <strong>质量评价：</strong>优良
</p>

<h3 style="margin-top: 20px; margin-bottom: 15px;">项目三：九江石化应急发电系统升级改造项目</h3>
<p style="line-height: 2;">
  <strong>建设单位：</strong>中国石化九江分公司<br>
  <strong>合同金额：</strong>人民币1200万元<br>
  <strong>建设地点：</strong>江西省九江市<br>
  <strong>完成时间：</strong>2024年3月<br>
  <strong>项目内容：</strong>600kW柴油发电机组2台，包括旧设备拆除、新设备安装、系统调试等<br>
  <strong>质量评价：</strong>优良
</p>

<h2 style="margin-top: 40px; margin-bottom: 20px;">八、项目管理团队</h2>
<table style="width: 100%; border-collapse: collapse; margin: 20px 0;">
  <tr style="background: #f3f4f6;">
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">姓名</th>
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">职务</th>
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">职称/资格</th>
    <th style="border: 1px solid #000; padding: 10px; text-align: center;">工作年限</th>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">李四</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">项目经理</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">一级建造师（机电工程）</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">15年</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">王五</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">技术负责人</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">高级工程师</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">18年</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">赵六</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">质量负责人</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">工程师</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">12年</td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">孙七</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">安全负责人</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">注册安全工程师</td>
    <td style="border: 1px solid #000; padding: 10px; text-align: center;">10年</td>
  </tr>
</table>

<h2 style="margin-top: 40px; margin-bottom: 20px;">九、售后服务承诺</h2>
<p style="line-height: 2; text-indent: 2em;">
  我公司承诺为本项目提供优质的售后服务，具体如下：
</p>
<ol style="line-height: 2; padding-left: 40px;">
  <li>设备质保期为交付验收合格后36个月；</li>
  <li>质保期内免费提供设备维护保养服务，每季度不少于1次；</li>
  <li>质保期内设备出现故障，接到通知后2小时内响应，24小时内到达现场处理；</li>
  <li>提供7×24小时技术支持热线服务；</li>
  <li>质保期满后，继续提供终身有偿维修服务；</li>
  <li>免费提供操作人员培训，确保设备正常运行。</li>
</ol>

<p style="text-align: right; margin-top: 60px;">
  投标单位：江西XX科技有限公司（盖章）<br>
  法定代表人或授权代表：________________（签字）<br>
  日期：2024年12月7日
</p>
`)
const chatMessages = ref([
  { id: 1, role: 'assistant', content: '您好！我是AI助手，可以帮助您优化文档内容、检查格式等。有什么需要帮助的吗？', time: '09:00' }
])
const chatInput = ref('')
const chatSending = ref(false)
const outlineChatMessagesRef = ref(null)
const documentZoom = ref(1)

// 文件预览弹窗相关
const previewMaterialDialogVisible = ref(false)
const previewingMaterial = ref(null)
// 注意：previewZoom 已在文件识别模块中声明，这里共用

// 更换文件弹窗相关
const changeMaterialDialogVisible = ref(false)
const currentChangingSection = ref(null)
const dialogMaterialFilter = ref({
  region: '',
  industry: '',
  year: ''
})
const selectedMaterials = ref([])
const uploadedFiles = ref([])
const materialUploadRef = ref(null)
const fileInputRef = ref(null)
const availableMaterials = ref([
  // 资质文件
  { id: 101, name: '营业执照.pdf', category: '资质文件', region: '江西省', year: '2024', matchScore: 98 },
  { id: 102, name: '资质证书.pdf', category: '资质文件', region: '江西省', year: '2024', matchScore: 95 },
  { id: 103, name: '安全生产许可证.pdf', category: '资质文件', region: '江西省', year: '2024', matchScore: 93 },
  { id: 104, name: '电力工程施工总承包资质.pdf', category: '资质文件', region: '江西省', year: '2024', matchScore: 97 },
  { id: 105, name: '建筑机电安装工程资质.pdf', category: '资质文件', region: '江西省', year: '2024', matchScore: 94 },
  
  // 财务文件
  { id: 106, name: '2023年财务审计报告.pdf', category: '财务文件', region: '江西省', year: '2023', matchScore: 92 },
  { id: 107, name: '2024年财务审计报告.pdf', category: '财务文件', region: '江西省', year: '2024', matchScore: 96 },
  { id: 108, name: '银行资信证明.pdf', category: '财务文件', region: '南昌市', year: '2024', matchScore: 90 },
  { id: 109, name: '纳税证明.pdf', category: '财务文件', region: '江西省', year: '2024', matchScore: 89 },
  
  // 业绩文件
  { id: 110, name: '南昌高新区数据中心项目业绩.pdf', category: '业绩文件', region: '江西省', year: '2023', matchScore: 88 },
  { id: 111, name: '赣州经开区智能制造项目业绩.pdf', category: '业绩文件', region: '赣州市', year: '2024', matchScore: 91 },
  { id: 112, name: '九江石化应急发电系统项目.pdf', category: '业绩文件', region: '江西省', year: '2024', matchScore: 93 },
  { id: 113, name: '上饶市政府办公楼项目.pdf', category: '业绩文件', region: '江西省', year: '2023', matchScore: 86 },
  
  // 技术方案
  { id: 114, name: '发电机组技术方案模板.docx', category: '技术方案', region: '全国', year: '2024', matchScore: 95 },
  { id: 115, name: '500kW柴油发电机组技术方案.pdf', category: '技术方案', region: '江西省', year: '2024', matchScore: 98 },
  { id: 116, name: '应急电源系统设计方案.pdf', category: '技术方案', region: '江西省', year: '2024', matchScore: 96 },
  { id: 117, name: '自动化控制系统方案.pdf', category: '技术方案', region: '江西省', year: '2024', matchScore: 94 },
  { id: 118, name: '远程监控系统技术方案.pdf', category: '技术方案', region: '江西省', year: '2024', matchScore: 92 },
  
  // 设备参数
  { id: 119, name: '康明斯发电机组参数表.xlsx', category: '设备参数', region: '全国', year: '2024', matchScore: 97 },
  { id: 120, name: '卡特彼勒发电机组参数.xlsx', category: '设备参数', region: '全国', year: '2024', matchScore: 96 },
  { id: 121, name: '深海控制器技术参数.pdf', category: '设备参数', region: '全国', year: '2024', matchScore: 93 },
  { id: 122, name: '配电柜技术参数表.xlsx', category: '设备参数', region: '江西省', year: '2024', matchScore: 90 },
  
  // 施工组织
  { id: 123, name: '发电机组安装施工方案.docx', category: '施工组织', region: '江西省', year: '2024', matchScore: 94 },
  { id: 124, name: '施工进度计划表.xlsx', category: '施工组织', region: '江西省', year: '2024', matchScore: 91 },
  { id: 125, name: '质量保证措施.docx', category: '施工组织', region: '江西省', year: '2024', matchScore: 89 },
  { id: 126, name: '安全文明施工方案.pdf', category: '施工组织', region: '江西省', year: '2024', matchScore: 92 },
  
  // 人员资料
  { id: 127, name: '项目经理一级建造师证书.pdf', category: '人员资料', region: '江西省', year: '2024', matchScore: 99 },
  { id: 128, name: '技术负责人高级工程师证.pdf', category: '人员资料', region: '江西省', year: '2024', matchScore: 97 },
  { id: 129, name: '安全员注册证书.pdf', category: '人员资料', region: '江西省', year: '2024', matchScore: 95 },
  { id: 130, name: '质量员资格证书.pdf', category: '人员资料', region: '江西省', year: '2024', matchScore: 94 },
  
  // 其他文件
  { id: 131, name: '法定代表人身份证.pdf', category: '身份证明', region: '江西省', year: '2024', matchScore: 99 },
  { id: 132, name: '授权委托书模板.docx', category: '模板文件', region: '全国', year: '2024', matchScore: 85 },
  { id: 133, name: '投标保证金缴纳凭证.pdf', category: '保证金', region: '江西省', year: '2024', matchScore: 98 },
  { id: 134, name: '售后服务承诺书.docx', category: '服务承诺', region: '江西省', year: '2024', matchScore: 91 },
  { id: 135, name: '培训方案.pdf', category: '培训资料', region: '江西省', year: '2024', matchScore: 88 }
])

// 步骤1：选择项目
const selectBusinessProject = (project) => {
  selectedBusinessProject.value = project
  ElMessage.success(`已选择项目：${project.name}`)
}

const confirmProjectSelection = () => {
  if (!selectedBusinessProject.value) {
    ElMessage.warning('请先选择一个项目')
    return
  }
  businessWriteStep.value = 1
  ElMessage.success('项目信息已同步，开始生成商务标大纲')
}

// 步骤2：生成大纲
const generateBusinessOutline = () => {
  generatingBusinessOutline.value = true
  ElMessage.info('正在基于招标文件生成商务标大纲...')
  
  setTimeout(() => {
    businessOutlineData.value = [
      { 
        id: 1, 
        title: '1. 投标函',
        children: []
      },
      { 
        id: 2, 
        title: '2. 法定代表人身份证明',
        children: []
      },
      { 
        id: 3, 
        title: '3. 授权委托书',
        children: []
      },
      { 
        id: 4, 
        title: '4. 投标保证金',
        children: []
      },
      { 
        id: 5, 
        title: '5. 资格证明文件',
        children: [
          { id: 51, title: '5.1 营业执照' },
          { id: 52, title: '5.2 资质证书' },
          { id: 53, title: '5.3 安全生产许可证' }
        ]
      },
      { 
        id: 6, 
        title: '6. 财务状况',
        children: [
          { id: 61, title: '6.1 财务审计报告' },
          { id: 62, title: '6.2 银行资信证明' }
        ]
      },
      { 
        id: 7, 
        title: '7. 业绩证明',
        children: []
      }
    ]
    generatingBusinessOutline.value = false
    ElMessage.success('商务标大纲生成成功！')
  }, 2000)
}

const addOutlineSection = () => {
  const newId = businessOutlineData.value.length + 1
  businessOutlineData.value.push({
    id: newId,
    title: `${newId}. 新章节`,
    children: []
  })
  ElMessage.success('已添加新章节')
}

const editOutlineNode = (data) => {
  ElMessageBox.prompt('请输入章节标题', '编辑章节', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    inputValue: data.title
  }).then(({ value }) => {
    data.title = value
    ElMessage.success('章节标题已更新')
  }).catch(() => {})
}

const addChildNode = (data) => {
  if (!data.children) {
    data.children = []
  }
  const newId = Date.now()
  data.children.push({
    id: newId,
    title: `${data.title.split('.')[0]}.${data.children.length + 1} 新子章节`
  })
  ElMessage.success('已添加子章节')
}

const deleteOutlineNode = (data) => {
  ElMessageBox.confirm('确定删除此章节吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    // 简化处理，实际需要递归查找并删除
    const index = businessOutlineData.value.findIndex(item => item.id === data.id)
    if (index > -1) {
      businessOutlineData.value.splice(index, 1)
      ElMessage.success('章节已删除')
    }
  }).catch(() => {})
}

const allowDrop = (draggingNode, dropNode, type) => {
  return type !== 'inner'
}

// 步骤3：材料匹配
const autoMatchAllMaterials = () => {
  if (businessOutlineData.value.length === 0) {
    ElMessage.warning('请先生成商务标大纲')
    return
  }
  
  matchingAllMaterials.value = true
  ElMessage.info('正在为所有章节智能匹配材料...')
  
  setTimeout(() => {
    // 为每个章节自动匹配材料
    businessOutlineData.value.forEach((section, index) => {
      const mockMaterialsPool = [
        { id: 1, name: '营业执照.pdf', category: '资质文件', matchScore: 98, applied: false },
        { id: 2, name: '资质证书.pdf', category: '资质文件', matchScore: 95, applied: false },
        { id: 3, name: '安全生产许可证.pdf', category: '资质文件', matchScore: 93, applied: false },
        { id: 4, name: '2024年财务审计报告.pdf', category: '财务文件', matchScore: 96, applied: false },
        { id: 5, name: '银行资信证明.pdf', category: '财务文件', matchScore: 90, applied: false },
        { id: 6, name: '项目业绩证明.pdf', category: '业绩文件', matchScore: 91, applied: false },
        { id: 7, name: '法定代表人身份证.pdf', category: '身份证明', matchScore: 99, applied: false },
        { id: 8, name: '授权委托书.docx', category: '模板文件', matchScore: 85, applied: false }
      ]
      
      // 根据章节标题智能匹配相关材料
      let matchedMaterials = []
      if (section.title.includes('资格证明') || section.title.includes('资质')) {
        matchedMaterials = mockMaterialsPool.filter(m => m.category === '资质文件').slice(0, 2)
      } else if (section.title.includes('财务')) {
        matchedMaterials = mockMaterialsPool.filter(m => m.category === '财务文件')
      } else if (section.title.includes('业绩')) {
        matchedMaterials = mockMaterialsPool.filter(m => m.category === '业绩文件')
      } else if (section.title.includes('身份证明')) {
        matchedMaterials = mockMaterialsPool.filter(m => m.category === '身份证明')
      } else if (section.title.includes('授权')) {
        matchedMaterials = mockMaterialsPool.filter(m => m.name.includes('授权'))
      } else {
        // 默认匹配1-2个材料
        matchedMaterials = mockMaterialsPool.slice(index % 3, (index % 3) + 2)
      }
      
      section.matchedMaterials = matchedMaterials
    })
    
    matchingAllMaterials.value = false
    ElMessage.success('所有章节材料匹配完成！')
  }, 2500)
}

const autoMatchMaterial = (section) => {
  ElMessage.info(`正在为"${section.title}"智能匹配材料...`)
  
  setTimeout(() => {
    // 模拟匹配结果
    const mockMaterials = [
      { id: 1, name: '营业执照.pdf', category: '资质文件', matchScore: 98, applied: false },
      { id: 2, name: '资质证书.pdf', category: '资质文件', matchScore: 95, applied: false },
      { id: 3, name: '财务审计报告.pdf', category: '财务文件', matchScore: 92, applied: false }
    ]
    
    section.matchedMaterials = mockMaterials.slice(0, 2)
    ElMessage.success('材料匹配完成')
  }, 1500)
}

const previewMaterial = (material) => {
  previewingMaterial.value = material
  previewMaterialDialogVisible.value = true
  previewZoom.value = 1
}

const toggleApplyMaterial = (section, material) => {
  material.applied = !material.applied
  if (material.applied) {
    ElMessage.success(`已应用"${material.name}"到"${section.title}"`)
  } else {
    ElMessage.info(`已取消应用"${material.name}"`)
  }
}

// 检查单个章节是否所有材料都已应用
const isSectionAllApplied = (section) => {
  if (!section.matchedMaterials || section.matchedMaterials.length === 0) {
    return false
  }
  return section.matchedMaterials.every(material => material.applied)
}

// 检查所有章节是否所有材料都已应用
const allMaterialsApplied = computed(() => {
  if (businessOutlineData.value.length === 0) {
    return false
  }
  
  let hasAnyMaterial = false
  for (const section of businessOutlineData.value) {
    if (section.matchedMaterials && section.matchedMaterials.length > 0) {
      hasAnyMaterial = true
      if (!section.matchedMaterials.every(material => material.applied)) {
        return false
      }
    }
  }
  
  return hasAnyMaterial
})

// 切换单个章节的所有材料应用状态
const toggleApplySectionMaterials = (section) => {
  if (!section.matchedMaterials || section.matchedMaterials.length === 0) {
    ElMessage.warning(`"${section.title}"暂无匹配的材料`)
    return
  }
  
  const allApplied = isSectionAllApplied(section)
  
  if (allApplied) {
    // 取消应用所有材料
    section.matchedMaterials.forEach(material => {
      material.applied = false
    })
    ElMessage.info(`已取消应用"${section.title}"的所有材料`)
  } else {
    // 应用所有材料
    let appliedCount = 0
    section.matchedMaterials.forEach(material => {
      if (!material.applied) {
        material.applied = true
        appliedCount++
      }
    })
    ElMessage.success(`已应用"${section.title}"的 ${appliedCount} 个材料`)
  }
}

// 切换所有章节的所有材料应用状态
const toggleApplyAllMaterials = () => {
  if (businessOutlineData.value.length === 0) {
    ElMessage.warning('请先生成商务标大纲')
    return
  }
  
  applyingAllMaterials.value = true
  
  setTimeout(() => {
    const allApplied = allMaterialsApplied.value
    let totalChanged = 0
    let sectionsWithMaterials = 0
    
    businessOutlineData.value.forEach(section => {
      if (section.matchedMaterials && section.matchedMaterials.length > 0) {
        sectionsWithMaterials++
        section.matchedMaterials.forEach(material => {
          if (allApplied) {
            // 取消应用
            if (material.applied) {
              material.applied = false
              totalChanged++
            }
          } else {
            // 应用
            if (!material.applied) {
              material.applied = true
              totalChanged++
            }
          }
        })
      }
    })
    
    applyingAllMaterials.value = false
    
    if (allApplied) {
      ElMessage.info(`已取消应用 ${sectionsWithMaterials} 个章节的 ${totalChanged} 个材料`)
    } else {
      if (totalChanged > 0) {
        ElMessage.success(`已应用 ${sectionsWithMaterials} 个章节的 ${totalChanged} 个材料`)
      } else {
        ElMessage.warning('暂无可应用的材料，请先进行智能匹配')
      }
    }
  }, 800)
}

// 更换文件相关函数
const openChangeMaterialDialog = (section) => {
  currentChangingSection.value = section
  changeMaterialDialogVisible.value = true
  selectedMaterials.value = []
  uploadedFiles.value = []
  // 重置筛选条件
  dialogMaterialFilter.value = {
    region: '',
    industry: '',
    year: ''
  }
}

// 手动触发文件上传选择
const triggerFileUpload = () => {
  // 直接触发原生 input 的点击
  if (fileInputRef.value) {
    fileInputRef.value.click()
  }
}

// 处理原生 input 的文件选择
const handleFileInputChange = (event) => {
  const files = event.target.files
  if (files && files.length > 0) {
    Array.from(files).forEach(file => {
      const newFile = {
        id: Date.now() + Math.random(),
        name: file.name,
        size: file.size,
        raw: file,
        category: '上传文件',
        matchScore: 100,
        applied: false,
        isUploaded: true
      }
      uploadedFiles.value.push(newFile)
    })
    ElMessage.success(`成功添加 ${files.length} 个文件`)
    // 清空 input 的值，以便可以重复选择相同的文件
    event.target.value = ''
  }
}

// 处理文件上传
const handleFileUpload = (file) => {
  const newFile = {
    id: Date.now() + Math.random(),
    name: file.name,
    size: file.size,
    raw: file.raw,
    category: '上传文件',
    matchScore: 100,
    applied: false,
    isUploaded: true
  }
  
  uploadedFiles.value.push(newFile)
  ElMessage.success(`文件"${file.name}"上传成功`)
}

// 格式化文件大小
const formatFileSize = (bytes) => {
  if (bytes === 0) return '0 B'
  const k = 1024
  const sizes = ['B', 'KB', 'MB', 'GB']
  const i = Math.floor(Math.log(bytes) / Math.log(k))
  return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i]
}

// 预览上传的文件
const previewUploadedFile = (file) => {
  previewingMaterial.value = file
  previewMaterialDialogVisible.value = true
  previewZoom.value = 1
}

// 删除上传的文件
const removeUploadedFile = (file) => {
  const index = uploadedFiles.value.findIndex(f => f.id === file.id)
  if (index > -1) {
    uploadedFiles.value.splice(index, 1)
    ElMessage.info(`已删除文件"${file.name}"`)
  }
}

// 取消选择文件
const cancelChangeMaterial = () => {
  changeMaterialDialogVisible.value = false
  uploadedFiles.value = []
  selectedMaterials.value = []
}

const searchDialogMaterials = () => {
  ElMessage.info('正在检索文件...')
  setTimeout(() => {
    ElMessage.success('检索完成')
  }, 1000)
}

const handleMaterialSelectionChange = (selection) => {
  selectedMaterials.value = selection
}

const previewDialogMaterial = (material) => {
  previewingMaterial.value = material
  previewMaterialDialogVisible.value = true
  previewZoom.value = 1
}

const downloadPreviewFile = () => {
  ElMessage.success(`正在下载：${previewingMaterial.value?.name}`)
}

const confirmChangeMaterial = () => {
  const totalFiles = selectedMaterials.value.length + uploadedFiles.value.length
  
  if (totalFiles === 0) {
    ElMessage.warning('请至少选择或上传一个文件')
    return
  }
  
  // 将选中的文件添加到当前章节
  if (!currentChangingSection.value.matchedMaterials) {
    currentChangingSection.value.matchedMaterials = []
  }
  
  // 添加知识库选中的文件
  selectedMaterials.value.forEach(material => {
    // 检查是否已存在
    const exists = currentChangingSection.value.matchedMaterials.some(m => m.id === material.id)
    if (!exists) {
      currentChangingSection.value.matchedMaterials.push({
        ...material,
        applied: false
      })
    }
  })
  
  // 添加上传的文件
  uploadedFiles.value.forEach(file => {
    currentChangingSection.value.matchedMaterials.push({
      ...file,
      applied: false
    })
  })
  
  ElMessage.success(`已添加 ${totalFiles} 个文件到"${currentChangingSection.value.title}"`)
  changeMaterialDialogVisible.value = false
  selectedMaterials.value = []
  uploadedFiles.value = []
}

// 步骤4：文档编辑
const formatText = (command) => {
  document.execCommand(command, false, null)
}

const updateBusinessDocContent = (event) => {
  businessDocumentContent.value = event.target.innerHTML
}

const saveBusinessDocument = () => {
  ElMessage.success('商务文件已保存')
}

const exportBusinessDocument = () => {
  ElMessage.success('商务文件导出成功')
}

const sendBusinessChatMessage = () => {
  if (!chatInput.value.trim()) return
  
  chatSending.value = true
  const userMessage = {
    id: Date.now(),
    role: 'user',
    content: chatInput.value,
    time: new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })
  }
  
  chatMessages.value.push(userMessage)
  chatInput.value = ''
  
  setTimeout(() => {
    const aiMessage = {
      id: Date.now() + 1,
      role: 'assistant',
      content: '我已经理解您的需求，正在为您优化文档内容...',
      time: new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })
    }
    chatMessages.value.push(aiMessage)
    chatSending.value = false
    
    // 滚动到底部
    if (outlineChatMessagesRef.value) {
      outlineChatMessagesRef.value.scrollTop = outlineChatMessagesRef.value.scrollHeight
    }
  }, 1000)
}

const quickAction = (action) => {
  const actions = {
    optimize: '正在优化当前段落...',
    expand: '正在扩写内容...',
    check: '正在检查格式...'
  }
  ElMessage.info(actions[action] || '执行操作中...')
}

// 文档浏览器功能（商务标大纲生成阶段）
const documentZoomIn = () => {
  if (documentZoom.value < 200) {
    documentZoom.value += 10
  }
}

const documentZoomOut = () => {
  if (documentZoom.value > 50) {
    documentZoom.value -= 10
  }
}

const downloadDocument = () => {
  ElMessage.success('招标文件下载成功')
}

// 技术标撰写 - 四阶段流程
const techWriteStep = ref(0)
const selectedTechProject = ref(null)
const generatingTechOutline = ref(false)
const techOutlineData = ref([])
const techDocumentContent = ref('<h1 style="text-align: center;">技术投标文件</h1><p>技术标文档内容...</p>')

// 技术标材料匹配相关
const techMaterialFilter = ref({
  region: '',
  industry: '',
  year: ''
})
const matchingAllTechMaterials = ref(false)
const allTechMaterialsApplied = ref(false)
const applyingAllTechMaterials = ref(false)

// 选择技术标项目
const selectTechProject = (project) => {
  selectedTechProject.value = project
  ElMessage.success(`已选择项目：${project.name}`)
}

// 生成技术标大纲
const generateTechOutline = () => {
  generatingTechOutline.value = true
  ElMessage.info('AI正在分析招标文件，生成技术标大纲...')
  
  setTimeout(() => {
    techOutlineData.value = [
      { id: 1, title: '1. 技术方案总体说明' },
      { id: 2, title: '2. 技术参数响应表' },
      { id: 3, title: '3. 设备选型说明' },
      { id: 4, title: '4. 施工组织设计', children: [
        { id: 41, title: '4.1 施工方案' },
        { id: 42, title: '4.2 施工进度计划' },
        { id: 43, title: '4.3 质量保证措施' },
        { id: 44, title: '4.4 安全文明施工措施' }
      ]},
      { id: 5, title: '5. 项目管理方案' },
      { id: 6, title: '6. 售后服务方案' },
      { id: 7, title: '7. 培训方案' }
    ]
    generatingTechOutline.value = false
    ElMessage.success('技术标大纲生成完成！')
  }, 2000)
}

// 添加技术标章节
const addTechSection = () => {
  ElMessageBox.prompt('请输入章节标题', '添加章节', {
    confirmButtonText: '确定',
    cancelButtonText: '取消'
  }).then(({ value }) => {
    if (value) {
      const newSection = {
        id: Date.now(),
        title: value
      }
      techOutlineData.value.push(newSection)
      ElMessage.success('章节已添加')
    }
  }).catch(() => {})
}

// 编辑技术标章节
const editTechSection = (section) => {
  ElMessageBox.prompt('请输入新的章节标题', '编辑章节', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    inputValue: section.title
  }).then(({ value }) => {
    if (value) {
      section.title = value
      ElMessage.success('章节已更新')
    }
  }).catch(() => {})
}

// 删除技术标章节
const deleteTechSection = (section) => {
  ElMessageBox.confirm('确定要删除这个章节吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    const index = techOutlineData.value.findIndex(s => s.id === section.id)
    if (index > -1) {
      techOutlineData.value.splice(index, 1)
      ElMessage.success('章节已删除')
    }
  }).catch(() => {})
}

// AI生成技术内容
const aiGenerateTechContent = (section) => {
  ElMessage.info(`正在为"${section.title}"生成技术内容...`)
  
  setTimeout(() => {
    section.content = `<p style="line-height: 2;">这是"${section.title}"的技术内容示例...</p>`
    ElMessage.success('内容生成完成')
  }, 1500)
}

// 手动编辑技术内容
const editTechContent = (section) => {
  ElMessage.info('打开编辑器')
}

// 导出技术标文档
const exportTechDoc = (format) => {
  ElMessage.success(`正在导出${format.toUpperCase()}格式...`)
}

// 更新技术标文档内容
const updateTechDocumentContent = (event) => {
  techDocumentContent.value = event.target.innerHTML
}

// 技术标材料匹配函数
const autoMatchAllTechMaterials = () => {
  matchingAllTechMaterials.value = true
  ElMessage.info('正在智能匹配技术资料...')
  
  setTimeout(() => {
    techOutlineData.value.forEach(section => {
      section.matchedMaterials = [
        {
          id: Date.now() + Math.random(),
          name: `${section.title}相关技术方案`,
          category: '技术方案',
          matchScore: 95,
          applied: false
        },
        {
          id: Date.now() + Math.random() + 1,
          name: `${section.title}设备参数表`,
          category: '设备参数',
          matchScore: 88,
          applied: false
        }
      ]
    })
    matchingAllTechMaterials.value = false
    ElMessage.success('技术资料匹配完成！')
  }, 2000)
}

const toggleApplyAllTechMaterials = () => {
  applyingAllTechMaterials.value = true
  const newState = !allTechMaterialsApplied.value
  
  setTimeout(() => {
    techOutlineData.value.forEach(section => {
      if (section.matchedMaterials) {
        section.matchedMaterials.forEach(material => {
          material.applied = newState
        })
      }
    })
    allTechMaterialsApplied.value = newState
    applyingAllTechMaterials.value = false
    ElMessage.success(newState ? '已应用所有技术资料' : '已取消应用所有技术资料')
  }, 500)
}

const autoMatchTechMaterial = (section) => {
  ElMessage.info(`正在为"${section.title}"匹配技术资料...`)
  
  setTimeout(() => {
    section.matchedMaterials = [
      {
        id: Date.now(),
        name: `${section.title}技术方案`,
        category: '技术方案',
        matchScore: 95,
        applied: false
      },
      {
        id: Date.now() + 1,
        name: `${section.title}参数说明`,
        category: '技术参数',
        matchScore: 90,
        applied: false
      }
    ]
    ElMessage.success('资料匹配完成')
  }, 1500)
}

const openChangeTechMaterialDialog = (section) => {
  currentChangingSection.value = section
  changeMaterialDialogVisible.value = true
}

const isTechSectionAllApplied = (section) => {
  if (!section.matchedMaterials || section.matchedMaterials.length === 0) {
    return false
  }
  return section.matchedMaterials.every(m => m.applied)
}

const toggleApplyTechSectionMaterials = (section) => {
  if (!section.matchedMaterials) return
  
  const newState = !isTechSectionAllApplied(section)
  section.matchedMaterials.forEach(material => {
    material.applied = newState
  })
  ElMessage.success(newState ? '已应用该章节所有资料' : '已取消应用该章节所有资料')
}

const toggleApplyTechMaterial = (section, material) => {
  material.applied = !material.applied
  ElMessage.success(material.applied ? `已应用：${material.name}` : `已取消应用：${material.name}`)
}

// 智能审核
const reviewStep = ref(0)
const reviewProjectTab = ref('ongoing')
const selectedReviewProject = ref(null)
const uploadedReviewFile = ref(null)
const reviewUploadRef = ref(null)
const selectedTemplate = ref(null)
const startingReview = ref(false)
const resultTab = ref('scoring')
const activeResultItem = ref(null)
const editMode = ref(false)
const currentPage = ref(1)
const totalPages = ref(10)
const documentContent = ref(`
  <div style="text-align: center; margin-bottom: 60px;">
    <h1 style="font-size: 28px; font-weight: bold; margin-bottom: 20px;">某数据中心发电机组采购项目</h1>
    <h2 style="font-size: 24px; font-weight: bold; margin-bottom: 40px;">投标文件</h2>
    <p style="font-size: 16px; margin-top: 80px;">投标单位：江西XX科技有限公司</p>
    <p style="font-size: 16px;">投标日期：2024年12月7日</p>
  </div>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">一、投标函</h2>
  <p style="text-indent: 2em; line-height: 2;">致：XX数据中心有限公司</p>
  <p style="text-indent: 2em; line-height: 2; margin-top: 16px;">
    根据贵方某数据中心发电机组采购项目的招标文件，经研究招标文件的全部内容和现场考察，
    我方愿意以总价人民币 <strong>壹佰伍拾万元整（¥1,500,000.00）</strong> 的投标价格，
    按招标文件规定的条件承担本项目的设备供应、安装调试及售后服务工作。
  </p>
  <p style="text-indent: 2em; line-height: 2; margin-top: 16px;">
    我方承诺在投标有效期90天内遵守本投标文件。如果在此期间撤回投标或中标后不签订合同，
    贵方有权没收我方的投标保证金。
  </p>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">二、营业执照</h2>
  <div style="padding: 20px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; text-align: center;">
    <p style="color: #6b7280;">【营业执照扫描件】</p>
    <p style="color: #6b7280; font-size: 14px; margin-top: 8px;">统一社会信用代码：91360000XXXXXXXXXX</p>
  </div>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">三、资质证书</h2>
  <div style="padding: 20px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; text-align: center;">
    <p style="color: #6b7280;">【电力工程施工总承包资质证书】</p>
    <p style="color: #6b7280; font-size: 14px; margin-top: 8px;">资质等级：贰级</p>
  </div>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">四、业绩证明</h2>
  <h3 style="font-size: 16px; font-weight: bold; margin: 20px 0 12px 0;">1. 南昌高新区数据中心项目</h3>
  <p style="text-indent: 2em; line-height: 2;">
    项目名称：南昌高新区数据中心发电机组采购及安装项目<br/>
    建设单位：南昌高新技术产业开发区管理委员会<br/>
    合同金额：180万元<br/>
    完成时间：2023年6月
  </p>
  
  <h3 style="font-size: 16px; font-weight: bold; margin: 20px 0 12px 0;">2. 赣州经开区智能制造项目</h3>
  <p style="text-indent: 2em; line-height: 2;">
    项目名称：赣州经开区智能制造产业园应急电源系统<br/>
    建设单位：赣州经济技术开发区管理委员会<br/>
    合同金额：220万元<br/>
    完成时间：2024年3月
  </p>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">五、技术方案</h2>
  <h3 style="font-size: 16px; font-weight: bold; margin: 20px 0 12px 0;">5.1 设备选型</h3>
  <p style="text-indent: 2em; line-height: 2;">
    本项目拟采用康明斯品牌500kW柴油发电机组，该机组具有以下特点：
  </p>
  <ul style="margin-left: 40px; line-height: 2;">
    <li>额定功率：500kW / 625kVA</li>
    <li>额定电压：400V/230V</li>
    <li>额定频率：50Hz</li>
    <li>启动方式：电启动，自动化控制</li>
    <li>冷却方式：闭式水循环冷却</li>
    <li>噪音水平：≤82dB(A) @7m</li>
    <li>防护等级：IP54</li>
  </ul>
  
  <h3 style="font-size: 16px; font-weight: bold; margin: 20px 0 12px 0;">5.2 控制系统</h3>
  <p style="text-indent: 2em; line-height: 2;">
    采用深海DSE8610 MKII智能控制器，具备远程监控、自动启停、故障报警等功能。
    支持市电与发电机组自动切换，切换时间≤10秒。
  </p>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">六、施工组织设计</h2>
  <h3 style="font-size: 16px; font-weight: bold; margin: 20px 0 12px 0;">6.1 施工进度安排</h3>
  <p style="text-indent: 2em; line-height: 2;">
    总工期：45个工作日<br/>
    设备采购：10个工作日<br/>
    基础施工：15个工作日<br/>
    设备安装：12个工作日<br/>
    调试验收：8个工作日
  </p>
  
  <h3 style="font-size: 16px; font-weight: bold; margin: 20px 0 12px 0;">6.2 质量保证措施</h3>
  <p style="text-indent: 2em; line-height: 2;">
    建立完善的质量管理体系，严格执行ISO9001质量管理标准。
    所有设备均提供原厂质保，关键部件质保期不少于2年。
  </p>
  
  <h2 style="font-size: 20px; font-weight: bold; margin: 40px 0 20px 0;">七、售后服务承诺</h2>
  <p style="text-indent: 2em; line-height: 2;">
    1. 提供7×24小时技术支持热线服务<br/>
    2. 南昌市区2小时内响应，4小时内到达现场<br/>
    3. 每季度进行一次免费巡检和保养<br/>
    4. 提供为期2年的免费质保服务<br/>
    5. 质保期后提供终身有偿维护服务
  </p>
`)

// 评分表模板
const scoringTemplates = ref([
  {
    id: 1,
    name: '综合评分法标准模板',
    description: '适用于综合评分法招标项目，包含商务、技术、价格等评分项',
    itemCount: 25,
    totalScore: 100,
    color: '#7c3aed'
  },
  {
    id: 2,
    name: '最低评标价法模板',
    description: '适用于最低评标价法招标项目，重点审核资格和价格',
    itemCount: 15,
    totalScore: 100,
    color: '#3b82f6'
  },
  {
    id: 3,
    name: '技术评分法模板',
    description: '适用于技术要求较高的项目，侧重技术方案评审',
    itemCount: 30,
    totalScore: 100,
    color: '#10b981'
  }
])

// 审核结果
const reviewResult = ref({
  totalScore: 85,
  maxScore: 100,
  missingCount: 2,
  warningCount: 5,
  scoringItems: [
    { id: 1, name: '营业执照', score: 5, maxScore: 5, page: 3, note: '' },
    { id: 2, name: '资质证书', score: 10, maxScore: 10, page: 5, note: '' },
    { id: 3, name: '业绩证明', score: 8, maxScore: 15, page: 12, note: '业绩数量不足，建议补充' },
    { id: 4, name: '技术方案', score: 20, maxScore: 25, page: 18, note: '部分技术参数未明确' },
    { id: 5, name: '施工组织设计', score: 15, maxScore: 15, page: 35, note: '' },
    { id: 6, name: '质量保证措施', score: 12, maxScore: 15, page: 48, note: '质量控制流程需完善' },
    { id: 7, name: '安全文明施工', score: 10, maxScore: 10, page: 56, note: '' },
    { id: 8, name: '售后服务承诺', score: 5, maxScore: 5, page: 62, note: '' }
  ],
  missingItems: [
    { id: 1, name: '投标保证金缴纳凭证', description: '未找到投标保证金缴纳凭证，这是必选项' },
    { id: 2, name: '法定代表人授权委托书', description: '缺少法定代表人授权委托书原件' }
  ],
  suggestions: [
    { id: 1, title: '补充业绩证明', description: '当前仅提供2个业绩案例，建议补充至5个以上', impact: 7 },
    { id: 2, title: '完善技术参数', description: '部分设备技术参数未明确标注，可能影响评分', impact: 5 },
    { id: 3, title: '优化质量保证体系', description: '质量控制流程描述不够详细，建议增加质量检测环节说明', impact: 3 }
  ]
})

// 选择审核项目
const selectReviewProject = (project) => {
  selectedReviewProject.value = project
  uploadedReviewFile.value = null
  ElMessage.success(`已选择项目：${project.name}`)
}

// 处理审核文件上传
const handleReviewFileUpload = (file) => {
  uploadedReviewFile.value = file.raw
  selectedReviewProject.value = null
  ElMessage.success(`已上传文件：${file.name}`)
}

// 删除审核文件
const removeReviewFile = () => {
  uploadedReviewFile.value = null
  ElMessage.info('已移除上传的文件')
}

// 选择评分表模板
const selectTemplate = (template) => {
  selectedTemplate.value = template
  ElMessage.success(`已选择评分表：${template.name}`)
}

// 开始审核
const startReview = () => {
  startingReview.value = true
  ElMessage.info('正在进行智能审核...')
  
  setTimeout(() => {
    startingReview.value = false
    reviewStep.value = 2
    ElMessage.success('审核完成！')
  }, 2000)
}

// 定位到文档中的位置
const locateInDocument = (item) => {
  activeResultItem.value = item
  jumpToPage(item.page)
}

// 跳转到指定页
const jumpToPage = (page) => {
  currentPage.value = page
  ElMessage.info(`已跳转到第 ${page} 页`)
}

// 文档编辑
const onDocumentEdit = (event) => {
  documentContent.value = event.target.innerHTML
}

// 导出评审表
const exportReviewTable = () => {
  ElMessage.success('正在导出评审表...')
}

// 导出评审结果
const exportReviewResult = () => {
  ElMessage.success('正在导出评审结果...')
}

// 导出修改后的标书
const exportModifiedDocument = () => {
  ElMessage.success('正在导出修改后的标书文件...')
}

// 格式统一
const formatConfig = ref({
  pageSize: 'A4',
  margin: 25,
  font: '宋体',
  fontSize: '12',
  lineHeight: '1.5'
})

const mergeFiles = ref([
  { name: '商务标.docx', type: 'Word', formatted: false },
  { name: '技术标.docx', type: 'Word', formatted: false },
  { name: '资质文件.pdf', type: 'PDF', formatted: false }
])

const startFormatUnify = () => {
  ElMessage.info('正在统一文件格式...')
  setTimeout(() => {
    mergeFiles.value.forEach(file => file.formatted = true)
    ElMessage.success('格式统一完成！')
  }, 2000)
}

// 索引生成
const indexConfig = ref({
  level: 3,
  pageFormat: 'arabic',
  autoUpdate: true
})

const generatedIndex = ref(null)

const generateIndex = () => {
  generatedIndex.value = [
    { id: 1, title: '1. 投标函', page: 1 },
    { id: 2, title: '2. 法定代表人身份证明', page: 3 },
    { id: 3, title: '3. 授权委托书', page: 5 },
    { id: 4, title: '4. 投标保证金', page: 7 },
    { id: 5, title: '5. 资格证明文件', page: 9 },
    { id: 6, title: '  5.1 营业执照', page: 9 },
    { id: 7, title: '  5.2 资质证书', page: 11 }
  ]
  ElMessage.success('目录生成完成！')
}

const previewIndex = () => {
  if (!generatedIndex.value) {
    ElMessage.warning('请先生成目录')
  } else {
    ElMessage.info('目录预览')
  }
}

// 完整性检查
const checking = ref(false)
const checkProgress = ref(0)
const checkResults = ref(null)

const startComplianceCheck = () => {
  checking.value = true
  checkProgress.value = 0
  const timer = setInterval(() => {
    checkProgress.value += 10
    if (checkProgress.value >= 100) {
      clearInterval(timer)
      checking.value = false
      checkResults.value = {
        passed: 15,
        warnings: 3,
        errors: 2,
        requiredItems: [
          { id: 1, name: '投标函', status: 'pass' },
          { id: 2, name: '法定代表人身份证明', status: 'pass' },
          { id: 3, name: '授权委托书', status: 'fail' },
          { id: 4, name: '投标保证金', status: 'pass' }
        ],
        formatItems: [
          { id: 1, name: '页面设置', status: 'pass', message: '符合要求' },
          { id: 2, name: '字体字号', status: 'warning', message: '部分不统一' },
          { id: 3, name: '页码编排', status: 'pass', message: '符合要求' }
        ]
      }
      ElMessage.success('完整性检查完成！')
    }
  }, 200)
}

// 评分模拟
const simulating = ref(false)
const scoreResult = ref(null)

const startScoreSimulation = () => {
  simulating.value = true
  setTimeout(() => {
    scoreResult.value = {
      total: 85,
      categories: [
        {
          name: '商务部分',
          score: 28,
          max: 30,
          items: [
            { name: '资格证明', score: 10, max: 10 },
            { name: '业绩证明', score: 8, max: 10 },
            { name: '财务状况', score: 10, max: 10 }
          ]
        },
        {
          name: '技术部分',
          score: 38,
          max: 50,
          items: [
            { name: '技术方案', score: 18, max: 25 },
            { name: '施工组织', score: 12, max: 15 },
            { name: '质量保证', score: 8, max: 10 }
          ]
        },
        {
          name: '报价部分',
          score: 19,
          max: 20,
          items: [
            { name: '报价合理性', score: 19, max: 20 }
          ]
        }
      ],
      suggestions: [
        {
          id: 1,
          title: '技术方案需要完善',
          description: '建议补充更详细的技术实施方案和创新点',
          impact: 5
        },
        {
          id: 2,
          title: '业绩证明不足',
          description: '建议增加更多类似项目的业绩证明材料',
          impact: 2
        }
      ]
    }
    simulating.value = false
    ElMessage.success('评分模拟完成！')
  }, 2000)
}

const getScoreType = (score) => {
  if (score >= 90) return 'success'
  if (score >= 80) return 'primary'
  if (score >= 70) return 'warning'
  return 'danger'
}

const getScoreLevel = (score) => {
  if (score >= 90) return '优秀'
  if (score >= 80) return '良好'
  if (score >= 70) return '中等'
  if (score >= 60) return '及格'
  return '不及格'
}

// 点击步骤查看详情
const viewStepDetail = (step, project) => {
  currentStepDetail.value = step
  currentStepProject.value = project
  activeNav.value = 'step-detail'
}

// 返回项目详情
const backToProjectDetail = () => {
  currentStepDetail.value = null
  currentStepProject.value = null
  activeNav.value = 'project-ongoing'
  // selectedProject 保持不变，这样会自动显示项目详情
}

// 处理项目更新
const handleProjectUpdate = () => {
  ElMessage.success('项目信息已更新')
  // 可以在这里重新加载项目数据
  // 如果需要刷新项目列表，可以调用相应的API
}

// 获取步骤图标
const getStepIcon = (stepKey) => {
  const iconMap = {
    'get-file': DocumentCopy,
    'write-file': Edit,
    'submit': Upload,
    'open-bid': View,
    'result': CircleCheckFilled
  }
  return iconMap[stepKey] || Document
}

// 前往功能操作
const goToFunction = (stepKey) => {
  const functionMap = {
    'get-file': 'file-import',      // 招标信息提取 → 文件智能采集
    'write-file': 'write-business',  // 撰写投标文件 → 商务标撰写
    'submit': 'merge-format',        // 文件提交 → 格式统一
    'open-bid': 'review-check',      // 开标 → 完整性检查
    'result': 'review-score'         // 结果公示 → 评分模拟
  }
  
  const targetNav = functionMap[stepKey]
  if (targetNav) {
    activeNav.value = targetNav
    selectedProject.value = null
    currentStepDetail.value = null
    currentStepProject.value = null
    
    // 展开对应的导航组
    const navItem = navItems.value.find(item => 
      item.children && item.children.some(child => child.key === targetNav)
    )
    if (navItem) {
      navItem.expanded = true
    }
    
    ElMessage.info('已跳转到对应功能模块')
  }
}

// 知识库方法
const viewCategory = (categoryKey) => {
  activeNav.value = 'kb-category'
  activeCategoryTab.value = categoryKey
}

const getCategoryFiles = (category) => {
  return allFiles.value.filter(file => file.category === category)
}

const filteredCategoryFiles = computed(() => {
  let files = getCategoryFiles(activeCategoryTab.value)
  
  // 按文件名搜索
  if (categorySearch.value) {
    files = files.filter(file => 
      file.name.toLowerCase().includes(categorySearch.value.toLowerCase()) ||
      file.description.toLowerCase().includes(categorySearch.value.toLowerCase())
    )
  }
  
  return files
})

const getCurrentCategoryColor = () => {
  const category = kbCategories.value.find(cat => cat.key === activeCategoryTab.value)
  return category ? category.color : '#7c3aed'
}

const getCurrentCategoryIcon = () => {
  const category = kbCategories.value.find(cat => cat.key === activeCategoryTab.value)
  return category ? category.icon : '📁'
}

const getFileIconColor = (fileName) => {
  const ext = fileName.split('.').pop().toLowerCase()
  const colorMap = {
    'pdf': '#ef4444',
    'doc': '#3b82f6',
    'docx': '#3b82f6',
    'xls': '#10b981',
    'xlsx': '#10b981',
    'ppt': '#f59e0b',
    'pptx': '#f59e0b',
    'jpg': '#8b5cf6',
    'jpeg': '#8b5cf6',
    'png': '#8b5cf6',
    'zip': '#6b7280',
    'rar': '#6b7280'
  }
  return colorMap[ext] || '#7c3aed'
}

const filteredHistoryFiles = computed(() => {
  let files = allFiles.value
  
  // 按分类筛选
  if (historyFilter.value) {
    files = files.filter(file => file.category === historyFilter.value)
  }
  
  // 按文件名搜索
  if (historySearch.value) {
    files = files.filter(file => 
      file.name.toLowerCase().includes(historySearch.value.toLowerCase())
    )
  }
  
  return files
})

const getCategoryLabel = (category) => {
  const labels = {
    qualification: '资质文件',
    technical: '技术模块文件',
    case: '项目案例',
    other: '其他资料'
  }
  return labels[category] || category
}

const getCategoryTagType = (category) => {
  const types = {
    qualification: '',
    technical: 'success',
    case: 'warning',
    other: 'info'
  }
  return types[category] || ''
}

// 文件上传方法
const handleFileChange = (file) => {
  fileList.value = [file]
  // 自动填充文件名（去除扩展名）
  const fileName = file.name.substring(0, file.name.lastIndexOf('.'))
  uploadForm.value.name = fileName
}

const aiRecognizeFile = async () => {
  if (!fileList.value.length) {
    ElMessage.warning('请先选择文件')
    return
  }
  
  aiRecognizing.value = true
  
  // 模拟AI识别过程
  setTimeout(() => {
    const file = fileList.value[0]
    const fileName = file.name.toLowerCase()
    
    // 根据文件名智能识别分类和描述
    if (fileName.includes('营业执照') || fileName.includes('license')) {
      uploadForm.value.category = 'qualification'
      uploadForm.value.description = '公司营业执照副本'
    } else if (fileName.includes('资质') || fileName.includes('证书')) {
      uploadForm.value.category = 'qualification'
      uploadForm.value.description = '企业资质证书'
    } else if (fileName.includes('技术') || fileName.includes('方案')) {
      uploadForm.value.category = 'technical'
      uploadForm.value.description = '技术方案文档'
    } else if (fileName.includes('案例') || fileName.includes('业绩')) {
      uploadForm.value.category = 'case'
      uploadForm.value.description = '项目案例或业绩证明'
    } else {
      uploadForm.value.category = 'other'
      uploadForm.value.description = '其他相关资料'
    }
    
    aiRecognizing.value = false
    ElMessage.success('AI识别完成！请确认或修改信息')
  }, 1500)
}

const confirmUpload = async () => {
  if (!fileList.value.length) {
    ElMessage.warning('请选择文件')
    return
  }
  
  if (!uploadForm.value.name) {
    ElMessage.warning('请输入文件名称')
    return
  }
  
  if (!uploadForm.value.category) {
    ElMessage.warning('请选择文件分类')
    return
  }
  
  uploading.value = true
  
  // 模拟上传过程
  setTimeout(() => {
    const newFile = {
      id: Date.now(),
      name: uploadForm.value.name + '.' + fileList.value[0].name.split('.').pop(),
      category: uploadForm.value.category,
      description: uploadForm.value.description || '无描述',
      uploadTime: new Date().toLocaleString('zh-CN', { 
        year: 'numeric', 
        month: '2-digit', 
        day: '2-digit', 
        hour: '2-digit', 
        minute: '2-digit', 
        second: '2-digit' 
      }).replace(/\//g, '-'),
      size: (fileList.value[0].size / 1024 / 1024).toFixed(2) + 'MB'
    }
    
    allFiles.value.unshift(newFile)
    
    // 更新分类统计
    const category = kbCategories.value.find(cat => cat.key === uploadForm.value.category)
    if (category) {
      category.count++
    }
    
    uploading.value = false
    showUploadDialog.value = false
    
    // 重置表单
    fileList.value = []
    uploadForm.value = {
      name: '',
      category: '',
      description: ''
    }
    
    ElMessage.success('文件上传成功！')
  }, 2000)
}

const downloadFile = (file) => {
  ElMessage.success(`正在下载：${file.name}`)
  // 实际项目中这里应该触发文件下载
}

const deleteFile = (file) => {
  ElMessageBox.confirm(
    `确定要删除文件"${file.name}"吗？`,
    '删除确认',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }
  ).then(() => {
    const index = allFiles.value.findIndex(f => f.id === file.id)
    if (index > -1) {
      allFiles.value.splice(index, 1)
      
      // 更新分类统计
      const category = kbCategories.value.find(cat => cat.key === file.category)
      if (category && category.count > 0) {
        category.count--
      }
      
      ElMessage.success('删除成功')
    }
  }).catch(() => {
    // 取消删除
  })
}

// 文件智能识别方法
const handleFileSelect = (file) => {
  // 只选择文件，不触发分析
  pendingBiddingFile.value = file.raw || file
  ElMessage.success(`已选择文件: ${pendingBiddingFile.value.name}`)
}

const clearPendingFile = () => {
  pendingBiddingFile.value = null
}

const startAnalyze = () => {
  if (!pendingBiddingFile.value) {
    ElMessage.warning('请先选择文件')
    return
  }
  
  analyzingFile.value = true
  ElMessage.info('正在识别招标文件...')
  
  // 模拟文件上传和识别
  setTimeout(() => {
    biddingFileData.value = {
      name: pendingBiddingFile.value.name,
      pages: 15,
      uploadTime: new Date().toLocaleString()
    }
    pendingBiddingFile.value = null
    analyzingFile.value = false
    
    // 模拟提取的商务关键信息
    // verifyStatus: 'no-need' | 'need' | 'must'
    businessKeyInfo.value = [
      { field: '项目名称', content: '智慧园区综合管理平台建设项目', pageNum: 1, lineNum: 3, verifyStatus: 'no-need' },
      { field: '招标编号', content: 'JXZB-2025-0629-001', pageNum: 1, lineNum: 5, verifyStatus: 'no-need' },
      { field: '招标人', content: '江西省城市生命线管理中心', pageNum: 1, lineNum: 8, verifyStatus: 'no-need' },
      { field: '招标代理机构', content: '江西华诚工程咨询有限公司', pageNum: 1, lineNum: 12, verifyStatus: 'no-need' },
      { field: '项目预算', content: '人民币1,280万元', pageNum: 2, lineNum: 6, verifyStatus: 'no-need' },
      { field: '最高限价', content: '人民币1,200万元', pageNum: 2, lineNum: 9, verifyStatus: 'must' },
      { field: '资金来源', content: '财政拨款', pageNum: 2, lineNum: 15, verifyStatus: 'no-need' },
      { field: '开标时间', content: '2025年07月01日 10:00', pageNum: 3, lineNum: 5, verifyStatus: 'no-need' },
      { field: '开标地点', content: '公共资源交易中心三楼开标室', pageNum: 3, lineNum: 8, verifyStatus: 'no-need' },
      { field: '投标截止时间', content: '2025年07月01日 09:30', pageNum: 3, lineNum: 12, verifyStatus: 'must' },
      { field: '澄清截止时间', content: '2025年06月25日前', pageNum: 3, lineNum: 18, verifyStatus: 'need' },
      { field: '招标保证金', content: '人民币80,000元整', pageNum: 5, lineNum: 6, verifyStatus: 'no-need' },
      { field: '保证金缴纳方式', content: '银行电汇或保函', pageNum: 5, lineNum: 10, verifyStatus: 'no-need' },
      { field: '保证金账户', content: '工商银行南昌分行 360xxxxxxx', pageNum: 5, lineNum: 14, verifyStatus: 'no-need' },
      { field: '保证金截止日期', content: '2025年06月28日 17:00', pageNum: 5, lineNum: 18, verifyStatus: 'must' },
      { field: '投标有效期', content: '90个日历日', pageNum: 6, lineNum: 3, verifyStatus: 'no-need' },
      { field: '合同工期', content: '180个日历日', pageNum: 6, lineNum: 8, verifyStatus: 'need' },
      { field: '质保期限', content: '验收合格后2年', pageNum: 6, lineNum: 12, verifyStatus: 'no-need' },
      { field: '付款方式', content: '预付30%，验收后付60%，质保期满付10%', pageNum: 7, lineNum: 5, verifyStatus: 'need' },
      { field: '履约保证金', content: '合同金额的5%', pageNum: 7, lineNum: 12, verifyStatus: 'no-need' }
    ]
    
    // 模拟提取的技术关键信息
    techKeyInfo.value = [
      { field: '系统架构', content: '微服务架构，支持分布式部署', pageNum: 8, lineNum: 3, verifyStatus: 'no-need' },
      { field: '开发框架', content: 'Vue3 + Spring Cloud + PostgreSQL', pageNum: 8, lineNum: 8, verifyStatus: 'no-need' },
      { field: '服务器要求', content: '应用服务器≥4台，数据库服务器≥2台', pageNum: 8, lineNum: 15, verifyStatus: 'need' },
      { field: 'CPU配置', content: '≥16核 Intel Xeon Gold 5218', pageNum: 9, lineNum: 5, verifyStatus: 'no-need' },
      { field: '内存配置', content: '≥128GB DDR4 ECC', pageNum: 9, lineNum: 9, verifyStatus: 'no-need' },
      { field: '存储容量', content: '总存储≥100TB，采用SAN架构', pageNum: 9, lineNum: 14, verifyStatus: 'must' },
      { field: '网络带宽', content: '核心交换机≥10Gbps', pageNum: 10, lineNum: 3, verifyStatus: 'no-need' },
      { field: '并发用户数', content: '支持≥5000并发用户', pageNum: 10, lineNum: 8, verifyStatus: 'need' },
      { field: '响应时间', content: '页面响应时间≤2秒', pageNum: 10, lineNum: 12, verifyStatus: 'no-need' },
      { field: '系统可用性', content: '年可用率≥99.9%', pageNum: 10, lineNum: 18, verifyStatus: 'must' },
      { field: '数据备份', content: '支持实时备份，RPO≤1分钟', pageNum: 11, lineNum: 4, verifyStatus: 'no-need' },
      { field: '灾备要求', content: '异地灾备，RTO≤4小时', pageNum: 11, lineNum: 10, verifyStatus: 'need' },
      { field: '安全等级', content: '等保三级认证', pageNum: 12, lineNum: 3, verifyStatus: 'must' },
      { field: '加密标准', content: 'SM2/SM3/SM4国密算法', pageNum: 12, lineNum: 8, verifyStatus: 'no-need' },
      { field: '接口规范', content: 'RESTful API，支持OpenAPI 3.0', pageNum: 12, lineNum: 15, verifyStatus: 'no-need' },
      { field: 'GIS平台', content: '支持超图/ArcGIS，三维可视化', pageNum: 13, lineNum: 5, verifyStatus: 'need' },
      { field: 'BIM集成', content: '支持IFC格式，轻量化展示', pageNum: 13, lineNum: 12, verifyStatus: 'need' },
      { field: 'IoT接入', content: '支持MQTT/Modbus/OPC UA协议', pageNum: 14, lineNum: 4, verifyStatus: 'no-need' },
      { field: '移动端支持', content: '原生APP + H5，支持iOS/Android', pageNum: 14, lineNum: 10, verifyStatus: 'no-need' },
      { field: 'AI能力', content: '集成计算机视觉、NLP等AI模块', pageNum: 15, lineNum: 6, verifyStatus: 'need' }
    ]
    
    ElMessage.success('招标文件识别完成！')
  }, 2000)
}

const createProjectFromRecognition = () => {
  // 打开创建项目对话框
  showCreateProjectDialog.value = true
  // 预填充项目名称（从文件名提取）
  if (biddingFileData.value) {
    const fileName = biddingFileData.value.name.replace(/\.[^/.]+$/, '') // 移除扩展名
    createProjectForm.value.name = fileName
  }
}

// 进入标书生成向导
const goToGenerateBid = () => {
  showBidTypeDialog.value = false
  bidGenerationMode.value = true
  bidWizardStep.value = 0
  currentOutline.value = []
  selectedProjects.value = []
  ElMessage.success('已进入标书生成向导')
}

// 退出标书生成向导
const exitBidGeneration = () => {
  bidGenerationMode.value = false
  bidWizardStep.value = 0
  selectedBidType.value = ''
}

// AI智能生成大纲
const generateOutline = () => {
  generatingOutline.value = true
  setTimeout(() => {
    if (selectedBidType.value === 'business') {
      currentOutline.value = [
        { title: '投标函及投标函附录', generated: false, content: '', sections: [
          { title: '投标函' },
          { title: '法定代表人身份证明' },
          { title: '授权委托书' }
        ]},
        { title: '资格审查文件', generated: false, content: '', sections: [
          { title: '企业营业执照' },
          { title: '资质证书' },
          { title: '财务状况证明' }
        ]},
        { title: '企业业绩', generated: false, content: '', sections: [
          { title: '类似项目经验' },
          { title: '项目合同复印件' },
          { title: '业绩证明文件' }
        ]},
        { title: '商务报价', generated: false, content: '', sections: [
          { title: '投标报价总表' },
          { title: '分项报价明细' },
          { title: '报价说明' }
        ]},
        { title: '其他商务文件', generated: false, content: '', sections: [
          { title: '承诺函' },
          { title: '廉洁承诺书' }
        ]}
      ]
    } else {
      currentOutline.value = [
        { title: '技术方案总体设计', generated: false, content: '', sections: [
          { title: '项目理解与分析' },
          { title: '总体设计思路' },
          { title: '技术架构设计' }
        ]},
        { title: '系统功能设计', generated: false, content: '', sections: [
          { title: '功能模块划分' },
          { title: '核心功能详细设计' },
          { title: '接口设计方案' }
        ]},
        { title: '项目实施方案', generated: false, content: '', sections: [
          { title: '项目组织架构' },
          { title: '实施进度计划' },
          { title: '质量保证措施' }
        ]},
        { title: '运维保障方案', generated: false, content: '', sections: [
          { title: '运维服务体系' },
          { title: '应急响应机制' },
          { title: '培训服务方案' }
        ]},
        { title: '项目团队配置', generated: false, content: '', sections: [
          { title: '项目经理简历' },
          { title: '技术负责人简历' },
          { title: '核心团队成员' }
        ]}
      ]
    }
    generatingOutline.value = false
    ElMessage.success('大纲生成完成')
  }, 2000)
}

// 添加大纲章节（智能审核模块）
const addReviewOutlineItem = () => {
  currentOutline.value.push({
    title: '新章节',
    generated: false,
    content: '',
    sections: []
  })
}

// 删除大纲章节
const removeOutlineItem = (index) => {
  currentOutline.value.splice(index, 1)
}

// 添加小节
const addSection = (chapterIndex) => {
  currentOutline.value[chapterIndex].sections.push({
    title: '新小节'
  })
}

// 删除小节
const removeSection = (chapterIndex, sectionIndex) => {
  currentOutline.value[chapterIndex].sections.splice(sectionIndex, 1)
}

// 材料匹配相关方法
const smartMatchAll = () => {
  ElMessage.info('正在智能匹配所有章节材料...')
  setTimeout(() => {
    currentOutline.value.forEach((chapter, index) => {
      smartMatchChapter(index, false)
    })
    ElMessage.success('智能匹配完成')
  }, 1500)
}

const smartMatchChapter = (chapterIndex, showMessage = true) => {
  const mockMaterials = [
    { name: '营业执照.pdf', category: '资质文件', type: 'pdf', matchScore: 98 },
    { name: '资质证书.pdf', category: '资质文件', type: 'pdf', matchScore: 95 }
  ]
  currentOutline.value[chapterIndex].materials = mockMaterials
  if (showMessage) {
    ElMessage.success('匹配完成')
  }
}

const applyAllMaterials = () => {
  ElMessage.success('已一键应用所有匹配材料')
}

// 检查章节是否全部已应用
const isChapterAllApplied = (chapterIndex) => {
  const materials = currentOutline.value[chapterIndex]?.materials
  if (!materials || materials.length === 0) return false
  return materials.every(m => m.applied)
}

const applyChapterMaterials = (chapterIndex) => {
  const materials = currentOutline.value[chapterIndex]?.materials
  if (!materials || materials.length === 0) {
    ElMessage.warning('暂无材料可应用')
    return
  }
  const allApplied = isChapterAllApplied(chapterIndex)
  materials.forEach(m => m.applied = !allApplied)
  ElMessage.success(allApplied ? `已取消第 ${chapterIndex + 1} 章所有材料应用` : `已应用第 ${chapterIndex + 1} 章所有材料`)
}

const applyMaterial = (chapterIndex, materialIndex) => {
  const material = currentOutline.value[chapterIndex]?.materials?.[materialIndex]
  if (material) {
    material.applied = !material.applied
    ElMessage.success(material.applied ? '材料已应用' : '已取消应用')
  }
}

const openAddFileDialog = (chapterIndex) => {
  currentAddFileChapterIndex.value = chapterIndex
  currentAddFileChapter.value = currentOutline.value[chapterIndex]
  showAddFileDialog.value = true
}

const previewOutlineMaterial = (material) => {
  previewingFile.value = material
  showPreviewDialog.value = true
}

const handleMaterialUpload = (file) => {
  ElMessage.success(`文件 ${file.name} 上传成功`)
}

const searchKnowledgeFiles = () => {
  ElMessage.info('正在检索知识库...')
}

const handleFileSelectionChange = (selection) => {
  selectedFiles.value = selection
}

const confirmAddFiles = () => {
  if (currentAddFileChapterIndex.value >= 0 && selectedFiles.value.length) {
    const materials = selectedFiles.value.map(f => ({
      name: f.name,
      category: f.category,
      type: 'pdf',
      matchScore: Math.floor(Math.random() * 15) + 85
    }))
    if (!currentOutline.value[currentAddFileChapterIndex.value].materials) {
      currentOutline.value[currentAddFileChapterIndex.value].materials = []
    }
    currentOutline.value[currentAddFileChapterIndex.value].materials.push(...materials)
    ElMessage.success(`已添加 ${selectedFiles.value.length} 个文件`)
  }
  showAddFileDialog.value = false
  selectedFiles.value = []
}

// 生成当前章节
const generateCurrentChapter = () => {
  generatingChapter.value = true
  setTimeout(() => {
    if (currentOutline.value[previewChapter.value]) {
      currentOutline.value[previewChapter.value].generated = true
      currentOutline.value[previewChapter.value].content = `
        <h3>${currentOutline.value[previewChapter.value].sections[0]?.title || '章节内容'}</h3>
        <p>本章节内容基于招标文件要求和关联项目经验自动生成。系统已从招标文件中提取关键要求，并结合历史项目的成功经验进行内容组织。</p>
        <p>具体内容包括但不限于：项目背景分析、需求理解、解决方案概述等核心内容。所有内容均符合招标文件的格式要求和评分标准。</p>
        <h4>主要内容</h4>
        <ul>
          <li>完整响应招标文件技术要求</li>
          <li>结合企业优势进行差异化表述</li>
          <li>突出项目亮点和创新点</li>
        </ul>
      `
    }
    generatingChapter.value = false
    ElMessage.success('章节生成完成')
  }, 1500)
}

// 完成标书生成
const completeBidGeneration = () => {
  ElMessage.success('标书生成完成，正在导出...')
  setTimeout(() => {
    ElMessage.success('标书已导出到下载目录')
    exitBidGeneration()
  }, 1000)
}

const getVerifyStatusText = (status) => {
  const statusMap = {
    'no-need': '标注清晰，无需人工核实',
    'need': '标注不全，需人工核实',
    'must': '标注缺失，请仔细核对原文'
  }
  return statusMap[status] || ''
}

const exportExtractedInfo = () => {
  ElMessage.success('提取信息已导出！')
}

const locateInPreview = (pageNum, lineNum) => {
  const pageElement = document.getElementById(`page-${pageNum}`)
  if (pageElement && previewContentRef.value) {
    pageElement.scrollIntoView({ behavior: 'smooth', block: 'start' })
    
    // 高亮对应行
    setTimeout(() => {
      const lineElement = document.getElementById(`page-${pageNum}-line-${lineNum}`)
      if (lineElement) {
        lineElement.classList.add('highlight-line')
        setTimeout(() => {
          lineElement.classList.remove('highlight-line')
        }, 3000)
      }
    }, 500)
    
    ElMessage.success(`已定位到第${pageNum}页第${lineNum}行`)
  }
}

const zoomIn = () => {
  if (previewZoom.value < 2) {
    previewZoom.value += 0.1
  }
}

const zoomOut = () => {
  if (previewZoom.value > 0.5) {
    previewZoom.value -= 0.1
  }
}

const resetZoom = () => {
  previewZoom.value = 1
}

const toggleTranslation = () => {
  if (isTranslated.value) {
    // 切换回原文
    isTranslated.value = false
    ElMessage.success('已切换到原文')
  } else {
    // 开始翻译
    translatingDocument.value = true
    ElMessage.info('正在翻译文档...')
    
    setTimeout(() => {
      // 模拟翻译结果
      translatedContent.value = {
        1: [
          'Bidding Announcement',
          '',
          'Project Name: Data Center Power Distribution System Procurement Project',
          'Bidding Number: 2024-XXX-001',
          '...'
        ],
        3: [
          'Instructions to Bidders',
          '',
          '1. Submission of Bidding Documents',
          '1. Deadline for submission of bidding documents: December 15, 2024 14:00',
          '2. Bid opening time: December 15, 2024 14:00',
          '3. Bid opening location: Bidder\'s conference room',
          '',
          '2. Clarification time: Before December 10, 2024',
          '...'
        ],
        5: [
          'Bid Bond',
          '',
          '1. Bid bond amount: RMB 500,000',
          '2. Form of bid bond: Bank transfer or guarantee',
          '3. Bid bond account: ...',
          '',
          'Bid Validity Period',
          '',
          '1. Bidding documents shall remain valid for 90 days after bid opening',
          '2. Bid validity period: Valid for 90 days from the date of bid opening',
          '...'
        ],
        8: [
          'Technical Specifications',
          '',
          '1. Product type: Distribution cabinet',
          '2. Quantity: 10 units',
          '3. Technical requirements: ...',
          '...'
        ],
        9: [
          'Performance Parameters',
          '',
          '1. Rated voltage: 10kV',
          '2. Rated current: 1000A',
          '3. Short-circuit current: 31.5kA',
          '',
          '4. Rated power: ≥500kW',
          '5. Efficiency: ≥95%',
          '...'
        ],
        10: [
          'Component Brand Requirements',
          '',
          '1. Circuit breaker: Schneider or ABB brand',
          '2. Main electrical components: Schneider or ABB brand',
          '3. Current transformer: ...',
          '...'
        ],
        11: [
          'Environmental Requirements',
          '1. Protection level: IP54',
          '2. Insulation class: Class F',
          '',
          '3. Operating temperature: -10℃~45℃',
          '4. Relative humidity: ≤95%',
          '...'
        ]
      }
      
      isTranslated.value = true
      translatingDocument.value = false
      ElMessage.success('文档翻译完成！')
    }, 2000)
  }
}

const getPageContentWithLines = (page) => {
  // 如果已翻译，返回翻译内容
  if (isTranslated.value && translatedContent.value[page]) {
    const lines = translatedContent.value[page]
    return lines.map((line, index) => 
      `<span id="page-${page}-line-${index + 1}" class="content-line">${line || '&nbsp;'}</span>`
    ).join('<br>')
  }
  
  // 模拟页面内容，带行号
  const contents = {
    1: [
      '招标公告',
      '',
      '项目名称：某数据中心配电系统采购项目',
      '招标编号：2024-XXX-001',
      '...'
    ],
    3: [
      '投标须知',
      '',
      '一、投标文件的递交',
      '1. 投标文件递交截止时间：2024年12月15日 14:00',
      '2. 开标时间：2024年12月15日 14:00',
      '3. 开标地点：招标人会议室',
      '',
      '二、澄清时间：2024年12月10日前',
      '...'
    ],
    5: [
      '投标保证金',
      '',
      '1. 投标保证金金额：人民币50万元整',
      '2. 投标保证金形式：银行转账或保函',
      '3. 投标保证金账户：...',
      '',
      '投标有效期',
      '',
      '1. 投标文件应在开标后90天内保持有效',
      '2. 投标有效期：自开标之日起90天内有效',
      '...'
    ],
    8: [
      '技术规格要求',
      '',
      '1. 产品类型：配电柜',
      '2. 数量：10台',
      '3. 技术要求：...',
      '...'
    ],
    9: [
      '性能参数要求',
      '',
      '1. 额定电压：10kV',
      '2. 额定电流：1000A',
      '3. 短路电流：31.5kA',
      '',
      '4. 额定功率：≥500kW',
      '5. 效率：≥95%',
      '...'
    ],
    10: [
      '部件品牌要求',
      '',
      '1. 断路器：施耐德或ABB品牌',
      '2. 主要电气元件：施耐德或ABB品牌',
      '3. 互感器：...',
      '...'
    ],
    11: [
      '环境要求',
      '1. 防护等级：IP54',
      '2. 绝缘等级：F级',
      '',
      '3. 工作温度：-10℃~45℃',
      '4. 相对湿度：≤95%',
      '...'
    ]
  }
  
  const lines = contents[page] || [`第 ${page} 页内容...`]
  return lines.map((line, index) => 
    `<span id="page-${page}-line-${index + 1}" class="content-line">${line || '&nbsp;'}</span>`
  ).join('<br>')
}

// 多语言翻译方法
const startTranslate = () => {
  if (!sourceText.value.trim()) {
    ElMessage.warning('请输入需要翻译的文本')
    return
  }
  
  translating.value = true
  ElMessage.info('正在翻译...')
  
  setTimeout(() => {
    translatedText.value = `[翻译结果] ${sourceText.value}`
    translating.value = false
    ElMessage.success('翻译完成')
  }, 2000)
}

const clearTranslate = () => {
  sourceText.value = ''
  translatedText.value = ''
}

const copyTranslation = () => {
  navigator.clipboard.writeText(translatedText.value)
  ElMessage.success('已复制到剪贴板')
}

const exportTranslation = () => {
  ElMessage.success('翻译结果已导出')
}

// 商务要素提取方法
const startBusinessExtract = () => {
  if (!selectedBidFile.value) {
    ElMessage.warning('请先选择招标文件')
    return
  }
  
  extracting.value = true
  extractProgress.value = 0
  
  const interval = setInterval(() => {
    extractProgress.value += 10
    if (extractProgress.value >= 100) {
      clearInterval(interval)
      extracting.value = false
      ElMessage.success('商务要素提取完成')
    }
  }, 300)
}

const exportBusinessElements = () => {
  ElMessage.success('商务要素表已导出为Excel')
}

const saveBusinessElements = () => {
  ElMessage.success('已保存到知识库')
}

// 否决项识别方法
const startRejectRecognition = () => {
  if (!selectedBidFile.value) {
    ElMessage.warning('请先选择招标文件')
    return
  }
  
  recognizing.value = true
  recognizeProgress.value = 0
  
  const interval = setInterval(() => {
    recognizeProgress.value += 10
    if (recognizeProgress.value >= 100) {
      clearInterval(interval)
      recognizing.value = false
      ElMessage.success('否决项识别完成')
    }
  }, 200)
}

const generateChecklist = () => {
  ElMessage.success('检查清单已生成')
}

const exportRejectReport = () => {
  ElMessage.success('否决项报告已导出')
}

// 监听导航变化，清空选中的项目
watch(activeNav, () => {
  selectedProject.value = null
})
</script>

<style lang="scss" scoped>
.bidding-system { 
  display: flex; 
  height: 100%; 
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
}

.bidding-sidebar { 
  width: 260px; 
  background: #fff; 
  border-right: 1px solid #e5e7eb; 
  display: flex; 
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

.sidebar-header { 
  padding: 24px 20px; 
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  
  .system-title { 
    display: flex; 
    align-items: center; 
    gap: 12px;
    
    .title-icon-wrapper {
      width: 48px;
      height: 48px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(10px);
      
      .title-icon { 
        font-size: 28px;
        color: #fff;
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
      }
    }
    
    .title-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
      
      .title-text { 
        font-size: 18px; 
        font-weight: 700; 
        color: #fff;
        letter-spacing: 0.5px;
      }
      
      .title-desc {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.8);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }
    }
  }
}

.bidding-nav { 
  padding: 16px 12px; 
  overflow-y: auto; 
  flex: 1;
}

.nav-group { 
  margin-bottom: 8px;
}

.nav-item { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 12px 14px; 
  border-radius: 10px; 
  cursor: pointer; 
  color: #4b5563; 
  font-size: 14px; 
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  
  &:hover { 
    background: #f3f4f6;
    transform: translateX(2px);
  }
  
  &.active { 
    background: linear-gradient(135deg, rgba(124,58,237,0.1) 0%, rgba(124,58,237,0.05) 100%);
    color: #7c3aed;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
    
    .nav-icon {
      color: #7c3aed;
    }
    
    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 4px;
      height: 60%;
      background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
      border-radius: 0 4px 4px 0;
    }
  }
  
  .nav-left { 
    display: flex; 
    align-items: center; 
    gap: 12px;
  }
  
  .nav-icon { 
    font-size: 18px;
    line-height: 1;
    color: #6b7280;
    transition: color 0.3s;
  }
  
  .nav-arrow { 
    font-size: 14px; 
    color: #9ca3af;
    transition: transform 0.3s;
  }
}

.nav-children { 
  margin-left: 32px;
  margin-top: 4px;
  padding-left: 12px;
  border-left: 2px solid #e5e7eb;
  
  .nav-child { 
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px; 
    font-size: 13px; 
    color: #6b7280; 
    cursor: pointer; 
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    
    .child-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #d1d5db;
      transition: all 0.2s;
    }
    
    &:hover { 
      background: #f3f4f6;
      color: #374151;
      
      .child-dot {
        background: #9ca3af;
      }
    }
    
    &.active { 
      color: #7c3aed;
      background: rgba(124,58,237,0.08);
      font-weight: 600;
      
      .child-dot {
        background: #7c3aed;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
      }
    }
  }
}

.bidding-content { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  overflow: hidden;
}

.content-header { 
  padding: 20px 32px; 
  background: #fff; 
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  
  .header-left {
    :deep(.el-breadcrumb) {
      font-size: 14px;
      
      .el-breadcrumb__item {
        .el-breadcrumb__inner {
          color: #6b7280;
          font-weight: 500;
          
          &.is-link:hover {
            color: #7c3aed;
          }
        }
        
        &:last-child .el-breadcrumb__inner {
          color: #1f2937;
          font-weight: 600;
        }
      }
    }
  }
  
  .header-right {
    :deep(.el-button) {
      border-color: #e5e7eb;
      
      &:hover {
        background: #f3f4f6;
        border-color: #7c3aed;
        color: #7c3aed;
      }
    }
  }
}

.content-main { 
  flex: 1; 
  padding: 24px; 
  overflow-y: auto;
  
  &::-webkit-scrollbar {
    width: 8px;
  }
  
  &::-webkit-scrollbar-track {
    background: transparent;
  }
  
  &::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
    
    &:hover {
      background: #9ca3af;
    }
  }
}

.panel { 
  background: #fff; 
  border-radius: 16px; 
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

.panel-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 24px;
  
  h3 { 
    font-size: 20px; 
    color: #1f2937; 
    margin: 0;
    font-weight: 700;
    position: relative;
    padding-left: 16px;
    
    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 4px;
      height: 24px;
      background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
      border-radius: 2px;
    }
  }
}
.stats-cards { 
  display: grid; 
  grid-template-columns: repeat(4, 1fr); 
  gap: 20px; 
  margin-bottom: 28px;
}

.stat-card { 
  background: linear-gradient(135deg, #fff 0%, #f9fafb 100%);
  border-radius: 14px; 
  padding: 24px; 
  text-align: center;
  border: 1px solid #e5e7eb;
  transition: all 0.3s;
  
  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(124, 58, 237, 0.1);
    border-color: #7c3aed;
  }
  
  .stat-value { 
    font-size: 32px; 
    font-weight: 700; 
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
  }
  
  .stat-label { 
    font-size: 13px; 
    color: #6b7280; 
    font-weight: 500;
  }
}

.kb-categories { 
  display: grid; 
  grid-template-columns: repeat(2, 1fr); 
  gap: 20px;
}

.category-card { 
  display: flex; 
  align-items: center; 
  gap: 16px; 
  padding: 24px; 
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px; 
  cursor: pointer; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  &:hover { 
    background: #fafbfc;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: #7c3aed;
  }
  
  .cat-icon { 
    width: 56px; 
    height: 56px; 
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    .el-icon {
      font-size: 28px;
      color: #fff;
    }
  }
  
  .cat-info { 
    flex: 1;
    
    .cat-name { 
      font-size: 16px; 
      font-weight: 600; 
      color: #1f2937;
      margin-bottom: 6px;
    }
    
    .cat-count { 
      font-size: 13px; 
      color: #6b7280;
      font-weight: 500;
    }
  }
}

.category-management {
  padding: 0;
  overflow: hidden;
}

.category-layout {
  display: flex;
  height: calc(100vh - 180px);
}

.category-sidebar {
  width: 280px;
  background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  
  .category-nav-header {
    padding: 24px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    
    .header-title {
      h4 {
        margin: 0 0 6px 0;
        font-size: 17px;
        font-weight: 700;
        color: #1f2937;
      }
      
      .header-subtitle {
        font-size: 12px;
        color: #6b7280;
        font-weight: 500;
      }
    }
  }
  
  .category-nav-list {
    padding: 20px 16px;
    overflow-y: auto;
    flex: 1;
  }
  
  .category-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    
    &:hover {
      transform: translateX(6px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
      border-color: #e5e7eb;
      
      .nav-arrow-icon {
        opacity: 1;
        transform: translateX(2px);
      }
    }
    
    &.active {
      border-color: #7c3aed;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(124, 58, 237, 0.03) 100%);
      box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
      transform: translateX(6px);
      
      .category-nav-name {
        color: #7c3aed;
        font-weight: 700;
      }
      
      .category-nav-count {
        color: #7c3aed;
        font-weight: 600;
      }
      
      .nav-arrow-icon {
        opacity: 1;
        color: #7c3aed;
      }
    }
    
    .category-nav-icon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      
      .el-icon {
        font-size: 22px;
        color: #fff;
      }
    }
    
    .category-nav-info {
      flex: 1;
      min-width: 0;
      
      .category-nav-name {
        font-size: 14px;
        font-weight: 600;
        color: #1f2937;
        margin-bottom: 6px;
        transition: all 0.2s;
      }
      
      .category-nav-count {
        font-size: 12px;
        color: #6b7280;
        font-weight: 500;
        transition: all 0.2s;
      }
    }
    
    .nav-arrow-icon {
      font-size: 16px;
      color: #9ca3af;
      opacity: 0;
      transition: all 0.3s;
    }
  }
  
  .category-sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    
    .footer-stat {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px;
      background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
      border-radius: 12px;
      border: 1px solid #e5e7eb;
      
      .stat-icon {
        font-size: 28px;
      }
      
      .stat-info {
        flex: 1;
        
        .stat-label {
          font-size: 12px;
          color: #6b7280;
          margin-bottom: 4px;
          font-weight: 500;
        }
        
        .stat-value {
          font-size: 20px;
          font-weight: 700;
          background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
        }
      }
    }
  }
}

.category-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  
  .category-content-header {
    padding: 28px 32px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    
    .header-info {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24px;
      
      .category-title-wrapper {
        display: flex;
        align-items: center;
        gap: 16px;
        
        .category-icon-large {
          width: 64px;
          height: 64px;
          border-radius: 16px;
          display: flex;
          align-items: center;
          justify-content: center;
          box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
          
          .el-icon {
            font-size: 32px;
            color: #fff;
          }
        }
        
        .category-title-info {
          h3 {
            margin: 0 0 6px 0;
            font-size: 24px;
            font-weight: 700;
            color: #1f2937;
          }
          
          .category-desc {
            margin: 0;
            font-size: 14px;
            color: #6b7280;
            font-weight: 500;
          }
        }
      }
      
      .header-actions {
        :deep(.el-button) {
          padding: 12px 24px;
          font-size: 14px;
        }
      }
    }
    
    .category-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      
      .toolbar-right {
        display: flex;
        gap: 8px;
      }
    }
  }
  
  .category-table-wrapper {
    flex: 1;
    overflow: auto;
    padding: 24px 32px;
    
    .file-name-cell {
      display: flex;
      align-items: center;
      gap: 10px;
      
      .file-icon {
        font-size: 18px;
        flex-shrink: 0;
      }
      
      .file-name {
        font-weight: 500;
        color: #1f2937;
      }
    }
    
    .table-actions {
      display: flex;
      align-items: center;
      gap: 25px;
      
      :deep(.el-button) {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-weight: 500;
        
        &.el-button--primary {
          color: #a78bfa;
          
          &:hover {
            color: #8b5cf6;
            background: rgba(167, 139, 250, 0.1);
          }
        }
        
        &.el-button--danger {
          color: #ef4444;
          
          &:hover {
            color: #dc2626;
            background: rgba(239, 68, 68, 0.1);
          }
        }
        
        .el-icon {
          font-size: 16px;
        }
      }
    }
    
    :deep(.el-table) {
      .el-table__empty-block {
        padding: 60px 0;
      }
      
      .el-table__empty-text {
        color: #9ca3af;
        font-size: 14px;
      }
    }
  }
}

.header-actions { 
  display: flex; 
  align-items: center; 
  gap: 12px;
}

// 全局表格样式优化
:deep(.el-table) {
  border-radius: 12px;
  overflow: hidden;
  
  .el-table__header-wrapper {
    th {
      background: #f9fafb;
      color: #374151;
      font-weight: 600;
      font-size: 13px;
      border-bottom: 2px solid #e5e7eb;
    }
  }
  
  .el-table__body-wrapper {
    .el-table__row {
      transition: all 0.2s;
      
      &:hover {
        background: #f9fafb;
      }
      
      td {
        border-bottom: 1px solid #f3f4f6;
        color: #4b5563;
        font-size: 14px;
      }
    }
  }
  
  .el-button--primary.is-link {
    color: #ac99e4ff !important;
    font-weight: 500;
    
    &:hover {
      color: #8b5cf6 !important;
      background: rgba(167, 139, 250, 0.08) !important;
    }
    
    .el-icon {
      color: #a78bfa;
    }
  }
  
  .el-button--danger.is-link {
    color: #ef4444 !important;
    font-weight: 500;
    
    &:hover {
      color: #dc2626 !important;
      background: rgba(239, 68, 68, 0.08) !important;
    }
    
    .el-icon {
      color: #ef4444;
    }
  }
}

// 标签样式优化
:deep(.el-tag) {
  border-radius: 6px;
  padding: 4px 12px;
  font-weight: 500;
  font-size: 12px;
  border: none;
  
  &.el-tag--success {
    background: #d1fae5;
    color: #059669;
  }
  
  &.el-tag--warning {
    background: #fef3c7;
    color: #d97706;
  }
  
  &.el-tag--info {
    background: #dbeafe;
    color: #2563eb;
  }
  
  &.el-tag--default {
    background: #ede9fe;
    color: #7c3aed;
  }
}

// 按钮样式优化
:deep(.el-button) {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s;
  
  &.el-button--primary {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border: none;
    
    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    }
    
    &:active {
      transform: translateY(0);
    }
  }
  
  &.el-button--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    
    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
  }
}

// 输入框样式优化
:deep(.el-input) {
  .el-input__wrapper {
    border-radius: 8px;
    box-shadow: 0 0 0 1px #e5e7eb;
    transition: all 0.2s;
    
    &:hover {
      box-shadow: 0 0 0 1px #d1d5db;
    }
    
    &.is-focus {
      box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
    }
  }
}

:deep(.el-select) {
  .el-input__wrapper {
    border-radius: 8px;
  }
}

:deep(.el-textarea) {
  .el-textarea__inner {
    border-radius: 8px;
    border-color: #e5e7eb;
    
    &:hover {
      border-color: #d1d5db;
    }
    
    &:focus {
      border-color: #7c3aed;
      box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    }
  }
}
.upload-zone { max-width: 500px; margin: 0 auto; :deep(.el-upload-dragger) { padding: 40px; border-radius: 12px; } .upload-icon { font-size: 48px; color: #9ca3af; } .upload-text { color: #666; margin-top: 12px; }}
.reject-list { .reject-item { padding: 16px; background: #fef2f2; border-radius: 8px; margin-bottom: 12px; .reject-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; .reject-icon { color: #ef4444; }} .reject-content { color: #374151; font-size: 14px; }}}
.write-layout { display: flex; gap: 20px; }
.outline-panel { width: 240px; background: #f9fafb; border-radius: 8px; padding: 16px; .outline-header { font-weight: 500; margin-bottom: 12px; color: #374151; }}
.editor-panel { flex: 1; .editor-toolbar { margin-bottom: 12px; display: flex; gap: 8px; }}
.check-summary { display: flex; gap: 20px; margin-bottom: 24px; .summary-item { flex: 1; text-align: center; padding: 24px; border-radius: 12px; &.pass { background: #d1fae5; .summary-value { color: #10b981; }} &.warning { background: #fef3c7; .summary-value { color: #f59e0b; }} &.error { background: #fee2e2; .summary-value { color: #ef4444; }} .summary-value { font-size: 32px; font-weight: 600; } .summary-label { font-size: 14px; color: #6b7280; margin-top: 4px; }}}
.panel-chat { height: calc(100vh - 180px); padding: 0; }
.chat-container { height: 100%; display: flex; flex-direction: column; }
.chat-messages { flex: 1; padding: 24px; overflow-y: auto; }
.chat-message { display: flex; gap: 12px; margin-bottom: 16px; &.user { flex-direction: row-reverse; .message-content { background: #7c3aed; color: #fff; }} .message-avatar { width: 36px; height: 36px; border-radius: 50%; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 18px; } .message-content { max-width: 70%; padding: 12px 16px; background: #f3f4f6; border-radius: 12px; line-height: 1.6; }}
.chat-input { padding: 16px 24px; border-top: 1px solid #e5e7eb; background: #fff; }

// 文件智能采集样式
.file-process-list {
  margin-top: 24px;
  
  .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    
    .el-icon {
      font-size: 18px;
    }
  }
  
  .process-status {
    display: flex;
    align-items: center;
    gap: 8px;
    
    .is-loading {
      animation: rotating 2s linear infinite;
    }
  }
}

@keyframes rotating {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

// 多语言翻译样式
.translate-layout {
  .translate-controls {
    margin-bottom: 24px;
  }
  
  .translate-panels {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    
    .translate-panel {
      flex: 1;
      
      .panel-title {
        font-size: 14px;
        font-weight: 600;
        color: #374151;
        margin-bottom: 12px;
      }
      
      .panel-actions {
        display: flex;
        gap: 8px;
        margin-top: 12px;
      }
    }
  }
  
  .translate-actions {
    display: flex;
    gap: 12px;
  }
}

// 商务要素提取样式
.extract-result {
  margin-top: 24px;
  
  .note-text {
    color: #f59e0b;
    font-size: 13px;
  }
  
  .extract-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
  }
}

// 否决项识别样式
.rejection-panel {
  .rejection-section,
  .deduction-section,
  .bonus-section {
    margin-bottom: 32px;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 2px solid #e5e7eb;
    
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 16px;
      border-bottom: 2px solid #e5e7eb;
      
      h4 {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 18px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
      }
      
      .total-score {
        font-size: 16px;
        font-weight: 600;
        color: #6b7280;
      }
    }
    
    .items-list {
      .rejection-item,
      .deduction-item,
      .bonus-item {
        display: flex;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
        margin-bottom: 12px;
        background: #f9fafb;
        border-radius: 8px;
        border: 2px solid transparent;
        transition: all 0.2s;
        
        &:hover {
          border-color: #a78bfa;
          box-shadow: 0 2px 8px rgba(167, 139, 250, 0.1);
        }
        
        .item-icon {
          font-size: 20px;
          font-weight: bold;
          flex-shrink: 0;
        }
        
        .item-content {
          flex: 1;
          
          .item-text {
            font-size: 15px;
            color: #1f2937;
            font-weight: 500;
            margin-bottom: 8px;
          }
          
          .item-meta {
            display: flex;
            gap: 8px;
          }
        }
        
        .item-actions {
          display: flex;
          align-items: center;
          gap: 12px;
          flex-shrink: 0;
        }
      }
      
      .rejection-item.critical {
        background: #fef2f2;
        border-color: #fecaca;
        
        .item-icon {
          color: #ef4444;
        }
      }
      
      .deduction-item {
        .item-icon {
          color: #f59e0b;
        }
      }
      
      .bonus-item {
        background: #f0fdf4;
        
        .item-icon {
          color: #10b981;
        }
      }
    }
  }
  
  .action-buttons {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
  }
}

// 项目管理样式
// 新项目管理样式
.pm-project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.pm-project-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  
  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(139, 92, 246, 0.15);
    border-color: #c4b5fd;
  }
  
  .pm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    
    .pm-card-title {
      margin: 0;
      font-size: 16px;
      font-weight: 600;
      color: #1f2937;
      line-height: 1.4;
      flex: 1;
      padding-right: 8px;
    }
  }
  
  .pm-card-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    
    .pm-info-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      
      .pm-info-label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: #6b7280;
        
        .el-icon {
          font-size: 14px;
        }
      }
      
      .pm-info-value {
        font-size: 13px;
        color: #374151;
        font-weight: 500;
        
        &.deadline {
          color: #ef4444;
          font-weight: 600;
        }
      }
    }
  }
  
  .pm-card-progress {
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    
    .pm-progress-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      
      span {
        font-size: 13px;
        color: #6b7280;
      }
      
      .pm-progress-value {
        font-weight: 600;
        color: #8b5cf6;
      }
    }
  }
}

.pm-empty-state {
  grid-column: 1 / -1;
  padding: 60px 20px;
}

// 已完结项目样式
.pm-completed-panel {
  .pm-completed-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    
    .pm-stat-card {
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 20px;
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      
      .pm-stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        
        .el-icon {
          font-size: 24px;
          color: #fff;
        }
        
        &.total {
          background: linear-gradient(135deg, #6366f1, #4f46e5);
        }
        
        &.won {
          background: linear-gradient(135deg, #22c55e, #16a34a);
        }
        
        &.lost {
          background: linear-gradient(135deg, #f87171, #ef4444);
        }
        
        &.rate {
          background: linear-gradient(135deg, #f59e0b, #d97706);
        }
      }
      
      .pm-stat-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
        
        .pm-stat-value {
          font-size: 28px;
          font-weight: 700;
          color: #1f2937;
          line-height: 1;
          
          &.won {
            color: #16a34a;
          }
          
          &.lost {
            color: #ef4444;
          }
          
          &.rate {
            color: #d97706;
          }
        }
        
        .pm-stat-label {
          font-size: 13px;
          color: #6b7280;
        }
      }
    }
  }
  
  .pm-completed-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    
    .pm-completed-card {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      overflow: hidden;
      transition: all 0.3s;
      
      &:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
      }
      
      &.won {
        border-left: 4px solid #22c55e;
        
        .pm-completed-card-header {
          background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
        }
      }
      
      &.lost {
        border-left: 4px solid #ef4444;
        
        .pm-completed-card-header {
          background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
        }
      }
      
      .pm-completed-card-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
        border-bottom: 1px solid #f3f4f6;
        
        .pm-completed-card-title {
          margin: 0;
          font-size: 16px;
          font-weight: 600;
          color: #1f2937;
          flex: 1;
        }
      }
      
      .pm-completed-card-body {
        padding: 20px;
        
        .pm-completed-info-grid {
          display: grid;
          grid-template-columns: 1fr 1fr;
          gap: 12px;
          
          .pm-completed-info-item {
            display: flex;
            flex-direction: column;
            gap: 4px;
            
            &.full-width {
              grid-column: 1 / -1;
            }
            
            .label {
              font-size: 12px;
              color: #9ca3af;
            }
            
            .value {
              font-size: 14px;
              color: #374151;
              font-weight: 500;
              
              &.amount {
                color: #059669;
                font-weight: 600;
              }
              
              &.fail-reason {
                color: #ef4444;
                font-size: 13px;
              }
            }
          }
        }
      }
      
      .pm-completed-card-footer {
        display: flex;
        justify-content: flex-start;
        gap: 8px;
        padding: 12px 20px;
        background: #f9fafb;
        border-top: 1px solid #f3f4f6;
      }
    }
  }
}

// 招标信息提取样式
.pm-step-extract {
  .pm-extract-upload {
    .pm-upload-area {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
      padding: 20px;
      
      .pm-upload-dragger {
        width: 100%;
        
        :deep(.el-upload-dragger) {
          border: 2px dashed #c4b5fd;
          border-radius: 12px;
          background: #faf5ff;
          padding: 40px;
          
          &:hover {
            border-color: #8b5cf6;
          }
        }
      }
      
      .pm-upload-content {
        text-align: center;
        
        .pm-upload-icon {
          font-size: 48px;
          color: #8b5cf6;
          margin-bottom: 16px;
        }
        
        .pm-upload-title {
          margin: 0 0 8px 0;
          font-size: 16px;
          color: #374151;
          font-weight: 500;
        }
        
        .pm-upload-hint {
          margin: 0;
          font-size: 13px;
          color: #9ca3af;
        }
      }
      
      .pm-selected-file {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 20px;
        background: #f3f4f6;
        border-radius: 8px;
        
        .el-icon {
          font-size: 20px;
          color: #8b5cf6;
        }
        
        .file-name {
          font-size: 14px;
          color: #374151;
        }
      }
      
      .pm-analyze-btn {
        min-width: 160px;
      }
    }
  }
  
  .pm-extract-result {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    
    .pm-extract-result-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      background: #f9fafb;
      border-radius: 8px;
      margin-bottom: 20px;
      flex-shrink: 0;
      
      .file-info {
        display: flex;
        align-items: center;
        gap: 16px;
        
        .file-icon {
          font-size: 32px;
          color: #8b5cf6;
        }
        
        .file-detail {
          display: flex;
          flex-direction: column;
          gap: 4px;
          
          .file-name {
            font-size: 15px;
            font-weight: 500;
            color: #1f2937;
          }
          
          .file-meta {
            font-size: 13px;
            color: #6b7280;
          }
        }
      }
    }
    
    // 底部操作按钮
    .pm-extract-footer {
      display: flex;
      justify-content: flex-end;
      padding: 16px 0 0 0;
      margin-top: 16px;
      border-top: 1px solid #e5e7eb;
    }
  }
  
  .pm-extract-result {
    padding: 20px;
    display: flex;
    flex-direction: column;
    
    // 主体内容：左右布局
    .pm-extract-body {
      display: flex;
      gap: 20px;
      height: 1000px;
      
      // 左侧：关键信息区域
      .pm-extract-left {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
        
        // 选项卡导航
        .pm-extract-tabs {
          display: flex;
          flex-wrap: wrap;
          gap: 0;
          padding: 0;
          background: #f9fafb;
          border-bottom: 1px solid #e5e7eb;
          flex-shrink: 0;
          
          .pm-extract-tab {
            padding: 12px 16px;
            font-size: 13px;
            color: #6b7280;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: all 0.2s;
            white-space: nowrap;
            
            &:hover {
              color: #8b5cf6;
              background: #faf5ff;
            }
            
            &.active {
              color: #8b5cf6;
              font-weight: 500;
              border-bottom-color: #8b5cf6;
              background: #fff;
            }
          }
        }
        
        // 选项卡内容区
        .pm-extract-tab-content {
          flex: 1;
          overflow-y: auto;
          padding: 16px;
          
          .pm-tab-panel {
            .pm-overview-stats {
              display: flex;
              gap: 16px;
              margin-bottom: 20px;
              
              .pm-stat-item {
                flex: 1;
                text-align: center;
                padding: 16px;
                background: #f9fafb;
                border-radius: 8px;
                
                .pm-stat-value {
                  font-size: 28px;
                  font-weight: 700;
                  color: #1f2937;
                  
                  &.highlight { color: #8b5cf6; }
                  &.success { color: #10b981; }
                }
                
                .pm-stat-label {
                  font-size: 12px;
                  color: #6b7280;
                  margin-top: 4px;
                }
              }
            }
            
            .pm-overview-summary {
              background: #f9fafb;
              border-radius: 8px;
              padding: 16px;
              
              h6 {
                margin: 0 0 8px 0;
                font-size: 14px;
                font-weight: 600;
                color: #374151;
              }
              
              p {
                margin: 0;
                font-size: 13px;
                line-height: 1.6;
                color: #6b7280;
              }
            }
            
            // 总体分析新增样式
            .pm-overview-row {
              display: flex;
              gap: 16px;
              margin-bottom: 16px;
            }
            
            .pm-overview-card {
              flex: 1;
              background: #fff;
              border: 1px solid #e5e7eb;
              border-radius: 8px;
              padding: 16px;
              
              &.half {
                flex: 1;
              }
              
              .pm-card-title {
                display: flex;
                align-items: center;
                gap: 8px;
                font-size: 14px;
                font-weight: 600;
                color: #374151;
                margin-bottom: 12px;
                
                .el-icon { color: #8b5cf6; }
                
                &.warning .el-icon { color: #f59e0b; }
                &.success .el-icon { color: #10b981; }
              }
            }
            
            // 评分权重分布
            .pm-score-distribution {
              display: flex;
              align-items: center;
              gap: 20px;
              
              .pm-donut-chart {
                width: 100px;
                height: 100px;
                
                .pm-donut-ring {
                  width: 100%;
                  height: 100%;
                  border-radius: 50%;
                  background: conic-gradient(#8b5cf6 0% 45%, #10b981 45% 80%, #f59e0b 80% 100%);
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  
                  .pm-donut-center {
                    width: 60px;
                    height: 60px;
                    background: #fff;
                    border-radius: 50%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    
                    .pm-donut-percent {
                      font-size: 14px;
                      font-weight: 600;
                      color: #374151;
                    }
                  }
                }
              }
              
              .pm-score-legend {
                .pm-legend-item {
                  display: flex;
                  align-items: center;
                  gap: 8px;
                  font-size: 13px;
                  color: #6b7280;
                  margin-bottom: 6px;
                  
                  .pm-legend-dot {
                    width: 10px;
                    height: 10px;
                    border-radius: 50%;
                    
                    &.tech { background: #8b5cf6; }
                    &.business { background: #10b981; }
                    &.price { background: #f59e0b; }
                  }
                  
                  .pm-legend-value {
                    margin-left: auto;
                    font-weight: 500;
                    color: #374151;
                  }
                }
              }
            }
            
            // 报价策略建议
            .pm-price-strategy {
              .pm-strategy-tip {
                display: flex;
                align-items: center;
                gap: 8px;
                padding: 10px 12px;
                background: #eff6ff;
                border-radius: 6px;
                font-size: 13px;
                color: #3b82f6;
                margin-bottom: 12px;
                
                .highlight {
                  font-weight: 600;
                  color: #8b5cf6;
                }
              }
              
              .pm-price-chart {
                .pm-chart-bars {
                  display: flex;
                  align-items: flex-end;
                  gap: 8px;
                  height: 80px;
                  padding-bottom: 8px;
                  
                  .pm-bar {
                    flex: 1;
                    background: #e5e7eb;
                    border-radius: 4px 4px 0 0;
                    display: flex;
                    align-items: flex-start;
                    justify-content: center;
                    padding-top: 4px;
                    
                    span {
                      font-size: 10px;
                      color: #6b7280;
                    }
                    
                    &.highlight {
                      background: linear-gradient(180deg, #8b5cf6 0%, #a78bfa 100%);
                      
                      span { color: #fff; }
                    }
                  }
                }
                
                .pm-chart-labels {
                  display: flex;
                  justify-content: space-between;
                  font-size: 11px;
                  color: #9ca3af;
                  padding-top: 4px;
                  border-top: 1px solid #e5e7eb;
                }
              }
            }
            
            // 时间节点规划
            .pm-timeline-section {
              background: #fff;
              border: 1px solid #e5e7eb;
              border-radius: 8px;
              padding: 16px;
              margin-bottom: 16px;
              
              .pm-timeline-row {
                display: flex;
                align-items: center;
                gap: 20px;
                margin-bottom: 16px;
              }
              
              .pm-countdown-box {
                width: 80px;
                height: 80px;
                background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
                border-radius: 12px;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                flex-shrink: 0;
                
                .pm-countdown-value {
                  font-size: 28px;
                  font-weight: 700;
                  color: #fff;
                }
                
                .pm-countdown-label {
                  font-size: 11px;
                  color: rgba(255,255,255,0.8);
                }
              }
              
              .pm-time-nodes {
                display: flex;
                flex: 1;
                gap: 12px;
                
                .pm-time-node {
                  flex: 1;
                  padding: 12px;
                  background: #f9fafb;
                  border-radius: 8px;
                  border-left: 3px solid #8b5cf6;
                  
                  &.warning { border-left-color: #f59e0b; }
                  &.primary { border-left-color: #3b82f6; }
                  
                  .pm-node-date {
                    font-size: 14px;
                    font-weight: 600;
                    color: #374151;
                    margin-bottom: 4px;
                  }
                  
                  .pm-node-label {
                    font-size: 12px;
                    color: #6b7280;
                  }
                }
              }
            }
            
            // 进度条
            .pm-progress-bars {
              .pm-progress-item {
                display: flex;
                align-items: center;
                gap: 12px;
                margin-bottom: 8px;
                
                &:last-child { margin-bottom: 0; }
                
                .pm-progress-label {
                  width: 70px;
                  font-size: 12px;
                  color: #6b7280;
                  flex-shrink: 0;
                }
                
                .pm-progress-bar {
                  flex: 1;
                  height: 8px;
                  background: #e5e7eb;
                  border-radius: 4px;
                  overflow: hidden;
                  
                  .pm-progress-fill {
                    height: 100%;
                    background: linear-gradient(90deg, #8b5cf6 0%, #3b82f6 100%);
                    border-radius: 4px;
                  }
                }
              }
            }
            
            // 注意事项和建议
            .pm-notice-list, .pm-suggestion-list {
              .pm-notice-item, .pm-suggestion-item {
                display: flex;
                align-items: flex-start;
                gap: 8px;
                font-size: 13px;
                color: #374151;
                padding: 8px 0;
                
                .el-icon {
                  margin-top: 2px;
                  flex-shrink: 0;
                }
                
                strong { color: #ef4444; }
              }
            }
            
            .pm-notice-list .pm-notice-item .el-icon { color: #f59e0b; }
            .pm-suggestion-list .pm-suggestion-item .el-icon { color: #10b981; }
            
            .pm-qualification-section {
              margin-bottom: 20px;
              padding: 16px;
              background: #fff;
              border: 1px solid #e5e7eb;
              border-radius: 8px;
              
              .pm-section-title {
                display: flex;
                align-items: center;
                gap: 8px;
                margin-bottom: 12px;
                font-size: 14px;
                font-weight: 600;
                color: #374151;
                
                .el-icon { color: #8b5cf6; }
                
                .pm-badge {
                  margin-left: auto;
                  padding: 2px 8px;
                  font-size: 11px;
                  font-weight: 500;
                  border-radius: 4px;
                  
                  &.danger { background: #fef2f2; color: #ef4444; }
                  &.warning { background: #fffbeb; color: #f59e0b; }
                  &.success { background: #ecfdf5; color: #10b981; }
                }
              }
              
              .pm-requirement-list {
                .pm-requirement-item {
                  display: flex;
                  align-items: flex-start;
                  gap: 8px;
                  padding: 10px 0;
                  border-bottom: 1px solid #f3f4f6;
                  font-size: 13px;
                  
                  &:last-child { border-bottom: none; }
                  
                  &.risk {
                    .el-icon { color: #f59e0b; }
                  }
                  
                  > .el-icon {
                    color: #10b981;
                    margin-top: 2px;
                    flex-shrink: 0;
                  }
                  
                  .label {
                    color: #8b5cf6;
                    font-weight: 500;
                    white-space: nowrap;
                  }
                  
                  .value {
                    color: #374151;
                    flex: 1;
                    
                    &.primary { color: #8b5cf6; }
                  }
                  
                  .el-tag {
                    margin-right: 8px;
                  }
                }
              }
            }
            
            .pm-reject-section {
              .pm-section-header {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 16px;
                
                .pm-section-title {
                  display: flex;
                  align-items: center;
                  gap: 8px;
                  font-size: 14px;
                  font-weight: 600;
                  color: #374151;
                  
                  .el-icon { color: #ef4444; }
                  
                  .pm-badge {
                    margin-left: 8px;
                    padding: 2px 8px;
                    font-size: 11px;
                    font-weight: 500;
                    border-radius: 4px;
                    
                    &.danger { background: #fef2f2; color: #ef4444; }
                  }
                }
              }
              
              .pm-reject-table {
                .el-table {
                  font-size: 13px;
                  
                  .el-input, .el-select {
                    width: 100%;
                  }
                }
              }
            }
            
            .pm-timeline {
              padding-left: 20px;
              border-left: 2px solid #e5e7eb;
              
              .pm-timeline-item {
                position: relative;
                padding-bottom: 24px;
                padding-left: 20px;
                
                &:last-child { padding-bottom: 0; }
                
                &::before {
                  content: '';
                  position: absolute;
                  left: -7px;
                  top: 6px;
                  width: 12px;
                  height: 12px;
                  background: #8b5cf6;
                  border-radius: 50%;
                  border: 2px solid #fff;
                }
                
                .pm-timeline-badge {
                  display: inline-block;
                  padding: 4px 10px;
                  background: #8b5cf6;
                  color: #fff;
                  font-size: 12px;
                  font-weight: 500;
                  border-radius: 12px;
                  margin-bottom: 8px;
                }
                
                .pm-timeline-content {
                  .pm-timeline-title {
                    font-size: 14px;
                    font-weight: 600;
                    color: #1f2937;
                    margin-bottom: 4px;
                  }
                  
                  .pm-timeline-desc {
                    font-size: 13px;
                    color: #6b7280;
                  }
                }
              }
            }
          }
          
          .pm-key-info-section {
            .pm-section-header {
              display: flex;
              align-items: center;
              justify-content: space-between;
              margin-bottom: 12px;
            }
            
            .pm-section-title {
              display: flex;
              align-items: center;
              gap: 8px;
              font-size: 14px;
              font-weight: 600;
              color: #374151;
              
              .el-icon { color: #8b5cf6; }
            }
            
            .pm-key-info-table {
              :deep(.el-table) {
                font-size: 13px;
                
                th {
                  background: #f9fafb;
                  font-weight: 500;
                }
                
                .el-input, .el-select {
                  width: 100%;
                }
              }
            }
          }
        }
        
      }
      
      // 右侧：文件预览区域
      .pm-extract-right {
        width: 400px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
        
        .pm-preview-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 12px 16px;
          background: #f9fafb;
          border-bottom: 1px solid #e5e7eb;
          flex-shrink: 0;
          
          h5 {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0;
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            
            .el-icon {
              color: #8b5cf6;
            }
          }
          
          .pm-preview-tools {
            display: flex;
            align-items: center;
          }
        }
        
        .pm-preview-content {
          flex: 1;
          overflow-y: auto;
          padding: 16px;
          transform-origin: top left;
          
          .pm-preview-pages {
            .pm-preview-page {
              background: #fff;
              border: 1px solid #e5e7eb;
              border-radius: 8px;
              margin-bottom: 16px;
              overflow: hidden;
              
              &:last-child {
                margin-bottom: 0;
              }
              
              .pm-page-number {
                padding: 8px 12px;
                background: #f3f4f6;
                font-size: 12px;
                color: #6b7280;
                font-weight: 500;
              }
              
              .pm-page-content {
                padding: 16px;
                
                .pm-preview-text {
                  margin: 0;
                  font-size: 13px;
                  line-height: 1.8;
                  color: #374151;
                }
              }
            }
          }
        }
      }
    }
  }
}

// 项目详情样式
.pm-project-detail {
  .pm-detail-header {
    margin-bottom: 24px;
  }
  
  .pm-detail-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e5e7eb;
  }
  
  .pm-detail-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    
    h2 {
      margin: 0;
      font-size: 22px;
      font-weight: 600;
      color: #1f2937;
    }
  }
  
  .pm-info-edit-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    
    .toggle-label {
      font-size: 13px;
      color: #6b7280;
    }
  }
  
  .pm-detail-info-grid {
    
    &.editing {
      .pm-info-section {
        border-color: #c4b5fd;
        background: #faf5ff;
      }
      
      .pm-info-row {
        .el-input, .el-select, .el-date-picker {
          flex: 1;
        }
      }
    }
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
    
    .pm-info-column {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }
    
    .pm-info-section {
      background: #f9fafb;
      border-radius: 12px;
      overflow: hidden;
      border: 1px solid #e5e7eb;
      
      &.system {
        background: #fafafa;
        
        .pm-info-section-title {
          background: #f3f4f6;
          
          .el-icon {
            color: #6b7280;
          }
        }
      }
      
      .pm-info-section-title {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
        border-bottom: 1px solid #e5e7eb;
        
        .el-icon {
          font-size: 16px;
          color: #8b5cf6;
        }
        
        span {
          font-size: 14px;
          font-weight: 600;
          color: #374151;
        }
      }
      
      .pm-info-section-content {
        padding: 16px;
        
        .pm-info-row {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 10px 0;
          border-bottom: 1px dashed #e5e7eb;
          
          &:last-child {
            border-bottom: none;
            padding-bottom: 0;
          }
          
          &:first-child {
            padding-top: 0;
          }
          
          &.highlight {
            background: linear-gradient(90deg, #fef2f2 0%, transparent 100%);
            margin: 0 -16px;
            padding: 12px 16px;
            border-radius: 8px;
            border-bottom: none;
            margin-bottom: 8px;
          }
          
          .label {
            font-size: 13px;
            color: #6b7280;
            flex-shrink: 0;
          }
          
          .value {
            font-size: 14px;
            font-weight: 500;
            color: #1f2937;
            text-align: right;
            
            &.budget {
              color: #059669;
              font-size: 16px;
              font-weight: 600;
            }
            
            &.code {
              font-family: 'Courier New', monospace;
              color: #6366f1;
              font-size: 13px;
            }
            
            &.deadline {
              color: #ef4444;
              font-weight: 600;
              display: flex;
              align-items: center;
              gap: 4px;
              
              .el-icon {
                font-size: 14px;
                animation: pulse 2s infinite;
              }
            }
          }
        }
      }
    }
  }
  
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
  
  .pm-progress-timeline {
    margin-bottom: 32px;
    
    h3 {
      margin: 0 0 24px 0;
      font-size: 16px;
      font-weight: 600;
      color: #374151;
    }
    
    .pm-step-item {
      cursor: pointer;
    }
    
    .pm-step-icon {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 600;
      
      &.finish {
        background: #22c55e;
        color: #fff;
      }
      
      &.process {
        background: #8b5cf6;
        color: #fff;
      }
      
      &.wait {
        background: #e5e7eb;
        color: #9ca3af;
      }
    }
  }
  
  .pm-current-step-detail {
    .pm-step-detail-card {
      background: linear-gradient(135deg, #f5f3ff, #ede9fe);
      border: 1px solid #c4b5fd;
      border-radius: 12px;
      padding: 24px;
      
      .pm-step-detail-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
        
        h4 {
          margin: 0;
          font-size: 18px;
          font-weight: 600;
          color: #5b21b6;
        }
      }
      
      .pm-step-detail-content {
        .pm-step-desc {
          margin: 0 0 20px 0;
          font-size: 14px;
          color: #6b7280;
          line-height: 1.6;
        }
        
        .pm-step-actions {
          display: flex;
          gap: 12px;
        }
      }
    }
    
    // ========== 开标步骤样式 ==========
    .pm-step-bid-opening {
      .pm-bid-opening-card {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
      }
      
      .pm-bid-opening-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 24px;
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
        border-bottom: 1px solid #bae6fd;
        
        .pm-bid-time-info {
          .pm-bid-time-label {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            color: #6b7280;
            margin-bottom: 4px;
            
            .el-icon {
              color: #0ea5e9;
            }
          }
          
          .pm-bid-time-value {
            font-size: 20px;
            font-weight: 600;
            color: #0c4a6e;
          }
        }
        
        .pm-bid-status {
          .countdown {
            margin-left: 4px;
            font-weight: normal;
          }
        }
      }
      
      .pm-bid-opening-info {
        padding: 20px 24px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        border-bottom: 1px solid #e5e7eb;
        
        .pm-bid-info-item {
          display: flex;
          align-items: flex-start;
          gap: 12px;
          
          .pm-bid-info-icon {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            
            .el-icon {
              font-size: 18px;
              color: #fff;
            }
            
            &.location {
              background: linear-gradient(135deg, #f97316, #ea580c);
            }
            
            &.online {
              background: linear-gradient(135deg, #3b82f6, #2563eb);
            }
            
            &.person {
              background: linear-gradient(135deg, #22c55e, #16a34a);
            }
          }
          
          .pm-bid-info-content {
            display: flex;
            flex-direction: column;
            gap: 4px;
            
            .label {
              font-size: 12px;
              color: #9ca3af;
            }
            
            .value {
              font-size: 14px;
              color: #1f2937;
              font-weight: 500;
              display: flex;
              align-items: center;
              gap: 8px;
              
              &.link {
                color: #3b82f6;
                text-decoration: none;
                
                &:hover {
                  text-decoration: underline;
                }
              }
            }
          }
        }
      }
      
      .pm-bid-opening-result {
        padding: 20px 24px;
        
        .pm-bid-result-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 16px;
          
          h4 {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0;
            font-size: 16px;
            font-weight: 600;
            color: #374151;
            
            .el-icon {
              color: #8b5cf6;
            }
          }
        }
        
        .our-company {
          font-weight: 600;
          color: #7c3aed;
        }
        
        .price {
          font-weight: 600;
          color: #059669;
        }
      }
      
      .pm-bid-waiting-tip {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 24px;
        color: #9ca3af;
        font-size: 14px;
        
        .el-icon {
          font-size: 16px;
        }
      }
    }
    
    // ========== 结果公示步骤样式 ==========
    .pm-step-result-announcement {
      .pm-result-card {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
      }
      
      .pm-result-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 24px;
        background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
        border-bottom: 1px solid #e9d5ff;
        
        .pm-result-title {
          display: flex;
          align-items: center;
          gap: 8px;
          font-size: 18px;
          font-weight: 600;
          color: #7c3aed;
          
          .el-icon {
            font-size: 20px;
          }
        }
      }
      
      .pm-result-section {
        padding: 20px 24px;
        border-bottom: 1px solid #f3f4f6;
        
        &:last-of-type {
          border-bottom: none;
        }
        
        .pm-result-section-title {
          display: flex;
          align-items: center;
          gap: 8px;
          font-size: 15px;
          font-weight: 600;
          color: #374151;
          margin-bottom: 16px;
          
          .el-icon {
            color: #8b5cf6;
          }
          
          .pm-section-tip {
            font-size: 12px;
            font-weight: normal;
            color: #9ca3af;
          }
        }
        
        .pm-result-form {
          .el-form-item {
            margin-bottom: 16px;
          }
        }
        
        .pm-result-score-table {
          .pm-score-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px dashed #e5e7eb;
            
            .pm-score-total {
              display: flex;
              align-items: center;
              gap: 16px;
              font-size: 13px;
              color: #6b7280;
              
              .total-item {
                strong {
                  font-size: 15px;
                  margin-left: 4px;
                  
                  &.our {
                    color: #8b5cf6;
                  }
                  
                  &.winner {
                    color: #059669;
                  }
                }
              }
            }
          }
        }
        
        .pm-result-upload {
          .el-upload-dragger {
            padding: 20px;
          }
        }
        
        .pm-result-remarks {
          .el-textarea__inner {
            font-size: 14px;
          }
        }
      }
      
      .pm-result-actions {
        display: flex;
        justify-content: center;
        gap: 16px;
        padding: 20px 24px;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb;
      }
      
      .pm-result-ai-report {
        margin: 20px 24px;
        padding: 20px;
        background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
        border: 1px solid #86efac;
        border-radius: 12px;
        
        .pm-ai-report-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 20px;
          padding-bottom: 16px;
          border-bottom: 1px solid #86efac;
          
          h4 {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0;
            font-size: 16px;
            font-weight: 600;
            color: #166534;
            
            .el-icon {
              color: #22c55e;
            }
          }
          
          .pm-report-time {
            font-size: 12px;
            color: #6b7280;
          }
        }
        
        .pm-ai-report-section {
          margin-bottom: 20px;
          
          &:last-of-type {
            margin-bottom: 0;
          }
          
          .pm-report-subtitle {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 12px;
          }
          
          .pm-report-summary {
            font-size: 14px;
            color: #374151;
            line-height: 1.6;
            margin: 0;
            padding: 12px;
            background: rgba(255, 255, 255, 0.6);
            border-radius: 8px;
          }
          
          .pm-report-reasons {
            .pm-reason-item {
              padding: 12px;
              background: rgba(255, 255, 255, 0.6);
              border-radius: 8px;
              margin-bottom: 8px;
              
              &:last-child {
                margin-bottom: 0;
              }
              
              .pm-reason-title {
                display: flex;
                align-items: center;
                gap: 8px;
                font-weight: 600;
                color: #374151;
                margin-bottom: 4px;
              }
              
              .pm-reason-content {
                margin: 0;
                font-size: 13px;
                color: #6b7280;
                line-height: 1.5;
              }
            }
          }
          
          .pm-report-suggestions {
            margin: 0;
            padding-left: 20px;
            
            li {
              font-size: 14px;
              color: #374151;
              line-height: 1.8;
            }
          }
        }
        
        .pm-ai-report-actions {
          display: flex;
          justify-content: flex-end;
          gap: 8px;
          margin-top: 16px;
          padding-top: 16px;
          border-top: 1px dashed #86efac;
        }
      }
    }
    
    // ========== 撰写招标文件样式 ==========
    .pm-write-container {
      padding: 20px;
      background: #fff;
      border-radius: 12px;
      border: 1px solid #e5e7eb;
      
      // 类型选择界面
      .pm-write-type-selection {
        .pm-write-type-header {
          text-align: center;
          margin-bottom: 32px;
          
          h4 {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
            margin: 0 0 8px 0;
            
            .el-icon { color: #8b5cf6; }
          }
          
          p {
            font-size: 14px;
            color: #6b7280;
            margin: 0;
          }
        }
        
        .pm-write-type-cards {
          display: flex;
          gap: 24px;
          justify-content: center;
          
          .pm-write-type-card {
            width: 320px;
            padding: 24px;
            background: #fff;
            border: 2px solid #e5e7eb;
            border-radius: 16px;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
            
            &:hover {
              border-color: #8b5cf6;
              box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
              transform: translateY(-4px);
            }
            
            .pm-type-icon {
              width: 64px;
              height: 64px;
              border-radius: 16px;
              display: flex;
              align-items: center;
              justify-content: center;
              margin: 0 auto 16px;
              
              .el-icon { font-size: 28px; color: #fff; }
              
              &.business { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
              &.technical { background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%); }
            }
            
            h5 {
              font-size: 18px;
              font-weight: 600;
              color: #1f2937;
              margin: 0 0 8px 0;
            }
            
            > p {
              font-size: 13px;
              color: #6b7280;
              margin: 0 0 16px 0;
              line-height: 1.5;
            }
            
            .pm-type-steps {
              display: flex;
              align-items: center;
              justify-content: center;
              gap: 6px;
              font-size: 12px;
              color: #9ca3af;
              flex-wrap: wrap;
              
              .el-icon { font-size: 10px; }
            }
          }
        }
      }
      
      // 编写流程界面
      .pm-write-workflow {
        .pm-write-header {
          display: flex;
          align-items: center;
          justify-content: center;
          position: relative;
          margin-bottom: 20px;
          padding-bottom: 16px;
          border-bottom: 1px solid #e5e7eb;
          
          .pm-write-type-badge {
            position: absolute;
            left: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            
            .el-icon { font-size: 18px; }
            
            &.business {
              background: #fef3c7;
              color: #d97706;
            }
            
            &.technical {
              background: #ede9fe;
              color: #7c3aed;
            }
          }
          
          .pm-write-progress-nodes {
            display: flex;
            align-items: center;
            
            .pm-write-node {
              display: flex;
              align-items: center;
              position: relative;
              
              .pm-node-dot {
                width: 28px;
                height: 28px;
                border-radius: 50%;
                background: #e5e7eb;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 12px;
                font-weight: 600;
                color: #9ca3af;
                transition: all 0.3s;
              }
              
              .pm-node-text {
                margin-left: 8px;
                font-size: 13px;
                color: #6b7280;
                white-space: nowrap;
              }
              
              .pm-node-line {
                width: 40px;
                height: 2px;
                background: #e5e7eb;
                margin: 0 8px;
              }
              
              &.active {
                .pm-node-dot {
                  background: #8b5cf6;
                  color: #fff;
                }
                .pm-node-text { color: #8b5cf6; font-weight: 500; }
              }
              
              &.completed {
                .pm-node-dot {
                  background: #10b981;
                  color: #fff;
                }
                .pm-node-line { background: #10b981; }
                .pm-node-text { color: #10b981; }
              }
              
              &.clickable { cursor: pointer; }
            }
          }
        }
        
        // 三分栏布局
        .pm-write-three-column {
          display: flex;
          gap: 16px;
          height: calc(100vh - 280px);
          min-height: 600px;
          
          .pm-column-left {
            width: 20%;
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            
            .pm-column-header {
              padding: 16px;
              border-bottom: 1px solid #e5e7eb;
              
              h5 {
                margin: 0;
                font-size: 15px;
                font-weight: 600;
                color: #1f2937;
                display: flex;
                align-items: center;
                gap: 8px;
                
                .el-icon { color: #8b5cf6; }
              }
            }
            
            .pm-outline-nav {
              flex: 1;
              overflow-y: auto;
              padding: 12px;
              
              .el-tree {
                background: transparent;
                
                .el-tree-node__content {
                  height: 36px;
                  border-radius: 6px;
                  
                  &:hover {
                    background: #f3f4f6;
                  }
                }
                
                .el-tree-node.is-current > .el-tree-node__content {
                  background: #ede9fe;
                  color: #7c3aed;
                }
              }
              
              .pm-outline-nav-item {
                font-size: 13px;
                
                &.active {
                  color: #7c3aed;
                  font-weight: 500;
                }
              }
            }
          }
          
          .pm-column-middle {
            width: 40%;
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            
            .pm-column-header {
              padding: 12px 16px;
              border-bottom: 1px solid #e5e7eb;
              display: flex;
              justify-content: space-between;
              align-items: center;
              
              h5 {
                margin: 0;
                font-size: 15px;
                font-weight: 600;
                color: #1f2937;
                display: flex;
                align-items: center;
                gap: 8px;
                
                .el-icon { color: #8b5cf6; }
              }
              
              .pm-editor-toolbar {
                display: flex;
                align-items: center;
                gap: 8px;
              }
            }
            
            .pm-editor-content {
              flex: 1;
              overflow-y: auto;
              padding: 20px;
              background: #f9fafb;
              
              .pm-document-paper {
                background: #fff;
                min-height: 100%;
                padding: 40px;
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
                border-radius: 4px;
                
                .pm-document-title {
                  font-size: 22px;
                  font-weight: bold;
                  text-align: center;
                  margin-bottom: 30px;
                  padding: 8px;
                  border: 1px dashed transparent;
                  outline: none;
                  
                  &:hover {
                    border-color: #d1d5db;
                  }
                  
                  &:focus {
                    border-color: #8b5cf6;
                    background: #faf5ff;
                  }
                }
                
                .pm-document-body {
                  line-height: 1.8;
                  white-space: pre-wrap;
                  padding: 8px;
                  border: 1px dashed transparent;
                  outline: none;
                  min-height: 300px;
                  
                  &:hover {
                    border-color: #d1d5db;
                  }
                  
                  &:focus {
                    border-color: #8b5cf6;
                    background: #faf5ff;
                  }
                }
              }
            }
            
            .pm-editor-footer {
              padding: 12px 16px;
              border-top: 1px solid #e5e7eb;
              display: flex;
              justify-content: flex-end;
              gap: 12px;
            }
          }
          
          .pm-column-right {
            width: 40%;
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            
            .pm-column-header {
              padding: 16px;
              border-bottom: 1px solid #e5e7eb;
              
              h5 {
                margin: 0;
                font-size: 15px;
                font-weight: 600;
                color: #1f2937;
                display: flex;
                align-items: center;
                gap: 8px;
                
                .el-icon { color: #8b5cf6; }
              }
            }
            
            .pm-ai-chat {
              flex: 1;
              display: flex;
              flex-direction: column;
              overflow: hidden;
              
              .pm-chat-messages {
                flex: 1;
                overflow-y: auto;
                padding: 16px;
                
                .pm-chat-message {
                  display: flex;
                  gap: 12px;
                  margin-bottom: 16px;
                  
                  .pm-message-avatar {
                    width: 36px;
                    height: 36px;
                    border-radius: 50%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    flex-shrink: 0;
                    
                    .el-icon {
                      font-size: 18px;
                    }
                  }
                  
                  .pm-message-content {
                    flex: 1;
                    
                    .pm-message-text {
                      padding: 12px 16px;
                      border-radius: 12px;
                      font-size: 14px;
                      line-height: 1.6;
                    }
                    
                    .pm-message-time {
                      font-size: 11px;
                      color: #9ca3af;
                      margin-top: 4px;
                      padding-left: 4px;
                    }
                  }
                  
                  &.assistant {
                    .pm-message-avatar {
                      background: linear-gradient(135deg, #8b5cf6, #6366f1);
                      color: #fff;
                    }
                    
                    .pm-message-text {
                      background: #f3f4f6;
                      color: #374151;
                    }
                  }
                  
                  &.user {
                    flex-direction: row-reverse;
                    
                    .pm-message-avatar {
                      background: #e0e7ff;
                      color: #4f46e5;
                    }
                    
                    .pm-message-content {
                      text-align: right;
                    }
                    
                    .pm-message-text {
                      background: #8b5cf6;
                      color: #fff;
                      display: inline-block;
                    }
                  }
                  
                  .pm-typing {
                    display: flex;
                    gap: 4px;
                    padding: 16px !important;
                    
                    span {
                      width: 8px;
                      height: 8px;
                      background: #9ca3af;
                      border-radius: 50%;
                      animation: typing 1.4s infinite;
                      
                      &:nth-child(2) { animation-delay: 0.2s; }
                      &:nth-child(3) { animation-delay: 0.4s; }
                    }
                  }
                }
              }
              
              .pm-chat-input {
                padding: 16px;
                border-top: 1px solid #e5e7eb;
                
                .el-textarea__inner {
                  resize: none;
                }
                
                .pm-chat-actions {
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                  margin-top: 12px;
                  
                  .pm-chat-tip {
                    font-size: 12px;
                    color: #9ca3af;
                  }
                }
              }
            }
          }
        }
        
        @keyframes typing {
          0%, 60%, 100% { transform: translateY(0); }
          30% { transform: translateY(-6px); }
        }
        
        .pm-write-content {
          .pm-write-step-content {
            .pm-write-body {
              display: flex;
              gap: 20px;
              height: 600px;
              
              .pm-write-left {
                flex: 1;
                background: #fff;
                border: 1px solid #e5e7eb;
                border-radius: 12px;
                display: flex;
                flex-direction: column;
                overflow: hidden;
                
                .pm-outline-header {
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                  padding: 12px 16px;
                  background: #f9fafb;
                  border-bottom: 1px solid #e5e7eb;
                  
                  h5 {
                    display: flex;
                    align-items: center;
                    gap: 8px;
                    margin: 0;
                    font-size: 14px;
                    font-weight: 600;
                    color: #374151;
                    
                    .el-icon { color: #8b5cf6; }
                  }
                  
                  .pm-outline-actions {
                    display: flex;
                    gap: 8px;
                  }
                }
                
                .pm-outline-tree {
                  flex: 1;
                  overflow-y: auto;
                  padding: 16px;
                  
                  .pm-outline-node {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    width: 100%;
                    padding: 4px 0;
                    
                    .pm-outline-title {
                      font-size: 13px;
                      color: #374151;
                    }
                    
                    .pm-outline-node-actions {
                      display: none;
                    }
                    
                    &:hover .pm-outline-node-actions {
                      display: flex;
                      gap: 4px;
                    }
                  }
                }
              }
              
              .pm-write-right {
                width: 400px;
                flex-shrink: 0;
                background: #fff;
                border: 1px solid #e5e7eb;
                border-radius: 12px;
                display: flex;
                flex-direction: column;
                overflow: hidden;
              }
            }
            
            .pm-write-step-footer {
              display: flex;
              justify-content: flex-end;
              gap: 12px;
              padding-top: 16px;
              margin-top: 16px;
              border-top: 1px solid #e5e7eb;
            }
          }
          
          // 材料智能匹配填充
          .pm-material-match-container {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            padding: 24px;
            
            .pm-material-header {
              margin-bottom: 20px;
              padding-bottom: 16px;
              border-bottom: 1px solid #e5e7eb;
              
              h4 {
                display: flex;
                align-items: center;
                gap: 8px;
                font-size: 18px;
                font-weight: 600;
                color: #7c3aed;
                margin: 0 0 8px 0;
                
                .el-icon { color: #7c3aed; }
              }
              
              p {
                font-size: 13px;
                color: #6b7280;
                margin: 0;
              }
            }
            
            .pm-material-filter {
              display: flex;
              align-items: center;
              gap: 16px;
              padding: 16px;
              background: #f9fafb;
              border-radius: 8px;
              margin-bottom: 20px;
              
              .pm-filter-label {
                display: flex;
                align-items: center;
                gap: 6px;
                font-size: 13px;
                color: #374151;
                white-space: nowrap;
                
                .el-icon { color: #6b7280; }
              }
              
              .pm-filter-controls {
                display: flex;
                align-items: center;
                gap: 12px;
                flex-wrap: wrap;
              }
            }
            
            .pm-material-list {
              .pm-material-item {
                border: 1px solid #e5e7eb;
                border-radius: 8px;
                margin-bottom: 16px;
                overflow: hidden;
                
                &:last-child { margin-bottom: 0; }
                
                .pm-material-item-header {
                  display: flex;
                  align-items: center;
                  justify-content: space-between;
                  padding: 12px 16px;
                  background: #f9fafb;
                  border-bottom: 1px solid #e5e7eb;
                  
                  .pm-material-title {
                    font-size: 14px;
                    font-weight: 600;
                    color: #7c3aed;
                  }
                  
                  .pm-material-actions {
                    display: flex;
                    gap: 8px;
                  }
                }
                
                .pm-material-item-content {
                  padding: 16px;
                  min-height: 60px;
                  
                  .pm-material-empty {
                    color: #9ca3af;
                    font-size: 13px;
                    text-align: center;
                  }
                  
                  .pm-material-files {
                    display: flex;
                    flex-wrap: wrap;
                    gap: 8px;
                    
                    .pm-file-tag {
                      display: flex;
                      align-items: center;
                      gap: 6px;
                      padding: 6px 12px;
                      background: #ede9fe;
                      color: #7c3aed;
                      border-radius: 4px;
                      font-size: 13px;
                      
                      .pm-file-tag-content {
                        display: flex;
                        align-items: center;
                        gap: 6px;
                        cursor: pointer;
                        
                        &:hover {
                          text-decoration: underline;
                        }
                      }
                      
                      .pm-file-close {
                        cursor: pointer;
                        opacity: 0.6;
                        transition: opacity 0.2s;
                        
                        &:hover { opacity: 1; }
                      }
                    }
                  }
                }
              }
            }
          }
          
          .pm-footer-between {
            justify-content: space-between !important;
          }
          
          // 添加文件弹窗样式
          .pm-dialog-header {
            span {
              font-weight: 600;
            }
            
            .pm-dialog-subtitle {
              font-weight: 400;
              color: #6b7280;
              margin-left: 8px;
            }
          }
          
          .pm-add-file-content {
            .pm-file-upload-area {
              margin-bottom: 16px;
              
              .pm-upload-icon {
                font-size: 40px;
                color: #8b5cf6;
              }
              
              .pm-upload-text {
                font-size: 14px;
                color: #374151;
                margin-top: 8px;
                
                .pm-upload-link {
                  color: #8b5cf6;
                  cursor: pointer;
                }
              }
              
              .pm-upload-tip {
                font-size: 12px;
                color: #9ca3af;
                margin-top: 4px;
              }
            }
            
            .pm-file-filter {
              display: flex;
              align-items: center;
              gap: 12px;
              margin-bottom: 16px;
              padding: 12px;
              background: #f9fafb;
              border-radius: 8px;
            }
            
            .pm-file-name-cell {
              display: flex;
              align-items: center;
              gap: 8px;
              
              .el-icon { color: #6b7280; }
            }
          }
          
          // 文件预览弹窗
          .pm-file-preview-content {
            .pm-preview-meta {
              display: flex;
              align-items: center;
              gap: 16px;
              padding-bottom: 16px;
              border-bottom: 1px solid #e5e7eb;
              margin-bottom: 20px;
              font-size: 13px;
              color: #6b7280;
            }
            
            .pm-preview-details {
              padding: 20px;
              background: #fef2f2;
              border: 1px solid #fecaca;
              border-radius: 8px;
              
              .pm-preview-icon {
                text-align: center;
                margin-bottom: 12px;
              }
              
              .pm-preview-info-list {
                margin-top: 16px;
                
                .pm-preview-info-item {
                  display: flex;
                  padding: 8px 0;
                  border-bottom: 1px dashed #fecaca;
                  
                  &:last-child { border-bottom: none; }
                  
                  .pm-info-label {
                    font-weight: 500;
                    color: #374151;
                    min-width: 140px;
                  }
                  
                  .pm-info-value {
                    color: #1f2937;
                  }
                }
              }
            }
            
            .pm-preview-placeholder {
              text-align: center;
              padding: 40px;
              
              p {
                margin: 12px 0 0;
                color: #374151;
                font-size: 14px;
              }
              
              .pm-preview-tip {
                color: #9ca3af;
                font-size: 12px;
              }
            }
          }
          
          // 技术项生成
          .pm-tech-gen-container {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            padding: 24px;
            
            .pm-tech-gen-header {
              margin-bottom: 20px;
              
              h5 {
                display: flex;
                align-items: center;
                gap: 8px;
                font-size: 16px;
                font-weight: 600;
                color: #1f2937;
                margin: 0 0 8px 0;
                
                .el-icon { color: #8b5cf6; }
              }
              
              p {
                font-size: 13px;
                color: #6b7280;
                margin: 0;
              }
            }
            
            .pm-tech-sections {
              .pm-tech-section {
                padding: 16px;
                background: #f9fafb;
                border-radius: 8px;
                margin-bottom: 12px;
                
                &:last-child { margin-bottom: 0; }
                
                .pm-tech-section-header {
                  display: flex;
                  align-items: center;
                  justify-content: space-between;
                  margin-bottom: 8px;
                  
                  .pm-tech-section-title {
                    font-size: 14px;
                    font-weight: 500;
                    color: #374151;
                  }
                }
              }
            }
          }
          
          // 标书样式
          .pm-style-container {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            padding: 24px;
            
            .pm-style-header {
              margin-bottom: 24px;
              
              h5 {
                display: flex;
                align-items: center;
                gap: 8px;
                font-size: 16px;
                font-weight: 600;
                color: #1f2937;
                margin: 0 0 8px 0;
                
                .el-icon { color: #8b5cf6; }
              }
              
              p {
                font-size: 13px;
                color: #6b7280;
                margin: 0;
              }
            }
            
            .pm-style-section {
              margin-bottom: 24px;
              
              &:last-child { margin-bottom: 0; }
              
              .pm-style-section-header {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 12px;
                
                .pm-style-section-title {
                  font-size: 15px;
                  font-weight: 600;
                  color: #374151;
                }
              }
              
              .pm-style-table {
                :deep(.el-table) {
                  font-size: 13px;
                }
                
                .el-input, .el-select {
                  width: 100%;
                }
              }
            }
          }
          
          // 标书生成
          .pm-generate-container {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            padding: 24px;
            
            .pm-generate-header {
              margin-bottom: 24px;
              
              h5 {
                display: flex;
                align-items: center;
                gap: 8px;
                font-size: 16px;
                font-weight: 600;
                color: #1f2937;
                margin: 0 0 8px 0;
                
                .el-icon { color: #8b5cf6; }
              }
              
              p {
                font-size: 13px;
                color: #6b7280;
                margin: 0;
              }
            }
            
            .pm-generate-preview {
              display: flex;
              align-items: center;
              justify-content: space-between;
              padding: 20px;
              background: #f9fafb;
              border-radius: 8px;
              
              .pm-generate-doc {
                display: flex;
                align-items: center;
                gap: 16px;
                
                .pm-doc-icon {
                  font-size: 48px;
                  color: #3b82f6;
                }
                
                .pm-doc-info {
                  display: flex;
                  flex-direction: column;
                  gap: 4px;
                  
                  .pm-doc-name {
                    font-size: 15px;
                    font-weight: 500;
                    color: #1f2937;
                  }
                  
                  .pm-doc-size {
                    font-size: 12px;
                    color: #6b7280;
                  }
                }
              }
              
              .pm-generate-actions {
                display: flex;
                gap: 12px;
              }
            }
          }
        }
      }
    }
  }
}

.pm-project-list {
  margin-top: 20px;
  
  .project-name-link {
    color: #8b5cf6;
    cursor: pointer;
    font-weight: 500;
    
    &:hover {
      color: #7c3aed;
      text-decoration: underline;
    }
  }
}

.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.project-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  
  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: #7c3aed;
  }
  
  &.completed {
    border-color: #d1d5db;
    
    &:hover {
      border-color: #10b981;
    }
  }
}

.project-card-header {
  margin-bottom: 16px;
  
  .project-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    
    h4 {
      margin: 0;
      font-size: 16px;
      font-weight: 600;
      color: #1f2937;
      flex: 1;
      margin-right: 12px;
    }
  }
  
  .project-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    
    .meta-item {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      color: #6b7280;
      
      .el-icon {
        font-size: 14px;
      }
    }
  }
}

.project-progress-bar {
  .progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #6b7280;
  }
}

.project-result {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
  
  .result-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    
    .bid-amount {
      font-size: 14px;
      font-weight: 600;
      color: #10b981;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    
    .fail-reason {
      font-size: 13px;
      color: #ef4444;
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 6px 10px;
      background: #fef2f2;
      border-radius: 6px;
      border: 1px solid #fecaca;
      
      .el-icon {
        font-size: 14px;
      }
    }
  }
}

.project-detail {
  .detail-header {
    margin-bottom: 24px;
  }
  
  .detail-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
  }
  
  .detail-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f3f4f6;
    
    h2 {
      margin: 0;
      font-size: 24px;
      font-weight: 600;
      color: #1f2937;
    }
  }
  
  .detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    
    .info-item {
      display: flex;
      align-items: center;
      gap: 8px;
      
      &.full-width {
        grid-column: 1 / -1;
      }
      
      .info-label {
        font-size: 14px;
        color: #6b7280;
        font-weight: 500;
      }
      
      .info-value {
        font-size: 14px;
        color: #1f2937;
        
        &.bid-amount-highlight {
          font-size: 16px;
          font-weight: 600;
          color: #10b981;
        }
        
        &.fail-reason-highlight {
          display: flex;
          align-items: center;
          gap: 6px;
          color: #ef4444;
          font-weight: 500;
          padding: 8px 12px;
          background: #fef2f2;
          border-radius: 6px;
          border: 1px solid #fecaca;
          
          .el-icon {
            font-size: 16px;
          }
        }
      }
    }
  }
  
  .project-timeline {
    h3 {
      font-size: 18px;
      font-weight: 600;
      color: #1f2937;
      margin-bottom: 24px;
    }
    
    :deep(.el-steps) {
      margin-top: 20px;
    }
  }
  
  .progress-actions {
    margin-top: 32px;
    
    h3 {
      font-size: 18px;
      font-weight: 600;
      color: #1f2937;
      margin-bottom: 20px;
    }
    
    .action-cards {
      display: grid;
      gap: 16px;
    }
    
    .action-card {
      background: #fff;
      border: 2px solid #e5e7eb;
      border-radius: 12px;
      padding: 16px;
      transition: all 0.3s;
      
      &.active {
        border-color: #7c3aed;
        background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
      }
      
      &.completed {
        border-color: #d1fae5;
        background: #f0fdf4;
      }
      
      .action-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
        
        .action-title {
          display: flex;
          align-items: center;
          gap: 10px;
          font-size: 16px;
          font-weight: 600;
          color: #1f2937;
          
          .el-icon {
            font-size: 20px;
            
            &.rotating {
              animation: rotating 2s linear infinite;
            }
          }
        }
      }
      
      .action-card-body {
        .action-desc {
          color: #6b7280;
          font-size: 14px;
          margin-bottom: 12px;
        }
        
        .action-buttons {
          display: flex;
          gap: 8px;
          flex-wrap: wrap;
        }
      }
    }
  }
}

@keyframes rotating {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

// 图纸识别样式
.drawing-workspace {
  display: flex;
  gap: 24px;
  margin-top: 24px;
  
  .drawing-preview {
    flex: 2;
    background: #f9fafb;
    border-radius: 12px;
    padding: 24px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    .empty-state {
      text-align: center;
      color: #9ca3af;
      
      .empty-icon {
        font-size: 64px;
        margin-bottom: 16px;
      }
    }
    
    .drawing-viewer {
      width: 100%;
      position: relative;
      
      img {
        width: 100%;
        border-radius: 8px;
      }
      
      .drawing-tools {
        position: absolute;
        top: 16px;
        right: 16px;
      }
    }
  }
  
  .drawing-info {
    flex: 1;
    
    h4 {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 16px;
      color: #1f2937;
    }
    
    .info-list {
      .info-item {
        margin-bottom: 16px;
        
        .label {
          font-size: 14px;
          color: #6b7280;
          display: block;
          margin-bottom: 4px;
        }
        
        .value {
          font-size: 14px;
          color: #1f2937;
          font-weight: 500;
        }
        
        .tags {
          display: flex;
          flex-wrap: wrap;
          gap: 8px;
          margin-top: 8px;
        }
      }
    }
  }
}

// 格式统一样式
.format-settings {
  background: #f9fafb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.file-list-panel {
  h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
  }
}

// 索引生成样式
.index-config {
  background: #f9fafb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.index-preview {
  h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
  }
  
  .index-tree {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    
    .index-item {
      display: flex;
      align-items: center;
      padding: 8px 0;
      font-size: 14px;
      
      .index-title {
        color: #1f2937;
      }
      
      .index-dots {
        flex: 1;
        border-bottom: 1px dotted #d1d5db;
        margin: 0 12px;
      }
      
      .index-page {
        color: #6b7280;
      }
    }
  }
}

// 完整性检查样式
.check-details {
  margin-top: 24px;
  
  .check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    
    span {
      flex: 1;
      font-size: 14px;
      color: #1f2937;
    }
  }
}

// 评分模拟样式
.score-overview {
  .total-score {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: #fff;
    margin-bottom: 32px;
    
    .score-circle {
      display: flex;
      align-items: baseline;
      justify-content: center;
      margin-bottom: 16px;
      
      .score-value {
        font-size: 72px;
        font-weight: 700;
      }
      
      .score-max {
        font-size: 32px;
        opacity: 0.8;
        margin-left: 8px;
      }
    }
    
    .score-label {
      font-size: 18px;
      margin-bottom: 16px;
      opacity: 0.9;
    }
  }
  
  .score-breakdown {
    display: grid;
    gap: 24px;
    
    .score-category {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      padding: 20px;
      
      .category-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        
        .category-name {
          font-size: 16px;
          font-weight: 600;
          color: #1f2937;
        }
        
        .category-score {
          font-size: 18px;
          font-weight: 600;
          color: #7c3aed;
        }
      }
      
      .category-items {
        margin-top: 16px;
        
        .score-item {
          display: flex;
          justify-content: space-between;
          padding: 8px 0;
          font-size: 14px;
          border-bottom: 1px solid #f3f4f6;
          
          &:last-child {
            border-bottom: none;
          }
          
          .item-name {
            color: #6b7280;
          }
          
          .item-score {
            color: #1f2937;
            font-weight: 500;
          }
        }
      }
    }
  }
}

.improvement-suggestions {
  margin-top: 32px;
  
  h4 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
  }
  
  .suggestion-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    margin-bottom: 12px;
    
    .suggestion-content {
      flex: 1;
      
      .suggestion-title {
        font-size: 15px;
        font-weight: 600;
        color: #92400e;
        margin-bottom: 4px;
      }
      
      .suggestion-desc {
        font-size: 14px;
        color: #78350f;
        margin-bottom: 8px;
      }
      
      .suggestion-impact {
        font-size: 13px;
        color: #10b981;
        font-weight: 600;
      }
    }
  }
}

// 技术参数解析样式
.tech-params-result {
  margin-top: 24px;
}

// 文件智能识别样式 - 全宽布局
.file-recognition-empty {
  margin-top: 24px;
  
  .upload-card-full {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    
    .upload-dragger {
      width: 100%;
      
      :deep(.el-upload) {
        width: 100%;
        border: none;
      }
      
      :deep(.el-upload-dragger) {
        width: 100%;
        height: auto;
        min-height: 200px;
        border: 2px dashed #d1d5db;
        border-radius: 12px;
        background: #fafbfc;
        padding: 40px 24px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transition: all 0.3s;
        
        &:hover {
          border-color: #8b5cf6;
          background: #f5f3ff;
        }
      }
    }
    
    .upload-icon-area {
      margin-bottom: 16px;
    }
    
    .upload-title {
      font-size: 16px;
      font-weight: 500;
      color: #1f2937;
      margin: 0 0 8px 0;
      text-align: center;
    }
    
    .upload-hint {
      font-size: 13px;
      color: #6b7280;
      margin: 0;
      text-align: center;
      line-height: 1.5;
    }
    
    .selected-file-info {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      margin-top: 20px;
      padding: 12px 16px;
      background: #f5f3ff;
      border: 1px solid #c4b5fd;
      border-radius: 8px;
      
      .file-name {
        flex: 1;
        font-size: 14px;
        color: #374151;
        font-weight: 500;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
    
    .analyze-btn {
      width: 100%;
      height: 48px;
      margin-top: 24px;
      font-size: 16px;
      font-weight: 500;
      border-radius: 10px;
      background: linear-gradient(135deg, #8b5cf6, #7c3aed);
      border-color: #8b5cf6;
      
      &:hover:not(:disabled) {
        background: linear-gradient(135deg, #7c3aed, #6d28d9);
        border-color: #7c3aed;
      }
      
      &:disabled {
        background: #d1d5db;
        border-color: #d1d5db;
      }
    }
  }
}

// 旧样式保留兼容
.upload-area-container {
  margin-top: 24px;
  
  .full-upload {
    width: 100%;
    
    :deep(.el-upload) {
      width: 100%;
      border: none;
    }
    
    :deep(.el-upload-dragger) {
      width: 100%;
      height: 400px;
      border: 2px dashed #d1d5db;
      border-radius: 16px;
      background: #fafafa;
      transition: all 0.3s;
      
      &:hover {
        border-color: #7c3aed;
        background: #f5f3ff;
      }
    }
  }
  
  .upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    
    .upload-plus-icon {
      font-size: 80px;
      color: #7c3aed;
      margin-bottom: 24px;
    }
    
    .upload-title {
      font-size: 20px;
      font-weight: 600;
      color: #1f2937;
      margin: 0 0 12px 0;
    }
    
    .upload-hint {
      font-size: 14px;
      color: #6b7280;
      margin: 0;
    }
  }
}

.file-recognition-layout {
  display: flex;
  gap: 24px;
  margin-top: 24px;
  height: calc(100vh - 250px);
  
  .extraction-panel {
    flex: 1;
    overflow-y: auto;
    
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      padding-bottom: 8px;
      border-bottom: 1px solid #e5e7eb;
      
      h4 {
        font-size: 14px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
      }
      
      .recognition-status {
        display: flex;
        align-items: center;
        gap: 3px;
        font-size: 11px;
        color: #10b981;
        font-weight: 500;
        
        .el-icon {
          font-size: 13px;
        }
      }
    }
    
    .info-section {
      margin-bottom: 16px;
      
      .section-title {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 13px;
        font-weight: 600;
        color: #374151;
        margin-bottom: 8px;
        padding: 6px 10px;
        background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
        border-radius: 5px;
        
        .el-icon {
          font-size: 14px;
          color: #7c3aed;
        }
      }
    }
    
    // 缩小表格字体和间距
    :deep(.el-table) {
      font-size: 12px;
      
      th {
        font-size: 12px;
        padding: 6px 0;
        font-weight: 600;
      }
      
      td {
        padding: 6px 0;
      }
      
      .cell {
        padding: 0 8px;
        line-height: 1.4;
      }
    }
  }
  
  .preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    
    .preview-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      background: #fff;
      border-bottom: 1px solid #e5e7eb;
      
      h4 {
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
      }
    }
    
    .preview-content {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      transform-origin: top left;
      transition: transform 0.2s;
      
      .file-info-bar {
        display: flex;
        justify-content: space-between;
        padding: 12px 16px;
        background: #fff;
        border-radius: 8px;
        margin-bottom: 16px;
        font-size: 14px;
        color: #6b7280;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      }
      
      .preview-pages {
        .preview-page {
          background: #fff;
          border-radius: 8px;
          padding: 24px;
          margin-bottom: 16px;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
          
          .page-number {
            font-size: 12px;
            color: #9ca3af;
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 1px solid #f3f4f6;
          }
          
          .page-content {
            .preview-text {
              font-size: 14px;
              line-height: 1.8;
              color: #374151;
              white-space: pre-wrap;
              word-wrap: break-word;
            }
          }
        }
      }
    }
  }
}

// 标书生成向导样式
.bid-generation-wizard {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  margin-top: 20px;
  
  .wizard-header {
    background: #fff;
    padding: 16px 24px;
    border-radius: 12px 12px 0 0;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    
    .back-btn {
      margin-bottom: 12px;
      color: #6b7280;
      
      &:hover {
        color: #3b82f6;
      }
    }
    
    .wizard-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 18px;
      font-weight: 600;
      color: #1f2937;
      margin-bottom: 16px;
    }
    
    .wizard-steps {
      max-width: 600px;
      margin: 0 auto;
    }
  }
  
  .wizard-content {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-bottom: none;
    padding: 24px;
    overflow-y: auto;
  }
  
  .wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 16px 24px;
    border-radius: 0 0 12px 12px;
    border: 1px solid #e5e7eb;
    border-top: none;
    
    .footer-right {
      display: flex;
      gap: 12px;
    }
  }
}

// 大纲生成 - 左右分栏布局
.outline-generation-layout {
  display: flex;
  gap: 20px;
  height: 100%;
  
  .outline-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    
    .outline-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      background: #f9fafb;
      border-bottom: 1px solid #e5e7eb;
      
      h4 {
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
      }
      
      .outline-actions {
        display: flex;
        gap: 12px;
      }
    }
    
    .outline-content {
      flex: 1;
      overflow-y: auto;
      padding: 16px;
      
      .outline-chapter {
        background: #fff;
        border-radius: 8px;
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        
        .chapter-header {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 12px 16px;
          background: #f9fafb;
          border-radius: 8px 8px 0 0;
          border-bottom: 1px solid #e5e7eb;
          
          .drag-handle {
            color: #9ca3af;
            cursor: grab;
          }
          
          .chapter-number {
            font-weight: 600;
            color: #3b82f6;
            min-width: 50px;
          }
        }
        
        .chapter-sections {
          padding: 12px 16px 12px 60px;
          
          .section-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 8px 0;
            border-bottom: 1px dashed #e5e7eb;
            
            &:last-of-type {
              border-bottom: none;
            }
            
            .section-number {
              font-size: 13px;
              color: #6b7280;
              min-width: 30px;
            }
          }
          
          .add-section-btn {
            margin-top: 8px;
            color: #3b82f6;
          }
        }
      }
    }
    
    .outline-empty {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 60px;
      
      p {
        margin-top: 16px;
        color: #9ca3af;
        font-size: 14px;
      }
    }
  }
  
  .source-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    
    .preview-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      background: #f9fafb;
      border-bottom: 1px solid #e5e7eb;
      
      h4 {
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
      }
    }
    
    .preview-body {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      
      .file-info-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        background: #f0f9ff;
        border-bottom: 1px solid #e5e7eb;
        font-size: 13px;
        color: #374151;
      }
      
      .preview-document-area {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        transform-origin: top left;
        
        .preview-page {
          background: #fff;
          border: 1px solid #e5e7eb;
          border-radius: 4px;
          margin-bottom: 16px;
          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
          
          .page-number {
            padding: 8px 12px;
            background: #f9fafb;
            border-bottom: 1px solid #e5e7eb;
            font-size: 12px;
            color: #6b7280;
          }
          
          .page-content {
            padding: 16px;
            
            .preview-text {
              font-size: 13px;
              line-height: 1.8;
              color: #374151;
              white-space: pre-wrap;
              word-wrap: break-word;
            }
          }
        }
      }
    }
  }
}

// 材料智能匹配填充
.material-matching {
  .matching-header {
    margin-bottom: 20px;
    
    h4 {
      font-size: 16px;
      font-weight: 600;
      color: #1f2937;
      margin: 0 0 8px 0;
    }
    
    .matching-desc {
      color: #6b7280;
      font-size: 14px;
      margin: 0;
    }
  }
  
  .filter-section {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    
    .filter-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      font-weight: 500;
      color: #374151;
      margin-bottom: 12px;
    }
    
    .filter-controls {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
  }
  
  .material-sections {
    .material-chapter {
      background: #fff;
      border-radius: 8px;
      margin-bottom: 16px;
      border: 1px solid #e5e7eb;
      overflow: hidden;
      
      .chapter-title-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 20px;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
        
        .chapter-title {
          font-size: 15px;
          font-weight: 600;
          color: #1f2937;
        }
        
        .chapter-actions {
          display: flex;
          gap: 8px;
        }
      }
      
      .matched-materials {
        padding: 12px 20px;
        
        .material-item {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 12px 16px;
          background: #f9fafb;
          border-radius: 6px;
          margin-bottom: 8px;
          transition: all 0.2s;
          border: 2px solid transparent;
          
          &:last-child {
            margin-bottom: 0;
          }
          
          &.applied {
            background: #f0fdf4;
            border-color: #22c55e;
          }
          
          .file-icon {
            font-size: 24px;
          }
          
          .material-info {
            flex: 1;
            
            .material-name {
              font-size: 14px;
              font-weight: 500;
              color: #1f2937;
              margin-bottom: 4px;
            }
            
            .material-meta {
              display: flex;
              align-items: center;
              gap: 12px;
              
              .match-score {
                font-size: 12px;
                color: #f59e0b;
                
                &.high {
                  color: #10b981;
                }
              }
            }
          }
          
          .material-actions {
            display: flex;
            gap: 8px;
          }
        }
      }
      
      .no-materials {
        padding: 24px 20px;
        text-align: center;
        color: #9ca3af;
        font-size: 14px;
      }
    }
  }
}

// 添加文件弹窗样式
.add-file-dialog {
  .dialog-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: #eff6ff;
    border-radius: 6px;
    border: 1px solid #93c5fd;
  }
  
  .file-upload-area {
    margin-bottom: 16px;
    
    :deep(.el-upload-dragger) {
      border: 2px dashed #d1d5db;
      border-radius: 8px;
      padding: 30px;
      
      &:hover {
        border-color: #8b5cf6;
      }
    }
    
    .upload-text {
      font-size: 14px;
      color: #374151;
      margin-top: 12px;
      
      em {
        color: #8b5cf6;
        font-style: normal;
        cursor: pointer;
      }
    }
    
    .upload-tip {
      font-size: 12px;
      color: #9ca3af;
      margin-top: 6px;
    }
  }
  
  .file-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
  }
  
  .file-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

// 预览文件弹窗样式
.file-preview-dialog {
  .preview-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #6b7280;
    
    .preview-tools {
      margin-left: auto;
      display: flex;
      gap: 8px;
    }
  }
  
  .preview-content-area {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    
    .preview-document-mock {
      text-align: center;
      padding: 30px;
      
      h3 {
        font-size: 18px;
        font-weight: 600;
        color: #ef4444;
        margin: 16px 0;
      }
      
      .mock-content {
        text-align: left;
        max-width: 400px;
        margin: 0 auto;
        
        p {
          font-size: 14px;
          color: #374151;
          margin: 8px 0;
          line-height: 1.6;
        }
      }
    }
  }
}

// 标书生成预览
.bid-generation {
  .generation-header {
    margin-bottom: 20px;
    
    h4 {
      font-size: 16px;
      font-weight: 600;
      color: #1f2937;
      margin: 0 0 8px 0;
    }
    
    .generation-desc {
      color: #6b7280;
      font-size: 14px;
      margin: 0;
    }
  }
  
  .generation-preview {
    display: flex;
    gap: 16px;
    height: 500px;
    
    .preview-sidebar {
      width: 240px;
      background: #fff;
      border-radius: 8px;
      border: 1px solid #e5e7eb;
      overflow: hidden;
      
      .sidebar-title {
        padding: 12px 16px;
        font-weight: 600;
        color: #374151;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
      }
      
      .toc-list {
        .toc-item {
          display: flex;
          align-items: center;
          gap: 8px;
          padding: 10px 16px;
          cursor: pointer;
          border-bottom: 1px solid #f3f4f6;
          transition: all 0.2s;
          
          &:hover {
            background: #f9fafb;
          }
          
          &.active {
            background: #eff6ff;
            color: #3b82f6;
          }
          
          .toc-number {
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #e5e7eb;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 600;
          }
          
          &.active .toc-number {
            background: #3b82f6;
            color: #fff;
          }
          
          .toc-title {
            flex: 1;
            font-size: 13px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
      }
    }
    
    .preview-main {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: #fff;
      border-radius: 8px;
      border: 1px solid #e5e7eb;
      overflow: hidden;
      
      .preview-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
      }
      
      .preview-document {
        flex: 1;
        padding: 24px;
        overflow-y: auto;
        
        .document-content {
          h2 {
            font-size: 18px;
            font-weight: 600;
            color: #1f2937;
            margin: 0 0 16px 0;
            padding-bottom: 12px;
            border-bottom: 2px solid #e5e7eb;
          }
          
          h3 {
            font-size: 15px;
            font-weight: 600;
            color: #374151;
            margin: 16px 0 8px 0;
          }
          
          h4 {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            margin: 12px 0 8px 0;
          }
          
          p {
            font-size: 14px;
            line-height: 1.8;
            color: #4b5563;
            margin: 0 0 12px 0;
          }
          
          ul {
            margin: 0 0 12px 0;
            padding-left: 20px;
            
            li {
              font-size: 14px;
              line-height: 1.8;
              color: #4b5563;
            }
          }
        }
        
        .content-placeholder {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          height: 200px;
          color: #9ca3af;
          
          p {
            margin-top: 12px;
            font-size: 14px;
          }
        }
      }
    }
  }
  
  .generation-progress {
    margin-top: 16px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    
    .progress-text {
      display: block;
      margin-top: 8px;
      font-size: 13px;
      color: #6b7280;
      text-align: center;
    }
  }
}

// 选择标书类型对话框样式
.bid-type-select {
  display: flex;
  gap: 20px;
  padding: 10px 0;
  
  .bid-type-card {
    flex: 1;
    padding: 24px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    
    &:hover {
      border-color: #93c5fd;
      background: #f0f9ff;
    }
    
    &.active {
      border-color: #3b82f6;
      background: #eff6ff;
      box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    }
    
    h4 {
      font-size: 16px;
      font-weight: 600;
      color: #1f2937;
      margin: 12px 0 8px;
    }
    
    p {
      font-size: 13px;
      color: #6b7280;
      margin: 0;
      line-height: 1.5;
    }
  }
}

// 新版招标信息提取面板样式
.extraction-panel-new {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  
  .extraction-tabs {
    display: flex;
    gap: 0;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
    
    .tab-item {
      padding: 14px 16px;
      font-size: 14px;
      color: #6b7280;
      cursor: pointer;
      white-space: nowrap;
      border-bottom: 2px solid transparent;
      transition: all 0.2s;
      
      &:hover {
        color: #3b82f6;
      }
      
      &.active {
        color: #3b82f6;
        border-bottom-color: #3b82f6;
        font-weight: 500;
      }
    }
  }
  
  .extraction-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
  }
  
  .tab-content {
    animation: fadeIn 0.3s ease;
  }
  
  // 信息提取表格区块
  .info-section-new {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    
    .section-title-new {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 15px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 16px;
      padding: 8px 12px;
      background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
      border-radius: 6px;
      
      .el-icon {
        font-size: 16px;
        color: #3b82f6;
      }
    }
    
    :deep(.el-table) {
      font-size: 13px;
      
      th {
        font-size: 13px;
        padding: 10px 0;
        font-weight: 600;
        background: #f9fafb;
      }
      
      td {
        padding: 10px 0;
      }
      
      .cell {
        padding: 0 12px;
        line-height: 1.5;
      }
    }
  }
  
  // 文件信息头部
  .file-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    
    .file-info-left {
      display: flex;
      align-items: center;
      gap: 12px;
      
      .file-icon-box {
        width: 48px;
        height: 48px;
        background: #eff6ff;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      
      .file-details {
        .file-name {
          font-size: 16px;
          font-weight: 600;
          color: #1f2937;
          margin-bottom: 4px;
        }
        
        .file-meta {
          font-size: 12px;
          color: #9ca3af;
        }
      }
    }
    
    .file-stats {
      display: flex;
      gap: 32px;
      
      .stat-item {
        text-align: center;
        
        .stat-value {
          font-size: 24px;
          font-weight: 700;
          color: #3b82f6;
        }
        
        .stat-label {
          font-size: 12px;
          color: #6b7280;
          margin-top: 2px;
        }
      }
    }
  }
  
  // 图表行
  .charts-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    
    .chart-card {
      flex: 1;
      background: #fff;
      border-radius: 10px;
      padding: 16px;
      border: 1px solid #e5e7eb;
      
      .card-title {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
        font-weight: 600;
        color: #1f2937;
        margin-bottom: 12px;
        
        .el-icon {
          color: #3b82f6;
        }
      }
      
      .pie-chart-placeholder {
        display: flex;
        align-items: center;
        gap: 20px;
        
        .pie-legend {
          .legend-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: #6b7280;
            margin-bottom: 8px;
            
            .dot {
              width: 10px;
              height: 10px;
              border-radius: 50%;
            }
          }
        }
        
        .pie-visual {
          width: 100px;
          height: 100px;
          
          svg {
            width: 100%;
            height: 100%;
          }
        }
      }
      
      .line-chart-hint {
        font-size: 11px;
        color: #3b82f6;
        background: #eff6ff;
        padding: 6px 10px;
        border-radius: 4px;
        margin-bottom: 12px;
      }
      
      .line-chart-placeholder {
        height: 80px;
        
        svg {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  
  // 信息卡片
  .info-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    
    .card-title {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 14px;
      font-weight: 600;
      color: #1f2937;
      margin-bottom: 16px;
      
      .el-icon {
        color: #3b82f6;
      }
    }
    
    .timeline-bar {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;
      
      .timeline-item {
        text-align: center;
        padding: 12px 16px;
        border-radius: 8px;
        
        &.highlight {
          background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
          
          .timeline-value {
            font-size: 28px;
            font-weight: 700;
            color: #fff;
          }
          
          .timeline-label {
            color: rgba(255, 255, 255, 0.9);
          }
        }
        
        .timeline-date {
          font-size: 14px;
          font-weight: 600;
          color: #3b82f6;
          background: #eff6ff;
          padding: 6px 12px;
          border-radius: 6px;
          margin-bottom: 4px;
        }
        
        .timeline-label {
          font-size: 12px;
          color: #6b7280;
        }
      }
    }
    
    .gantt-placeholder {
      .gantt-row {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
        
        .gantt-label {
          width: 70px;
          font-size: 12px;
          color: #6b7280;
        }
        
        .gantt-bar {
          height: 16px;
          background: linear-gradient(90deg, #93c5fd 0%, #3b82f6 100%);
          border-radius: 3px;
        }
      }
    }
  }
  
  // 提示行
  .tips-row {
    display: flex;
    gap: 16px;
    
    .tips-card {
      flex: 1;
      background: #fff;
      border-radius: 10px;
      padding: 16px;
      border: 1px solid #e5e7eb;
      
      .card-title {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
        font-weight: 600;
        color: #1f2937;
        margin-bottom: 12px;
      }
      
      .tip-item {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: 13px;
        color: #6b7280;
        margin-bottom: 10px;
        
        .el-icon {
          margin-top: 2px;
          color: #f59e0b;
        }
        
        &.success .el-icon {
          color: #10b981;
        }
      }
    }
  }
  
  // 需求卡片
  .requirement-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    
    .card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
      
      .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 15px;
        font-weight: 600;
        color: #1f2937;
      }
    }
    
    .requirement-list {
      .req-item {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 0;
        border-bottom: 1px solid #f3f4f6;
        
        &:last-child {
          border-bottom: none;
        }
        
        .el-icon {
          margin-top: 2px;
          flex-shrink: 0;
        }
        
        .req-label {
          font-size: 14px;
          color: #374151;
          font-weight: 500;
          min-width: 90px;
        }
        
        .req-value {
          font-size: 14px;
          color: #6b7280;
          flex: 1;
        }
      }
    }
  }
  
  // 流程时间线
  .process-timeline {
    padding-left: 20px;
    
    .timeline-node {
      position: relative;
      padding-left: 30px;
      padding-bottom: 24px;
      
      &::before {
        content: '';
        position: absolute;
        left: 6px;
        top: 12px;
        bottom: 0;
        width: 2px;
        background: #e5e7eb;
      }
      
      &:last-child::before {
        display: none;
      }
      
      .node-dot {
        position: absolute;
        left: 0;
        top: 4px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        border: 2px solid #e5e7eb;
        background: #fff;
        
        &.active {
          border-color: #3b82f6;
          background: #3b82f6;
        }
      }
      
      .node-content {
        .node-date {
          display: inline-block;
          font-size: 13px;
          font-weight: 600;
          color: #fff;
          background: #3b82f6;
          padding: 4px 12px;
          border-radius: 20px;
          margin-bottom: 12px;
        }
        
        .node-events {
          .event-item {
            margin-bottom: 12px;
            
            .event-time {
              font-size: 14px;
              font-weight: 500;
              color: #1f2937;
              margin-bottom: 4px;
            }
            
            .event-desc {
              font-size: 13px;
              color: #6b7280;
            }
          }
        }
      }
    }
  }
  
  // 风险列表
  .risk-list {
    .risk-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 14px 0;
      border-bottom: 1px solid #f3f4f6;
      
      &:last-child {
        border-bottom: none;
      }
      
      .risk-label {
        font-size: 14px;
        font-weight: 500;
        color: #374151;
        min-width: 80px;
      }
      
      .risk-desc {
        font-size: 13px;
        color: #6b7280;
        flex: 1;
      }
    }
  }
  
  // 建议列表
  .suggestion-list {
    .suggestion-item {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 12px 0;
      border-bottom: 1px solid #f3f4f6;
      
      &:last-child {
        border-bottom: none;
      }
      
      .el-icon {
        margin-top: 2px;
        flex-shrink: 0;
      }
      
      .sug-label {
        font-size: 14px;
        color: #374151;
        font-weight: 500;
        min-width: 80px;
      }
      
      .sug-value {
        font-size: 14px;
        color: #6b7280;
        flex: 1;
      }
    }
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

// AI核实状态样式
.verify-status {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  
  .el-icon {
    font-size: 14px;
    flex-shrink: 0;
  }
  
  span {
    word-break: keep-all;
    white-space: nowrap;
  }
  
  &.status-no-need {
    background-color: #d1fae5;
    color: #065f46;
    
    .el-icon {
      color: #10b981;
    }
  }
  
  &.status-need {
    background-color: #fef3c7;
    color: #92400e;
    
    .el-icon {
      color: #f59e0b;
    }
  }
  
  &.status-must {
    background-color: #fee2e2;
    color: #991b1b;
    
    .el-icon {
      color: #ef4444;
    }
  }
}

// 高亮行样式
.content-line {
  display: inline-block;
  width: 100%;
  transition: all 0.3s;
  
  &.highlight-line {
    background-color: #fef08a;
    padding: 2px 4px;
    margin: -2px -4px;
    animation: highlight-fade 3s ease-out;
  }
}

@keyframes highlight-fade {
  0% {
    background-color: #fef08a;
  }
  100% {
    background-color: transparent;
  }
}

// 可点击步骤样式
.clickable-step {
  cursor: pointer;
  transition: all 0.3s ease;
  
  &:hover {
    transform: translateY(-2px);
    
    :deep(.el-step__title) {
      color: #7c3aed !important;
    }
    
    :deep(.el-step__icon) {
      border-color: #7c3aed !important;
    }
  }
}

// 步骤详情容器
.step-detail-container {
  .step-project-info {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    
    h2 {
      margin: 0 0 12px 0;
      font-size: 24px;
      font-weight: 600;
    }
    
    .project-meta {
      display: flex;
      align-items: center;
      gap: 16px;
      font-size: 14px;
      opacity: 0.95;
    }
  }
  
  .step-function-content {
    margin-top: 24px;
  }
  
  .step-content-placeholder {
    text-align: center;
    padding: 80px 20px;
    
    .placeholder-icon {
      margin-bottom: 24px;
      color: #7c3aed;
    }
    
    h3 {
      margin: 0 0 12px 0;
      font-size: 24px;
      color: #1f2937;
    }
    
    p {
      margin: 0 0 24px 0;
      font-size: 16px;
      color: #6b7280;
    }
  }
}

// 招标信息提取结果区域
.extracted-info-section {
  margin: 24px 0;
  padding: 24px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  
  > h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
    
    .el-icon {
      color: #7c3aed;
      font-size: 20px;
    }
  }
  
  .tab-label {
    display: flex;
    align-items: center;
    gap: 6px;
    
    .el-icon {
      font-size: 16px;
    }
  }
  
  .info-table-wrapper {
    margin-top: 16px;
  }
}

// 商务文件撰写样式
.business-write-panel {
  .business-steps-container {
    margin: 24px 0;
    padding: 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  
  .step-content {
    margin-top: 24px;
    
    h4 {
      margin: 0 0 12px 0;
      font-size: 20px;
      font-weight: 600;
      color: #1f2937;
    }
    
    .step-desc {
      margin: 0 0 24px 0;
      font-size: 14px;
      color: #6b7280;
    }
    
    .step-actions {
      margin-top: 32px;
      padding-top: 24px;
      border-top: 1px solid #e5e7eb;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }
  
  // 步骤头部栏
  .step-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
    
    .project-badge {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      border-radius: 8px;
      font-weight: 500;
      
      .el-icon {
        font-size: 18px;
      }
    }
    
    .header-actions {
      display: flex;
      gap: 12px;
    }
  }
  
  // 项目选择（商务标和技术标通用）
  .project-selection {
    .step-title-section {
      margin-bottom: 24px;
      padding: 20px;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(124, 58, 237, 0.02) 100%);
      border-left: 4px solid #7c3aed;
      border-radius: 8px;
      
      h4 {
        margin: 0 0 12px 0;
        font-size: 20px;
        font-weight: 600;
        color: #1f2937;
      }
      
      .step-desc-highlight {
        margin: 0;
        font-size: 15px;
        line-height: 1.6;
        color: #4b5563;
        font-weight: 500;
      }
    }
    
    .project-cards,
    .project-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
      gap: 20px;
      margin: 24px 0;
    }
    
    .project-card {
      padding: 20px;
      background: #ffffff;
      border: 2px solid #e5e7eb;
      border-radius: 12px;
      cursor: pointer;
      transition: all 0.3s ease;
      position: relative;
      
      &:hover {
        border-color: #7c3aed;
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
        transform: translateY(-2px);
      }
      
      &.selected {
        border-color: #7c3aed;
        background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(124, 58, 237, 0.1) 100%);
      }
      
      .project-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 16px;
        
        h5 {
          margin: 0;
          font-size: 16px;
          font-weight: 600;
          color: #1f2937;
          flex: 1;
        }
      }
      
      .project-card-body {
        .project-info-item {
          display: flex;
          align-items: center;
          gap: 8px;
          margin-bottom: 8px;
          font-size: 14px;
          
          .label {
            color: #6b7280;
          }
          
          .value {
            color: #1f2937;
          }
          
          .el-icon {
            font-size: 16px;
          }
        }
      }
      
      .selected-badge {
        position: absolute;
        top: 12px;
        right: 12px;
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 12px;
        background: #7c3aed;
        color: white;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
        
        .el-icon {
          font-size: 14px;
        }
      }
    }
  }
  
  // 大纲生成
  .outline-generation {
    .outline-actions {
      margin: 20px 0;
      display: flex;
      gap: 12px;
    }
    
    .outline-content-layout {
      display: flex;
      gap: 20px;
      margin-top: 24px;
      height: calc(100vh - 450px);
      min-height: 500px;
      
      .outline-editor-panel {
        width: 400px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
        
        .panel-title {
          display: flex;
          align-items: center;
          gap: 8px;
          padding: 16px;
          background: #f9fafb;
          border-bottom: 1px solid #e5e7eb;
          font-weight: 600;
          color: #1f2937;
          
          .el-icon {
            color: #7c3aed;
            font-size: 18px;
          }
        }
        
        .outline-editor {
          flex: 1;
          padding: 16px;
          overflow-y: auto;
          
          .custom-tree-node {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 12px;
            
            .node-title {
              font-size: 14px;
              color: #1f2937;
            }
            
            .node-actions {
              display: flex;
              gap: 4px;
              opacity: 0;
              transition: opacity 0.3s;
            }
            
            &:hover .node-actions {
              opacity: 1;
            }
          }
        }
        
        .outline-empty {
          flex: 1;
          display: flex;
          align-items: center;
          justify-content: center;
          padding: 40px 20px;
        }
      }
      
      .bidding-document-viewer {
        flex: 1;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
        
        .viewer-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 16px;
          background: #f9fafb;
          border-bottom: 1px solid #e5e7eb;
          
          .viewer-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            color: #1f2937;
            
            .el-icon {
              color: #7c3aed;
              font-size: 18px;
            }
          }
          
          .viewer-tools {
            display: flex;
            align-items: center;
            gap: 12px;
          }
        }
        
        .viewer-content {
          flex: 1;
          overflow: auto;
          padding: 20px;
          background: #f9fafb;
          transform-origin: top center;
          transition: transform 0.3s;
          
          .document-page {
            max-width: 800px;
            margin: 0 auto;
            padding: 40px;
            background: #ffffff;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            
            h2 {
              font-size: 22px;
              font-weight: 600;
              color: #1f2937;
            }
            
            h3 {
              font-size: 18px;
              font-weight: 600;
              color: #374151;
              margin-top: 20px;
              margin-bottom: 12px;
            }
            
            p {
              font-size: 14px;
              line-height: 1.8;
              color: #4b5563;
              margin: 8px 0;
            }
          }
        }
      }
    }
  }
  
  // 材料匹配
  .material-matching {
    .material-filter {
      margin: 20px 0;
      padding: 20px;
      background: #f9fafb;
      border-radius: 12px;
      
      .filter-title {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 2px solid #e5e7eb;
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        
        .el-icon {
          color: #7c3aed;
          font-size: 18px;
        }
      }
    }
    
    .material-sections {
      margin-top: 24px;
      
      .material-section {
        margin-bottom: 24px;
        padding: 20px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        
        .section-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 16px;
          padding-bottom: 12px;
          border-bottom: 1px solid #e5e7eb;
          
          h5 {
            margin: 0;
            font-size: 16px;
            font-weight: 600;
            color: #1f2937;
          }
          
          .section-actions {
            display: flex;
            gap: 8px;
          }
        }
        
        .matched-materials {
          .material-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px;
            margin-bottom: 12px;
            background: #f9fafb;
            border-radius: 8px;
            transition: all 0.3s;
            
            &:hover {
              background: #f3f4f6;
            }
            
            .material-info {
              display: flex;
              align-items: center;
              gap: 12px;
              flex: 1;
              
              .el-icon {
                font-size: 24px;
                color: #7c3aed;
              }
              
              .material-details {
                flex: 1;
                
                .material-name {
                  font-size: 14px;
                  font-weight: 500;
                  color: #1f2937;
                  margin-bottom: 4px;
                }
                
                .material-meta {
                  display: flex;
                  align-items: center;
                  gap: 12px;
                  font-size: 12px;
                  
                  .match-score {
                    color: #10b981;
                    font-weight: 500;
                  }
                }
              }
            }
            
            .material-actions {
              display: flex;
              gap: 8px;
            }
          }
        }
        
        .no-materials {
          padding: 40px 20px;
        }
      }
    }
  }
  
  // 文档编辑器布局
  .document-editor-layout {
    .editor-container {
      display: flex;
      gap: 20px;
      margin-top: 20px;
      height: calc(100vh - 300px);
      
      .document-editor {
        flex: 1;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
        
        .editor-toolbar {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 12px 16px;
          background: #f9fafb;
          border-bottom: 1px solid #e5e7eb;
          flex-wrap: wrap;
        }
        
        .editor-content {
          flex: 1;
          padding: 40px;
          overflow-y: auto;
          background: #ffffff;
          outline: none;
          line-height: 1.8;
          
          &:focus {
            outline: none;
          }
          
          h1, h2, h3 {
            margin: 20px 0 12px 0;
            font-weight: 600;
          }
          
          h1 {
            font-size: 24px;
            color: #1f2937;
          }
          
          h2 {
            font-size: 20px;
            color: #374151;
          }
          
          h3 {
            font-size: 18px;
            color: #4b5563;
          }
          
          p {
            margin: 12px 0;
            color: #1f2937;
          }
        }
      }
      
      .ai-assistant {
        width: 350px;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
        
        .assistant-header {
          display: flex;
          align-items: center;
          gap: 8px;
          padding: 16px;
          background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
          color: white;
          font-weight: 600;
          
          .el-icon {
            font-size: 20px;
          }
        }
        
        .chat-messages {
          flex: 1;
          padding: 16px;
          overflow-y: auto;
          background: #f9fafb;
          
          .chat-message {
            margin-bottom: 16px;
            display: flex;
            gap: 12px;
            
            &.user {
              flex-direction: row-reverse;
              
              .message-content {
                background: #7c3aed;
                color: white;
                
                .message-time {
                  color: rgba(255, 255, 255, 0.8);
                }
              }
            }
            
            .message-avatar {
              width: 36px;
              height: 36px;
              border-radius: 50%;
              background: #e5e7eb;
              display: flex;
              align-items: center;
              justify-content: center;
              flex-shrink: 0;
              
              .el-icon {
                font-size: 18px;
                color: #6b7280;
              }
            }
            
            .message-content {
              flex: 1;
              padding: 12px;
              background: #ffffff;
              border-radius: 12px;
              box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
              
              .message-text {
                font-size: 14px;
                line-height: 1.6;
                margin-bottom: 6px;
              }
              
              .message-time {
                font-size: 12px;
                color: #9ca3af;
              }
            }
          }
        }
        
        .chat-input {
          padding: 16px;
          border-top: 1px solid #e5e7eb;
          background: #ffffff;
          
          .el-textarea {
            margin-bottom: 12px;
          }
          
          .el-button {
            width: 100%;
          }
        }
        
        .quick-actions {
          padding: 12px 16px;
          border-top: 1px solid #e5e7eb;
          background: #f9fafb;
          
          .quick-action-title {
            font-size: 12px;
            color: #6b7280;
            margin-bottom: 8px;
            font-weight: 500;
          }
          
          .el-button {
            margin-right: 8px;
            margin-bottom: 8px;
          }
        }
      }
    }
  }
}

// 文件预览弹窗样式
.material-preview-dialog {
  .preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
    
    .file-info {
      display: flex;
      align-items: center;
      gap: 16px;
      
      .file-size,
      .file-date {
        font-size: 13px;
        color: #6b7280;
      }
    }
    
    .preview-actions {
      display: flex;
      align-items: center;
      gap: 12px;
    }
  }
  
  .preview-content-area {
    max-height: 600px;
    overflow: auto;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 20px;
    
    .preview-document {
      transform-origin: top center;
      transition: transform 0.3s;
      
      .pdf-preview,
      .other-file-preview {
        .document-page {
          max-width: 800px;
          margin: 0 auto;
          background: #ffffff;
          box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
          border-radius: 8px;
          padding: 40px;
          
          .page-header {
            border-bottom: 2px solid #e5e7eb;
            padding-bottom: 20px;
            margin-bottom: 20px;
          }
          
          .document-content {
            p {
              margin: 12px 0;
              line-height: 1.8;
              color: #1f2937;
            }
            
            strong {
              color: #374151;
              font-weight: 600;
            }
            
            ul {
              li {
                margin: 8px 0;
                color: #1f2937;
              }
            }
            
            table {
              width: 100%;
              border-collapse: collapse;
              margin: 20px 0;
              
              th, td {
                border: 1px solid #e5e7eb;
                padding: 12px;
              }
              
              th {
                background: #f3f4f6;
                font-weight: 600;
                text-align: left;
              }
            }
          }
        }
      }
    }
  }
}

// 更换文件弹窗样式
.change-material-dialog {
  .dialog-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(124, 58, 237, 0.05) 100%);
    border-radius: 8px;
    font-weight: 600;
    color: #1f2937;
    
    .el-icon {
      color: #7c3aed;
      font-size: 18px;
    }
  }
  
  .dialog-upload-area {
    margin-bottom: 20px;
    
    .custom-upload-trigger {
      width: 100%;
      padding: 40px 20px;
      border: 2px dashed #d1d5db;
      border-radius: 8px;
      background: #f9fafb;
      transition: all 0.3s;
      cursor: pointer;
      text-align: center;
      
      &:hover {
        border-color: #7c3aed;
        background: rgba(124, 58, 237, 0.05);
      }
      
      .el-icon--upload {
        font-size: 48px;
        color: #7c3aed;
        margin-bottom: 16px;
      }
      
      .el-upload__text {
        font-size: 14px;
        color: #6b7280;
        margin-bottom: 8px;
        
        em {
          color: #7c3aed;
          font-style: normal;
        }
      }
      
      .el-upload__tip {
        font-size: 12px;
        color: #9ca3af;
      }
    }
    
    :deep(.el-upload) {
      width: 100%;
    }
    
    :deep(.el-upload-dragger) {
      width: 100%;
      padding: 40px 20px;
      border: 2px dashed #d1d5db;
      border-radius: 8px;
      background: #f9fafb;
      transition: all 0.3s;
      
      &:hover {
        border-color: #7c3aed;
        background: rgba(124, 58, 237, 0.05);
      }
    }
    
    :deep(.el-icon--upload) {
      font-size: 48px;
      color: #7c3aed;
      margin-bottom: 16px;
    }
    
    :deep(.el-upload__text) {
      font-size: 14px;
      color: #6b7280;
      
      em {
        color: #7c3aed;
        font-style: normal;
      }
    }
    
    :deep(.el-upload__tip) {
      margin-top: 12px;
      font-size: 12px;
      color: #9ca3af;
    }
  }
  
  .uploaded-files-section {
    margin-bottom: 20px;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    
    .section-title {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
      font-weight: 600;
      color: #166534;
      
      .el-icon {
        font-size: 18px;
      }
    }
    
    .uploaded-files-list {
      .uploaded-file-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px;
        margin-bottom: 8px;
        background: #ffffff;
        border: 1px solid #bbf7d0;
        border-radius: 8px;
        transition: all 0.3s;
        
        &:last-child {
          margin-bottom: 0;
        }
        
        &:hover {
          box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
        }
        
        .file-info {
          display: flex;
          align-items: center;
          gap: 12px;
          flex: 1;
          
          .el-icon {
            color: #7c3aed;
            font-size: 24px;
          }
          
          .file-details {
            flex: 1;
            
            .file-name {
              font-size: 14px;
              font-weight: 500;
              color: #1f2937;
              margin-bottom: 4px;
            }
            
            .file-meta {
              display: flex;
              align-items: center;
              gap: 8px;
              
              .file-size {
                font-size: 12px;
                color: #6b7280;
              }
            }
          }
        }
        
        .file-actions {
          display: flex;
          gap: 4px;
        }
      }
    }
  }
  
  .dialog-filter {
    margin-bottom: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
  }
  
  .dialog-file-list {
    margin-bottom: 16px;
    
    .file-name-cell {
      display: flex;
      align-items: center;
      gap: 8px;
      
      .el-icon {
        color: #7c3aed;
        font-size: 18px;
      }
      
      span {
        flex: 1;
      }
    }
  }
  
  .dialog-selected-info {
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    text-align: center;
  }
  
  .dialog-footer-info {
    flex: 1;
    text-align: left;
    color: #6b7280;
    font-size: 14px;
  }
}

:deep(.el-dialog__footer) {
  display: flex;
  align-items: center;
  gap: 12px;
}

// 技术标撰写整体布局优化
.tech-solution-filling,
.outline-generation-layout,
.document-editor-layout {
  h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
  }
  
  .step-desc {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
  }
}

// 技术方案填充页面
.tech-solution-filling {
  .tech-sections {
    margin-top: 24px;
    
    .tech-section {
      margin-bottom: 24px;
      padding: 20px;
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      transition: all 0.3s;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
      
      &:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        transform: translateY(-2px);
      }
      
      .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid #e5e7eb;
        
        h5 {
          margin: 0;
          font-size: 16px;
          font-weight: 600;
          color: #1f2937;
        }
        
        .section-actions {
          display: flex;
          gap: 8px;
        }
      }
      
      .section-content {
        .content-preview {
          padding: 16px;
          background: #f9fafb;
          border-radius: 8px;
          line-height: 1.8;
          color: #374151;
          
          h2, h3 {
            margin: 16px 0 12px 0;
            color: #1f2937;
          }
          
          p {
            margin: 8px 0;
          }
          
          ul, ol {
            margin: 12px 0;
            padding-left: 24px;
            
            li {
              margin: 6px 0;
            }
          }
          
          table {
            width: 100%;
            border-collapse: collapse;
            margin: 16px 0;
            
            th, td {
              border: 1px solid #d1d5db;
              padding: 8px 12px;
              text-align: left;
            }
            
            th {
              background: #f3f4f6;
              font-weight: 600;
            }
          }
        }
      }
      
      .no-content {
        padding: 40px 0;
      }
    }
  }
}

// 技术标大纲生成布局（精细优化）
.outline-generation-layout {
  .outline-split-view {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    min-height: 600px;
    
    .outline-editor-section {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      
      .outline-actions {
        display: flex;
        gap: 12px;
        margin: 20px 0;
        flex-wrap: wrap;
      }
      
      .outline-tree {
        flex: 1;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 16px;
        min-height: 400px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        overflow-y: auto;
        
        .tree-node-content {
          display: flex;
          justify-content: space-between;
          align-items: center;
          width: 100%;
          padding: 8px 12px;
          border-radius: 6px;
          transition: all 0.3s;
          
          &:hover {
            background: #f9fafb;
          }
          
          .node-title {
            flex: 1;
            font-size: 14px;
            color: #374151;
            font-weight: 500;
          }
          
          .node-actions {
            display: flex;
            gap: 4px;
            opacity: 0;
            transition: opacity 0.3s;
          }
          
          &:hover .node-actions {
            opacity: 1;
          }
        }
        
        // Element Plus Tree 样式覆盖
        :deep(.el-tree-node__content) {
          padding: 4px 0;
          
          &:hover {
            background: transparent;
          }
        }
        
        :deep(.el-tree-node__expand-icon) {
          color: #7c3aed;
        }
      }
    }
    
    .bidding-document-viewer {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      
      .viewer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        background: #f9fafb;
        border-radius: 12px 12px 0 0;
        border: 1px solid #e5e7eb;
        border-bottom: none;
        
        .viewer-title {
          display: flex;
          align-items: center;
          gap: 8px;
          font-weight: 600;
          color: #1f2937;
          
          .el-icon {
            color: #7c3aed;
            font-size: 18px;
          }
        }
        
        .viewer-tools {
          display: flex;
          gap: 12px;
        }
      }
      
      .viewer-content {
        flex: 1;
        background: #f3f4f6;
        border: 1px solid #e5e7eb;
        border-radius: 0 0 12px 12px;
        padding: 24px;
        overflow-y: auto;
        transform-origin: top center;
        transition: transform 0.3s;
        
        // 自定义滚动条
        &::-webkit-scrollbar {
          width: 8px;
        }
        
        &::-webkit-scrollbar-track {
          background: #f1f1f1;
          border-radius: 4px;
        }
        
        &::-webkit-scrollbar-thumb {
          background: #c1c1c1;
          border-radius: 4px;
          
          &:hover {
            background: #a8a8a8;
          }
        }
        
        .document-page {
          max-width: 800px;
          margin: 0 auto;
          background: #ffffff;
          padding: 40px;
          box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
          border-radius: 8px;
          
          h2 {
            font-size: 20px;
            margin: 24px 0 16px 0;
            color: #1f2937;
            font-weight: 600;
          }
          
          h3 {
            font-size: 16px;
            margin: 20px 0 12px 0;
            color: #374151;
            font-weight: 600;
          }
          
          p {
            margin: 8px 0;
            line-height: 1.8;
            color: #4b5563;
            font-size: 14px;
          }
        }
      }
    }
  }
}

// 技术标文档编辑器布局（复用商务标样式）
.document-editor-layout {
  .editor-layout {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    
    .document-editor {
      flex: 2;
      min-width: 0;
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      overflow: hidden;
      
      .editor-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
        
        .format-controls {
          display: flex;
          gap: 12px;
          align-items: center;
        }
        
        .export-controls {
          display: flex;
          gap: 8px;
        }
      }
      
      .editor-content {
        padding: 40px;
        min-height: 600px;
        max-height: 800px;
        overflow-y: auto;
        background: #ffffff;
        outline: none;
        
        &:focus {
          outline: none;
        }
        
        // 自定义滚动条
        &::-webkit-scrollbar {
          width: 8px;
        }
        
        &::-webkit-scrollbar-track {
          background: #f1f1f1;
          border-radius: 4px;
        }
        
        &::-webkit-scrollbar-thumb {
          background: #c1c1c1;
          border-radius: 4px;
          
          &:hover {
            background: #a8a8a8;
          }
        }
        
        h1 {
          font-size: 24px;
          margin: 20px 0;
          text-align: center;
        }
        
        h2 {
          font-size: 20px;
          margin: 24px 0 16px 0;
        }
        
        h3 {
          font-size: 16px;
          margin: 20px 0 12px 0;
        }
        
        p {
          margin: 12px 0;
          line-height: 2;
        }
        
        table {
          width: 100%;
          border-collapse: collapse;
          margin: 20px 0;
          
          th, td {
            border: 1px solid #000;
            padding: 10px;
          }
          
          th {
            background: #f3f4f6;
            font-weight: 600;
          }
        }
        
        ul, ol {
          margin: 12px 0;
          padding-left: 40px;
          
          li {
            margin: 8px 0;
            line-height: 2;
          }
        }
      }
    }
    
    .ai-assistant {
      flex: 1;
      min-width: 300px;
      max-width: 400px;
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      display: flex;
      flex-direction: column;
      height: 800px;
      
      .assistant-header {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 16px;
        background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
        color: #ffffff;
        font-weight: 600;
        border-radius: 12px 12px 0 0;
        
        .el-icon {
          font-size: 20px;
        }
      }
      
      .chat-messages {
        flex: 1;
        padding: 16px;
        overflow-y: auto;
        background: #f9fafb;
        
        // 自定义滚动条
        &::-webkit-scrollbar {
          width: 6px;
        }
        
        &::-webkit-scrollbar-track {
          background: #f1f1f1;
          border-radius: 3px;
        }
        
        &::-webkit-scrollbar-thumb {
          background: #c1c1c1;
          border-radius: 3px;
          
          &:hover {
            background: #a8a8a8;
          }
        }
        
        .chat-message {
          margin-bottom: 16px;
          display: flex;
          gap: 12px;
          
          &.assistant {
            .message-content {
              background: #ffffff;
            }
          }
          
          &.user {
            flex-direction: row-reverse;
            
            .message-content {
              background: #7c3aed;
              color: #ffffff;
            }
          }
          
          .message-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: #e5e7eb;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            
            .el-icon {
              font-size: 18px;
              color: #6b7280;
            }
          }
          
          .message-content {
            flex: 1;
            padding: 12px;
            border-radius: 12px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            
            .message-text {
              font-size: 14px;
              line-height: 1.6;
              margin-bottom: 6px;
            }
            
            .message-time {
              font-size: 12px;
              opacity: 0.6;
            }
          }
        }
      }
      
      .chat-input {
        padding: 16px;
        background: #ffffff;
        border-top: 1px solid #e5e7eb;
        border-radius: 0 0 12px 12px;
        
        .el-textarea {
          margin-bottom: 12px;
        }
        
        .el-button {
          width: 100%;
        }
      }
    }
  }
}

// 智能审核样式
.review-step-content {
  padding: 24px;
  
  h4 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
  }
  
  .step-desc {
    color: #6b7280;
    margin-bottom: 24px;
  }
  
  .step-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
  }
}

// 上传审核区域
.upload-review-area {
  padding: 24px;
  
  .uploaded-review-file {
    margin-top: 24px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    
    .el-icon {
      font-size: 24px;
      color: #7c3aed;
    }
    
    .file-name {
      flex: 1;
      font-weight: 500;
      color: #1f2937;
    }
    
    .file-size {
      color: #6b7280;
      font-size: 14px;
    }
  }
}

// 评分表模板卡片
.scoring-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.template-card {
  position: relative;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  
  &:hover {
    border-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
  }
  
  &.selected {
    border-color: #7c3aed;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(124, 58, 237, 0.02) 100%);
  }
  
  .template-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    
    .el-icon {
      font-size: 32px;
    }
    
    h5 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #1f2937;
    }
  }
  
  .template-body {
    .template-desc {
      color: #6b7280;
      font-size: 14px;
      line-height: 1.6;
      margin-bottom: 16px;
    }
    
    .template-info {
      display: flex;
      gap: 16px;
      
      .info-item {
        display: flex;
        align-items: center;
        gap: 4px;
        color: #7c3aed;
        font-size: 14px;
        font-weight: 500;
        
        .el-icon {
          font-size: 16px;
        }
      }
    }
  }
  
  .selected-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #7c3aed;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    
    .el-icon {
      font-size: 14px;
    }
  }
}

// 审核结果布局
.review-result-layout {
  .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    
    .project-info {
      display: flex;
      align-items: center;
      gap: 12px;
      
      h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #1f2937;
      }
    }
    
    .result-actions {
      display: flex;
      gap: 8px;
    }
  }
  
  .review-content-split {
    display: flex;
    height: calc(100vh - 250px);
    gap: 1px;
    background: #e5e7eb;
  }
}

// 审核结果面板（左侧）
.review-results-panel {
  flex: 1;
  background: #fff;
  overflow-y: auto;
  
  .results-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    
    .summary-card {
      text-align: center;
      padding: 20px;
      background: #fff;
      border-radius: 12px;
      border: 1px solid #e5e7eb;
      
      .summary-label {
        font-size: 14px;
        color: #6b7280;
        margin-bottom: 8px;
      }
      
      .summary-value {
        font-size: 32px;
        font-weight: 700;
        color: #7c3aed;
        
        &.error {
          color: #ef4444;
        }
        
        &.warning {
          color: #f59e0b;
        }
      }
      
      .summary-max {
        font-size: 16px;
        color: #9ca3af;
        margin-top: 4px;
      }
    }
  }
  
  .scoring-items,
  .missing-items,
  .suggestion-items {
    padding: 16px;
  }
  
  .scoring-item {
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    
    &:hover {
      border-color: #7c3aed;
      box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
    }
    
    &.active {
      border-color: #7c3aed;
      background: rgba(124, 58, 237, 0.05);
    }
    
    .item-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      
      .item-name {
        font-weight: 500;
        color: #1f2937;
      }
      
      .item-score {
        font-weight: 600;
        color: #7c3aed;
      }
    }
    
    .item-location {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 14px;
      color: #6b7280;
      
      .page-ref {
        color: #7c3aed;
        cursor: pointer;
        
        &:hover {
          text-decoration: underline;
        }
      }
    }
    
    .item-note {
      margin-top: 8px;
      padding: 8px 12px;
      background: #fef3c7;
      border-radius: 6px;
      font-size: 13px;
      color: #92400e;
      display: flex;
      align-items: center;
      gap: 6px;
    }
  }
  
  .missing-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    
    .el-icon {
      font-size: 20px;
      flex-shrink: 0;
    }
    
    .missing-content {
      flex: 1;
      
      .missing-name {
        font-weight: 600;
        color: #991b1b;
        margin-bottom: 4px;
      }
      
      .missing-desc {
        font-size: 14px;
        color: #7f1d1d;
        margin-bottom: 8px;
      }
    }
  }
  
  .suggestion-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    
    .el-icon {
      font-size: 20px;
      flex-shrink: 0;
    }
    
    .suggestion-content {
      flex: 1;
      
      .suggestion-title {
        font-weight: 600;
        color: #92400e;
        margin-bottom: 4px;
      }
      
      .suggestion-desc {
        font-size: 14px;
        color: #78350f;
        margin-bottom: 8px;
      }
      
      .suggestion-impact {
        font-size: 13px;
        color: #10b981;
        font-weight: 500;
      }
    }
  }
}

// 文档查看器面板（右侧）
.document-viewer-panel {
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
  
  .viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    
    .page-indicator {
      font-size: 14px;
      color: #6b7280;
    }
  }
  
  .document-content {
    flex: 1;
    overflow: auto;
    padding: 24px;
    background: #f3f4f6;
    
    &.edit-mode {
      .document-page {
        border: 2px dashed #7c3aed;
      }
    }
    
    .document-page {
      background: #fff;
      padding: 40px;
      margin: 0 auto;
      max-width: 800px;
      min-height: 1000px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      
      &:focus {
        outline: none;
      }
      
      .page-content {
        font-size: 14px;
        line-height: 1.8;
        color: #1f2937;
        
        h1 {
          text-align: center;
          font-size: 24px;
          margin-bottom: 32px;
        }
        
        p {
          margin-bottom: 16px;
        }
      }
    }
  }
}
</style>
