p-honggang.li
7 天以前 522737d66480d2f42b8e83c2ddde0efa3b740f38
src/views/approveManage/tradeApproval/list.vue
@@ -9,7 +9,7 @@
            <el-input v-model="query.productName" placeholder="请输入产品名称" clearable style="width: 100%" />
          </el-form-item>
          <el-form-item label="行业领域" class="col-25">
            <el-select v-model="query.industry" placeholder="请选择行业领域" clearable style="width: 100%">
            <el-select v-model="query.industry" placeholder="请选择行业领域" clearable style="width: 100%" @change="handleIndustryChange">
              <el-option v-for="item in industryOptions" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
@@ -31,15 +31,15 @@
            <el-input v-model="query.orderNo" placeholder="请输入订单编号" clearable style="width: 100%" />
          </el-form-item>
          <el-form-item label="产品类型" class="col-25">
            <el-select v-model="query.productType" placeholder="请选择产品类型" clearable style="width: 100%">
            <el-select v-model="query.productType" placeholder="请选择产品类型" clearable style="width: 100%" @change="handleProductTypeChange">
              <el-option v-for="item in productTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item label="" class="col-17">
            <el-select v-model="query.productSubType" placeholder="请选择产品类型子级" clearable style="width: 100%">
              <el-option v-for="item in productSubTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
<!--          <el-form-item label="" class="col-17">-->
<!--            <el-select v-model="query.productSubType" placeholder="请选择产品类型子级" clearable style="width: 100%">-->
<!--              <el-option v-for="item in productSubTypeOptions" :key="item.value" :label="item.label" :value="item.value" />-->
<!--            </el-select>-->
<!--          </el-form-item>-->
          <el-form-item label="申请时间" class="col-30">
            <el-date-picker
              v-model="query.dateRange"
@@ -57,12 +57,54 @@
        <!-- 第三行:操作按钮(右对齐) -->
        <div class="form-row actions">
          <el-form-item class="row-actions">
            <el-button type="primary" @click="handleSearch" :icon="Search">查询</el-button>
            <el-button @click="reset" :icon="Refresh">重置</el-button>
            <el-button type="primary" @click="handleSearch" icon="Search">查询</el-button>
            <el-button @click="reset" icon="Refresh">重置</el-button>
          </el-form-item>
        </div>
      </el-form>
    </el-card>
    <div class="buttonDiv">
      <el-row>
        <el-col :span="6" style="margin-top: 10px"> </el-col>
        <el-col :span="18" align="right" style="margin-top: 10px">
          <div class="btnBox">
            <div
                class="btnDiv"
                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_point0' }"
                @click="btnClick('0','trade_point')"
            >
              <span class="numjx">积分待办</span>
<!--              <span>{{ workFlowStatus.tradePointDealData }}</span>-->
            </div>
            <div
                class="btnDiv"
                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_point1' }"
                @click="btnClick('1','trade_point')"
            >
              <span class="numjx">积分已办</span>
<!--              <span>{{ workFlowStatus.completedData }}</span>-->
            </div>
            <div
                class="btnDiv"
                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_agreement0' }"
                @click="btnClick('0','trade_agreement')"
            >
              <span class="numjx">协议待办</span>
<!--              <span>{{ workFlowStatus.dealwithData }}</span>-->
            </div>
            <div
                class="btnDiv"
                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_agreement1' }"
                @click="btnClick('1','trade_agreement')"
            >
              <span class="numjx">协议已办</span>
<!--              <span>{{ workFlowStatus.completedData }}</span>-->
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
    <!-- 订单列表区域 -->
    <el-card class="mt15" shadow="never">
@@ -74,9 +116,6 @@
              <template #default="{ row }">
                <div v-if="row.isMainOrder" class="main-order-info">
                  <div class="order-header">
                    <div class="order-item status-item">
                      <el-tag :type="getStatusType(row.status)" size="small">{{ row.statusName }}</el-tag>
                    </div>
                    <div class="order-item">
                      <span class="label">申请时间:</span>
                      <span class="value">{{ row.applyTime }}</span>
