From 48fe0cb207daade06a428654ec766429e87db5a7 Mon Sep 17 00:00:00 2001 From: zhangdi <1104545947@qq.com> Date: Wed, 15 Apr 2026 20:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E4=BB=B6=E7=94=B3=E6=8A=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/declareAdd.vue | 73 ++++++++++--------- 1 file changed, 40 insertions(+), 33 deletions(-) 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;