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

@@ -10,42 +10,11 @@
</CoilInfoRender>
</div>
<!-- 排产计划 -->
<el-card class="plan-card" v-if="planSheetList.length > 0" style="margin-bottom: 20px;">
<el-card class="plan-card" v-if="currentLineName" style="margin-bottom: 20px;">
<div slot="header" class="card-header">
<span><i class="el-icon-s-order"></i> {{ currentLineName }}排产计划</span>
</div>
<el-tabs v-model="activePlanSheetId" type="card" size="mini">
<el-tab-pane v-for="sheet in planSheetList" :key="sheet.planSheetId" :name="sheet.planSheetId"
:label="sheet.planCode || ('排产单' + sheet.planSheetId)" />
</el-tabs>
<div style="overflow-x: auto;">
<el-table :data="activePlanSheetDetails" size="small" max-height="300" stripe border>
<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>
<PlanSheetViewer :line-name="currentLineName" :show-header="false" />
</el-card>
<el-alert v-if="acidPrefill.visible" :title="acidPrefill.title" :type="acidPrefill.type" :closable="false" show-icon
@@ -416,8 +385,6 @@ import { getMaterialCoil, updateMaterialCoil, getFirstHeatCoilMaterial } from '@
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
import { matchBestSpecVersion } from '@/api/wms/processSpecVersion';
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
import { listPlanSheet } from '@/api/aps/planSheet';
import { listPlanDetail } from '@/api/aps/planDetail';
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache';
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
@@ -430,6 +397,7 @@ import { addCoilContractRel } from "@/api/wms/coilContractRel";
import ContractSelect from "@/components/KLPService/ContractSelect";
import L2MatchPanel from './panels/L2MatchPanel.vue'
import DrMatchPanel from './panels/DrMatchPanel.vue';
import PlanSheetViewer from './components/PlanSheetViewer.vue';
// actionType -> 产线名称映射
@@ -455,6 +423,7 @@ export default {
ContractSelect,
L2MatchPanel,
DrMatchPanel,
PlanSheetViewer,
},
dicts: ['coil_quality_status', 'coil_abnormal_position', 'coil_abnormal_code', 'coil_abnormal_degree', 'coil_business_purpose'],
data() {
@@ -576,11 +545,7 @@ export default {
currentCache: null,
parsedCacheData: null,
itemSelectorQueryParams: {},
// 排产计划
planSheetList: [],
planSheetDetailMap: {},
activePlanSheetId: null,
currentLineName: '',
// 异常继承
inheritDialogVisible: false,
inheritLoading: false,
@@ -592,8 +557,8 @@ export default {
l2HotCoilId() {
return (this.currentInfo && this.currentInfo.enterCoilNo) || ''
},
activePlanSheetDetails() {
return this.planSheetDetailMap[this.activePlanSheetId] || []
currentLineName() {
return actionTypeToLineName[this.actionType] || ''
},
/** 是否双机架工序actionType 504=正常 / 524=修复) */
isDrAction() {
@@ -677,8 +642,6 @@ export default {
}
}
// 加载排产计划
await this.loadPlanDetails();
},
methods: {
/** 双机架计划/道次快捷写入 */
@@ -802,43 +765,6 @@ export default {
}
},
// 根据当前actionType加载对应产线的最近3个排产计划
async loadPlanDetails() {
const lineName = actionTypeToLineName[this.actionType]
if (!lineName) return
this.currentLineName = lineName
try {
const sheetRes = await listPlanSheet({
lineName,
pageNum: 1,
pageSize: 3,
})
this.planSheetList = sheetRes.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 (error) {
console.error('加载排产计划失败', error)
}
},
async fetchPlanSheetDetail(planSheetId) {
try {
const detailRes = await listPlanDetail({
planSheetId,
pageNum: 1,
pageSize: 50,
})
if (detailRes.rows) {
const details = detailRes.rows.sort((a, b) => (parseInt(a.bizSeqNo) || 0) - (parseInt(b.bizSeqNo) || 0))
this.$set(this.planSheetDetailMap, planSheetId, details)
}
} catch (e) { console.error('查询排产单明细失败', e) }
},
// 复制当前信息到更新表单
copyFromCurrent() {
// 复制除了指定字段之外的其他字段