Commit e5c1761b authored by 黄奎's avatar 黄奎

座位表修改

parent 784bcedd
...@@ -352,8 +352,9 @@ ...@@ -352,8 +352,9 @@
self.reSeat = function (dataRowIndex) { self.reSeat = function (dataRowIndex) {
var dataList = SeatData(); var dataList = SeatData();
var newObj = self.clone(SeatData()[dataRowIndex]);
var col_input = $("#col_input").val(); var col_input = $("#col_input").val();
var newObj = self.clone(SeatData()[dataRowIndex]);
if (newObj.noLenth > 0) if (newObj.noLenth > 0)
{ {
var middleIndex = col_input % 2 == 1 ? parseInt(col_input / 2) + 1 : parseInt(col_input / 2); var middleIndex = col_input % 2 == 1 ? parseInt(col_input / 2) + 1 : parseInt(col_input / 2);
...@@ -361,7 +362,7 @@ ...@@ -361,7 +362,7 @@
var rightArray = []; var rightArray = [];
var leftArray = []; var leftArray = [];
var newColumnArray = [];
for (var i = 0; i < newObj.ColumnArray.length; i++) for (var i = 0; i < newObj.ColumnArray.length; i++)
{ {
//单数列 //单数列
...@@ -403,10 +404,10 @@ ...@@ -403,10 +404,10 @@
} }
} }
} }
leftArray.reverse();
var leftIndex = 1; var leftIndex = 1;
var leftNewArray = []; var leftNewArray = [];
for (var i = 0; i < leftArray.length; i++) for (var i = leftArray.length-1; i >=0 ; i--)
{ {
if (leftArray[i] != "No") { if (leftArray[i] != "No") {
leftNewArray.push(leftIndex * 2); leftNewArray.push(leftIndex * 2);
...@@ -428,36 +429,13 @@ ...@@ -428,36 +429,13 @@
rightNewArray.push("No"); rightNewArray.push("No");
} }
} }
console.log("rightArray", rightNewArray); var newArray = leftNewArray.reverse();
console.log("leftArray", leftNewArray); newObj.myArr = newArray.concat(rightNewArray);
newObj.myArr = leftNewArray.concat(rightNewArray); for (var k = 0; k < newObj.ColumnArray.length; k++) {
newObj.ColumnArray[k].col = newObj.myArr[k];
}
SeatData.replace(SeatData()[dataRowIndex], newObj);
} }
SeatData.replace(SeatData()[dataRowIndex], newObj);
//for (var i = 0; i < dataList.length; i++) {
// var jiArr = [];
// var ouArr = [];
// if (dataList[i].noLenth > 0) {
// var newObj = self.clone(SeatData()[i]);
// for (var j = 0; j < newObj.noLenth; j++) {
// if (j % 2 == 0) {
// ouArr.push(j + 1);
// } else {
// jiArr.push(j + 1);
// }
// }
// jiArr.reverse();
// newObj.myArr = jiArr.concat(ouArr);
// var _index = 0;
// for (var k = 0; k < newObj.ColumnArray.length; k++) {
// if (newObj.ColumnArray[k].SeatClassStr != 'noSeat') {
// newObj.ColumnArray[k].col = newObj.myArr[_index];
// _index++;
// }
// }
// SeatData.replace(SeatData()[i], newObj);
// }
//}
} }
//用做ko更新数组某一项数据时的克隆,无需重新清空并绑定整个列表 //用做ko更新数组某一项数据时的克隆,无需重新清空并绑定整个列表
...@@ -706,7 +684,6 @@ ...@@ -706,7 +684,6 @@
} }
}) })
}) })
}); });
</script> </script>
</body> </body>
......
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