Commit b6e85fd7 authored by 黄奎's avatar 黄奎

座位图修改

parent 1793a385
......@@ -350,7 +350,7 @@
* 生成楼行对象
*/
self.CreateLouRow = function (index, array) {
var dataRow = { rowIndex: (index + 1 + '排'), rowOriIndex: index + 1, houseType: 1, ColumnArray: [] };
var dataRow = { rowIndex: (index + 1 + '排'), rowOriIndex: index + 1, houseType: 1, ColumnArray: [], HasValue: true};
for (var j = 0; j < array.length; j++) {
var dataColumn = {
col: array[j],
......@@ -371,10 +371,10 @@
self.CreateTangRow = function (index, lourow,array) {
var dataRow = {};
if (index + 1 > lourow) {
dataRow = { rowIndex: ((index + 1 - lourow) + '排'), rowOriIndex: index + 1, houseType: 3, ColumnArray: [] };
dataRow = { rowIndex: ((index + 1 - lourow) + '排'), rowOriIndex: index + 1, houseType: 3, ColumnArray: [], HasValue: true};
}
else {
dataRow = { rowIndex: (index + 1 + '排'), rowOriIndex: index + 1, houseType: 3, ColumnArray: [] };
dataRow = { rowIndex: (index + 1 + '排'), rowOriIndex: index + 1, houseType: 3, ColumnArray: [], HasValue: true };
}
for (var j = 0; j < array.length; j++) {
var dataColumn = {
......@@ -395,7 +395,7 @@
};
self.reSeat = function (dataRowIndex, isAdd, houseType) {
var dataList = SeatData();
var col_input = $("#col_input").val();
var newObj = self.cloneTwo(SeatData()[dataRowIndex]);
if (newObj != null && newObj.rowOriIndex) {
......@@ -507,8 +507,6 @@
newObjArray.push({ID:i,Value:1});
}
}
this.console.log("singleArray", singleArray);
this.console.log("doubleArray", doubleArray);
var doubleIndex = 0;
var singleIndex = 0;
if (doubleArray != null && doubleArray.length > 0) {
......@@ -541,15 +539,15 @@
if (newObj.noLenth == newObj.ColumnArray.length && isAdd == 1) {
newObj.rowIndex = "";
SeatData.replace(SeatData()[dataRowIndex], newObj);
var subindex = dataRowIndex;
//楼厢
if (houseType == 1) {
for (var i = dataRowIndex; i < lourow; i++) {
var tempData = self.cloneTwo(SeatData()[i]);
if (tempData.rowIndex != "") {
var subindex = self.CreateNum(i, 1);
tempData.rowIndex = (subindex + "排");
SeatData.replace(SeatData()[i], tempData);
subindex++;
}
}
}
......@@ -558,21 +556,21 @@
for (var i = dataRowIndex; i < (tangrow + lourow); i++) {
var tempData = self.cloneTwo(SeatData()[i]);
if (tempData.rowIndex != "") {
var subindex = self.CreateNum(i, 1);
tempData.rowIndex = (subindex - lourow) + "排";
SeatData.replace(SeatData()[i], tempData);
subindex++;
}
}
}
}
else if (isAdd == 0 && newObj.rowIndex == "") {
newObj.rowIndex = (dataRowIndex + 1) + "排";
newObj.rowIndex = (dataRowIndex + 1) + "排";
SeatData.replace(SeatData()[dataRowIndex], newObj);
if (houseType == 1) {
for (var i = dataRowIndex + 1; i < lourow; i++) {
var tempData = self.cloneTwo(SeatData()[i]);
if (tempData.rowIndex != "") {
var newIndex = i + 1;
var newIndex = self.CreateNum(i, 3);
tempData.rowIndex = newIndex + "排";
SeatData.replace(SeatData()[i], tempData);
}
......@@ -582,7 +580,7 @@
for (var i = dataRowIndex; i < (tangrow + lourow); i++) {
var tempData = self.cloneTwo(SeatData()[i]);
if (tempData.rowIndex != "") {
var newIndex = i + 1;
var newIndex = self.CreateNum(i, 3);
tempData.rowIndex = (newIndex - lourow) + "排";
SeatData.replace(SeatData()[i], tempData);
}
......@@ -595,6 +593,33 @@
}
};
/**
* 生成行号
*/
self.CreateNum = function (index, type) {
var num = 0;
var dataList = SeatData();
if (type == 1) {
for (var i = 0; i < dataList.length; i++) {
if (dataList[i].houseType == 1) {
if (i <= index && dataList[i].HasValue) {
num++;
}
}
}
}
else {
for (var i = 0; i < dataList.length; i++) {
if (dataList[i].houseType == 3) {
if (i <= index && dataList[i].HasValue) {
num++;
}
}
}
}
return num;
};
/**
* 用做ko更新数组某一项数据时的克隆,无需重新清空并绑定整个列表
*/
......@@ -705,6 +730,13 @@
});
var newRowIndex = parentRowIndex - 1;
SeatData()[newRowIndex].noLenth = $(rowObj).find(".noSeat").length;
if (SeatData()[newRowIndex].noLenth > 0) {
SeatData()[newRowIndex].HasValue = !(SeatData()[newRowIndex].noLenth == SeatData()[newRowIndex].ColumnArray.length);
}
else {
SeatData()[newRowIndex].HasValue = true ;
}
self.reSeat(newRowIndex, isAdd, parentHouseType);
if (SeatData()[newRowIndex].noLenth > 0 && isAdd==1) {
$(".row_input").each(function (x) {
......
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