@@ -17,7 +17,7 @@ var save;
var selectedRow;
var refreshGirdData;
var tempdatra = new Array();
var pricecount = 0;
var order = 0;
var bootstrap = function ($, learun) {
"use strict";
@@ -61,13 +61,16 @@ var bootstrap = function ($, learun) {
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res, index) {
if (res) {
order = 0;
$.each(tempdatra, function (key, val) {
if (tempdatra[key].ID === keyValue) {
pricecount -= tempdatra[key].AAIPrice * tempdatra[key].AAIStock ;
// order -= tempdatra[key].TeachSum + tempdatra[key].StuSum ;
tempdatra.splice(key, 1);
} else {
order += (parseInt(tempdatra[key].TeachSum) + parseInt(tempdatra[key].StuSum));
}
});
$("#AAPrice").val(pricecount );
$("#OrderNum").val(order );
$('#TextBookIndentDetail').jfGridSet('refreshdata', tempdatra.sort(sortNumber));
top.layer.close(index);
}
@@ -185,13 +188,13 @@ var bootstrap = function ($, learun) {
}
else {
$('[data-table="' + id + '"]').lrSetFormData(data[id]);
if (data[id].AAPrice) {
pricecount = data[id].AAPrice;
}
// if (data[id].AAPrice) {
// pricecount = data[id].AAPrice;
// }
}
}
});
}
}
}
};
refreshGirdData = function (temprow) {
@@ -205,16 +208,17 @@ var bootstrap = function ($, learun) {
if (ifnewrow) {
tempdatra.push(temprow);
}
//总价计算
pricecount = 0;
//for (var i = 0; i < tempdatra.length; i++) {
// pricecount += tempdatra[i].AAIPrice * tempdatra[i].AAIStock;
//}
//$("#AAPrice").val(pricecount);
//订购数量
order = 0;
for (var i = 0; i < tempdatra.length; i++) {
order += (parseInt(tempdatra[i].TeachSum) + parseInt(tempdatra[i].StuSum));
}
$("#OrderNum").val(order);
$('#TextBookIndentDetail').jfGridSet('refreshdata', tempdatra.sort(sortNumber));
};
function sortNumber(a, b) {
return a.AAIOrder - b.AAIOrder ;
return a.StuSum - b.StuSum ;
}
// 设置表单数据
setFormData = function (processId, param, callback) {