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.
227 lines
8.8 KiB
227 lines
8.8 KiB
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
}
|
|
|
|
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
|
|
<script>
|
|
$(document).ready(function () {
|
|
$("input.cell").keyup(function (e) {
|
|
switch (e.keyCode) {
|
|
|
|
case 40:
|
|
$(this).parent()
|
|
.parent()
|
|
.next()
|
|
.children("td")
|
|
.children("input.cell[name="
|
|
+ $(this).attr("name") + "]")
|
|
.focus();
|
|
break;
|
|
|
|
|
|
case 38:
|
|
$(this).parent()
|
|
.parent()
|
|
.prev()
|
|
.children("td")
|
|
.children("input.cell[name="
|
|
+ $(this).attr("name") + "]")
|
|
.focus();
|
|
break;
|
|
}
|
|
});
|
|
});</script>
|
|
<script>
|
|
$(function () {
|
|
gridList();
|
|
})
|
|
|
|
function gridList() {
|
|
var $gridList = $("#gridList");
|
|
var queryJson = {
|
|
BadCode: $("#txt_BadCode").val(),
|
|
BadCodeName: $("#txt_BadCodeName").val(),
|
|
}
|
|
$gridList.dataGrid({
|
|
url: "/WMS/BasicSettings/GetICSBadCodeGroup" + "?" + Math.random(),
|
|
postData: { queryJson: JSON.stringify(queryJson) },
|
|
height: $(window).height() - 200,
|
|
width: $(window).width() - 300,
|
|
colModel: [
|
|
{ label: "主键", name: "ID", hidden: true, key: true },
|
|
{ label: 'ID', name: 'ID', hidden: true },
|
|
{ label: '不良代码组编码', name: 'BCGCode', width: 120, align: 'left' },
|
|
{ label: '不良代码组描述', name: 'BCGDesc', width: 150, align: 'left' },
|
|
{ label: '操作人', name: 'MUSER', width: 100, align: 'left' },
|
|
{ label: '操作人名称', name: 'MUSERName', width: 200, align: 'left' },
|
|
{ label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
|
|
// { label: "Free1", name: "Free1", hidden: true },
|
|
|
|
],
|
|
shrinkToFit: false,//宽度自适应
|
|
autoWidth:true,
|
|
gridComplete: function () {
|
|
},
|
|
pager: "#gridPager",
|
|
sortorder: "desc",
|
|
sortname: 'BCGCode ',
|
|
viewrecords: true,
|
|
multiselect: true,
|
|
subGrid: true, // (1)开启子表格支持
|
|
subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
|
|
debugger;
|
|
$("#gridList").jqGrid("setSelection", rowid, false);
|
|
bindSubGrid(subgrid_id, rowid)
|
|
}
|
|
});
|
|
$("#btn_search").click(function () {
|
|
var warehouse = $("#warehouse a.active").attr('data-value');
|
|
var queryJson = {
|
|
BadCode: $("#txt_BadCode").val(),
|
|
BadCodeName: $("#txt_BadCodeName").val(),
|
|
}
|
|
$gridList.jqGrid('setGridParam', {
|
|
postData: { queryJson: JSON.stringify(queryJson) },
|
|
}).trigger('reloadGrid');
|
|
});
|
|
}
|
|
|
|
|
|
function bindSubGrid(subgrid_id, rowid) {
|
|
|
|
debugger;
|
|
$("#gridList").jqGrid("setSelection", rowid, false);
|
|
var subgrid_table_id;
|
|
subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
|
|
|
|
var subgrid_pager_id;
|
|
subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
|
|
|
|
// (5)动态添加子报表的table和pager
|
|
$("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
|
|
var ID = $("#gridList").jqGrid('getRowData', rowid).ID;
|
|
// (6)创建jqGrid对象
|
|
$("#" + subgrid_table_id).dataGrid({
|
|
cellEdit: true,
|
|
url: "/WMS/BasicSettings/GetICSBadCodeGroupdetil?ID=" + ID + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
|
|
colModel: [
|
|
{ label: "主键", name: "ID", hidden: true, key: true },
|
|
{ label: "不良代码组唯一标识", name: "BCGroupID", width: 150, align: 'left' },
|
|
{ label: "不良代码编码", name: "BadCode", width: 150, align: 'left' },
|
|
{ label: '不良代码描述', name: 'BadDesc', width: 100, align: 'left' },
|
|
{ label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
|
|
{ label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
|
|
],
|
|
sortname: 'MTIME',
|
|
shrinkToFit: true,//宽度自适应
|
|
//multiselect: true,
|
|
prmNames: { search: "search" },
|
|
viewrecords: true,
|
|
height: "100%",
|
|
rowNum: 20,
|
|
pager: subgrid_pager_id,
|
|
});
|
|
}
|
|
|
|
function btn_Delete() {
|
|
var objArr = '';
|
|
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
|
|
for (var i = 0; i < objList.length; i++) {
|
|
var rowId = objList[i];
|
|
var rowData = $("#gridList").jqGrid('getRowData', rowId);
|
|
objArr += "'" + rowData.ID + "',";
|
|
}
|
|
if (objArr == '') {
|
|
$.modalAlert("请选择一项进行删除!");
|
|
return;
|
|
}
|
|
$.deleteForm({
|
|
url: "/WMS/BasicSettings/DeleteICSBadCodeGroup" + "?" + Math.random(),
|
|
param: { keyValue: JSON.stringify(objArr) },
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
|
|
//修改类型
|
|
function btn_update() {
|
|
debugger;
|
|
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
|
|
if (ids.length != 1) {
|
|
$.modalAlert("请选择一行数据进行修改!");
|
|
return;
|
|
}
|
|
for (var i in ids) {
|
|
var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
|
|
//ID
|
|
var ID = rowData.ID;
|
|
var BRGCode = rowData.BCGCode;
|
|
var BRGDesc = rowData.BCGDesc;
|
|
$.modalOpen({
|
|
id: "Details",
|
|
title: "修改",
|
|
url: "/WMS/BasicSettings/ICSBadCodeAdd?ID=" + ID + "&BRGCode=" + BRGCode + "&BRGDesc=" + encodeURI(encodeURI(BRGDesc)) + "&" + Math.random(),
|
|
width: "900px",
|
|
height: "800px",
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function btnCreate() {
|
|
$.modalOpen({
|
|
id: "ICSBadCodeAdd",
|
|
title: "新增",
|
|
url: "/WMS/BasicSettings/ICSBadCodeAdd" + "?" + Math.random(),
|
|
width: "900px",
|
|
height: "800px",
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<div class="topPanel" style="height:60px">
|
|
<div class="toolbar">
|
|
<div class="btn-group">
|
|
<a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
|
|
<a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
|
|
<a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
|
|
</div>
|
|
</div>
|
|
<div class="search">
|
|
<table>
|
|
<tr>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_POCode">不良代码编号</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_BadCode" type="text" class="form-control" style="width: 100px;">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_POCode">不良代码描述</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_BadCodeName" type="text" class="form-control" style="width: 100px;">
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<span class="input-group-btn">
|
|
<button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="gridPanel">
|
|
<table id="gridList"></table>
|
|
<div id="gridPager"></div>
|
|
</div>
|