//列表结构
var grid = $("#maingrid").ligerGrid({
columns: [
{ display: '选择', align: 'left', width: 50, isAllowHide: false, render: function(rowdata) {
return '<div class="access-icon access-permit" rowid = "' + rowdata['__id'] + '"></div>';
}
}, { display: "商品编号", name: "Productcode", width: 80 }
, { display: "商品名称", name: "Productdescr", width: 160, render: function(rowdata) {
if (typeof (rowdata.Productdescr) != "undefined") {
return rowdata.Productdescr.replace(/\s/g, " ");
}
}
}
, { display: "会员价格", name: "Memberprice", width: 80 }
, { display: "部门列表", width: 80,
render: function(item) {
if (!item.Deptdescrs)
return "";
return "<a href=" + "'" + "#" + "'" + " οnclick=" + "\"" +
"javascript:$.ligerDialog.open({title:" + "'" + "调价部门列表" + "'" +
",width:300,height:380,url: " + "'" + "../../Dialog/ImeiSelect.aspx?columnName=" + encodeURI("部门列表") + "&imei=" + encodeURI(item.Deptdescrs) +
"'" + ",buttons:[{text:" + "'" + "关闭" + "'," + "onclick:function(item, dialog){dialog.close();}" + "}] });" + "\"" + ">显示</a>";
}
}
, { display: "生效日期", type: "date", name: "Effdt", width: 100 }
, { display: "操作人", name: "Lastupdbyname", width: 80 }
, { display: "操作日期", type: "date", name: "Lastupddttm", width: 100 }
, { display: "审核人", name: "Approvedbyname", width: 80 }
, { display: "审核日期", type: "date", name: "Approveddttm", width: 100
, render: function(item) {
if (item.Approvedbyname == "") {
return "";
}
else {
return ChangeDateFormat(item.Approveddttm)
}
}
}
, { display: "状态", name: "Approvedby", width: 80
, render: function(item) {
if (item.Enabled == "0") {
return "无效";
}
if (item.Approvedby != "") {
return '已审核';
}
return '未审核';
}
}
]
, onAfterShowData: function(datatotal) {
$("#maingrid .l-grid-body-table tr").each(function() {
if ($("td", this).eq(11).text() == "未审核") {
$("td", this).each(function(i) {
if (i > 1) {
$(this).css("color", "#ff0000");
$('a', this).css("color", "#ff0000");
}
});
}
});
//合并同一个调整单的样式
var data = datatotal.Rows;
var templength = 1;
for (var i = 0; i < data.length; i++) {
if (data[i - 1] != null && data[i] != null && data[i].Memberpricecode != "" && data[i - 1].Memberpricecode != "") {
if (data[i].Memberpricecode == data[i - 1].Memberpricecode) {
templength += 1;
//最后一行需要特殊处理 && data[i].Dept == data[i - 1].Dept
if (i == data.length - 1) {
$("#maingrid\\|2\\|" + data[i - templength + 1].__id + "\\|c106").attr("rowSpan", templength);
$("#maingrid\\|2\\|" + data[i - templength + 1].__id + "\\|c106").css("background", "#ffffff");
//去除原先的td
for (var j = 1; j < templength; j++) {
$("#maingrid\\|2\\|" + data[i - templength + j + 1].__id + "\\|c106").remove();
}
}
} else {
if (templength > 1) {
$("#maingrid\\|2\\|" + data[i - templength].__id + "\\|c106").attr("rowSpan", templength);
$("#maingrid\\|2\\|" + data[i - templength].__id + "\\|c106").css("background", "#ffffff");
//去除原先的td
for (var j = 1; j < templength; j++) {
$("#maingrid\\|2\\|" + data[i - templength + j].__id + "\\|c106").remove();
}
}
templength = 1;
}
}
}
}
, dataAction: 'server', pageSize: 20, toolbar: {}, enabledSort: false, rownumbers: true
, url: dataPath, sortName: 'Lastupddttm', parms: { dtbg: $("#bgdate").val(), dted: $("#eddate").val() }
, width: '100%', height: '100%', checkbox: false
});