/*根据查询条件查询调度单列表*/
function InitGrid(queryData) {
$("#dg").datagrid({
loadMsg: "数据加载中,请稍后……",
pageNumber: 1,
striped: true,
border: true,
fitColumns: true,
pageSize: 10, // 页面显示条目数
pageList: [10, 20],
url: "../DPC_LOSTBIKE/ReportList.aspx",
queryParams: queryData,
columns: [[{
field: "REPORT_NAME",
title: "报案人姓名",
align: "center",
width: 100,
}, {
field: "ID_CODE",
title: "报案人身份证",
align: "center",
width: 130,
formatter: function (value, row, index) {
return value.substr(0, 6) + "***********" + value.substr(14, 4);// return value.substring(0, 3) + "***";
}
}, {
field: "OWNER_NAME",
title: "主人姓名",
align: "center",
width: 100
}, {
field: "OWNER_ID",
title: "主人身份证",
align: "center",
width: 130,
formatter: function (value, row, index) {
return value.substr(0, 6) + "***********" + value.substr(14, 4); // value.substring(0, 3) + "***";
}
}
// 郑林飞 20170817 陈总要求去除类型选择 所以 才去掉和车辆类型有关的 车牌号 车型号
//, {
// field: "BIKE_CODE",
// title: "车牌号",
// align: "center",
// width: 100
//}
, {
field: "IS_REGIST",
title: "是否安装RFID",
align: "center",
width: 100,
formatter: function (value, row, index) {
if (value == "1") {
return '<span style="color:red;">是<span>';
} else {
return '<span style="color:green;">否<span>';
}
}
}
, {
field: "LASTTIME",
title: "最近出现时间",
align: "center",
width: 100,
formatter: function (value, row, index) {
return value;
}
}
// 郑林飞 20170817 陈总要求去除类型选择 所以 才去掉和车辆类型有关的 车牌号 车型号
//, {
// field: "BIKE_TYPE",
// title: "车型号",
// align: "center",
// width: 100
//}
// 郑林飞 20170817 陈总要求去除类型选择 所以 才去掉和车辆类型有关的 车牌号 车型号 车颜色
//, {
// field: "BIKE_COLOR",
// title: "车颜色",
// align: "center",
// width: 100
//}
, {
field: "LOST_DATE",
title: "丢失时间",
align: "center",
width: 100,
formatter: function (value, row, index) {
return dateStamp2String(new Date(value));
}
}, {
field: "REGIST_DATE",
title: "报警时间",
align: "center",
width: 100,
formatter: function (value, row, index) {
return dateStamp2String(new Date(value));
}
}, {
field: "CUR_STATUS",
title: "状态",
align: "center",
width: 50,
align: "center",
formatter: function (value, row, index) {
//if (row.CUR_STATUS == 0) {
// return "疑似";
//} else if (row.CUR_STATUS == 1) {
// return "报案";
//} else if (row.CUR_STATUS == 0) {
// return "结案";
//}
//1表示报警;2表示结案;3.取消报警
if (row.CUR_STATUS == 1) {
return "报警";
} else if (row.CUR_STATUS == 2) {
return ""; //结案
} else if (row.CUR_STATUS == 3) {
return ""; //取消报警
}
}
}, {
field: "opt1",
title: "编辑",
align: "center",
width: 50,
align: "center",
formatter: function (value, row, index) {
if (row.CUR_STATUS == 0) {
return "";
}
if (row.CUR_STATUS != 2) {
return '<a href="javascript:openEditWindow(\'' + row.ID + '\')">编辑</a>';
}
}
}, {
field: "opt3",
title: "结案",
align: "center",
width: 60,
align: "center",
//formatter: function (value, row, index) {
// if (row.CUR_STATUS != 2) {
// return '<a href="javascript:finishData(\'' + row.ID + '\')">结案</a>';
// } else {
// return '<a href="javascript:finishedData(\'' + row.ID + '\')">已结案</a>';
// }
//}
formatter: function (value, row, index) {
if (row.CUR_STATUS ==1) {
return '<a href="javascript:finishData(\'' + row.ID + '\')">结案</a>';
} else if (row.CUR_STATUS == 2) {
return '<a href="javascript:finishedData(\'' + row.ID + '\')">已结案</a>';
} else {
return '取消报警';
}
}
}]],
pagination: true,
rowStyler: function (index, row) {
var rdate = dateStamp2String(new Date(row.REGIST_DATE));
var ldate = dateStamp2String(new Date(row.LASTTIME));
alert(rdate); alert(ldate);
var day = DateDiff(rdate, ldate);
if (parseInt(day) < 0) {
}
else {
return 'background-color:red;color:green;font-weight:bold;'; //******************************************************* 关键部位在此 根据判断 改变行背景
}
//if (row.IS_REGIST!="1") {
// return 'background-color:red;color:green;font-weight:bold;';
//}
//else {
// return 'background-color:yellow;color:green;font-weight:bold;';
//}
},
onDblClickRow:function(index,row)
{
showWindow(row.ID)
}, onLoadSuccess: function (data) {
var rowData = data.rows;
$.each(rowData, function (index, msg) {//遍历JSON
if (msg.IS_REGIST != "") {
var td = $(this).children('td[field="IS_REGIST"]'); // 取出行中,DATA_NAME 这一列。
var textValue = td.children("div").text(); // 取出该列的值。
alert(textValue)
td.children("div").css({
"text-align": "right",
"background": "red"
});
}
//如果数据行为已选中则选中改行
});
}
});
var p = $("#dg").datagrid("getPager");
$(p).pagination({
beforePageText: "第",
afterPageText: "页 共 {pages} 页",
displayMsg: "共{total}条数据",
});
};