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.
 
 
 
 
 

155 lines
5.6 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
#ISO {
width: 10px;
}
</style>
<link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
<script src="~/Content/js/select2/select2.min.js"></script>
<script>
var ID = $.request("ID");
var MouldNumber = $.request("MouldNumber");
//var WarehouseName = decodeURI($.getUrlParam("WarehouseName"));
var Type = $.request("Type");
var Phone = $.request("Phone");
var MouldName = decodeURI($.request("MouldName"));
var Specification = decodeURI($.request("Specification"));
var Unit = decodeURI($.request("Unit"));
//var expArrivalDate = $
$(function () {
debugger;
InitControl();
if (ID != "") {
$("#sel_Type").val([Type]).trigger("change");
$("#MouldNumber").val(MouldNumber);
$("#MouldName").val(MouldName);
$("#Specification").val(Specification);
$("#Unit").val(Unit);
$("#Phone").val(Phone);
}
});
$.getUrlParam = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
;
function InitControl() {
debugger;
var $VenCode = $("#sel_Type");
$VenCode.select2({
allowClear: true,
escapeMarkup: function (m) {
return m;
}
});
$.ajax({
url: "/Boxes/BasicSettings/GetType?tableName=" + "ICSMould" + "&" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
$.each(data, function (index, item) {
$VenCode.append("<option value='" + item.Type + "'>" + item.Type + "</option>");
});
}
});
}
//新增模具
function submitForm() {
if (!$('#form1').formValid()) {
return false;
}
debugger;
var MouldNumber = $("#MouldNumber").val();
var MouldName = $("#MouldName").val();
var Type = $("#sel_Type").find("option:selected").text();
var Unit = $("#Unit").val();
var Specification = $("#Specification").val();
var Phone = $("#Phone").val();
if (MouldNumber == "" || MouldName == "" || Type == "" || Specification == "" || Unit=="" ) {
$.modalAlertNew("WMS00062");
return;
}
var objArr = {
ID:ID,
MouldNumber: $("#MouldNumber").val(),
MouldName: $("#MouldName").val(),
Type: $("#sel_Type").find("option:selected").text(),
Unit: $("#Unit").val(),
Specification: $("#Specification").val(),
Phone: $("#Phone").val(),
}
if (ID != "") {
$.submitForm({
url: "/Boxes/BasicSettings/UpdateMould" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
} else {
$.submitForm({
url: "/Boxes/BasicSettings/InsertMould" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
}
</script>
<form id="form1">
<div style="padding-top: 50px; margin-right: 50px;">
<table class="form">
<tr>
<th class="formTitle"><span style="color: red;">*</span>模具编码:</th>
<td class="formValue">
<input id="MouldNumber" name="MouldNumber" type="text" class="form-control required" style="width: 150px;" maxlength="10" placeholder="模具编码" required />
</td>
<th class="formTitle"><span style="color: red;">*</span>名称:</th>
<td class="formValue">
<input id="MouldName" name="MouldName" type="text" class="form-control required" maxlength="10" placeholder="名称" required/>
</tr>
<tr>
<th class="formTitle">联系电话:</th>
<td class="formValue">
<input id="Phone" name="Phone" type="text" class="form-control " style="width: 150px;" maxlength="10" placeholder="联系电话" />
</td>
<th class="formTitle"><span style="color: red;">*</span>类型:</th>
<td style="width:150px">
<select id="sel_Type" name="sel_Type" class="form-control select2 required" style="width: 135px; height: 25px;" placeholder="类型"></select>
<input type="hidden" id="hidetext" />
</td>
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>规格:</th>
<td class="formValue">
<input id="Specification" name="Specification" type="text" class="form-control required" style="width: 150px; " maxlength="10" placeholder="规格" required />
<th class="formTitle"><span style="color: red;">*</span>单位:</th>
<td class="formValue">
<input id="Unit" name="Unit" type="text" class="form-control required" maxlength="10" placeholder="单位" />
</tr>
</table>
</div>
</form>