三级前端修改

This commit is contained in:
2025-11-11 14:21:46 +08:00
parent 8d4bc2de3c
commit 9867f07c64
3 changed files with 60 additions and 128 deletions

View File

@@ -330,40 +330,7 @@ export default {
}
},
watch: {
// 监听材料类型变化,自动设置物料类型
'updateForm.materialType'(newVal, oldVal) {
console.log('🔥 typing.vue watch 触发! materialType 变化:', oldVal, '->', newVal);
// 先清空物品选择
this.$set(this.updateForm, 'itemId', null);
// 设置物料类型
if (newVal === '成品') {
this.$set(this.updateForm, 'itemType', 'product');
console.log('✅ 设置 itemType = product');
} else if (newVal === '原料' || newVal === '废品') {
this.$set(this.updateForm, 'itemType', 'raw_material');
console.log('✅ 设置 itemType = raw_material');
}
console.log('📊 当前 updateForm:', {
materialType: this.updateForm.materialType,
itemType: this.updateForm.itemType,
itemId: this.updateForm.itemId
});
console.log('📦 数据列表:', {
rawMaterialList: this.rawMaterialList.length,
productList: this.productList.length
});
},
// 监听物品类型变化,加载对应的列表
'updateForm.itemType'(newVal, oldVal) {
if (newVal !== oldVal && newVal) {
this.updateForm.itemId = null;
this.loadItemList(newVal);
}
}
// 不再需要watch直接用@change事件处理
},
async created() {
console.log('🚀 typing.vue created 钩子执行');