Commit 2622f89b authored by wanghao's avatar wanghao

1 托盘编号 调整 由以前的一条龙 改成 27 个一组 一条龙

parent 6b26eb9d
...@@ -186,16 +186,23 @@ export default { ...@@ -186,16 +186,23 @@ export default {
const col = (i % 9) + 1; // 1-9列 const col = (i % 9) + 1; // 1-9列
let number; let number;
// 计算当前行的起始数字
const rowStart = (row - 1) * 9 + 1;
const rowEnd = row * 9;
if (row % 2 === 1) { // 计算属于第几段(0,1,2)
// 奇数行:从左到右递增(1-9, 19-27, 37-45, 55-63) const segment = Math.floor((row - 1) / 3); // 0:1-3行, 1:4-6行, 2:7-8行
number = rowStart + (col - 1);
// 计算段内行号(0,1,2)
const segmentRow = (row - 1) % 3;
// 计算当前段的起始数字
const segmentStart = segment * 27 + 1;
// 每段内按照一条龙排列
if (segmentRow % 2 === 0) {
// 奇数行(第1、4、7行):从左到右递增
number = segmentStart + segmentRow * 9 + (col - 1);
} else { } else {
// 偶数行:从右到左递增(18-10, 36-28, 54-46, 72-64) // 偶数行(第2、5、8行):从右到左递增
number = rowEnd - (col - 1); number = segmentStart + (segmentRow + 1) * 9 - col;
} }
return { return {
...@@ -331,16 +338,22 @@ export default { ...@@ -331,16 +338,22 @@ export default {
const col = (i % 9) + 1; // 1-9列 const col = (i % 9) + 1; // 1-9列
let number; let number;
// 计算当前行的起始数字 // 计算属于第几段(0,1,2)
const rowStart = (row - 1) * 9 + 1; const segment = Math.floor((row - 1) / 3); // 0:1-3行, 1:4-6行, 2:7-8行
const rowEnd = row * 9;
// 计算段内行号(0,1,2)
const segmentRow = (row - 1) % 3;
// 计算当前段的起始数字
const segmentStart = segment * 27 + 1;
if (row % 2 === 1) { // 每段内按照一条龙排列
// 奇数行:从左到右递增(1-9, 19-27, 37-45, 55-63) if (segmentRow % 2 === 0) {
number = rowStart + (col - 1); // 奇数行(第1、4、7行):从左到右递增
number = segmentStart + segmentRow * 9 + (col - 1);
} else { } else {
// 偶数行:从右到左递增(18-10, 36-28, 54-46, 72-64) // 偶数行(第2、5、8行):从右到左递增
number = rowEnd - (col - 1); number = segmentStart + (segmentRow + 1) * 9 - col;
} }
return { return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment