From 07192f22bcd95e549d6d2524a64f3a51801292af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= <2178503051@qq.com>
Date: Mon, 11 May 2026 13:14:23 +0800
Subject: [PATCH] =?UTF-8?q?feat(planSheet):=20=E6=96=B0=E5=A2=9E=E6=8E=92?=
=?UTF-8?q?=E4=BA=A7=E5=8D=95=E6=89=B9=E9=87=8F=E6=96=B0=E5=A2=9E=E6=98=8E?=
=?UTF-8?q?=E7=BB=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
实现了批量新增排产单明细的完整流程:添加批量新增按钮,开发批量选择合同和明细的对话框,支持搜索筛选合同、分页展示合同列表,多选明细后批量提交新增,新增成功后刷新列表
---
klp-ui/src/views/aps/planSheet/index.vue | 209 ++++++++++++++++++++++-
1 file changed, 208 insertions(+), 1 deletion(-)
diff --git a/klp-ui/src/views/aps/planSheet/index.vue b/klp-ui/src/views/aps/planSheet/index.vue
index 439065e8..4acda21c 100644
--- a/klp-ui/src/views/aps/planSheet/index.vue
+++ b/klp-ui/src/views/aps/planSheet/index.vue
@@ -9,6 +9,7 @@
{{ currentPlanSheetInfo.planSheetName || '排产单详情' }}
新增明细
+ 批量新增
刷新
@@ -287,6 +288,75 @@
+
+
+
+
+
+
+
选择合同
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 选择
+
+
+
+
+
+
+
+
+
选择明细(多选)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -351,7 +421,31 @@ export default {
// 订单明细加载状态
orderItemLoading: false,
// 当前编辑的行
- currentEditingRow: null
+ currentEditingRow: null,
+ // 批量新增对话框
+ batchAddDialogVisible: false,
+ // 批量查询参数
+ batchQueryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ contractCode: undefined,
+ customerName: undefined,
+ salesman: undefined
+ },
+ // 批量订单列表
+ batchOrderList: [],
+ // 批量订单总数
+ batchOrderTotal: 0,
+ // 批量订单加载状态
+ batchOrderLoading: false,
+ // 批量明细列表
+ batchItemList: [],
+ // 批量明细加载状态
+ batchItemLoading: false,
+ // 选中的合同
+ selectedContract: null,
+ // 选中的明细
+ selectedBatchItems: []
};
},
created() {
@@ -582,6 +676,98 @@ export default {
// 处理订单行点击
handleOrderSelect(row) {
this.selectOrder(row);
+ },
+ // 打开批量新增对话框
+ handleBatchAdd() {
+ this.batchAddDialogVisible = true;
+ this.selectedContract = null;
+ this.selectedBatchItems = [];
+ this.getBatchOrderList();
+ },
+ // 获取批量订单列表
+ getBatchOrderList() {
+ this.batchOrderLoading = true;
+ listOrder(this.batchQueryParams).then(response => {
+ this.batchOrderList = response.rows;
+ this.batchOrderTotal = response.total;
+ this.batchOrderLoading = false;
+ });
+ },
+ // 重置批量查询参数
+ resetBatchQuery() {
+ this.batchQueryParams = {
+ pageNum: 1,
+ pageSize: 10,
+ contractCode: undefined,
+ customerName: undefined,
+ salesman: undefined
+ };
+ this.getBatchOrderList();
+ },
+ // 选择批量合同
+ selectBatchContract(row) {
+ this.selectedContract = row;
+ this.selectedBatchItems = [];
+ this.batchItemLoading = true;
+ listOrderItem({ orderId: row.orderId }).then(res => {
+ this.batchItemList = res.rows;
+ this.batchItemLoading = false;
+ });
+ },
+ // 处理批量明细选择变更
+ handleBatchItemSelectionChange(selection) {
+ this.selectedBatchItems = selection;
+ },
+ // 确认批量新增
+ confirmBatchAdd() {
+ if (this.selectedBatchItems.length === 0) {
+ this.$message.warning('请至少选择一条明细');
+ return;
+ }
+
+ this.$confirm(`确认新增 ${this.selectedBatchItems.length} 条明细?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ const currentMaxSeqNo = this.planDetailList.length > 0
+ ? Math.max(...this.planDetailList.map(item => parseInt(item.bizSeqNo) || 0))
+ : 0;
+
+ const addPromises = this.selectedBatchItems.map((item, index) => {
+ const newRow = {
+ planSheetId: this.currentPlanSheetId,
+ bizSeqNo: currentMaxSeqNo + index + 1,
+ orderCode: this.selectedContract.orderCode,
+ contractCode: this.selectedContract.contractCode,
+ customerName: this.selectedContract.companyName,
+ salesman: this.selectedContract.salesman,
+ orderId: this.selectedContract.orderId,
+ productName: item.productType,
+ productMaterial: item.material,
+ productWidth: item.width,
+ rollingThick: item.thickness,
+ markCoatThick: item.thickness,
+ tonSteelLengthRange: 0,
+ planQty: item.productNum,
+ planWeight: item.weight,
+ surfaceTreatment: item.surfaceTreatment,
+ productPackaging: item.packagingReq,
+ widthReq: item.edgeCuttingReq,
+ productEdgeReq: item.widthTolerance,
+ usageReq: item.purpose
+ };
+ return addPlanDetail(newRow);
+ });
+
+ Promise.all(addPromises).then(() => {
+ this.$message.success('批量新增成功');
+ this.batchAddDialogVisible = false;
+ this.getList();
+ }).catch(error => {
+ this.$message.error('批量新增失败');
+ });
+ });
}
}
};
@@ -654,4 +840,25 @@ export default {
/* ::v-deep .el-input__inner {
padding: 0 1px;
} */
+
+.batch-add-content {
+ padding: 10px 0;
+}
+
+.contract-section {
+ margin-bottom: 30px;
+ padding-bottom: 20px;
+ border-bottom: 1px solid #eee;
+}
+
+.item-section {
+ margin-top: 20px;
+}
+
+.section-title {
+ font-size: 14px;
+ font-weight: 600;
+ margin-bottom: 15px;
+ color: #303133;
+}