前端修改

This commit is contained in:
2025-11-11 14:52:41 +08:00
parent 613f509466
commit b0a9fae314
4 changed files with 15 additions and 112 deletions

View File

@@ -339,8 +339,6 @@ export default {
// 不再需要watch直接用@change事件处理
},
async created() {
console.log('🚀 merge.vue created 钩子执行');
// 加载库区列表
await this.loadWarehouses();
@@ -402,25 +400,15 @@ export default {
methods: {
// 处理材料类型变化
handleMaterialTypeChange(value) {
console.log('🔥 merge.vue materialType变化:', value);
// 清空物品选择
this.$set(this.targetCoil, 'itemId', null);
// 根据材料类型设置物品类型
if (value === '成品') {
this.$set(this.targetCoil, 'itemType', 'product');
console.log('✅ 设置 itemType = product');
} else if (value === '原料' || value === '废品') {
this.$set(this.targetCoil, 'itemType', 'raw_material');
console.log('✅ 设置 itemType = raw_material');
}
console.log('📊 targetCoil更新后:', {
materialType: this.targetCoil.materialType,
itemType: this.targetCoil.itemType,
itemId: this.targetCoil.itemId
});
},
// 加载第一个钢卷(从待操作进入时)
@@ -484,43 +472,33 @@ export default {
async loadPendingMergeList() {
try {
this.pendingLoading = true;
console.log('=== 开始加载待合卷列表 ===');
// 分别查询待处理和处理中的记录
const responses = await Promise.all([
listPendingAction({
actionType: 1, // 1=合卷
actionStatus: 0, // 0=待处理
actionType: 1, // 合卷操作
actionStatus: 0, // 待处理
pageNum: 1,
pageSize: 50
pageSize: 1000
}),
listPendingAction({
actionType: 1, // 1=合卷
actionStatus: 1, // 1=处理中
actionType: 1, // 合卷操作
actionStatus: 1, // 处理中
pageNum: 1,
pageSize: 50
pageSize: 1000
})
]);
console.log('待处理响应:', responses[0]);
console.log('处理中响应:', responses[1]);
// 合并两个列表
const allPending = [
...(responses[0].rows || []),
...(responses[1].rows || [])
];
console.log('所有待合卷记录数量:', allPending.length);
console.log('所有待合卷记录:', allPending);
// 排除当前钢卷
const currentCoilId = this.sourceCoils[0] ? this.sourceCoils[0].coilId : null;
console.log('当前钢卷ID:', currentCoilId);
this.pendingMergeList = allPending.filter(item => item.coilId !== currentCoilId);
console.log('过滤后的待合卷列表数量:', this.pendingMergeList.length);
console.log('过滤后的待合卷列表:', this.pendingMergeList);
} catch (error) {
console.error('加载待合卷列表失败', error);
} finally {
@@ -620,7 +598,6 @@ export default {
// 页面加载时一次性加载所有原料和产品列表
async loadAllItems() {
console.log('🔥 merge.vue 开始加载所有物品列表');
try {
// 同时加载原料和产品
const [rawMaterialRes, productRes] = await Promise.all([
@@ -630,27 +607,22 @@ export default {
if (rawMaterialRes.code === 200) {
this.rawMaterialList = rawMaterialRes.rows || [];
console.log('✅ merge.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
}
if (productRes.code === 200) {
this.productList = productRes.rows || [];
console.log('✅ merge.vue 产品列表加载成功,数量:', this.productList.length);
}
} catch (error) {
console.error('❌ merge.vue 加载物品列表失败', error);
console.error('加载物品列表失败', error);
}
},
// 加载物品列表(根据类型)
async loadItemList(itemType) {
if (!itemType) {
console.log('merge.vue loadItemList: itemType 为空');
return;
}
console.log('merge.vue 开始加载物品列表,类型:', itemType);
try {
this.itemSearchLoading = true;
if (itemType === 'raw_material') {
@@ -659,10 +631,8 @@ export default {
pageSize: 100,
withBom: true
});
console.log('merge.vue 原材料列表响应:', response);
if (response.code === 200) {
this.rawMaterialList = response.rows || [];
console.log('merge.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
}
} else if (itemType === 'product') {
const response = await listProduct({
@@ -670,10 +640,8 @@ export default {
pageSize: 100,
withBom: true
});
console.log('merge.vue 产品列表响应:', response);
if (response.code === 200) {
this.productList = response.rows || [];
console.log('merge.vue 产品列表加载成功,数量:', this.productList.length);
}
}
} catch (error) {
@@ -844,7 +812,6 @@ export default {
}))
};
console.log('提交的合卷数据:', mergeData);
loadingInstance = this.$loading({
lock: true,
text: '正在合卷,请稍后...',
@@ -895,12 +862,8 @@ export default {
});
// 批量完成所有待操作
console.log('需要完成的待操作ID列表:', actionIds);
const promises = actionIds.map(id => completeAction(id));
await Promise.all(promises);
console.log('所有待操作已完成');
} catch (error) {
console.error('完成待操作失败:', error);
// 不影响主流程,只记录错误