From 2052244755cf907f44713191961c633e68ecf71e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 22 九月 2026 11:54:01 +0800
Subject: [PATCH] fix: 生产追溯页面重构
---
src/views/productionManagement/productionTraceability/index.vue | 1955 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 1,419 insertions(+), 536 deletions(-)
diff --git a/src/views/productionManagement/productionTraceability/index.vue b/src/views/productionManagement/productionTraceability/index.vue
index 9312a44..2efbdfc 100644
--- a/src/views/productionManagement/productionTraceability/index.vue
+++ b/src/views/productionManagement/productionTraceability/index.vue
@@ -1,146 +1,427 @@
<template>
- <div class="app-container">
+ <div class="app-container trace-page">
<PageHeader v-if="showHeader"
- content="鐢熶骇璁㈠崟" />
- <el-card style="height:82vh;overflow:auto;">
- <template #header>
- <div class="card-header">
- <el-form :inline="true"
- :model="searchForm"
- class="search-form">
- <el-form-item label="鐢熶骇璁㈠崟鍙�">
- <el-select v-model="selectedNpsNo"
- filterable
- remote
- reserve-keyword
- placeholder="璇疯緭鍏ョ敓浜ц鍗曞彿"
- :loading="npsNoLoading"
- :remote-method="handleNpsNoSearch"
- @change="handleSearch"
- style="width: 400px;">
- <el-option v-for="option in npsNoOptions"
- :key="option.id"
- :label="option.npsNo + '-' + option.productName + '-' + option.model"
- :value="option.id" />
- </el-select>
- </el-form-item>
- </el-form>
+ content="鐢熶骇杩芥函" />
+
+ <el-card class="filter-card"
+ shadow="never">
+ <el-form :inline="true"
+ :model="searchForm"
+ class="search-form"
+ @submit.prevent>
+ <el-form-item label="鐢熶骇璁㈠崟鍙�">
+ <el-input v-model="searchForm.npsNo"
+ placeholder="璇疯緭鍏ョ敓浜ц鍗曞彿"
+ clearable
+ prefix-icon="Search"
+ style="width: 200px;"
+ @keyup.enter="handleQuery"
+ @clear="handleQuery" />
+ </el-form-item>
+ <el-form-item label="浜у搧鍚嶇О">
+ <el-input v-model="searchForm.productName"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
+ clearable
+ prefix-icon="Search"
+ style="width: 180px;"
+ @keyup.enter="handleQuery"
+ @clear="handleQuery" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸">
+ <el-input v-model="searchForm.model"
+ placeholder="璇疯緭鍏ヨ鏍�"
+ clearable
+ prefix-icon="Search"
+ style="width: 180px;"
+ @keyup.enter="handleQuery"
+ @clear="handleQuery" />
+ </el-form-item>
+ <el-form-item label="鐘舵��">
+ <el-select v-model="searchForm.status"
+ placeholder="鍏ㄩ儴"
+ clearable
+ style="width: 140px;"
+ @change="handleQuery">
+ <el-option v-for="item in statusOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ icon="Search"
+ @click="handleQuery">鎼滅储</el-button>
+ <el-button icon="Refresh"
+ @click="handleReset">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+ </el-card>
+
+ <div class="trace-layout">
+ <el-card class="order-panel"
+ shadow="never"
+ :body-style="{ padding: '12px 14px 8px' }">
+ <template #header>
+ <div class="panel-header">
+ <span class="panel-title">
+ <el-icon><Tickets /></el-icon>
+ 鐢熶骇璁㈠崟
+ </span>
+ <el-tag type="info"
+ effect="plain"
+ round>鍏� {{ page.total }} 鏉�</el-tag>
+ </div>
+ </template>
+ <el-table ref="orderTableRef"
+ v-loading="listLoading"
+ :data="orderList"
+ row-key="id"
+ border
+ highlight-current-row
+ height="calc(100vh - 28em)"
+ @row-click="handleSelectOrder">
+ <el-table-column label="鐢熶骇璁㈠崟鍙�"
+ min-width="210">
+ <template #default="{ row }">
+ <div class="order-cell">
+ <span class="order-no">{{ row.npsNo || '-' }}</span>
+ <span class="order-sub">{{ [row.productName, row.model].filter(Boolean).join(' / ') || '-' }}</span>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐘舵��"
+ width="82"
+ align="center">
+ <template #default="{ row }">
+ <el-tag size="small"
+ effect="light"
+ :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="瀹屾垚杩涘害"
+ width="116"
+ align="center">
+ <template #default="{ row }">
+ <div class="mini-progress">
+ <el-progress :percentage="toProgress(row.completionStatus)"
+ :color="progressColor(row.completionStatus)"
+ :stroke-width="6"
+ :show-text="false" />
+ <span class="mini-progress-text">{{ percentText(row.completionStatus) }}</span>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ width="70"
+ align="center">
+ <template #default="{ row }">
+ <el-button type="primary"
+ link
+ @click.stop="handleSelectOrder(row)">杩芥函</el-button>
+ </template>
+ </el-table-column>
+ <template #empty>
+ <el-empty description="鏆傛棤鐢熶骇璁㈠崟"
+ :image-size="80" />
+ </template>
+ </el-table>
+ <div class="panel-pagination">
+ <el-pagination small
+ background
+ layout="sizes, prev, pager, next"
+ :page-sizes="[10, 20, 50, 100]"
+ :pager-count="5"
+ :total="page.total"
+ :current-page="page.current"
+ :page-size="page.size"
+ @current-change="handlePageChange"
+ @size-change="handleSizeChange" />
</div>
- </template>
- <!-- 鍩虹淇℃伅 -->
- <div v-if="rowData.productionOrderDto"
- class="detail-section">
- <h3 class="section-title">鍩虹淇℃伅</h3>
- <el-descriptions :column="3"
- border>
- <el-descriptions-item label="鐢熶骇璁㈠崟鍙�">{{ rowData.productionOrderDto?.npsNo || '-' }}</el-descriptions-item>
- <el-descriptions-item label="浜у搧鍚嶇О">{{ rowData.productionOrderDto?.productName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="浜у搧瑙勬牸">{{ rowData.productionOrderDto?.model || '-' }}</el-descriptions-item>
- <!-- <el-descriptions-item label="鐗╂枡缂栫爜">{{ rowData.productionOrderDto?.materialCode || '-' }}</el-descriptions-item> -->
- <el-descriptions-item label="璁″垝鏁伴噺">{{ rowData.productionOrderDto?.quantity || 0 }} <span class="unit">{{ rowData.productionOrderDto?.unit || '-' }}</span></el-descriptions-item>
- <el-descriptions-item label="褰撳墠鐘舵��">
- <el-tag :type="getStatusType(rowData.productionOrderDto?.status)">
- {{ getStatusText(rowData.productionOrderDto?.status) }}
- </el-tag>
- </el-descriptions-item>
- <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ rowData.productionOrderDto?.customerName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="寮�濮嬫棩鏈�">{{ parseTime(rowData.productionOrderDto?.startTime,'{y}-{m}-{d}') || '-' }}</el-descriptions-item>
- <el-descriptions-item label="瀹屾垚杩涘害">
- <el-progress :percentage="rowData.productionOrderDto?.completionStatus>=100?100:rowData.productionOrderDto?.completionStatus"
- :color="customColors(rowData.productionOrderDto?.completionStatus)"
- :status="rowData.productionOrderDto?.completionStatus >= 100 ? 'success' : ''"
- style="width: 80%;" />
- </el-descriptions-item>
- </el-descriptions>
- </div>
- <el-empty v-else
- description="璇锋悳绱㈢敓浜ц鍗曞彿" />
- <!-- 鐢熶骇鎶ュ伐璁板綍 -->
- <div v-if="rowData.productionRecords && rowData.productionRecords.length > 0"
- class="progress-container">
- <div class="progress-section">
- <h3 class="section-title">宸ュ崟淇℃伅</h3>
- <div class="order-item">
- <el-table :data="rowData.productionRecords"
+ </el-card>
+
+ <div class="detail-panel">
+ <el-card v-if="!currentOrder"
+ class="placeholder-card"
+ shadow="never">
+ <div class="placeholder">
+ <div class="placeholder-icon">
+ <el-icon><Aim /></el-icon>
+ </div>
+ <p class="placeholder-title">鐢熶骇鍏ㄦ祦绋嬭拷婧�</p>
+ <p class="placeholder-tip">
+ 浠庡乏渚ц鍗曞垪琛ㄤ腑閫夋嫨涓�涓敓浜ц鍗曪紝鍗冲彲鏌ョ湅璇ヨ鍗曠殑鍩虹淇℃伅銆佸伐搴忚繘搴︺�佹姤宸ヨ褰曚笌璐ㄦ淇℃伅
+ </p>
+ </div>
+ <div v-if="orderList.length"
+ class="quick-orders">
+ <div class="quick-title">蹇�熸煡鐪嬪綋鍓嶉〉璁㈠崟</div>
+ <div class="quick-list">
+ <div v-for="item in orderList.slice(0, 6)"
+ :key="item.id"
+ class="quick-item"
+ @click="handleSelectOrder(item)">
+ <span class="quick-no">{{ item.npsNo }}</span>
+ <span class="quick-name">{{ item.productName || '-' }}</span>
+ <el-tag size="small"
+ effect="light"
+ :type="getStatusType(item.status)">{{ getStatusText(item.status) }}</el-tag>
+ </div>
+ </div>
+ </div>
+ </el-card>
+
+ <template v-else>
+ <el-card class="detail-card"
+ shadow="never"
+ v-loading="detailLoading">
+ <div class="detail-head">
+ <div class="detail-head-left">
+ <el-image v-if="productImage"
+ :src="productImage"
+ :preview-src-list="productImageList"
+ preview-teleported
+ fit="cover"
+ class="product-thumb" />
+ <div v-else
+ class="product-thumb product-thumb-empty">
+ <el-icon><Box /></el-icon>
+ </div>
+ <div class="detail-head-info">
+ <div class="detail-title-row">
+ <span class="detail-no">{{ currentOrder.npsNo || '-' }}</span>
+ <el-tag :type="getStatusType(currentOrder.status)"
+ effect="light">{{ getStatusText(currentOrder.status) }}</el-tag>
+ <el-tag v-if="currentOrder.endOrder"
+ type="danger"
+ effect="plain">宸茬粨鏉�</el-tag>
+ </div>
+ <div class="detail-sub">
+ <span>{{ orderInfo.productName || '-' }}</span>
+ <el-divider direction="vertical" />
+ <span>瑙勬牸锛歿{ orderInfo.model || '-' }}</span>
+ <el-divider direction="vertical" />
+ <span>瀹㈡埛锛歿{ orderInfo.customerName || '-' }}</span>
+ </div>
+ </div>
+ </div>
+ <div class="detail-head-actions">
+ <el-button link
+ type="primary"
+ icon="Refresh"
+ @click="loadDetail(currentOrder)">鍒锋柊</el-button>
+ <el-button link
+ icon="Close"
+ @click="handleCloseDetail">鏀惰捣</el-button>
+ </div>
+ </div>
+
+ <div class="stat-grid">
+ <div v-for="item in statTiles"
+ :key="item.label"
+ class="stat-tile"
+ :class="`tone-${item.tone}`">
+ <div class="stat-tile-value">{{ item.value }}</div>
+ <div class="stat-tile-label">{{ item.label }}</div>
+ </div>
+ </div>
+
+ <h4 class="sub-title">鍩虹淇℃伅</h4>
+ <el-descriptions :column="3"
+ border>
+ <el-descriptions-item label="鐢熶骇璁㈠崟鍙�">{{ orderInfo.npsNo || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="浜у搧鍚嶇О">{{ orderInfo.productName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="浜у搧瑙勬牸">{{ orderInfo.model || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="閿�鍞崟鍙�">{{ orderInfo.salesContractNo || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ orderInfo.customerName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="宸ヨ壓璺嚎缂栧彿">{{ orderInfo.processRouteCode || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="BOM缂栧彿">{{ orderInfo.bomNo || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="寮�濮嬫棩鏈�">{{ orderStartDate }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝瀹屾垚鏃堕棿">{{ parseTime(orderInfo.planCompleteTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="缁撴潫鏃ユ湡">{{ orderEndDate }}</el-descriptions-item>
+ <el-descriptions-item label="鍒涘缓鏃堕棿">{{ parseTime(orderInfo.createTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁㈠崟瀹屾垚杩涘害">
+ <el-progress :percentage="toProgress(orderInfo.completionStatus)"
+ :color="progressColor(orderInfo.completionStatus)"
+ :status="toPercent(orderInfo.completionStatus) >= 100 ? 'success' : ''">
+ <span>{{ percentText(orderInfo.completionStatus) }}</span>
+ </el-progress>
+ </el-descriptions-item>
+ </el-descriptions>
+ </el-card>
+
+ <el-card v-if="workOrderList.length"
+ class="detail-card"
+ shadow="never">
+ <template #header>
+ <div class="panel-header">
+ <span class="panel-title">
+ <el-icon><Operation /></el-icon>
+ 宸ュ簭杩涘害
+ </span>
+ <span class="panel-hint">鐐瑰嚮宸ュ簭鍗$墖鍙煡鐪嬭宸ュ簭鐨勬姤宸ヨ褰�</span>
+ </div>
+ </template>
+ <div class="flow-steps">
+ <div v-for="(item, index) in workOrderList"
+ :key="item.workOrder?.id ?? index"
+ class="flow-step"
+ :class="stepClass(item)"
+ @click="handleClickStep(item)">
+ <div class="flow-step-main">
+ <div class="flow-step-circle">{{ percentLabel(item.workOrder?.completionStatus) }}</div>
+ <div class="flow-step-name"
+ :title="item.workOrder?.operationName">{{ item.workOrder?.operationName || '鏈懡鍚嶅伐搴�' }}</div>
+ <div class="flow-step-qty">{{ formatNumber(item.workOrder?.completeQuantity) }}/{{ formatNumber(item.workOrder?.planQuantity) }}</div>
+ <div class="flow-step-badges">
+ <span class="badge badge-report">鎶ュ伐 {{ (item.reportList || []).length }}</span>
+ <span class="badge badge-inspect">璐ㄦ {{ (item.inspectList || []).length }}</span>
+ </div>
+ </div>
+ <div v-if="index < workOrderList.length - 1"
+ class="flow-step-line"></div>
+ </div>
+ </div>
+ </el-card>
+
+ <el-card class="detail-card"
+ shadow="never">
+ <template #header>
+ <div class="panel-header">
+ <span class="panel-title">
+ <el-icon><List /></el-icon>
+ 宸ュ崟淇℃伅
+ </span>
+ <span class="panel-hint">鍏� {{ workOrderList.length }} 閬撳伐搴�</span>
+ </div>
+ </template>
+ <el-table :data="workOrderList"
border
style="width: 100%">
- <el-table-column prop="workOrder.workOrderNo"
- label="宸ュ崟缂栧彿"
- align="center">
- </el-table-column>
- <el-table-column label="浜у搧鍚嶇О"
+ <el-table-column label="宸ュ崟缂栧彿"
+ min-width="150"
align="center">
<template #default="{ row }">
- {{ row.workOrder.productName || '-' }}
- </template>
- </el-table-column>
- <el-table-column label="瑙勬牸"
- align="center">
- <template #default="{ row }">
- {{ row.workOrder.model || '-' }}
+ {{ row.workOrder?.workOrderNo || '-' }}
</template>
</el-table-column>
<el-table-column label="宸ュ簭"
- prop="workOrder.operationName"
- align="center" />
- <el-table-column prop="workOrder.planQuantity"
- label="闇�姹傛暟閲�"
- align="center" />
- <el-table-column prop="workOrder.completeQuantity"
- label="瀹屾垚鏁伴噺"
- align="center" />
- <el-table-column prop="workOrder.scrapQty"
- label="鎶ュ簾鏁伴噺"
- align="center" />
- <el-table-column prop="workOrder.completionStatus"
- label="瀹屾垚杩涘害"
+ min-width="110"
align="center">
<template #default="{ row }">
- <span :style="{ color: customColors(row.workOrder.completionStatus) }">{{ row.workOrder.completionStatus || 0 }}%</span>
+ {{ row.workOrder?.operationName || '-' }}
</template>
</el-table-column>
- <el-table-column label="璇︽儏"
- align="center"
- width="200">
+ <el-table-column label="浜у搧鍚嶇О"
+ min-width="120"
+ align="center">
<template #default="{ row }">
- <el-link @click="handleClickStep(row)"
- type="primary">鎶ュ伐璁板綍</el-link>
- <el-link @click="handleClickQuality(row)"
- style="margin-left:20px"
- type="primary">璐ㄦ淇℃伅</el-link>
+ {{ row.workOrder?.productName || '-' }}
</template>
</el-table-column>
+ <el-table-column label="瑙勬牸"
+ min-width="110"
+ align="center">
+ <template #default="{ row }">
+ {{ row.workOrder?.model || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="闇�姹傛暟閲�"
+ width="90"
+ align="center">
+ <template #default="{ row }">
+ {{ formatNumber(row.workOrder?.planQuantity) }}
+ </template>
+ </el-table-column>
+ <el-table-column label="瀹屾垚鏁伴噺"
+ width="90"
+ align="center">
+ <template #default="{ row }">
+ {{ formatNumber(row.workOrder?.completeQuantity) }}
+ </template>
+ </el-table-column>
+ <el-table-column label="鎶ュ簾鏁伴噺"
+ width="90"
+ align="center">
+ <template #default="{ row }">
+ <span :class="{ 'danger-text': Number(row.workOrder?.scrapQty) > 0 }">{{ formatNumber(row.workOrder?.scrapQty) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="瀹屾垚杩涘害"
+ width="150"
+ align="center">
+ <template #default="{ row }">
+ <el-progress :percentage="toProgress(row.workOrder?.completionStatus)"
+ :color="progressColor(row.workOrder?.completionStatus)"
+ :status="toPercent(row.workOrder?.completionStatus) >= 100 ? 'success' : ''">
+ <span>{{ percentText(row.workOrder?.completionStatus) }}</span>
+ </el-progress>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎶ュ伐/璐ㄦ"
+ width="110"
+ align="center">
+ <template #default="{ row }">
+ <span class="badge badge-report">{{ (row.reportList || []).length }}</span>
+ <span class="badge badge-inspect">{{ (row.inspectList || []).length }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="瀹為檯鏃堕棿"
+ min-width="190"
+ align="center">
+ <template #default="{ row }">
+ {{ parseTime(row.workOrder?.actualStartTime, '{y}-{m}-{d}') || '-' }}
+ ~
+ {{ parseTime(row.workOrder?.actualEndTime, '{y}-{m}-{d}') || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ width="170"
+ align="center"
+ fixed="right">
+ <template #default="{ row }">
+ <el-button type="primary"
+ link
+ @click="handleClickStep(row)">鎶ュ伐璁板綍</el-button>
+ <el-button type="success"
+ link
+ @click="handleClickQuality(row)">璐ㄦ淇℃伅</el-button>
+ </template>
+ </el-table-column>
+ <template #empty>
+ <el-empty description="鏆傛棤宸ュ崟鏁版嵁"
+ :image-size="80" />
+ </template>
</el-table>
- </div>
- </div>
+ </el-card>
+ </template>
</div>
- <el-empty v-else-if="rowData.productionOrderDto"
- description="鏆傛棤鎶ュ伐璁板綍" />
- </el-card>
- <!-- 鐢熶骇鎶ュ伐璇︽儏寮圭獥 -->
+ </div>
+
<el-dialog v-model="detailDialogVisible"
- title="鐢熶骇鎶ュ伐璇︽儏"
+ :title="reportDialogTitle"
width="1000px"
:close-on-click-modal="false"
- custom-class="custom-dialog">
+ class="trace-dialog">
<div class="detail-container">
- <!-- 鍩虹淇℃伅 -->
<div class="detail-section">
<h3 class="section-title">宸ュ崟鍩虹淇℃伅</h3>
<el-descriptions :column="3"
border>
<el-descriptions-item label="鐢熶骇宸ュ崟鍙�">{{ detailData.workOrder.workOrderNo || '-' }}</el-descriptions-item>
- <el-descriptions-item label="璁″垝鏁伴噺">{{ detailData.workOrder.planQuantity || 0 }}</el-descriptions-item>
- <el-descriptions-item label="瀹屾垚鏁伴噺">{{ detailData.workOrder.completeQuantity || 0 }}</el-descriptions-item>
+ <el-descriptions-item label="宸ュ簭鍚嶇О">{{ detailData.workOrder.operationName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝鏁伴噺">{{ formatNumber(detailData.workOrder.planQuantity) }}</el-descriptions-item>
+ <el-descriptions-item label="瀹屾垚鏁伴噺">{{ formatNumber(detailData.workOrder.completeQuantity) }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ュ簾鏁伴噺">{{ formatNumber(detailData.workOrder.scrapQty) }}</el-descriptions-item>
+ <el-descriptions-item label="瀹屾垚杩涘害">
+ <span :style="{ color: progressColor(detailData.workOrder.completionStatus) }">{{ percentText(detailData.workOrder.completionStatus) }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="璁″垝寮�濮嬫椂闂�">{{ parseTime(detailData.workOrder.planStartTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝瀹屾垚鏃堕棿">{{ parseTime(detailData.workOrder.planEndTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
<el-descriptions-item label="瀹為檯寮�濮嬫椂闂�">{{ parseTime(detailData.workOrder.actualStartTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
<el-descriptions-item label="瀹為檯缁撴潫鏃堕棿">{{ parseTime(detailData.workOrder.actualEndTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
- <!-- <el-descriptions-item label="瀹屾垚杩涘害">
- <el-progress :percentage="detailData.workOrder.completionStatus >= 100 ? 100 : (detailData.workOrder.completionStatus || 0)"
- :color="customColors(detailData.workOrder.completionStatus)"
- :status="detailData.workOrder.completionStatus >= 100 ? 'success' : ''"
- style="width:500px;" />
- </el-descriptions-item> -->
- <el-descriptions-item label="瀹屾垚杩涘害"><span :style="{ color: customColors(detailData.workOrder.completionStatus) }">{{ detailData.workOrder.completionStatus || 0 }}%</span></el-descriptions-item>
+ <el-descriptions-item label="鎶ュ伐浜哄憳">{{ detailData.workOrder.userNames || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ュ伐娆℃暟">{{ detailData.reports.length }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="detail-section">
@@ -148,6 +429,10 @@
<el-table :data="detailData.reports"
border
style="width: 100%">
+ <el-table-column label="搴忓彿"
+ type="index"
+ width="60"
+ align="center" />
<el-table-column label="鎶ュ伐鍗曞彿"
prop="productNo"
align="center" />
@@ -157,18 +442,27 @@
<el-table-column label="鍒涘缓鏃堕棿"
align="center">
<template #default="{ row }">
- {{ parseTime(row.createTime, '{y}-{m}-{d}') }}
+ {{ parseTime(row.createTime, '{y}-{m}-{d}') || '-' }}
</template>
</el-table-column>
<el-table-column label="宸ユ椂锛坔锛�"
- prop="workHour"
- align="center" />
+ align="center">
+ <template #default="{ row }">
+ {{ formatNumber(row.workHour) }}
+ </template>
+ </el-table-column>
<el-table-column label="浜у嚭鏁伴噺"
- prop="quantity"
- align="center" />
+ align="center">
+ <template #default="{ row }">
+ {{ formatNumber(row.quantity) }}
+ </template>
+ </el-table-column>
<el-table-column label="鎶ュ簾鏁伴噺"
- prop="scrapQty"
- align="center" />
+ align="center">
+ <template #default="{ row }">
+ {{ formatNumber(row.scrapQty) }}
+ </template>
+ </el-table-column>
<el-table-column label="鎿嶄綔"
align="center"
width="200">
@@ -181,6 +475,10 @@
@click="showParamDetail(row.productionOperationParamList)">鍙傛暟璇︽儏</el-button>
</template>
</el-table-column>
+ <template #empty>
+ <el-empty description="鏆傛棤鎶ュ伐璁板綍"
+ :image-size="80" />
+ </template>
</el-table>
</div>
</div>
@@ -190,14 +488,15 @@
</div>
</template>
</el-dialog>
- <!-- 鎶曞叆妯℃�佹 -->
+
<input-modal v-if="isShowInput"
v-model:visible="isShowInput"
:production-product-main-id="isShowingId" />
- <!-- 鍙傛暟璇︽儏寮圭獥 -->
+
<el-dialog v-model="paramDetailVisible"
title="鍙傛暟璇︽儏"
- width="600px">
+ width="600px"
+ class="trace-dialog">
<div v-if="currentParams && currentParams.length > 0"
class="param-detail-list">
<el-descriptions :column="1"
@@ -219,61 +518,89 @@
</span>
</template>
</el-dialog>
- <!-- 璐ㄦ淇℃伅寮圭獥 -->
+
<el-dialog v-model="qualityDialogVisible"
title="璐ㄦ璇︽儏"
width="1000px"
:close-on-click-modal="false"
- custom-class="custom-dialog">
+ class="trace-dialog">
<div class="detail-container">
- <div v-for="(record, index) in qualityRecords"
- :key="record.id"
- class="quality-record-block">
- <div class="detail-section">
- <h3 class="section-title">妫�娴嬭褰� {{ index + 1 }} - {{ parseTime(record.createTime, '{y}-{m}-{d}') }}</h3>
- <el-descriptions :column="3"
- border>
- <el-descriptions-item label="妫�娴嬫棩鏈�">{{ parseTime(record.createTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
- <el-descriptions-item label="鎶ュ伐鍗曞彿">{{ record.reportNo || '-' }}</el-descriptions-item>
- <el-descriptions-item label="鎶ュ伐浜哄憳">{{ record.userName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="浜у搧鍚嶇О">{{ record.productName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ record.model || '-' }}</el-descriptions-item>
- <el-descriptions-item label="鏁伴噺">{{ record.quantity || 0 }} {{ record.unit || '-' }}</el-descriptions-item>
- <el-descriptions-item label="妫�娴嬪崟浣�">{{ record.checkCompany || '-' }}</el-descriptions-item>
- <el-descriptions-item label="妫�楠屽憳">{{ record.checkName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="鍚堟牸鐜�">
- <el-tag :type="getPassRateTagType(record)">
- {{ getPassRateDisplay(record) }}
- </el-tag>
- </el-descriptions-item>
- </el-descriptions>
- <h4 class="sub-section-title">妫�楠屾寚鏍囧垪琛�</h4>
- <el-table :data="record.inspectParamList"
- border
- style="width: 100%">
- <el-table-column label="搴忓彿"
- type="index"
- width="60"
- align="center" />
- <el-table-column label="鎸囨爣"
- prop="parameterItem"
- align="center" />
- <el-table-column label="鍗曚綅"
- prop="unit"
- align="center" />
- <el-table-column label="鏍囧噯鍊�"
- prop="standardValue"
- align="center" />
- <el-table-column label="鍐呮帶鍊�"
- prop="controlValue"
- align="center" />
- <el-table-column label="瀹為檯鍊�"
- prop="testValue"
- align="center" />
- </el-table>
+ <div v-if="qualityRecords.length">
+ <div v-for="(record, index) in qualityRecords"
+ :key="record.id ?? index"
+ class="quality-record-block">
+ <div class="detail-section">
+ <h3 class="section-title">妫�娴嬭褰� {{ index + 1 }} - {{ parseTime(record.createTime, '{y}-{m}-{d}') }}</h3>
+ <el-descriptions :column="3"
+ border>
+ <el-descriptions-item label="妫�娴嬫棩鏈�">{{ parseTime(record.createTime, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ュ伐鍗曞彿">{{ record.reportNo || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ュ伐浜哄憳">{{ record.userName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="浜у搧鍚嶇О">{{ record.productName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ record.model || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鏁伴噺">{{ formatNumber(record.quantity) }} {{ record.unit || '' }}</el-descriptions-item>
+ <el-descriptions-item label="妫�娴嬪崟浣�">{{ record.checkCompany || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="妫�楠屽憳">{{ record.checkName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鍚堟牸鐜�">
+ <el-tag :type="getPassRateTagType(record)">
+ {{ getPassRateDisplay(record) }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="鍚堟牸鏁伴噺">{{ formatNumber(record.qualifiedQuantity) }}</el-descriptions-item>
+ <el-descriptions-item label="涓嶅悎鏍兼暟閲�">{{ formatNumber(record.unqualifiedQuantity) }}</el-descriptions-item>
+ <el-descriptions-item label="妫�楠岀粨璁�">{{ record.checkResult || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="涓嶅悎鏍肩幇璞�"
+ :span="3">{{ record.defectivePhenomena || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <h4 class="sub-section-title">妫�楠屾寚鏍囧垪琛�</h4>
+ <el-table :data="record.inspectParamList"
+ border
+ style="width: 100%">
+ <el-table-column label="搴忓彿"
+ type="index"
+ width="60"
+ align="center" />
+ <el-table-column label="鎸囨爣"
+ prop="parameterItem"
+ align="center" />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ align="center" />
+ <el-table-column label="鏍囧噯鍊�"
+ prop="standardValue"
+ align="center" />
+ <el-table-column label="鍐呮帶鍊�"
+ prop="controlValue"
+ align="center" />
+ <el-table-column label="瀹為檯鍊�"
+ prop="testValue"
+ align="center" />
+ <template #empty>
+ <el-empty description="鏆傛棤妫�楠屾寚鏍�"
+ :image-size="60" />
+ </template>
+ </el-table>
+ <div v-if="record.inspectFileList && record.inspectFileList.length"
+ class="inspect-files">
+ <h4 class="sub-section-title">妫�楠岄檮浠�</h4>
+ <div class="inspect-file-list">
+ <a v-for="file in record.inspectFileList"
+ :key="file.id"
+ :href="resolveFileUrl(file.url) || undefined"
+ :target="resolveFileUrl(file.url) ? '_blank' : undefined"
+ class="inspect-file-item"
+ :class="{ 'is-disabled': !resolveFileUrl(file.url) }">
+ <el-icon><Paperclip /></el-icon>
+ {{ file.name || '闄勪欢' }}
+ </a>
+ </div>
+ </div>
+ </div>
+ <el-divider v-if="index < qualityRecords.length - 1" />
</div>
- <el-divider v-if="index < qualityRecords.length - 1" />
</div>
+ <el-empty v-else
+ description="鏆傛棤璐ㄦ璁板綍" />
</div>
<template #footer>
<div class="dialog-footer">
@@ -285,8 +612,8 @@
</template>
<script setup>
- import { ref, reactive, onMounted, computed } from "vue";
- import { useRoute, useRouter } from "vue-router";
+ import { ref, reactive, computed, onMounted } from "vue";
+ import { useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import { parseTime } from "@/utils/ruoyi";
import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
@@ -296,37 +623,305 @@
} from "@/api/productionManagement/productionOrder";
const route = useRoute();
- const router = useRouter();
- // 鍒ゆ柇鏄惁鏄剧ず椤靛ご
+ const statusOptions = [
+ { label: "寰呭紑濮�", value: 1 },
+ { label: "杩涜涓�", value: 2 },
+ { label: "宸插畬鎴�", value: 3 },
+ { label: "宸插彇娑�", value: 4 },
+ { label: "宸茬粨鏉�", value: 5 },
+ ];
+
const showHeader = computed(() => {
return (
Object.keys(route.query).length > 0 || Object.keys(route.params).length > 0
);
});
- // 鎼滅储鐩稿叧
const searchForm = reactive({
npsNo: "",
- });
- const selectedNpsNo = ref(null);
- const npsNoLoading = ref(false);
- const npsNoOptions = ref([]);
-
- // 璇︽儏鏁版嵁
- const rowData = reactive({
- productionOrderDto: null,
- productionRecords: [],
+ productName: "",
+ model: "",
+ status: "",
});
- // 鎶ュ伐璇︽儏寮圭獥
+ const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0,
+ });
+
+ const orderList = ref([]);
+ const listLoading = ref(false);
+ const orderTableRef = ref(null);
+
+ const currentOrder = ref(null);
+ const detailLoading = ref(false);
+ const detail = ref({
+ productionOrder: null,
+ workOrderList: [],
+ });
+
+ const workOrderList = computed(() => detail.value.workOrderList || []);
+ const orderInfo = computed(
+ () => detail.value.productionOrder || currentOrder.value || {}
+ );
+ const productImageList = computed(() =>
+ (orderInfo.value.productImages || [])
+ .map(item => item.previewURL || item.url)
+ .filter(Boolean)
+ );
+ const productImage = computed(() => productImageList.value[0] || "");
+ const unitText = computed(() => workOrderList.value[0]?.workOrder?.unit || "");
+
+ const firstDate = values => {
+ const list = values.filter(Boolean).map(String).sort();
+ return list.length ? parseTime(list[0], "{y}-{m}-{d}") : null;
+ };
+
+ const lastDate = values => {
+ const list = values.filter(Boolean).map(String).sort();
+ return list.length ? parseTime(list[list.length - 1], "{y}-{m}-{d}") : null;
+ };
+
+ const reportCreateTimes = computed(() =>
+ workOrderList.value.flatMap(item =>
+ (item.reportList || []).map(report => report.reportMain?.createTime)
+ )
+ );
+
+ const orderStartDate = computed(() => {
+ const info = orderInfo.value;
+ if (info.startTime) return parseTime(info.startTime, "{y}-{m}-{d}");
+ const fromWorkOrders = firstDate(
+ workOrderList.value.map(item => item.workOrder?.actualStartTime)
+ );
+ if (fromWorkOrders) return fromWorkOrders;
+ return firstDate(reportCreateTimes.value) || "-";
+ });
+
+ const orderEndDate = computed(() => {
+ const info = orderInfo.value;
+ if (info.endTime) return parseTime(info.endTime, "{y}-{m}-{d}");
+ const fromWorkOrders = lastDate(
+ workOrderList.value.map(item => item.workOrder?.actualEndTime)
+ );
+ if (fromWorkOrders) return fromWorkOrders;
+ return lastDate(reportCreateTimes.value) || "-";
+ });
+
+ const getStatusType = status => {
+ const typeMap = { 1: "primary", 2: "warning", 3: "success", 5: "danger" };
+ return typeMap[status] || "info";
+ };
+ const getStatusText = status => {
+ if (status === null || status === undefined || status === "") return "-";
+ const statusMap = { 1: "寰呭紑濮�", 2: "杩涜涓�", 3: "宸插畬鎴�", 5: "宸茬粨鏉�", 4: "宸插彇娑�" };
+ return statusMap[status] || "-";
+ };
+
+ const resolveFileUrl = url => {
+ if (!url) return "";
+ if (/^(https?:)?\/\//i.test(url) || url.startsWith("data:")) return url;
+ return "";
+ };
+
+ const toPercent = value => {
+ const num = Number(value);
+ if (!Number.isFinite(num) || num <= 0) return 0;
+ return Math.round(num * 100) / 100;
+ };
+
+ const toProgress = value => Math.min(100, Math.round(toPercent(value)));
+
+ const percentText = value => `${toPercent(value)}%`;
+
+ const percentLabel = value => `${Math.round(toPercent(value))}%`;
+
+ const progressColor = value => {
+ const percentage = toPercent(value);
+ if (percentage < 30) return "#f56c6c";
+ if (percentage < 70) return "#e6a23c";
+ return "#67c23a";
+ };
+
+ const formatNumber = value => {
+ if (value === null || value === undefined || value === "") return "-";
+ const num = Number(value);
+ if (!Number.isFinite(num)) return value;
+ return Number.isInteger(num) ? num : Number(num.toFixed(2));
+ };
+
+ const summary = computed(() => {
+ let scrapQty = 0;
+ let reportCount = 0;
+ let inspectCount = 0;
+ let qualified = 0;
+ let unqualified = 0;
+ workOrderList.value.forEach(item => {
+ const workOrder = item.workOrder || {};
+ scrapQty += Number(workOrder.scrapQty) || 0;
+ reportCount += (item.reportList || []).length;
+ const inspectList = item.inspectList || [];
+ inspectCount += inspectList.length;
+ inspectList.forEach(record => {
+ qualified += Number(record.inspect?.qualifiedQuantity) || 0;
+ unqualified += Number(record.inspect?.unqualifiedQuantity) || 0;
+ });
+ });
+ const totalInspect = qualified + unqualified;
+ return {
+ scrapQty,
+ reportCount,
+ inspectCount,
+ workOrderCount: workOrderList.value.length,
+ passRate: totalInspect
+ ? Number(((qualified / totalInspect) * 100).toFixed(2))
+ : null,
+ };
+ });
+
+ const statTiles = computed(() => {
+ const info = orderInfo.value;
+ const data = summary.value;
+ return [
+ { label: "璁″垝鏁伴噺", value: withUnit(info.quantity), tone: "blue" },
+ { label: "瀹屾垚鏁伴噺", value: withUnit(info.completeQuantity), tone: "green" },
+ { label: "鎶ュ簾鏁伴噺", value: withUnit(data.scrapQty), tone: "red" },
+ { label: "瀹屾垚杩涘害", value: percentText(info.completionStatus), tone: "orange" },
+ { label: "宸ュ崟鏁�", value: data.workOrderCount, tone: "indigo" },
+ { label: "鎶ュ伐璁板綍", value: data.reportCount, tone: "cyan" },
+ { label: "璐ㄦ璁板綍", value: data.inspectCount, tone: "purple" },
+ {
+ label: "鑹搧鐜�",
+ value: data.passRate === null ? "鈥�" : `${data.passRate}%`,
+ tone: "teal",
+ },
+ ];
+ });
+
+ const withUnit = value => {
+ const text = formatNumber(value);
+ if (text === "-") return text;
+ return unitText.value ? `${text} ${unitText.value}` : text;
+ };
+
+ const stepClass = item => {
+ const percentage = toPercent(item.workOrder?.completionStatus);
+ if (percentage >= 100) return "is-done";
+ if (percentage > 0) return "is-active";
+ return "";
+ };
+
+ const getList = async () => {
+ listLoading.value = true;
+ try {
+ const res = await productOrderListPage({
+ npsNo: searchForm.npsNo || undefined,
+ productName: searchForm.productName || undefined,
+ model: searchForm.model || undefined,
+ status: searchForm.status || undefined,
+ current: page.current,
+ size: page.size,
+ });
+ const data = res.data || {};
+ orderList.value = data.records || [];
+ page.total = Number(data.total) || 0;
+ } catch (error) {
+ console.error(error);
+ ElMessage.error("鑾峰彇鐢熶骇璁㈠崟鍒楄〃澶辫触");
+ orderList.value = [];
+ page.total = 0;
+ } finally {
+ listLoading.value = false;
+ }
+ };
+
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+
+ const handleReset = () => {
+ searchForm.npsNo = "";
+ searchForm.productName = "";
+ searchForm.model = "";
+ searchForm.status = "";
+ handleQuery();
+ };
+
+ const handlePageChange = current => {
+ page.current = current;
+ getList();
+ };
+
+ const handleSizeChange = size => {
+ page.size = size;
+ page.current = 1;
+ getList();
+ };
+
+ const loadDetail = async row => {
+ if (!row?.npsNo) return;
+ detailLoading.value = true;
+ detail.value = { productionOrder: row, workOrderList: [] };
+ try {
+ const res = await getOrderDetail(row.npsNo);
+ if (res.code === 200 && res.data) {
+ const loadedOrder = res.data.productionOrder || row;
+ detail.value = {
+ productionOrder: loadedOrder,
+ workOrderList: res.data.workOrderList || [],
+ };
+ currentOrder.value = loadedOrder;
+ } else {
+ ElMessage.warning(res.msg || "鑾峰彇鐢熶骇璁㈠崟杩芥函淇℃伅澶辫触");
+ }
+ } catch (error) {
+ console.error(error);
+ ElMessage.error("鑾峰彇鐢熶骇璁㈠崟杩芥函淇℃伅澶辫触");
+ } finally {
+ detailLoading.value = false;
+ }
+ };
+
+ const handleSelectOrder = row => {
+ if (!row) return;
+ currentOrder.value = row;
+ orderTableRef.value?.setCurrentRow(row);
+ loadDetail(row);
+ };
+
+ const handleCloseDetail = () => {
+ currentOrder.value = null;
+ detail.value = { productionOrder: null, workOrderList: [] };
+ orderTableRef.value?.setCurrentRow();
+ };
+
const detailDialogVisible = ref(false);
const detailData = ref({
workOrder: {},
reports: [],
});
- // 鎶曞叆妯℃�佹
+ const reportDialogTitle = computed(() => {
+ const operationName = detailData.value.workOrder?.operationName;
+ return operationName ? `${operationName} - 鎶ュ伐璁板綍` : "鐢熶骇鎶ュ伐璇︽儏";
+ });
+
+ const handleClickStep = row => {
+ detailData.value = {
+ workOrder: row.workOrder || {},
+ reports: (row.reportList || []).map(item => ({
+ ...(item.reportMain || {}),
+ ...((item.reportOutputList || [])[0] || {}),
+ workHour: item.workHour ?? item.reportMain?.workHour,
+ productionOperationParamList: item.reportParamList || [],
+ })),
+ };
+ detailDialogVisible.value = true;
+ };
+
const isShowInput = ref(false);
const isShowingId = ref(0);
const showInput = id => {
@@ -334,7 +929,6 @@
isShowingId.value = id;
};
- // 鍙傛暟璇︽儏寮圭獥
const paramDetailVisible = ref(false);
const currentParams = ref([]);
const showParamDetail = params => {
@@ -342,26 +936,21 @@
paramDetailVisible.value = true;
};
- // 璐ㄦ淇℃伅寮圭獥
const qualityDialogVisible = ref(false);
const qualityRecords = ref([]);
- // 鐘舵�佸鐞�
- const getStatusType = status => {
- const typeMap = { 1: "primary", 2: "warning", 3: "success", 5: "danger" };
- return typeMap[status] || "info";
- };
- const getStatusText = status => {
- const statusMap = { 1: "寰呭紑濮�", 2: "杩涜涓�", 3: "宸插畬鎴�", 5: "宸茬粨鏉�" };
- return statusMap[status] || "宸插彇娑�";
- };
- const customColors = percentage => {
- if (percentage < 30) return "#f56c6c";
- if (percentage < 70) return "#e6a23c";
- return "#67c23a";
+ const handleClickQuality = row => {
+ qualityRecords.value = (row.inspectList || []).map(item => ({
+ ...(item.inspect || {}),
+ reportNo: item.reportNo,
+ userName: item.reportMain?.userName || "-",
+ inspectParamList: item.inspectParamList || [],
+ inspectFileList: item.inspectFileList || [],
+ }));
+ qualityDialogVisible.value = true;
};
- const getPassRate = (record) => {
+ const getPassRate = record => {
const qualified = Number(record.qualifiedQuantity) || 0;
const unqualified = Number(record.unqualifiedQuantity) || 0;
const total = qualified + unqualified;
@@ -369,386 +958,680 @@
return Number(((qualified / total) * 100).toFixed(2));
};
- const getPassRateDisplay = (record) => {
+ const getPassRateDisplay = record => {
const rate = getPassRate(record);
- if (rate === null) return '鈥�';
+ if (rate === null) return "鈥�";
return `${rate}%`;
};
- const getPassRateTagType = (record) => {
+ const getPassRateTagType = record => {
const rate = getPassRate(record);
- if (rate === null) return 'info';
- if (rate >= 100) return 'success';
- if (rate >= 75) return 'primary';
- return 'danger';
- };
-
- // 妯℃嫙鎼滅储鏂规硶
- const handleNpsNoSearch = async query => {
- npsNoLoading.value = true;
- try {
- const res = await productOrderListPage({
- npsNo: query || "",
- pageNum: 1,
- pageSize: 50,
- });
- // 鍙傜収 productionOrder/index.vue 鐨勬暟鎹粨鏋� res.data.records
- npsNoOptions.value = res.data?.records || res.rows || [];
- } catch (error) {
- console.error(error);
- } finally {
- npsNoLoading.value = false;
- }
- };
-
- const handleSearch = async id => {
- const selected = npsNoOptions.value.find(item => item.id === id);
- if (selected) {
- try {
- const res = await getOrderDetail(selected.npsNo);
- if (res.code === 200) {
- const { productionOrder, workOrderList } = res.data;
- rowData.productionOrderDto = productionOrder || selected;
- rowData.productionRecords = workOrderList || [];
- } else {
- rowData.productionOrderDto = selected;
- rowData.productionRecords = [];
- }
- } catch (error) {
- console.error(error);
- ElMessage.error("鑾峰彇璁㈠崟璇︽儏澶辫触");
- rowData.productionOrderDto = selected;
- }
- }
- };
-
- const handleBack = () => {
- router.back();
- };
-
- const handleClickStep = row => {
- // row 鏄� workOrderList 涓殑涓�椤癸紝鍖呭惈 workOrder, reportList, inspectList
- detailData.value = {
- workOrder: row.workOrder || {},
- reports: (row.reportList || []).map(r => ({
- ...r.reportMain,
- ...(r.reportOutputList[0] || {}),
- productionOperationParamList: r.reportParamList || [],
- })),
- };
- detailDialogVisible.value = true;
- };
-
- const handleClickQuality = row => {
- // row 鏄� workOrderList 涓殑涓�椤�
- const inspects = row.inspectList || [];
- qualityRecords.value = inspects.map(i => ({
- ...i.inspect,
- reportNo: i.reportNo,
- userName: i.reportMain?.userName || "-",
- inspectParamList: i.inspectParamList || [],
- inspectFileList: i.inspectFileList || [],
- }));
- qualityDialogVisible.value = true;
+ if (rate === null) return "info";
+ if (rate >= 100) return "success";
+ if (rate >= 75) return "primary";
+ return "danger";
};
onMounted(async () => {
- // 鍒濆鍔犺浇鍒楄〃
- await handleNpsNoSearch();
-
- if (route.query.npsNo) {
- const npsNo = route.query.npsNo;
- const found = npsNoOptions.value.find(item => item.npsNo === npsNo);
- if (found) {
- selectedNpsNo.value = found.id;
- handleSearch(found.id);
- } else {
- // 濡傛灉鍒楄〃涓病鏈夛紙鍙兘鏄垎椤靛師鍥狅級锛屽垯鏍规嵁 npsNo 鍐嶆绮惧噯鎼滅储
- try {
- const res = await productOrderListPage({
- npsNo,
- pageNum: -1,
- pageSize: -1,
- });
- const records = res.data?.records || res.rows || [];
- if (records.length > 0) {
- const item = records[0];
- npsNoOptions.value.unshift(item);
- selectedNpsNo.value = item.id;
- handleSearch(item.id);
- }
- } catch (error) {
- console.error("鑾峰彇璺敱鍙傛暟瀵瑰簲鐨勮鍗曞け璐�", error);
- }
- }
+ const queryNpsNo = route.query.npsNo ? String(route.query.npsNo) : "";
+ if (queryNpsNo) {
+ searchForm.npsNo = queryNpsNo;
+ }
+ await getList();
+ if (!queryNpsNo) return;
+ const found = orderList.value.find(item => item.npsNo === queryNpsNo);
+ if (found) {
+ handleSelectOrder(found);
+ } else {
+ handleSelectOrder({ npsNo: queryNpsNo });
}
});
</script>
-<style scoped>
- .app-container {
- padding: 20px;
- background-color: #f5f7fa;
- min-height: 100vh;
+<style scoped lang="scss">
+ .trace-page {
+ min-height: 100%;
}
- .card-header {
+ .filter-card {
+ margin-bottom: 16px;
+ border-radius: var(--radius-md);
+
+ :deep(.el-card__body) {
+ padding: 18px 20px 0;
+ }
+
+ :deep(.el-form-item) {
+ margin-bottom: 18px;
+ }
+ }
+
+ .trace-layout {
+ display: grid;
+ grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
+ gap: 16px;
+ align-items: start;
+ }
+
+ @media (max-width: 1280px) {
+ .trace-layout {
+ grid-template-columns: minmax(0, 1fr);
+ }
+ }
+
+ .order-panel,
+ .detail-card,
+ .placeholder-card {
+ border-radius: var(--radius-md);
+ }
+
+ .panel-header {
display: flex;
+ align-items: center;
justify-content: space-between;
- align-items: center;
- padding: 0 10px;
+ gap: 8px;
}
- .search-form {
- width: 100%;
- }
-
- .search-form .el-form-item {
- margin-right: 10px;
- }
-
- .detail-section {
- margin-bottom: 24px;
- background-color: #ffffff;
- border-radius: 10px;
- padding: 24px;
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
- transition: all 0.3s ease;
- }
-
- .detail-section:hover {
- box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.12);
- }
-
- .section-title {
- font-size: 16px;
- font-weight: 600;
- margin-bottom: 20px;
- color: #1a1a1a;
- border-bottom: 2px solid #409eff;
- padding-bottom: 10px;
+ .panel-title {
display: flex;
align-items: center;
+ gap: 6px;
+ font-weight: 600;
+ color: var(--text-primary);
}
- .section-title::before {
- content: "";
- display: inline-block;
- width: 4px;
- height: 16px;
- background-color: #409eff;
- margin-right: 8px;
- border-radius: 2px;
+ .panel-hint {
+ font-size: 12px;
+ font-weight: 400;
+ color: var(--text-tertiary);
+ }
+
+ .order-cell {
+ display: flex;
+ flex-direction: column;
+ padding: 2px 0;
+ line-height: 1.4;
+ }
+
+ .order-no {
+ font-weight: 600;
+ color: var(--text-primary);
+ }
+
+ .order-sub {
+ font-size: 12px;
+ color: var(--text-tertiary);
+ margin-top: 2px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .mini-progress {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+
+ :deep(.el-progress) {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .mini-progress-text {
+ font-size: 12px;
+ color: var(--text-tertiary);
+ width: 34px;
+ text-align: right;
+ }
+ }
+
+ .panel-pagination {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 10px;
+ }
+
+ .placeholder-card {
+ :deep(.el-card__body) {
+ padding: 40px 32px;
+ }
+ }
+
+ .placeholder {
+ text-align: center;
+ padding: 20px 0 8px;
+ }
+
+ .placeholder-icon {
+ width: 72px;
+ height: 72px;
+ margin: 0 auto 18px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 34px;
+ color: #fff;
+ background: linear-gradient(135deg, #3b82f6, #38bdf8);
+ box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
+ }
+
+ .placeholder-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: var(--text-primary);
+ margin: 0 0 8px;
+ }
+
+ .placeholder-tip {
+ font-size: 13px;
+ color: var(--text-tertiary);
+ line-height: 1.8;
+ margin: 0 auto;
+ max-width: 460px;
+ }
+
+ .quick-orders {
+ margin-top: 28px;
+ border-top: 1px dashed var(--surface-border);
+ padding-top: 20px;
+ }
+
+ .quick-title {
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--text-secondary);
+ margin-bottom: 12px;
+ }
+
+ .quick-list {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
+ gap: 10px;
+ }
+
+ .quick-item {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 10px 12px;
+ border: 1px solid var(--surface-border);
+ border-radius: var(--radius-sm);
+ background: var(--surface-soft);
+ cursor: pointer;
+ transition: all 0.25s ease;
+
+ &:hover {
+ border-color: var(--surface-border-strong);
+ box-shadow: var(--shadow-sm);
+ transform: translateY(-1px);
+ }
+
+ .quick-no {
+ font-weight: 600;
+ color: var(--text-primary);
+ font-size: 13px;
+ }
+
+ .quick-name {
+ flex: 1;
+ min-width: 0;
+ font-size: 12px;
+ color: var(--text-tertiary);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ }
+
+ .detail-card {
+ margin-bottom: 16px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ .detail-head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 16px;
+ padding-bottom: 16px;
+ border-bottom: 1px solid var(--surface-border);
+ margin-bottom: 18px;
+ }
+
+ .detail-head-left {
+ display: flex;
+ align-items: center;
+ gap: 14px;
+ min-width: 0;
+ }
+
+ .product-thumb {
+ width: 60px;
+ height: 60px;
+ border-radius: var(--radius-sm);
+ border: 1px solid var(--surface-border);
+ overflow: hidden;
+ flex-shrink: 0;
+ }
+
+ .product-thumb-empty {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 26px;
+ color: #94a3b8;
+ background: var(--surface-muted);
+ }
+
+ .detail-head-info {
+ min-width: 0;
+ }
+
+ .detail-title-row {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex-wrap: wrap;
+ }
+
+ .detail-no {
+ font-size: 18px;
+ font-weight: 700;
+ color: var(--text-primary);
+ letter-spacing: 0.02em;
+ }
+
+ .detail-sub {
+ margin-top: 6px;
+ font-size: 13px;
+ color: var(--text-tertiary);
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ }
+
+ .detail-head-actions {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ flex-shrink: 0;
+ }
+
+ .stat-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
+ gap: 10px;
+ margin-bottom: 22px;
+ }
+
+ .stat-tile {
+ position: relative;
+ padding: 14px 14px 14px 18px;
+ border-radius: var(--radius-sm);
+ background: var(--surface-muted);
+ border: 1px solid var(--surface-border);
+ overflow: hidden;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: 0;
+ top: 0;
+ bottom: 0;
+ width: 4px;
+ background: var(--tile-accent, #3b82f6);
+ }
+
+ .stat-tile-value {
+ font-size: 20px;
+ font-weight: 700;
+ color: var(--text-primary);
+ line-height: 1.3;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .stat-tile-label {
+ margin-top: 4px;
+ font-size: 12px;
+ color: var(--text-tertiary);
+ }
+ }
+
+ .tone-blue {
+ --tile-accent: #3b82f6;
+ }
+
+ .tone-green {
+ --tile-accent: #10b981;
+ }
+
+ .tone-red {
+ --tile-accent: #ef4444;
+ }
+
+ .tone-orange {
+ --tile-accent: #f59e0b;
+ }
+
+ .tone-indigo {
+ --tile-accent: #6366f1;
+ }
+
+ .tone-cyan {
+ --tile-accent: #06b6d4;
+ }
+
+ .tone-purple {
+ --tile-accent: #a855f7;
+ }
+
+ .tone-teal {
+ --tile-accent: #14b8a6;
+ }
+
+ .sub-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--text-primary);
+ margin: 0 0 12px;
+ display: flex;
+ align-items: center;
+
+ &::before {
+ content: "";
+ display: inline-block;
+ width: 3px;
+ height: 14px;
+ background: var(--accent-primary, #2563eb);
+ border-radius: 2px;
+ margin-right: 8px;
+ }
}
.sub-section-title {
- font-size: 14px;
+ font-size: 13px;
font-weight: 600;
- margin-bottom: 16px;
+ color: var(--text-secondary);
+ margin: 18px 0 10px;
+ display: flex;
+ align-items: center;
+
+ &::before {
+ content: "";
+ display: inline-block;
+ width: 3px;
+ height: 12px;
+ background: #67c23a;
+ border-radius: 2px;
+ margin-right: 8px;
+ }
+ }
+
+ .flow-steps {
+ display: flex;
+ align-items: center;
+ overflow-x: auto;
+ padding: 6px 2px 10px;
+ }
+
+ .flow-step {
+ display: flex;
+ align-items: center;
+ flex: 0 0 auto;
+ cursor: pointer;
+ }
+
+ .flow-step-main {
+ width: 136px;
+ padding: 14px 10px 12px;
+ border-radius: var(--radius-sm);
+ border: 1px solid var(--surface-border);
+ background: var(--surface-soft);
+ text-align: center;
+ transition: all 0.25s ease;
+
+ &:hover {
+ border-color: var(--surface-border-strong);
+ box-shadow: var(--shadow-sm);
+ transform: translateY(-2px);
+ }
+ }
+
+ .flow-step-circle {
+ width: 48px;
+ height: 48px;
+ margin: 0 auto 10px;
+ border-radius: 50%;
+ border: 2px solid #cbd5e1;
+ background: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 12px;
+ font-weight: 700;
+ color: var(--text-secondary);
+ }
+
+ .flow-step.is-done .flow-step-circle {
+ border-color: #67c23a;
+ color: #67c23a;
+ }
+
+ .flow-step.is-active .flow-step-circle {
+ border-color: #2563eb;
+ color: #2563eb;
+ }
+
+ .flow-step-name {
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--text-primary);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .flow-step-qty {
+ margin-top: 4px;
+ font-size: 12px;
+ color: var(--text-tertiary);
+ }
+
+ .flow-step-badges {
+ margin-top: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ }
+
+ .flow-step-line {
+ width: 34px;
+ height: 2px;
+ margin: 0 6px;
+ background: linear-gradient(
+ 90deg,
+ rgba(148, 163, 184, 0.45),
+ rgba(148, 163, 184, 0.12)
+ );
+ flex-shrink: 0;
+ }
+
+ .badge {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ padding: 1px 8px;
+ border-radius: 10px;
+ font-size: 12px;
+ line-height: 18px;
+ }
+
+ .badge-report {
+ color: #2563eb;
+ background: rgba(37, 99, 235, 0.1);
+ }
+
+ .badge-inspect {
+ color: #0f9d8f;
+ background: rgba(20, 184, 166, 0.12);
+ }
+
+ .badge + .badge {
+ margin-left: 6px;
+ }
+
+ .danger-text {
+ color: #ef4444;
+ font-weight: 600;
+ }
+
+ :deep(.el-descriptions__label) {
+ font-weight: 500;
+ color: var(--text-secondary);
+ }
+
+ :deep(.el-table th) {
+ background-color: var(--surface-soft) !important;
+ font-weight: 600;
+ color: var(--text-secondary);
+ }
+
+ :deep(.el-table .el-table__row) {
+ cursor: pointer;
+ }
+
+ :deep(.el-tag) {
+ border-radius: 10px;
+ }
+</style>
+
+<style lang="scss">
+ .trace-dialog {
+ border-radius: 12px;
+ overflow: hidden;
+ }
+
+ .trace-dialog .el-dialog__header {
+ background-color: #f5f7fa;
+ padding: 18px 20px;
+ border-bottom: 1px solid #ebeef5;
+ margin-right: 0;
+ }
+
+ .trace-dialog .el-dialog__title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #1a1a1a;
+ }
+
+ .trace-dialog .el-dialog__body {
+ padding: 20px;
+ }
+
+ .trace-dialog .detail-container {
+ max-height: 62vh;
+ overflow-y: auto;
+ padding: 0 4px;
+ }
+
+ .trace-dialog .detail-section {
+ padding: 4px 0;
+ }
+
+ .trace-dialog .section-title {
+ font-size: 15px;
+ font-weight: 600;
+ margin: 0 0 16px;
+ color: #1a1a1a;
+ display: flex;
+ align-items: center;
+ }
+
+ .trace-dialog .section-title::before {
+ content: "";
+ display: inline-block;
+ width: 4px;
+ height: 15px;
+ background-color: #2563eb;
+ border-radius: 2px;
+ margin-right: 8px;
+ }
+
+ .trace-dialog .sub-section-title {
+ font-size: 13px;
+ font-weight: 600;
+ margin: 18px 0 10px;
color: #303133;
display: flex;
align-items: center;
}
- .sub-section-title::before {
+ .trace-dialog .sub-section-title::before {
content: "";
display: inline-block;
width: 3px;
height: 12px;
background-color: #67c23a;
- margin-right: 8px;
border-radius: 2px;
- }
-
- .unit {
- font-size: 12px;
- color: #909399;
- margin-left: 4px;
- }
-
- :deep(.el-descriptions) {
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
- }
-
- :deep(.el-descriptions__row:nth-child(odd)) {
- background-color: #f9f9f9;
- }
-
- :deep(.el-descriptions__label) {
- font-weight: 500;
- color: #606266;
- background-color: #f5f7fa;
- }
-
- :deep(.el-descriptions__content) {
- color: #303133;
- font-weight: 500;
- }
-
- .progress-container {
- display: flex;
- gap: 24px;
- }
-
- .progress-section {
- margin-bottom: 24px;
- background-color: #ffffff;
- border-radius: 10px;
- padding: 24px;
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
- flex: 1;
- transition: all 0.3s ease;
- width: 100%;
- }
-
- .progress-section:hover {
- box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.12);
- }
-
- .order-item {
- margin-bottom: 20px;
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
- }
-
- :deep(.el-table) {
- border-radius: 8px;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
- }
-
- :deep(.el-table th) {
- background-color: #f5f7fa !important;
- font-weight: 600;
- color: #606266;
- }
-
- :deep(.el-progress-bar__inner) {
- border-radius: 10px;
- }
-
- :deep(.el-tag) {
- border-radius: 12px;
- padding: 2px 10px;
- }
-
- /* 寮圭獥鏍峰紡 */
- .detail-container {
- max-height: 600px;
- overflow-y: auto;
- padding: 0 16px;
- }
-
- .process-item {
- margin-bottom: 24px;
- padding: 20px;
- background-color: #ffffff;
- border-radius: 8px;
- border: 1px solid #ebeef5;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
- }
-
- .process-header {
- margin-bottom: 20px;
- padding-bottom: 12px;
- border-bottom: 1px solid #f0f2f5;
- }
-
- .process-title {
- font-size: 15px;
- font-weight: 600;
- margin-bottom: 12px;
- color: #1a1a1a;
- display: flex;
- align-items: center;
- }
-
- .process-title::before {
- content: "";
- display: inline-block;
- width: 4px;
- height: 16px;
- background-color: #409eff;
margin-right: 8px;
- border-radius: 2px;
}
- .process-info {
- display: flex;
- gap: 20px;
- font-size: 13px;
- color: #606266;
- }
-
- .process-label {
- padding: 4px 12px;
- background-color: #ecf5ff;
- border-radius: 4px;
- color: #409eff;
- font-weight: 500;
- }
-
- .process-details {
- margin-bottom: 20px;
- }
-
- .num1 {
- color: #1107cc;
- font-weight: 600;
- }
-
- .num2 {
- color: #0fcf25;
- font-weight: 600;
- }
-
- .num3 {
- color: #d31818;
- font-weight: 600;
- }
-
- .dialog-footer {
+ .trace-dialog .dialog-footer {
text-align: center;
- padding: 20px;
- border-top: 1px solid #ebeef5;
}
- .dialog-footer .el-button {
- min-width: 100px;
- padding: 8px 20px;
- }
-
- /* 鑷畾涔夊璇濇鏍峰紡 */
- :deep(.custom-dialog) {
- border-radius: 12px;
- overflow: hidden;
- }
-
- :deep(.custom-dialog .el-dialog__header) {
- background-color: #f5f7fa;
- padding: 20px;
- border-bottom: 1px solid #ebeef5;
- }
-
- :deep(.custom-dialog .el-dialog__title) {
- font-size: 18px;
- font-weight: 600;
- color: #1a1a1a;
- }
-
- :deep(.custom-dialog .el-dialog__body) {
- padding: 20px;
- }
-
- .unit-text {
+ .trace-dialog .unit-text {
margin-left: 5px;
color: #909399;
font-size: 12px;
}
- .param-detail-list {
- padding: 10px;
+ .trace-dialog .param-detail-list {
+ padding: 4px;
+ }
+
+ .trace-dialog .inspect-files {
+ margin-top: 6px;
+ }
+
+ .trace-dialog .inspect-file-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+ }
+
+ .trace-dialog .inspect-file-item {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 4px 10px;
+ border-radius: 8px;
+ border: 1px solid #e4e7ed;
+ background: #f8fafc;
+ color: #2563eb;
+ font-size: 13px;
+ text-decoration: none;
+ }
+
+ .trace-dialog .inspect-file-item:hover {
+ border-color: #bfdbfe;
+ background: #eff6ff;
+ }
+
+ .trace-dialog .inspect-file-item.is-disabled {
+ color: #64748b;
+ cursor: default;
+ }
+
+ .trace-dialog .inspect-file-item.is-disabled:hover {
+ border-color: #e4e7ed;
+ background: #f8fafc;
}
</style>
--
Gitblit v1.9.3