$(function () {
$("-sharpdatagrid-2").bootstrapTable({
loadMsg: "...",
url: window.webapi + "/BridgeDaliyReport/DamageList",
method: "post",
async: false,
pagination: true,
height: $(window).height() - $(".hei1").height() - $(".hei2").height() - 100,
pageSize: 15,
pageList: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
clickToSelect: false,
showColumns: true,
minimumCountColumns: 2,
clickToSelect: true,
sidePagination: "server", //
queryParamsType: "limit",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
columns: [
//{
// field: "state",
// checkbox: true,
// align: "center",
//},
{ field: "BRIDGENAME", title: "", sortable: true },
{ field: "CheckName", title: "", sortable: true },
{
field: "CreateTime",
title: "",
sortable: true,
formatter: function (val) {
if (val)
return val.split("T")[0];
else return val;
}
},
{ field: "DefectDegreeName", title: "", sortable: true },
{
field: "State",
title: "",
sortable: true,
width: 200,
formatter: function (val, rowData, index) {
if (val == 0) {
return "<input type="checkbox" checked="checked"></input>";
} else {
return "<input type="checkbox" ></input>";
}
}
},
{
field: "CHECKDATE",
title: "",
sortable: true,
formatter: function (val, rowData, index) {
if (rowData.State != 0) return;
if (val)
return val.split("T")[0];
else return val;
}
},
{
field: "Description", title: "", sortable: true,
formatter: function (val, rowData, index) {
if (val == null || val == "undefined" || val == "") val = "";
if (val == "") return "<a href="-sharp" class="btnDetail" style="color:-sharp337AB7" onclick="getDetail()" data-id="" + rowData.ReportId + "" data-toggle="modal" data-target=".checkitemList"></a>";
else return "<a href="-sharp" class="btnDetail" style="color:-sharp337AB7" onclick="getDetail()" data-id="" + rowData.ReportId + "" data-toggle="modal" data-target=".checkitemList">" + val + "</a>";
}
}
],
queryParams: function (params) {
//var conck = $.trim($("th-inner checkbox").val());
var searchString;
if ($.trim($(".txt_search").val()) == $(".txt_search").attr("placeholder")) {
searchString = "";
} else searchString = $(".txt_search").val().trim();
var date;
if ($.trim($(".datepicker").val()) == $(".datepicker").attr("placeholder")) {
date = "";
} else date = $(".datepicker").val().trim();
//
var checkItem = [];
$(".sickSearchItem li.selected.checkitem").each(function (index) {
checkItem.push($(this).data("id"));
});
var checknames = checkItem.join(",");
var damageDegree = [];
$(".sickSearchItem li.selected.damage").each(function (index) {
damageDegree.push($(this).text());
});
var damageDegree = damageDegree.join(",");
var state = 3; //0 1 2
if ($(".sickSearchItem li.selected.state").length == 1) {
if ($(".sickSearchItem li.selected.state").text() == "") state = 0;
else state = 1;
}
var columns = [];
$("-sharpdatagrid-2").find("thead tr th").each(function (index) {
var column = $(this).attr("data-field");
if (column != null || column != undefined || column != "") {
columns.push(column);
}
});
columns.push("ReportId");
var columns = columns.join(",");
var bridgeID = window.location.search.replace("?", "").split("=")[1];
//var bridgeID = $(".id_search").val().trim();
return {
pageNumber: params.offset / params.limit + 1,
pageSize: params.limit,
type: 2,
damageDegree: damageDegree,
bridgename: searchString,
date: date,
columns: columns,
checknames: checknames,
state: state,
bridgeID: bridgeID
};
}
/**
index
row:Json
$detail:td
*/
});
$("-sharpdatagrid-1").bootstrapTable({
loadMsg: "...",
url: window.webapi + "/BridgeDaliyReport/DamageList",
method: "post",
async: false,
pagination: true,
height: $(window).height() - $(".hei1").height() - $(".hei2").height() - 100,
pageSize: 15,
pageList: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
sidePagination: "server", //
queryParamsType: "limit",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
columns: [
{ field: "BRIDGENAME", title: "", sortable: true },
{ field: "CheckName", title: "", sortable: true },
{
field: "CreateTime",
title: "",
sortable: true,
formatter: function (val) {
if (val)
return val.split("T")[0];
else return val;
}
},
{ field: "DefectDegreeName", title: "", sortable: true },
{
field: "State",
title: "",
formatter: function (val)
{
if (val == 0) return "";
else return "";
}
},
{
field: "CHECKDATE",
title: "",
sortable: true,
formatter: function (val, rowData, index) {
if (rowData.State != 0) return;
if (val)
return val.split("T")[0];
else return val;
}
},
{
field: "Description", title: "", sortable: true,
formatter: function (val, rowData, index) {
if (val == null || val == "undefined" || val == "") val = "";
if (val == "") return "<a href="-sharp" class="btnDetail" style="color:-sharp337AB7" onclick="getDetail2()" data-id="" + rowData.ReportId + "" data-toggle="modal" data-target=".checkitemList"></a>";
else return "<a href="-sharp" class="btnDetail" style="color:-sharp337AB7" onclick="getDetail2()" data-id="" + rowData.ReportId + "" data-toggle="modal" data-target=".checkitemList">" + val + "</a>";
}
}
],
queryParams: function (params) {
var searchString;
if ($.trim($(".txt_search").val()) == $(".txt_search").attr("placeholder")) {
searchString = "";
} else searchString = $(".txt_search").val().trim();
var date;
if ($.trim($(".datepicker").val()) == $(".datepicker").attr("placeholder")) {
date = "";
} else date = $(".datepicker").val().trim();
//
var checkItem = [];
$(".sickSearchItem li.selected.checkitem1").each(function (index) {
checkItem.push($(this).data("id"));
});
var checknames = checkItem.join(",");
var damageDegree = [];
$(".sickSearchItem li.selected.damage").each(function (index) {
damageDegree.push($(this).text());
});
var damageDegree = damageDegree.join(",");
var state = 3; //0 1 2
if ($(".sickSearchItem li.selected.state").length == 1) {
if ($(".sickSearchItem li.selected.state").text() == "") state = 0;
else state = 1;
}
var columns = [];
$("-sharpdatagrid-1").find("thead tr th").each(function (index) {
var column = $(this).attr("data-field");
if (column != null || column != undefined || column != "") {
columns.push(column);
}
});
columns.push("ReportId");
var columns = columns.join(",");
var bridgeID = window.location.search.replace("?", "").split("=")[1];
//var bridgeID = $(".id_search").val().trim();
return {
pageNumber: params.offset / params.limit + 1,
pageSize: params.limit,
type: 1,
damageDegree: damageDegree,
bridgename: searchString,
date: date,
columns: columns,
checknames: checknames,
state: state,
bridgeID: bridgeID
};
}
/**
index
row:Json
$detail:td
*/
});
});