diff --git a/src/views/productionManagement/shortageApplication/components/declareAdd.vue b/src/views/productionManagement/shortageApplication/components/declareAdd.vue index 14420f1..b62e452 100644 --- a/src/views/productionManagement/shortageApplication/components/declareAdd.vue +++ b/src/views/productionManagement/shortageApplication/components/declareAdd.vue @@ -9,7 +9,9 @@ - 查询批次号 + 查询批次号 @@ -112,8 +114,8 @@ export default { }, data() { return { - saveLoading:false, - batchLoading:false, + saveLoading: false, + batchLoading: false, openShow: false, wcData: [], formError: '', // 全局错误提示 @@ -155,18 +157,22 @@ export default { this.openShow = this.showDialog; this.getWorkCenterList(); // 初始添加一行(可选) - }, methods: { // 根据零件查询批次号 - queryBatchNo(){ + queryBatchNo() { this.batchLoading = true; - queryBatch({partCode: this.form.partCode}).then(res=>{ - this.form.tableData = res.data.data || []; - this.batchLoading = false; - }).catch(err=>{ - this.batchLoading = false; - }) + queryBatch({ partCode: this.form.partCode }) + .then(res => { + if (res.data.data) { + this.form.tableData.push(res.data.data); + } + // this.form.tableData = res.data.data || []; + this.batchLoading = false; + }) + .catch(err => { + this.batchLoading = false; + }); }, getWorkCenterList() { getWorkCenterList().then(res => { @@ -221,32 +227,33 @@ export default { }); return; } - this.saveLoading = true + this.saveLoading = true; // 调用接口提交(实际项目替换) - saveDeclare(this.form.tableData).then(res=>{ - this.$message.success('操作成功'); - this.saveLoading = false + saveDeclare(this.form.tableData) + .then(res => { + this.$message.success('操作成功'); + this.saveLoading = false; this.closeDialog(); - }).catch(err=>{ - this.saveLoading = false - }) - // try { - // const res = saveDeclare(this.form.tableData); - // if (res.code === 200) { - // this.$message.success('操作成功'); - // this.closeDialog(); - // this.$emit('submitSuccess', submitData); - // } else { - // this.$message.error(res.msg || '操作失败'); - // } - + }) + .catch(err => { + this.saveLoading = false; + }); + // try { + // const res = saveDeclare(this.form.tableData); + // if (res.code === 200) { + // this.$message.success('操作成功'); + // this.closeDialog(); + // this.$emit('submitSuccess', submitData); + // } else { + // this.$message.error(res.msg || '操作失败'); + // } - // } catch (err) { - // this.$message.error(err); - // console.error('提交失败:', err); - // } + // } catch (err) { + // this.$message.error(err); + // console.error('提交失败:', err); + // } }); }, }, @@ -283,7 +290,7 @@ export default { font-size: 14px; line-height: 1.5; } -:deep(.el-table .el-table__cell) { +:deep(.el-table .el-table-body .el-table__cell) { height: 50px !important; padding: 0 !important; line-height: 50px !important;