@@ -92,6 +131,9 @@
                    <div class="order-item">
                      <span class="label">供应方:</span>
                      <span class="value">{{ row.supplySide }}</span>
                    </div>
                    <div class="order-item status-item">
                      <el-tag :type="getStatusType(row.status)" size="small">{{ row.statusName }}</el-tag>
                    </div>
                  </div>
                </div>
@@ -148,13 +190,13 @@
                <div v-if="row.isSpacer" class="spacer-cell"></div>
                <div v-else-if="!row.isMainOrder" class="price-info">
                  <span v-if="row.priceType === 'points'" class="price-points">
                    {{ row.unitPrice }}积分
                    积分 {{ row.unitPrice }}
                  </span>
                  <span v-else-if="row.priceType === 'currency'" class="price-currency">
                    ¥{{ row.unitPrice }}
                    货币 {{ row.unitPrice }}
                  </span>
                  <span v-else-if="row.priceType === 'agreement'" class="price-agreement">
                    {{ row.unitPrice }}
                    协议
                  </span>
                  <span v-else-if="row.priceType === 'free'" class="price-free">
                    免费
@@ -176,8 +218,8 @@
              <template #default="{ row }">
                <div v-if="row.isSpacer" class="spacer-cell"></div>
                <div v-else-if="!row.isMainOrder" class="period-info">
                  <span>{{ row.period }}</span>
                  <span v-if="row.isPermanent" class="permanent">永久</span>
                  <span v-if="row.period === 0" class="permanent">永久</span>
                  <span v-else>{{ row.period }}</span>
                </div>
              </template>
            </el-table-column>
@@ -192,10 +234,45 @@
                  <div v-if="row.parentOrder && row.parentOrder.subOrders && row.parentOrder.subOrders.findIndex((sub: any) => sub.id === row.id) === 0" class="all-actions">
                    <div class="action-item">
                      <div class="action-buttons">
                        <el-button v-if="row.parentOrder.canApprove" type="primary" link size="small" @click="toApprove(row.parentOrder)">审批</el-button>
                        <el-button v-if="row.parentOrder.canCheck" type="primary" link size="small" @click="toCheckFiles(row.parentOrder)">核查文件</el-button>
                        <el-button type="primary" link size="small" @click="toDetail(row.parentOrder)">查看</el-button>
                        <el-button type="primary" link size="small" @click="toTrack(row.parentOrder)">追踪</el-button>
                        <template v-for="action in getAvailableActions(row.parentOrder)" :key="action.type">
                          <el-button
                            v-if="action.type === ActionType.VIEW"
                            type="primary"
                            link
                            size="small"
                            @click="handleAction(action, row.parentOrder)"
                          >
                            查看
                          </el-button>
                          <el-button
                            v-else-if="action.type === ActionType.TRACK"
                            type="primary"
                            link
                            size="small"
                            @click="handleAction(action, row.parentOrder)"
                          >
                            追踪
                          </el-button>
                          <el-button
                            v-else-if="action.type === ActionType.AUTHORIZE"
                            type="primary"
                            link
                            size="small"
                            @click="handleAction(action, row.parentOrder)"
                          >
                            授权
                          </el-button>
                          <el-button
                              v-else-if="action.type === ActionType.WAIT_APPROVAL_AUTHORIZE"
                              type="primary"
                              link
                              size="small"
                              @click="handleAction(action, row.parentOrder)"
                          >
                            审批
                          </el-button>
                        </template>
                      </div>
                    </div>
                  </div>
@@ -219,57 +296,44 @@
        />
      </div>
    </el-card>
    <!-- 订单状态对话框 -->
