liuhairui 1 year ago
parent
commit
9b5adb3bdb
1 changed files with 90 additions and 37 deletions
  1. 90 37
      src/view/performance/chafengbaogong.vue

+ 90 - 37
src/view/performance/chafengbaogong.vue

@@ -40,8 +40,8 @@
 				  :data="tableData"  border row-key="ID" size="small" 
 				  highlight-current-row="true" @row-dblclick="updateCompanyFunc"
 				  @row-click="tableRowClick" :show-overflow-tooltip="true"
-				  @selection-change="handleSelectionChange">
-				<!-- <el-table-column type="selection" width="55" /> -->
+				  @selection-change="table_SelectionChange">
+				<el-table-column type="selection" width="55" />
 				<el-table-column  sortable 	align="center" label="序号" 	prop="序号"  		width="70" />
 				<el-table-column  sortable 	align="left" label="订单子编号" 	prop="订单子编号"  	width="115"/>
 				<el-table-column  sortable  align="left" label="订单号" 		prop="订单号" 		width="115"/>
@@ -698,44 +698,83 @@ const baogong_del = () => {
 	}
 }
 
-// 表格复选框
-const handleSelectionChange = (selection, type) => {
-  const ids = selection.map(item => {
-    return item.订单子编号
-  })
-  bgSelection.value = ids.join(',')
-}
+// 保存当前选中的行数据
+const table_selectrows = ref([]);
 
+// 表格复选框选中变化时触发
+const table_SelectionChange = (val) => {
+    table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
+}
 
-// =========== 补打小票 ===========
+// =========== 批量打印小票 ===========
 const onxiaopiaoclick = async () => {
-	if(row_onclick.value === '' || row_onclick.value === null || row_onclick.value === undefined){
-		ElMessage({type: 'warning',message: '请选择一条数据' })
-		 return false;
-	}
-		let weibao; 
-		if (row_onclick.value['是否尾包'] === '是') {
-			weibao = 1;
-		} else {
-			weibao = 0;
-		}
-		const ewm = `${row_onclick.value['订单子编号']},01,${row_onclick.value['尺码']},${row_onclick.value['数量']},${weibao}`;
-	printdata.value = {
-	    emm: ewm,
-	    zddbh: row_onclick.value['订单子编号'],
-	    kh: row_onclick.value['生产款号'],
-	    pm: row_onclick.value['款式'],
-	    ys: row_onclick.value['颜色'],
-	    cm: row_onclick.value['尺码'],
-	    sl: row_onclick.value['报工数量'],
-	    zb: row_onclick.value['组别'],
-	    dyrq: currentDate,
-	    wb: row_onclick.value['是否尾包'],
-	};
-	hiprint.init();
-	const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
-	hiprintTemplate.print(printdata.value);
-}
+    if (table_selectrows.value.length === 0) {
+        ElMessage({type: 'warning', message: '请勾选打印的数据' });
+        return false;
+    }
+    const allPrintData = table_selectrows.value.map((row) => {
+        let weibao = row['是否尾包'] === '是' ? 1 : 0;
+        const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
+        return {
+            emm: ewm,
+            zddbh: row['订单子编号'],
+            kh: row['生产款号'],
+            pm: row['款式'],
+            ys: row['颜色'],
+            cm: row['尺码'],
+            sl: row['报工数量'],
+            zb: row['组别'],
+            dyrq: currentDate,
+            wb: row['是否尾包'],
+        };
+    });
+    // 将所有数据一次性传递给打印模板
+    const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
+    hiprintTemplate.print(allPrintData);
+	
+}
+
+// // 表格复选框
+// const handleSelectionChange = (selection, type) => {
+//   const ids = selection.map(item => {
+//     return item.订单子编号
+//   })
+//   bgSelection.value = ids.join(',')
+// }
+
+// // 表格复选框
+// const table_SelectionChange = (val, type) => {
+// 	console.log(val)
+// }
+// // =========== 补打小票 ===========
+// const onxiaopiaoclick = async () => {
+// 	if(row_onclick.value === '' || row_onclick.value === null || row_onclick.value === undefined){
+// 		ElMessage({type: 'warning',message: '请选择一条数据' })
+// 		 return false;
+// 	}
+// 		let weibao; 
+// 		if (row_onclick.value['是否尾包'] === '是') {
+// 			weibao = 1;
+// 		} else {
+// 			weibao = 0;
+// 		}
+// 		const ewm = `${row_onclick.value['订单子编号']},01,${row_onclick.value['尺码']},${row_onclick.value['数量']},${weibao}`;
+// 		printdata.value = {
+// 			emm: ewm,
+// 			zddbh: row_onclick.value['订单子编号'],
+// 			kh: row_onclick.value['生产款号'],
+// 			pm: row_onclick.value['款式'],
+// 			ys: row_onclick.value['颜色'],
+// 			cm: row_onclick.value['尺码'],
+// 			sl: row_onclick.value['报工数量'],
+// 			zb: row_onclick.value['组别'],
+// 			dyrq: currentDate,
+// 			wb: row_onclick.value['是否尾包'],
+// 		};
+// 	hiprint.init();
+// 	const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
+// 	hiprintTemplate.print(printdata.value);
+// }
 
 // =========== 修改 ===========
 const dialogFormVisible = ref(false)
@@ -831,6 +870,20 @@ const handleSizeChange = (val) => {
     margin-right: 0;
   }
 }
+/* 表格复选框大小调整 */
+:deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
+    width: 30px; /* 复选框宽度 */
+    height: 20px; /* 复选框高度 */
+}
+
+:deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
+    transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
+    top: 5%; /* 调整对勾位置 */
+    left: 40%; /* 调整对勾位置 */
+    width: 5px; /* 调整对勾宽度 */
+    height: 9px; /* 调整对勾高度 */
+}
+
 /*:deep(.el-table td .cell) {*/
 /*  line-height: 30px !important;*/
 /*}*/