feat(wms): 添加订单页面显示已绑定产需单功能
- 在订单详情页面新增已绑定产需单卡片组件 - 实现产需单表格展示包括单号、生产日期、重量等信息 - 添加产需单状态标签显示功能 - 实现加载已绑定产需单的业务逻辑 - 集成产需单API接口获取相关数据 - 添加空状态提示和错误处理机制
This commit is contained in:
@@ -187,6 +187,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 已绑定的产需单卡片 -->
|
||||||
|
<div class="detail-card">
|
||||||
|
<div class="detail-card-header">
|
||||||
|
<span>已绑定的产需单({{ boundReqList.length }} 条)</span>
|
||||||
|
</div>
|
||||||
|
<div class="detail-card-body" style="padding:0;">
|
||||||
|
<el-table v-if="boundReqList.length > 0" :data="boundReqList" border size="small" class="aps-product-table">
|
||||||
|
<el-table-column label="产需单号" prop="scheduleNo" min-width="140" />
|
||||||
|
<el-table-column label="生产日期" prop="prodDate" width="100" align="center" />
|
||||||
|
<el-table-column label="总重量(吨)" prop="totalPlanWeight" width="110" align="right" />
|
||||||
|
<el-table-column label="占用重量(吨)" prop="relWeight" width="110" align="right" />
|
||||||
|
<el-table-column label="状态" width="80" align="center">
|
||||||
|
<template slot-scope="{ row }">
|
||||||
|
<el-tag :type="reqStatusTag(row.scheduleStatus)" size="small">
|
||||||
|
{{ reqStatusLabel(row.scheduleStatus) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-empty v-else description="暂未绑定产需单" :image-size="50" style="padding: 20px 0;" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 订单明细卡片 -->
|
<!-- 订单明细卡片 -->
|
||||||
<div class="detail-card">
|
<div class="detail-card">
|
||||||
<div class="detail-card-header">
|
<div class="detail-card-header">
|
||||||
@@ -225,6 +248,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listCrmOrder } from '@/api/aps/order'
|
import { listCrmOrder } from '@/api/aps/order'
|
||||||
|
import { listRel, getRequirement } from '@/api/aps/requirement'
|
||||||
import { parseProductContent } from '@/utils/productContent'
|
import { parseProductContent } from '@/utils/productContent'
|
||||||
import { ORDER_STATUS } from '@/views/crm/js/enum'
|
import { ORDER_STATUS } from '@/views/crm/js/enum'
|
||||||
import FileList from '@/components/FileList'
|
import FileList from '@/components/FileList'
|
||||||
@@ -241,6 +265,7 @@ export default {
|
|||||||
orderList: [],
|
orderList: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
currentOrder: null,
|
currentOrder: null,
|
||||||
|
boundReqList: [],
|
||||||
productList: [],
|
productList: [],
|
||||||
productName: '',
|
productName: '',
|
||||||
totalQuantity: 0,
|
totalQuantity: 0,
|
||||||
@@ -295,6 +320,7 @@ export default {
|
|||||||
handleOrderClick(order) {
|
handleOrderClick(order) {
|
||||||
this.currentOrder = order
|
this.currentOrder = order
|
||||||
this.parseProductContent(order)
|
this.parseProductContent(order)
|
||||||
|
this.loadBoundRequirements(order.orderId)
|
||||||
},
|
},
|
||||||
parseProductContent(order) {
|
parseProductContent(order) {
|
||||||
if (!order || !order.productContent) {
|
if (!order || !order.productContent) {
|
||||||
@@ -317,6 +343,45 @@ export default {
|
|||||||
statusLabel(status) {
|
statusLabel(status) {
|
||||||
const labels = { 0: '待生产', 1: '生产中', 2: '部分发货', 3: '已发货', 4: '已签收' }
|
const labels = { 0: '待生产', 1: '生产中', 2: '部分发货', 3: '已发货', 4: '已签收' }
|
||||||
return labels[status] || '未知'
|
return labels[status] || '未知'
|
||||||
|
},
|
||||||
|
/** 加载已绑定的产需单 */
|
||||||
|
loadBoundRequirements(orderId) {
|
||||||
|
this.boundReqList = []
|
||||||
|
if (!orderId) return
|
||||||
|
listRel({ orderId }).then(relRes => {
|
||||||
|
const rels = (relRes.rows || []).filter(r => r.scheduleId)
|
||||||
|
if (rels.length === 0) return
|
||||||
|
const scheduleIds = [...new Set(rels.map(r => r.scheduleId))]
|
||||||
|
Promise.all(scheduleIds.map(id => getRequirement(id).catch(() => null))).then(reqs => {
|
||||||
|
const reqMap = {}
|
||||||
|
reqs.forEach(r => {
|
||||||
|
if (r && r.data) reqMap[r.data.scheduleId] = r.data
|
||||||
|
})
|
||||||
|
this.boundReqList = rels.reduce((arr, rel) => {
|
||||||
|
const req = reqMap[rel.scheduleId]
|
||||||
|
if (req) {
|
||||||
|
arr.push({
|
||||||
|
scheduleNo: req.scheduleNo || '-',
|
||||||
|
prodDate: req.prodDate || '-',
|
||||||
|
scheduleStatus: req.scheduleStatus,
|
||||||
|
totalPlanWeight: req.totalPlanWeight,
|
||||||
|
relWeight: rel.relWeight
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return arr
|
||||||
|
}, [])
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.boundReqList = []
|
||||||
|
})
|
||||||
|
},
|
||||||
|
reqStatusTag(status) {
|
||||||
|
const map = { 0: 'info', 1: 'warning', 2: 'success', 3: 'danger' }
|
||||||
|
return map[status] || 'info'
|
||||||
|
},
|
||||||
|
reqStatusLabel(status) {
|
||||||
|
const labels = { 0: '草稿', 1: '待审核', 2: '已下达', 3: '已退回' }
|
||||||
|
return labels[status] || '未知'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user