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.
 
 
 
 
 

238 lines
8.5 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 MouldCode = $.request("MouldCode");
var Describe = $.request("Describe");
var MouldName = decodeURI($.request("MouldName"));
//状态
var Status = decodeURI($.request("Status"));
//上限
var UpperLimit = $.request("UpperLimit");
//下限
var LowerLimit = $.request("LowerLimit");
var Picture = "";
$(function () {
debugger;
InitControl();
InitControl1();
if (ID != "") {
$("#sel_MouldNumber").val([MouldNumber]).trigger("change");
$("#sel_MajorStates").val([Status]).trigger("change");
$("#MouldName").val(MouldName);
$("#MouldCode").val(MouldCode);
$("#UpperLimit").val(UpperLimit);
$("#LowerLimit").val(LowerLimit);
}
});
$.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_MouldNumber");
$VenCode.select2({
allowClear: true,
escapeMarkup: function (m) {
return m;
}
});
$.ajax({
url: "/Boxes/BasicSettings/GetMouldNumber" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
$.each(data, function (index, item) {
$VenCode.append("<option value='" + item.MouldNumber + "'>" + item.MouldNumber + "</option>");
});
}
});
}
function InitControl1() {
debugger;
var $VenCode = $("#sel_MajorStates");
$VenCode.select2({
allowClear: true,
escapeMarkup: function (m) {
return m;
}
});
$.ajax({
url: "/Boxes/BasicSettings/GetType?tableName=" + "ICSMouldAccount" + "&" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
$.each(data, function (index, item) {
$VenCode.append("<option value='" + item.TypeName + "'>" + item.TypeName + "</option>");
});
}
});
}
function submitForm() {
if (!$('#form1').formValid()) {
return false;
}
var MouldCode = $("#MouldCode").val();//模具代码
var MouldNumber = $("#sel_MouldNumber").find("option:selected").text();//模具编码
var MouldName = $("#MouldName").val();//模具名称
//状态
var Status = $("#sel_MajorStates").find("option:selected").text();
//上限
var UpperLimit = $("#UpperLimit").val();
//下限
var LowerLimit = $("#LowerLimit").val();
var objArr = {
ID: ID,
MouldCode: MouldCode,
MouldNumber: MouldNumber,
MouldName: MouldName,
Picture: Picture,
Status: Status,
UpperLimit: UpperLimit,
LowerLimit, LowerLimit
}
debugger;
if (ID != "") {
$.submitForm({
url: "/Boxes/BasicSettings/UpdateMouldAccount" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
} else {
$.submitForm({
url: "/Boxes/BasicSettings/InsertMouldAccount" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
}
//导入
function btn_Introduction() {
debugger;
$("#FileUp").click();
}
function btnUpLoad(up) {
var form = new FormData(document.getElementById("form1"));
$.ajax({
url: "/Boxes/BasicSettings/UpLoadFileImport?" + Math.random(),
type: "post",
data: form,
dataType: "json",
contentType: false,
processData: false,
success: function (data) {
Picture = data.data;
if (data.data == "上传成功!") {
alert("上传成功");
}
else {
alert(data.message);
}
},
error: function (aa) {
alert("上传失败:" + aa);
}
});
}
$(".u-file-btn").on("change", "input[type='file']", function () {
var filePath = $(this).val();
if (filePath.indexOf("xls") != -1 || filePath.indexOf("xlsx") != -1) {
var arr = filePath.split('\\');
var fileName = arr[arr.length - 1];
document.getElementById("showFileName").innerText = fileName;
} else {
document.getElementById("showFileName").innerText = "";
alert("您未上传文件,或者您上传文件类型有误!");
return false
}
})
</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 style="width:150px">
<select id="sel_MouldNumber" name="sel_MouldNumber" class="form-control select2 required" style="width: 135px; height: 25px;" placeholder="模具编码" required></select>
<input type="hidden" id="hidetext" />
</td>
<th class="formTitle" style="width: 108px;"><span style="color: red;">*</span>模具代码:</th>
<td class="formValue">
<input id="MouldCode" name="MouldCode" type="text" class="form-control " style="width: 155px;" maxlength="10" placeholder="模具代码" required />
</td>
</tr>
<tr>
<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 />
</td>
<th class="formTitle"><span style="color: red;">*</span>状态:</th>
<td style="width:150px">
<select id="sel_MajorStates" name="sel_MajorStates" class="form-control select2 required" style="width: 135px; height: 25px;" placeholder="状态" required></select>
<input type="hidden" id="hidetext" />
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>上限值:</th>
<td class="formValue">
<input id="UpperLimit" name="UpperLimit" type="text" class="form-control required" maxlength="10" placeholder="上限值" required />
</td>
<th class="formTitle">图片文件名称:</th>
<td class="formValue">
<div id="u-file-c" class="u-file-btn">
<input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" onchange="btnUpLoad(this)" />
<a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Introduction()">上传</a>
</div>
</td>
<td>
<label id="showFileName"></label>
</td>
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>下限值:</th>
<td class="formValue">
<input id="LowerLimit" name="LowerLimit" type="text" class="form-control required" maxlength="10" placeholder="下限值" required />
</td>
</tr>
</table>
</div>
</form>