纽威
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.
 
 
 
 
 

192 lines
6.5 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
$(function () {
gridList();
SireCodeBinding();
CodeBinding();
});
function gridList() {
var $gridList = $("#gridList");
$gridList.dataGrid({
url: "/WMS/BasicSettings/GetSendContainer?" + Math.random(),
height: $(window).height() -50,
width: $(window).width() - 400,
cellEdit: true,
cellsubmit: "clientArray",
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{
label: '删除', width: 100, align: 'left',
formatter: btnLook
},
{ label: '父容器唯一标识', name: 'ContainerID', width: 120, align: 'left' },
{ label: '容器代码', name: 'ContainerCode', width: 150, align: 'left' },
{ label: '容器名称', name: 'ContainerName', width: 100, align: 'left' },
{ label: '备注', name: 'Memo', width: 200, align: 'left' },
{ label: '操作人', name: 'MUSER', width: 200, align: 'left' },
{ label: '操作人姓名', name: 'MUSERName', width: 200, align: 'left' },
{ label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
{ label: '站点', name: 'WorkPoint', width: 200, align: 'left' },
],
afterSaveCell: function (rowid, cellname, value) {
if (cellname === 'ProjectCN') {
$gridList.jqGrid("setCell", rowid, 'ProjectID', value);
}
},
width: "100%",
autowidth: true,
rownumbers: true,
viewrecords: true,
});
}
function btnLook(cellvalue, options, rowObject) {
return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">删除</a>";
}
function UpLoadClick(ID) {
$("#gridList").delRowData(ID);
}
function SireCodeBinding() {
$("#SireCode").keydown(function (e) {
var curKey = e.which;
debugger;
if (curKey == 13) {
var SireCode = $("#SireCode").val();//需绑定容器
$.ajax({
url: "/WMS/BasicSettings/GetBindContainerID?SireCode=" + SireCode,
dataType: "json",
async: false,
success: function (data) {
debugger;
if (data == "" || data == null) {
$.modalAlert("未查询到该容器信息!");
return;
}
$("#SireID").val(data.rows[0].ID);
$("#Code").focus();
}
});
}
});
};
function CodeBinding() {
$("#Code").keydown(function (e) {
var curKey = e.which;
debugger;
if (curKey == 13) {
var Code = $("#Code").val();//需绑定容器
$.ajax({
url: "/WMS/BasicSettings/GetContainerInfo?Code=" + Code,
dataType: "json",
async: false,
success: function (data) {
debugger;
if (data == "" || data == null) {
$.modalAlert("未查询到该容器信息!");
return;
}
//最后一行新增数据
var obj = {
ID: data.rows[0].ID,
ContainerID: data.rows[0].ContainerID,
ContainerCode: data.rows[0].ContainerCode,
ContainerName: data.rows[0].ContainerName,
Memo: data.rows[0].Memo,
MUSER: data.rows[0].MUSER,
MUSERName: data.rows[0].MUSERName,
MTIME: data.rows[0].MTIME,
WorkPoint: data.rows[0].WorkPoint,
};
$("#gridList").jqGrid('addRowData', obj.ID, obj, 'first');
$(".unwritten").hide();
}
});
}
});
};
function submitForm() {
debugger;
var SireID = $("#SireID").val();
var ICSMTDOC = [];
var obj_Item1 = $("#gridList");
var rowIds_Item1 = obj_Item1.getDataIDs();
if (rowIds_Item1.length > 0) {
for (var i = 0; i < rowIds_Item1.length; i++) {
var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
var obj = {
ID: RowData_Item1.ID,
ContainerCode: RowData_Item1.ContainerCode,
};
ICSMTDOC.push(obj);
}
}
debugger;
$.modalConfirm("确定绑定吗?", function (r) {
if (r) {
$.submitForm({
url: "/WMS/BasicSettings/BindingContainerID?SireID=" + SireID + "&" + Math.random(),
param: { ICSMTDOC: JSON.stringify(ICSMTDOC) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
});
}
</script>
<form id="form1">
<div style="padding-top: 20px; margin-right: 20px;">
<table class="form">
<tr>
<th class="formTitle">父容器:</th>
<td class="formValue">
<input id="SireCode" type="text" class="form-control" style="width: 300px;" οnkeydοwn="SireCodeBinding()"/>
<input id="SireID" type="text" class="form-control" style="display:none" οnkeydοwn="SireCodeBinding()" />
</td>
<th class="formTitle">需绑定容器:</th>
<td class="formValue">
<input id="Code" type="text" class="form-control" style="width: 300px;" οnkeydοwn="CodeBinding()" />
</td>
</tr>
</table>
</div>
</form>
<!--色牢度-->
<div class="gridPanel" style="width: 100% ">
<div class="ibox-title">
子表
</div>
<div class="gridPanel">
<table id="gridList"></table>
</div>
</div>