三级前端修改
This commit is contained in:
@@ -148,7 +148,12 @@
|
||||
<el-input v-model="targetCoil.team" placeholder="请输入班组名称" :disabled="readonly"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="材料类型">
|
||||
<el-select v-model="targetCoil.materialType" placeholder="请选择材料类型" style="width: 100%" :disabled="readonly">
|
||||
<el-select
|
||||
v-model="targetCoil.materialType"
|
||||
placeholder="请选择材料类型"
|
||||
style="width: 100%"
|
||||
:disabled="readonly"
|
||||
@change="handleMaterialTypeChange">
|
||||
<el-option label="原料" value="原料" />
|
||||
<el-option label="成品" value="成品" />
|
||||
<el-option label="废品" value="废品" />
|
||||
@@ -331,40 +336,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听材料类型变化,自动设置物料类型
|
||||
'targetCoil.materialType'(newVal, oldVal) {
|
||||
console.log('🔥 merge.vue watch 触发! materialType 变化:', oldVal, '->', newVal);
|
||||
|
||||
// 先清空物品选择
|
||||
this.$set(this.targetCoil, 'itemId', null);
|
||||
|
||||
// 设置物料类型
|
||||
if (newVal === '成品') {
|
||||
this.$set(this.targetCoil, 'itemType', 'product');
|
||||
console.log('✅ 设置 itemType = product');
|
||||
} else if (newVal === '原料' || newVal === '废品') {
|
||||
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
|
||||
});
|
||||
|
||||
console.log('📦 数据列表:', {
|
||||
rawMaterialList: this.rawMaterialList.length,
|
||||
productList: this.productList.length
|
||||
});
|
||||
},
|
||||
// 监听物品类型变化,加载对应的列表
|
||||
'targetCoil.itemType'(newVal, oldVal) {
|
||||
if (newVal !== oldVal && newVal) {
|
||||
this.targetCoil.itemId = null; // 清空物品ID
|
||||
this.loadItemList(newVal);
|
||||
}
|
||||
}
|
||||
// 不再需要watch,直接用@change事件处理
|
||||
},
|
||||
async created() {
|
||||
console.log('🚀 merge.vue created 钩子执行');
|
||||
@@ -428,6 +400,29 @@ 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
|
||||
});
|
||||
},
|
||||
|
||||
// 加载第一个钢卷(从待操作进入时)
|
||||
async loadFirstCoil(coilId) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user