You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
342 lines
13 KiB
342 lines
13 KiB
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
}
|
|
<style>
|
|
</style>
|
|
<script src="~/Content/js/CommonReport/CommonReport.js"></script>
|
|
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
|
|
<script>
|
|
var _Clos = new Array();
|
|
// 创建一个新的 Date 对象,表示当前日期和时间
|
|
var currentDate = new Date();
|
|
// 获取当前月份(注意:月份是从0开始计数的)
|
|
var currentMonth = currentDate.getMonth() + 1; // 加1以符合人类习惯
|
|
var currentyear = currentDate.getFullYear();
|
|
|
|
$(function () {
|
|
$("#txt_DateNow").val(currentyear + "-" + currentMonth)
|
|
SetCols();
|
|
gridList();
|
|
// 搜索按钮点击事件
|
|
$("#btn_search").click(function () {
|
|
currentDate = new Date($("#txt_DateNow").val());
|
|
currentMonth = currentDate.getMonth() + 1; // 加1以符合人类习惯
|
|
currentyear = currentDate.getFullYear();
|
|
SetCols();
|
|
gridList();
|
|
});
|
|
|
|
})
|
|
//初始化所有grid
|
|
function SetCols() {
|
|
var cols = new Array();
|
|
var colModel = [
|
|
{
|
|
label: '材料类别', name: 'Decomposition1', width: 240, align: "center",
|
|
cellattr: function (rowId, tv, rawObject, cm, rdata) {
|
|
//合并单元格
|
|
return 'id=\'Decomposition1' + rowId + "\'";
|
|
}
|
|
},
|
|
{ label: '类别', name: 'Decomposition2', width: 240, align: "center" },
|
|
{
|
|
label: currentMonth + '月第1周', name: 'Week1', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第2周', name: 'Week2', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第3周', name: 'Week3', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第4周', name: 'Week4', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第5周', name: 'Week5', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第6周', name: 'Week6', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '当月累计', name: 'MonthlyCumulative', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '1月', name: 'Month1', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '2月', name: 'Month2', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '3月', name: 'Month3', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '4月', name: 'Month4', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '5月', name: 'Month5', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '6月', name: 'Month6', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '7月', name: 'Month7', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '8月', name: 'Month8', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '9月', name: 'Month9', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '10月', name: 'Month10', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '11月', name: 'Month11', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '12月', name: 'Month12', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
{
|
|
label: '年度累计', name: 'AnnualAccumulation', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
if (rowObject.Decomposition2 == '不良率') {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
return cellvalue
|
|
|
|
}
|
|
},
|
|
];
|
|
cols.push(colModel);
|
|
_Clos = colModel;
|
|
}
|
|
|
|
|
|
|
|
// 仓库
|
|
function gridList() {
|
|
debugger;
|
|
document.getElementById("gridPanel").innerHTML = '<table id="gridList"></table><div id="gridPager"></div> ';//重置grid
|
|
var $gridList = $("#gridList");
|
|
var queryJson = {
|
|
DateNow: $("#txt_DateNow").val(),
|
|
}
|
|
// 初始化表格
|
|
$gridList.dataGrid({
|
|
url: "/KBSWMS/ICSInspectionReports/GetPassFirstTime3" + "?" + Math.random(),
|
|
height: $(window).height() - 128,
|
|
width: $(window).width() - 128,
|
|
postData: { queryJson: JSON.stringify(queryJson) },
|
|
colModel: _Clos,
|
|
rownumbers: false,
|
|
rowNum: 2000,
|
|
gridComplete: function () {
|
|
var gridName = "gridList";
|
|
Merger(gridName, 'Decomposition1');
|
|
},
|
|
});
|
|
$gridList.jqGrid('setGroupHeaders', {
|
|
useColSpanStyle: true,
|
|
groupHeaders: [
|
|
{ startColumnName: 'Week1', numberOfColumns: 6, titleText: '实际(周/月/年累计)' },
|
|
{ startColumnName: 'Jan', numberOfColumns: 12, titleText: '各月度推移' },
|
|
]
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
//公共调用方法
|
|
function Merger(gridName, CellName) {
|
|
debugger;
|
|
//得到显示到界面的id集合
|
|
var mya = $("#" + gridName + "").getDataIDs();
|
|
//当前显示多少条
|
|
var length = mya.length;
|
|
for (var i = 0; i < length; i++) {
|
|
//从上到下获取一条信息
|
|
var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
|
|
//定义合并行数
|
|
var rowSpanTaxCount = 1;
|
|
for (j = i + 1; j <= length; j++) {
|
|
//和上边的信息对比 如果值一样就合并行数+1 然后设置rowspan 让当前单元格隐藏
|
|
var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
|
|
if (before[CellName] == end[CellName]) {
|
|
rowSpanTaxCount++;
|
|
$("#" + gridName + "").setCell(mya[j], CellName, '', { display: 'none' });
|
|
} else {
|
|
rowSpanTaxCount = 1;
|
|
break;
|
|
}
|
|
$("#" + CellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
|
|
}
|
|
}
|
|
}
|
|
|
|
function btn_Export() {
|
|
var data = "&DateNow=" + $("#txt_DateNow").val()
|
|
$.download("/KBSWMS/ICSInspectionReports/ExportAll3?" + Math.random(), data, 'post');
|
|
}
|
|
|
|
</script>
|
|
<iframe id="ifrm" src="" width="0" height="0"></iframe>
|
|
<div class="topPanel" style="height:50px">
|
|
<div class="toolbar">
|
|
<div class="btn-group">
|
|
<a class="btn btn-primary" id="btn_search"><span class="glyphicon glyphicon-refresh"></span></a>
|
|
<a id="NF-Export" authorize="yes" class="btn btn-primary" onclick="btn_Export()"><i class="fa fa-download"></i>当前页导出</a>
|
|
</div>
|
|
</div>
|
|
<div class="search">
|
|
<table>
|
|
<tr>
|
|
<th class="formTitle">
|
|
<span style="color: red;">*</span>日期:
|
|
</th>
|
|
<td class="formValue">
|
|
<input type="text" name="txt_DateNow" id="txt_DateNow" class="form-control" style="width: 100px;height:13px" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM' })" placeholder="日期" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="gridPanel" id="gridPanel">
|
|
<table id="gridList"></table>
|
|
<div id="gridPager"></div>
|
|
</div>
|
|
|