refactor(wms/coil): 抽象排产单组件,复用排产单展示逻辑

1.  新增PlanSheetViewer通用排产单展示组件,支持图片、excel、普通文件预览和空状态
2.  改造TimeInput组件,修复绑定属性写法
3.  替换typing.vue、stepSplit.vue、split.vue、merge.vue中的旧排产单代码,统一使用新组件
4.  删除冗余的排产单相关API调用和本地数据逻辑
This commit is contained in:
2026-06-08 10:22:30 +08:00
parent 857a3948d6
commit f6a74e58ea
6 changed files with 207 additions and 357 deletions

View File

@@ -109,56 +109,12 @@
</el-table-column>
</el-table>
<!-- 今日排产单 -->
<div v-if="planSheetList.length > 0" class="plan-sheet-section">
<el-descriptions :column="1" border :title="'最近排产单(' + planSheetLineName + ''" />
<el-tabs v-model="activePlanSheetId" type="card">
<el-tab-pane
v-for="sheet in planSheetList"
:key="sheet.planSheetId"
:name="sheet.planSheetId"
:label="sheet.planCode || ('排产单' + sheet.planSheetId)"
/>
</el-tabs>
<el-table
v-loading="planSheetLoading"
:data="activePlanSheetDetails"
border
stripe
size="mini"
max-height="400"
>
<el-table-column type="index" label="序号" width="50" />
<el-table-column label="订单信息" header-align="center">
<el-table-column prop="contractCode" label="合同号" width="140" show-overflow-tooltip />
<el-table-column prop="customerName" label="客户" width="120" show-overflow-tooltip />
<el-table-column prop="salesman" label="业务员" width="100" show-overflow-tooltip />
</el-table-column>
<el-table-column label="成品信息" header-align="center">
<el-table-column prop="productName" label="成品名称" width="140" show-overflow-tooltip />
<el-table-column prop="productMaterial" label="材质" width="100" />
<el-table-column prop="coatingG" label="镀层g" width="80" />
<el-table-column prop="productWidth" label="成品宽度" width="100" />
<el-table-column prop="rollingThick" label="轧制厚度" width="100" />
<el-table-column prop="markCoatThick" label="标丝厚度" width="100" />
<el-table-column prop="tonSteelLengthRange" label="长度区间(m)" width="120" />
<el-table-column prop="planQty" label="数量" width="80" />
<el-table-column prop="planWeight" label="重量" width="100" />
<el-table-column prop="surfaceTreatment" label="表面处理" width="110" show-overflow-tooltip />
<el-table-column prop="widthReq" label="切边要求" width="110" show-overflow-tooltip />
<el-table-column prop="productPackaging" label="包装要求" width="100" show-overflow-tooltip />
<el-table-column prop="productEdgeReq" label="宽度要求" width="100" show-overflow-tooltip />
<el-table-column prop="usageReq" label="用途" width="100" show-overflow-tooltip />
</el-table-column>
<el-table-column prop="remark" label="备注" width="140" show-overflow-tooltip />
</el-table>
</div>
<!-- 今日排产单空状态 -->
<div v-if="planSheetList.length === 0 && planSheetLineName && !planSheetLoading" class="plan-sheet-section">
<el-descriptions :column="1" border :title="'最近排产单(' + planSheetLineName + ''" />
<el-empty description="今天暂无排产单" :image-size="80" />
</div>
<!-- 最近排产单 -->
<template v-if="planSheetLineName">
<div class="plan-sheet-section">
<PlanSheetViewer :line-name="planSheetLineName" :table-max-height="400" />
</div>
</template>
</div>
</el-col>
@@ -505,14 +461,13 @@ import { listCoilAbnormal } from '@/api/wms/coilAbnormal'
import { completeAction, getPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'
import { getGalvanize1TypingPrefill } from '@/api/pocket/acidTyping'
import { listPlanSheet } from '@/api/aps/planSheet'
import { listPlanDetail } from '@/api/aps/planDetail'
import ProductSelect from '@/components/KLPService/ProductSelect'
import RawMaterialSelect from '@/components/KLPService/RawMaterialSelect'
import WarehouseSelect from '@/components/KLPService/WarehouseSelect'
import ActualWarehouseSelect from '@/components/KLPService/ActualWarehouseSelect'
import TimeInput from '@/components/TimeInput'
import AbnormalForm from '../components/AbnormalForm'
import PlanSheetViewer from '../components/PlanSheetViewer.vue'
import { generateCoilNoPrefix } from '@/utils/coil/coilNo'
import ProductInfo from '@/components/KLPService/Renderer/ProductInfo'
import RawMaterialInfo from '@/components/KLPService/Renderer/RawMaterialInfo'
@@ -530,7 +485,8 @@ export default {
AbnormalForm,
ProductInfo,
RawMaterialInfo,
ContractSelect
ContractSelect,
PlanSheetViewer,
},
props: {
actionId: {
@@ -644,11 +600,6 @@ export default {
parsedCacheData: null,
// 最早的热轧卷板材质
firstHeatMaterial: '',
// 排产单相关
planSheetList: [],
planSheetDetailMap: {},
planSheetLoading: false,
activePlanSheetId: null,
// 异常继承
inheritDialogVisible: false,
inheritLoading: false,
@@ -668,7 +619,7 @@ export default {
200: '酸轧线',
520: '酸轧线',
206: '镀锌线',
202: '镀锌线',
501: '镀锌线',
521: '镀锌线',
@@ -697,10 +648,13 @@ export default {
const day = String(d.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
},
activePlanSheetDetails() {
return this.planSheetDetailMap[this.activePlanSheetId] || []
todayDateStr() {
const d = new Date()
const y = d.getFullYear()
const m = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
},
// 是否是镀铬操作
isGrindAction() {
return this.actionType == 505 || this.actionType == 525 || this.actionType == 206
},
@@ -746,56 +700,10 @@ export default {
// 获取镀锌线二级系统数据
this.getZincList()
}
if (this.planSheetLineName) {
this.fetchPlanSheets()
}
}
}
},
methods: {
// 查询最近排产单及明细
async fetchPlanSheets() {
if (!this.planSheetLineName) return
this.planSheetLoading = true
try {
const res = await listPlanSheet({
lineName: this.planSheetLineName,
pageSize: 3,
pageNum: 1
})
this.planSheetList = res.rows || []
this.planSheetDetailMap = {}
if (this.planSheetList.length > 0) {
this.activePlanSheetId = this.planSheetList[0].planSheetId
for (const sheet of this.planSheetList) {
this.fetchPlanSheetDetail(sheet.planSheetId)
}
}
} catch (e) {
console.error('查询排产单失败', e)
} finally {
this.planSheetLoading = false
}
},
async fetchPlanSheetDetail(planSheetId) {
try {
const res = await listPlanDetail({
planSheetId,
pageSize: 100,
pageNum: 1
})
const details = res.rows || []
details.sort((a, b) => {
const na = parseInt(a.bizSeqNo) || 0
const nb = parseInt(b.bizSeqNo) || 0
return na - nb
})
this.$set(this.planSheetDetailMap, planSheetId, details)
} catch (e) {
console.error('查询排产单明细失败', e)
}
},
// 查询待分条的钢卷信息
async getCoilInfo() {
try {