前端修改
This commit is contained in:
@@ -286,8 +286,6 @@ export default {
|
||||
computed: {
|
||||
},
|
||||
async created() {
|
||||
console.log('🚀 split.vue created 钩子执行');
|
||||
|
||||
// 先加载库区列表
|
||||
await this.loadWarehouses();
|
||||
|
||||
@@ -316,25 +314,15 @@ export default {
|
||||
methods: {
|
||||
// 处理材料类型变化
|
||||
handleMaterialTypeChange(item, index) {
|
||||
console.log(`🔥 子卷${index+1} materialType变化:`, item.materialType);
|
||||
|
||||
// 清空物品选择
|
||||
this.$set(item, 'itemId', null);
|
||||
|
||||
// 根据材料类型设置物品类型
|
||||
if (item.materialType === '成品') {
|
||||
this.$set(item, 'itemType', 'product');
|
||||
console.log(`✅ 子卷${index+1} 设置 itemType = product`);
|
||||
} else if (item.materialType === '原料' || item.materialType === '废品') {
|
||||
this.$set(item, 'itemType', 'raw_material');
|
||||
console.log(`✅ 子卷${index+1} 设置 itemType = raw_material`);
|
||||
}
|
||||
|
||||
console.log(`📊 子卷${index+1} 更新后:`, {
|
||||
materialType: item.materialType,
|
||||
itemType: item.itemType,
|
||||
itemId: item.itemId
|
||||
});
|
||||
},
|
||||
|
||||
// 动态获取标签
|
||||
@@ -359,26 +347,17 @@ export default {
|
||||
},
|
||||
// 获取子卷的物品列表
|
||||
getItemListForSplit(itemType) {
|
||||
console.log(`📋 getItemListForSplit 被调用,itemType:`, itemType);
|
||||
console.log(`📋 rawMaterialList 长度:`, this.rawMaterialList?.length);
|
||||
console.log(`📋 productList 长度:`, this.productList?.length);
|
||||
|
||||
if (itemType === 'raw_material') {
|
||||
const list = this.rawMaterialList.map(item => ({
|
||||
return this.rawMaterialList.map(item => ({
|
||||
id: item.rawMaterialId,
|
||||
name: this.formatItemName(item)
|
||||
}));
|
||||
console.log(`📋 返回原材料列表,数量:`, list.length);
|
||||
return list;
|
||||
} else if (itemType === 'product') {
|
||||
const list = this.productList.map(item => ({
|
||||
return this.productList.map(item => ({
|
||||
id: item.productId,
|
||||
name: this.formatItemName(item)
|
||||
}));
|
||||
console.log(`📋 返回产品列表,数量:`, list.length);
|
||||
return list;
|
||||
}
|
||||
console.log(`📋 返回空列表`);
|
||||
return [];
|
||||
},
|
||||
|
||||
@@ -426,15 +405,9 @@ export default {
|
||||
// 搜索子卷物品
|
||||
async searchItemsForSplit(query, index) {
|
||||
const item = this.splitList[index];
|
||||
console.log(`🔍 searchItemsForSplit 调用,子卷${index}:`, {
|
||||
materialType: item.materialType,
|
||||
itemType: item.itemType,
|
||||
query: query
|
||||
});
|
||||
|
||||
const itemType = item.itemType;
|
||||
if (!itemType) {
|
||||
console.log(`❌ 子卷${index} itemType 为空!`);
|
||||
this.$message.warning('请先选择材料类型');
|
||||
return;
|
||||
}
|
||||
@@ -476,7 +449,6 @@ export default {
|
||||
|
||||
// 页面加载时一次性加载所有原料和产品列表
|
||||
async loadAllItems() {
|
||||
console.log('🔥 split.vue 开始加载所有物品列表');
|
||||
try {
|
||||
// 同时加载原料和产品
|
||||
const [rawMaterialRes, productRes] = await Promise.all([
|
||||
@@ -486,27 +458,22 @@ export default {
|
||||
|
||||
if (rawMaterialRes.code === 200) {
|
||||
this.rawMaterialList = rawMaterialRes.rows || [];
|
||||
console.log('✅ split.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
|
||||
if (productRes.code === 200) {
|
||||
this.productList = productRes.rows || [];
|
||||
console.log('✅ split.vue 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ split.vue 加载物品列表失败', error);
|
||||
console.error('加载物品列表失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载子卷物品列表
|
||||
async loadItemListForSplit(itemType) {
|
||||
if (!itemType) {
|
||||
console.log('loadItemListForSplit: itemType 为空');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('split.vue 开始加载物品列表,类型:', itemType);
|
||||
|
||||
try {
|
||||
this.itemSearchLoading = true;
|
||||
if (itemType === 'raw_material') {
|
||||
@@ -515,10 +482,8 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true
|
||||
});
|
||||
console.log('split.vue 原材料列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.rawMaterialList = response.rows || [];
|
||||
console.log('split.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
} else if (itemType === 'product') {
|
||||
const response = await listProduct({
|
||||
@@ -526,10 +491,8 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true
|
||||
});
|
||||
console.log('split.vue 产品列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.productList = response.rows || [];
|
||||
console.log('split.vue 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -601,7 +564,6 @@ export default {
|
||||
const response = await listWarehouse({ pageNum: 1, pageSize: 1000 });
|
||||
if (response.code === 200) {
|
||||
this.warehouseList = response.rows || response.data || [];
|
||||
console.log('库区列表加载成功,数量:', this.warehouseList.length);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载库区列表失败', error);
|
||||
@@ -709,8 +671,6 @@ export default {
|
||||
}))
|
||||
};
|
||||
|
||||
console.log('提交的分条数据:', splitData);
|
||||
|
||||
const response = await splitMaterialCoil(splitData);
|
||||
if (response.code === 200) {
|
||||
this.$message.success('分条保存成功');
|
||||
|
||||
Reference in New Issue
Block a user