<!--    <ProductOrderStatusDialog -->
<!--      v-model="orderStatusDialogVisible" -->
<!--      :order-id="currentOrderId" -->
<!--    />-->
  </div>
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { Search, Refresh } from '@element-plus/icons-vue'
import { fetchApprovalPage } from '@/api/approvalManage'
import { ElMessage } from 'element-plus'
import { fetchApprovalPage, fetchApprovalPageWithProductConditions } from '@/api/approvalManage'
import productApi from '@/api/productApi'
import { useUserInfo } from '@/stores/modules/userInfo'
import { OrderWorkflowController, OrderStatus, ActionType, PageType, StatusMapper } from '@/utils/orderWorkflow'
import { queryUserDetail } from '@/api/userInfo'
const router = useRouter()
const userStore = useUserInfo()
// 状态选项
// 状态选项(更新为新的工作流程状态)
const statusOptions = [
  { label: '全部', value: '' },
  { label: '待审核', value: 'WAIT_APPROVAL' },
  { label: '待上传文件', value: 'WAIT_UPLOAD' },
  { label: '待核查文件', value: 'WAIT_CHECK' },
  { label: '待授权', value: 'WAIT_AUTHORIZE' },
  { label: '待审批授权', value: 'WAIT_APPROVAL_AUTHORIZE' },
  { label: '待交易确认', value: 'WAIT_CONFIRM' },
  { label: '已驳回', value: 'REJECTED' },
  { label: '已完成', value: 'FINISH' },
  { label: '已完成', value: 'COMPLETED' },
  { label: '已评价', value: 'EVALUATED' },
]
// 行业领域选项
const industryOptions = [
  { label: '建筑工程', value: 'construction' },
  { label: '交通工程', value: 'transportation' },
  { label: '水利工程', value: 'water' },
  { label: '电力工程', value: 'power' },
]
// 单位工程选项
const unitProjectOptions = [
  { label: '土建工程', value: 'civil' },
  { label: '安装工程', value: 'installation' },
  { label: '装饰工程', value: 'decoration' },
]
// 产品类型选项
const productTypeOptions = [
  { label: '企业私有SaaS版许可', value: 'enterprise_private' },
  { label: '企业公有SaaS版许可', value: 'enterprise_public' },
  { label: '项目公有SaaS版许可', value: 'project_public' },
  { label: '个人公有SaaS版许可', value: 'personal_public' },
]
// 产品类型子级选项
const productSubTypeOptions = [
  { label: '基础版', value: 'basic' },
  { label: '标准版', value: 'standard' },
  { label: '高级版', value: 'premium' },
]
// 动态选项数据
const industryOptions = ref<any[]>([])
const unitProjectOptions = ref<any[]>([])
const productTypeOptions = ref<any[]>([])
const productSubTypeOptions = ref<any[]>([])
// 查询条件
const query = reactive({
@@ -289,209 +353,144 @@
// 订单列表数据(包含主订单和子订单)
const orderList = ref<any[]>([])
// 模拟数据用于展示
const mockData = [
  {
    id: '1',
    isMainOrder: true,
    applyTime: '2025-05-21 10:00:00',
    orderNo: '4348442557619205545',
    demandSide: '中交方远建设有限公司',
    supplySide: '中交方远科技有限公司',
    status: 'WAIT_APPROVAL',
    statusName: '待审核',
    canApprove: true,
    canCheck: false,
    subOrders: [
      {
        id: '1-1',
        isMainOrder: false,
        productName: '中交方远智能实测实量管理系统',
        suiteName: '企业私有SaaS版许可',
        salesForm: '买断',
        accountCount: 50,
        customerObject: '企业',
        concurrentCount: 50,
        priceType: 'points',
        unitPrice: '50,000',
        quantity: 1,
        period: 1,
        isPermanent: true,
      },
      {
        id: '1-2',
        isMainOrder: false,
        productName: '中交方远智能实测实量管理系统',
        suiteName: '企业私有SaaS版OTA升级服务',
        salesForm: 'OTA服务',
        accountCount: 50,
        customerObject: '企业',
        concurrentCount: 50,
        priceType: 'currency',
        unitPrice: '7,500',
        quantity: 1,
        period: 1,
        isPermanent: false,
      },
      {
        id: '1-3',
        isMainOrder: false,
        productName: '中交方远智能实测实量管理系统',
        suiteName: '企业私有SaaS版用户增量包',
        salesForm: '私有增量包',
        accountCount: 100,
        customerObject: '企业',
        concurrentCount: 100,
        priceType: 'agreement',
        unitPrice: '协议价',
        quantity: 1,
        period: 1,
        isPermanent: false,
      },
      {
        id: '1-4',
        isMainOrder: false,
        productName: '中交方远智能实测实量管理系统',
        suiteName: '个人公有SaaS版许可',
        salesForm: '私有增量包',
        accountCount: 50,
        customerObject: '个人',
        concurrentCount: 50,
        priceType: 'free',
        unitPrice: '0',
        quantity: 1,
        period: 3,
        isPermanent: true,
      },
    ],
  },
  {
    id: '2',
    isMainOrder: true,
    applyTime: '2025-05-20 10:00:00',
    orderNo: '4347442557619205545',
    demandSide: '华为技术有限公司',
    supplySide: '华为软件技术有限公司',
    status: 'WAIT_UPLOAD',
    statusName: '待上传文件',
    canApprove: false,
    canCheck: false,
    subOrders: [
      {
        id: '2-1',
        isMainOrder: false,
        productName: '基于国产芯片宽窄融合自组网设备的应用',
        suiteName: '企业公有SaaS版许可',
        salesForm: '租赁',
        accountCount: 100,
        customerObject: '企业',
        concurrentCount: 100,
        priceType: 'currency',
        unitPrice: '80,000',
        quantity: 1,
        period: 1,
        isPermanent: false,
      },
    ],
  },
  {
    id: '3',
    isMainOrder: true,
    applyTime: '2025-05-19 10:00:00',
    orderNo: '4347342557619205545',
    demandSide: '中交第四航务工程局有限公司',
    supplySide: '中交第四航务工程局有限公司',
    status: 'WAIT_CHECK',
    statusName: '待核查文件',
    canApprove: true,
    canCheck: true,
    subOrders: [
      {
        id: '3-1',
        isMainOrder: false,
        productName: '高桩码头辅助出图工具箱',
        suiteName: '项目公有SaaS版许可',
        salesForm: '租赁',
        accountCount: 50,
        customerObject: '项目部',
        concurrentCount: 50,
        priceType: 'currency',
        unitPrice: '60,000',
        quantity: 1,
        period: 1,
        isPermanent: false,
      },
    ],
  },
  {
    id: '4',
    isMainOrder: true,
    applyTime: '2025-05-18 10:00:00',
    orderNo: '4347442557619205545',
    demandSide: '中国交通建设股份有限公司',
    supplySide: '中交公路规划设计院有限公司',
    status: 'WAIT_CONFIRM',
    statusName: '待交易确认',
    canApprove: false,
    canCheck: false,
    subOrders: [
      {
        id: '4-1',
        isMainOrder: false,
        productName: '公路数字化方案设计系统',
        suiteName: '企业公有SaaS版许可',
        salesForm: '租赁',
        accountCount: 100,
        customerObject: '企业',
        concurrentCount: 100,
        priceType: 'currency',
        unitPrice: '80,000',
        quantity: 1,
        period: 1,
        isPermanent: false,
      },
    ],
  },
  {
    id: '5',
    isMainOrder: true,
    applyTime: '2025-05-17 10:00:00',
    orderNo: '4347342557619205545',
    demandSide: '中交第三航务工程局有限公司',
    supplySide: '中交第三航务工程局有限公司',
    status: 'REJECTED',
    statusName: '已驳回',
    canApprove: false,
    canCheck: false,
    subOrders: [
      {
        id: '5-1',
        isMainOrder: false,
        productName: '基于无人机的企业级可视化项目管理系统',
        suiteName: '项目公有SaaS版许可',
        salesForm: '租赁',
        accountCount: 50,
        customerObject: '项目部',
        concurrentCount: 50,
        priceType: 'free',
        unitPrice: '0',
        quantity: 1,
        period: 1,
        isPermanent: true,
      },
    ],
  },
]
// 订单状态对话框相关
const orderStatusDialogVisible = ref(false)
const currentOrderId = ref<string>('')
const workFlowStatus = reactive<any>({
  btnClassShow: 'trade_point0',
  workFlowType: 0,
  businessType: 'trade_point' // trade_point
})
// 使用工作流程控制器的状态映射
const statusUiToServer: Record<string, string> = {
  WAIT_UPLOAD: OrderStatus.WAIT_UPLOAD,
  WAIT_AUTHORIZE: OrderStatus.WAIT_AUTHORIZE,
  WAIT_CONFIRM: OrderStatus.WAIT_CONFIRM,
  COMPLETED: OrderStatus.COMPLETED,
  EVALUATED: OrderStatus.EVALUATED,
}
const statusServerToUi: Record<string, string> = {
  [OrderStatus.WAIT_UPLOAD]: 'WAIT_UPLOAD',
  [OrderStatus.WAIT_AUTHORIZE]: 'WAIT_AUTHORIZE',
  [OrderStatus.WAIT_CONFIRM]: 'WAIT_CONFIRM',
  [OrderStatus.COMPLETED]: 'COMPLETED',
  [OrderStatus.EVALUATED]: 'EVALUATED',
  [OrderStatus.WAIT_APPROVAL_AUTHORIZE]: 'WAIT_APPROVAL_AUTHORIZE'
}
const formatDateTime = (val?: string) => {
  if (!val) return ''
  // 后端 LocalDateTime 可能是 2025-05-21T10:00:00
  return val.replace('T', ' ').slice(0, 19)
}
const normalizePriceType = (val?: string): 'points' | 'currency' | 'agreement' | 'free' => {
  if (!val) return 'currency'
  const s = String(val)
  if (/(积分|points)/i.test(s)) return 'points'
  if (/(协议|agreement)/i.test(s)) return 'agreement'
  if (/(免费|free)/i.test(s)) return 'free'
  return 'currency'
}
// 获取行业领域选项
const getIndustryOptions = async () => {
  try {
    const res = await productApi.getCategoryByParent({ parentCode: 'business_direction' })
    if (res?.code === 200 && res.data) {
      industryOptions.value = res.data.map((item: any) => ({
        label: item.name,
        value: item.id
      }))
    }
  } catch (error) {
    console.error('获取行业领域选项失败:', error)
  }
}
// 获取产品类型选项
const getProductTypeOptions = async () => {
  try {
    const res = await productApi.getCategoryByParent({ parentCode: 'ProductTechnologyType' })
    if (res?.code === 200 && res.data) {
      productTypeOptions.value = res.data.map((item: any) => ({
        label: item.name,
        value: item.id
      }))
    }
  } catch (error) {
    console.error('获取产品类型选项失败:', error)
  }
}
// 根据行业领域获取单位工程选项
const getUnitProjectOptions = async (industryCode: string) => {
  if (!industryCode) {
    unitProjectOptions.value = []
    return
  }
  try {
    const res = await productApi.getCategoryByParent({ parentId: industryCode })
    if (res?.code === 200 && res.data) {
      unitProjectOptions.value = res.data.map((item: any) => ({
        label: item.name,
        value: item.id
      }))
    }
  } catch (error) {
    console.error('获取单位工程选项失败:', error)
    unitProjectOptions.value = []
  }
}
// 根据产品类型获取产品子级选项
const getProductSubTypeOptions = async (productTypeCode: string) => {
  if (!productTypeCode) {
    productSubTypeOptions.value = []
    return
  }
  try {
    const res = await productApi.getCategoryByParent({ parentId: productTypeCode })
    if (res?.code === 200 && res.data) {
      productSubTypeOptions.value = res.data.map((item: any) => ({
        label: item.name,
        value: item.id
      }))
    }
  } catch (error) {
    console.error('获取产品子级选项失败:', error)
    productSubTypeOptions.value = []
  }
}
// 处理行业领域变化
const handleIndustryChange = async (value: string) => {
  // 清空单位工程选择
  query.unitProject = ''
  // 获取对应的单位工程选项
  await getUnitProjectOptions(value)
}
// 处理产品类型变化
const handleProductTypeChange = async (value: string) => {
  // 清空产品子级选择
  query.productSubType = ''
  // 获取对应的产品子级选项
  // await getProductSubTypeOptions(value)
}
// 获取状态类型
const getStatusType = (status: string) => {
  const statusMap: Record<string, 'warning' | 'danger' | 'success' | 'info'> = {
    WAIT_APPROVAL: 'warning',
    WAIT_UPLOAD: 'warning',
    WAIT_CHECK: 'warning',
    WAIT_AUTHORIZE: 'warning',
    WAIT_APPROVAL_AUTHORIZE: 'warning',
    WAIT_CONFIRM: 'warning',
    REJECTED: 'danger',
    FINISH: 'success',
    COMPLETED: 'success',
    EVALUATED: 'success',
  }
  return statusMap[status] || 'info'
}
@@ -575,26 +574,93 @@
  }
}
// 搜索处理
// 搜索处理(接入真实后端)
const handleSearch = async () => {
  // 模拟API调用,实际项目中这里会调用真实的API
  // const { data } = (await fetchApprovalPage({ ...query, pageNo: page.current, pageSize: page.size })) as any
  const payload: any = {
    pageNum: page.current,
    pageSize: page.size,
    productName: query.productName || undefined,
    orderId: query.orderNo || undefined,
    userId: userStore.getUserId,
    unitId: userStore.getUnitId,
    workFlowType: workFlowStatus.workFlowType,
    businessType: workFlowStatus.businessType,
    departmentId: userStore.getDepartmentId
  }
  if (query.status) payload.orderStatus = statusUiToServer[query.status]
  if (Array.isArray(query.dateRange) && query.dateRange.length === 2) {
    payload.applyTimeStart = query.dateRange[0]
    payload.applyTimeEnd = query.dateRange[1]
  }
  
  // 使用模拟数据
  // 添加产品条件查询
  if (query.industry) payload.industryId = query.industry
  if (query.unitProject) payload.unitProjectId = query.unitProject
  if (query.productType) payload.productTypeId = query.productType
  if (query.productSubType) payload.productSubTypeId = query.productSubType
  // 根据是否有产品条件选择不同的API
  const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType
  const apiMethod = hasProductConditions ? fetchApprovalPageWithProductConditions : fetchApprovalPage
  const res = (await apiMethod(payload)) as any
  const pageData = res?.data
  const list: any[] = Array.isArray(pageData?.list) ? pageData.list : []
  page.total = Number(pageData?.total || 0)
  const flatData: any[] = []
  mockData.forEach(order => {
    flatData.push(order)
    if (order.subOrders) {
      order.subOrders.forEach((subOrder: any) => {
        flatData.push({ ...subOrder, parentOrder: order })
      })
  list.forEach((order: any, idx: number) => {
    const uiStatus = statusServerToUi[order.orderStatus] || 'WAIT_UPLOAD'
    const mainRow: any = {
      id: order.orderId,
      isMainOrder: true,
      applyTime: formatDateTime(order.applyTime || ''),
      orderNo: order.orderId,
      demandSide: '',
      supplySide: order.providerName || '',
      status: uiStatus,
      statusName: order.orderStatus || '',
      orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 转换为标准状态枚举
      workFlowId: order.workflowId || '',
      taskId: order.taskId || ''
    }
    // 在每个订单块的末尾插入一个分隔空行
    flatData.push({ isSpacer: true, isMainOrder: false, parentOrder: order })
    const subOrders: any[] = Array.isArray(order?.orderDetails)
      ? order?.orderDetails.map((d: any, i: number) => ({
          id: `${order.orderId}-${i + 1}`,
          isMainOrder: false,
          productName: order.productName || '',
          suiteName: d.suiteName,
          salesForm: d.salesForm,
          accountCount: d.accountLimit,
          customerObject: d.customerType,
          concurrentCount: d.concurrentNodes,
          priceType: normalizePriceType(d.priceType),
          unitPrice: d.unitPrice,
          quantity: d.quantity,
          period: d.duration,
        }))
      : []
    // 供合并逻辑使用
    ;(mainRow as any).subOrders = subOrders
    flatData.push(mainRow)
    subOrders.forEach((sub) => flatData.push({ ...sub, parentOrder: mainRow }))
    flatData.push({ isSpacer: true, isMainOrder: false, parentOrder: mainRow })
  })
  orderList.value = flatData
  page.total = mockData.length
}
const btnClick = (workFlowType?: any,businessType?: any) => {
  workFlowStatus.btnClassShow = businessType+workFlowType
  workFlowStatus.workFlowType = workFlowType
  workFlowStatus.businessType = businessType
  // 获取list数据
  handleSearch()
}
// 重置
@@ -609,6 +675,9 @@
    status: '',
    dateRange: [],
  })
  // 清空动态选项
  unitProjectOptions.value = []
  productSubTypeOptions.value = []
  page.current = 1
  handleSearch()
}
@@ -617,9 +686,76 @@
const toApprove = (row: any) => router.push({ name: 'tradeApproval', params: { id: row.id } })
const toCheckFiles = (row: any) => router.push({ name: 'tradeCheckFiles', params: { id: row.id } })
const toDetail = (row: any) => router.push({ name: 'tradeOrderDetail', params: { id: row.id } })
const toTrack = (row: any) => router.push({ name: 'tradeTrack', params: { id: row.id } })
const toTrack = (row: any) => {
  if (!row.workFlowId) {
    ElMessage.warning('该订单暂无工作流信息')
    return
  }
  router.push({ name: 'tradeTrack', params: { id: row.workFlowId } })
}
onMounted(handleSearch)
// 追踪订单 - 显示订单状态对话框
const showOrderTrack = (row: any) => {
  currentOrderId.value = row.id
  orderStatusDialogVisible.value = true
}
// 获取可用操作列表
const getAvailableActions = (order: any) => {
  if (!order.orderStatus) return []
  return OrderWorkflowController.getAvailableActions(PageType.TRADE_APPROVAL, order.orderStatus)
}
// 处理操作点击
const handleAction = (action: any, order: any) => {
  switch (action.type) {
    case ActionType.VIEW:
      toDetail(order)
      break
    case ActionType.TRACK:
      toTrack(order)
      break
    case ActionType.WAIT_APPROVAL_AUTHORIZE:
    case ActionType.AUTHORIZE:
      toAuthorize(order)
      break
    default:
      console.warn('未知的操作类型:', action.type)
  }
}
// 授权:跳转到授权页面
const toAuthorize = (row: any) => {
  router.push({ name: 'tradeAuthorization', params: { id: row.id, taskId: row.taskId } })
}
onMounted(async ()=>{
  // 获取用户信息
  if (!userStore.getUserId) {
    try {
      const res: any = await queryUserDetail()
      if (res?.code === 200 && res.data) {
        userStore.updateUserDetail(res.data)
      } else {
        ElMessage.error(res?.msg || '无法获取用户信息,请先登录')
        return
      }
    } catch (e) {
      console.error('获取用户详情失败:', e)
      ElMessage.error('获取用户信息失败,请稍后重试')
      return
    }
  }
  // 获取初始选项数据
  await Promise.all([
    getIndustryOptions(),
    getProductTypeOptions()
  ])
  // 执行搜索
  handleSearch()
})
</script>
<style scoped lang="scss">
@@ -757,12 +893,16 @@
    gap: 20px;
    align-items: center;
    overflow: hidden;
    .status-item{
      flex-direction: row-reverse;
    }
    .order-item {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      flex: 1;
      
      .label {
        color: #909399;
@@ -778,6 +918,11 @@
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      &.status-item {
        justify-content: flex-start;
        margin-left: 0;
      }
    }
  }
@@ -1003,6 +1148,69 @@
  padding-bottom: 0 !important;
  border-bottom: 2px solid #e4e7ed; // 显示分隔边框线
}
.buttonDiv {
  width: 100%;
  height: 33px;
}
.btnBox {
  width: 505px;
  height: 33px;
  //background-color: pink;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  .btnDivClass {
    background-color: #2f4589 !important;
    color: #fff;
  }
  .btnDiv {
    width: 120px;
    height: 33px;
    border-radius: 5px;
    border: 1px solid #ebeef5;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    //color: #919399;
    cursor: pointer;
    background-color: #FFFFFF;
    span :nth-child(2) {
      color: #f04844;
    }
  }
  .elFormDiv {
    width: 100%;
    height: 100px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    .searchFormDiv {
      display: flex;
      flex-direction: row;
      align-items: center;
    }
    .searchBtnDiv {
      //width: 20%;
      height: 100%;
      display: flex;
      flex-direction: row;
      align-items: center;
    }
  }
}
.numjx {
  padding-right: 5px;
}
</style>