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.
288 lines
11 KiB
288 lines
11 KiB
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
}
|
|
<style>
|
|
|
|
/*.ui-jqgrid tr.jqgrow td {
|
|
white-space: normal !important;
|
|
height: auto;
|
|
}*/
|
|
</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 () {
|
|
debugger;
|
|
$("#txt_DateNow").val(currentyear + "-" + currentMonth)
|
|
SetCols();
|
|
gridList();
|
|
// 搜索按钮点击事件
|
|
$("#btn_search").click(function () {
|
|
//var queryJson = {
|
|
// DateNow: $("#txt_DateNow").val(),
|
|
//}
|
|
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 = [
|
|
{
|
|
name: 'Decomposition', // 这不是数据源中的实际字段,而是用于展示组合数据的占位符
|
|
index: 'Decomposition', // 通常与name相同,但在这种情况下它只是一个标识符
|
|
label: '分解指标',
|
|
width: 240,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
debugger;
|
|
// rowObject 包含整行数据
|
|
var field1 = rowObject.Decomposition1; // 第一个数据字段
|
|
var field2 = rowObject.Decomposition2; // 第二个数据字段
|
|
// 根据需要组合字段值
|
|
return field1 + ' ' + field2;
|
|
}
|
|
},
|
|
|
|
|
|
{
|
|
label: currentMonth + '月第1周', name: 'Week1', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第2周', name: 'Week2', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第3周', name: 'Week3', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第4周', name: 'Week4', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第5周', name: 'Week5', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: currentMonth + '月第6周', name: 'Week6', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '当月累计', name: 'MonthlyCumulative', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '1月', name: 'Month1', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '2月', name: 'Month2', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '3月', name: 'Month3', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '4月', name: 'Month4', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '5月', name: 'Month5', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '6月', name: 'Month6', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '7月', name: 'Month7', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '8月', name: 'Month8', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '9月', name: 'Month9', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '10月', name: 'Month10', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '11月', name: 'Month11', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '12月', name: 'Month12', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
return cellvalue + '%';
|
|
}
|
|
},
|
|
{
|
|
label: '年度累计', name: 'AnnualAccumulation', width: 90, align: "center", formatter: function (cellvalue, options, rowObject) {
|
|
// 在这里添加百分号
|
|
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/GetPassFirstTime" + "?" + Math.random(),
|
|
height: $(window).height() - 128,
|
|
width: $(window).width() - 128,
|
|
postData: { queryJson: JSON.stringify(queryJson) },
|
|
colModel: _Clos,
|
|
rownumbers: false,
|
|
//pager: "#gridPager",
|
|
//sortname: 'WarehouseCode',
|
|
//sortorder: "desc",
|
|
//viewrecords: true,
|
|
//multiselect: true
|
|
});
|
|
$gridList.jqGrid('setGroupHeaders', {
|
|
useColSpanStyle: true,
|
|
groupHeaders: [
|
|
//{ startColumnName: '', numberOfColumns: 2, titleText: '分解指标' },
|
|
{ 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() {
|
|
debugger;
|
|
$("#NF-Export").attr("disabled", "disabled");
|
|
var data = "&DateNow=" + $("#txt_DateNow").val()
|
|
$.download("/KBSWMS/ICSInspectionReports/ExportAll1?" + Math.random(), data, 'post');
|
|
$("#NF-Export").removeAttr("disabled");
|
|
|
|
|
|
}
|
|
|
|
</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" 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>
|
|
|