|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml";}
<script src="~/Content/js/datepicker/WdatePicker.js"></script><!--引入 element-ui 的样式,--><link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css"><script src="~/Content/vue/dist/vue.js"></script><script src="~/Content/element-ui/lib/index.js"></script>
<script src="~/Content/axios.min.js"></script><style></style><form id="form1"> <div id="app"> <div class="topPanel" style="height:100px;"> <div class="toolbar"> <div class="btn-group"> <input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /> <input id='FileUp2' type='file' style="display: none" /> <a id="NF-Add" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Add()"><i class="fa fa-pencil-square-o"></i>新增</a> <a id="NF-Remove" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Remove()"><i class="fa fa-pencil-square-o"></i>删除</a> <a id="NF-Edit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Edit()"><i class="fa fa-pencil-square-o"></i>修改</a> <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_UPload()">导入</a> <a href="~/File/IQC/物料关联检验AQL.xlsx" id="NF-IntroductionMould" authorize="no" class="btn btn-primary dropdown-text" onclick="btn_IntroductionMould()"><i class="fa fa-file-excel-o"></i>导入模板下载</a> <a id="NF-ExportAll" authorize="no" class="btn btn-primary"><i class="fa fa-download"></i>导出</a> <a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()"><i class="fa fa-file-excel-o"></i>上传</a> <a id="NF-ViewFile" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_ViewFile()"><i class="fa fa-pencil-square-o"></i>质量文件查看</a> <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
</div> <div class="btn-group" style="display:block;padding-left:2px;"> <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a> </div> @*<script>$('.toolbar').authorizeButton()</script>*@ </div> <div class="search"> <table> <tr> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvCode"> 物料编码</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_InvCode" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvName"> 物料名称</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_InvName" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_RulesCode"> AQL编码</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_RulesCode" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_RulesName"> AQL名称</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_RulesName" type="text" class="form-control HideItems" style="width: 200px;"> </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> </div></form>
<script type="text/javascript"> function btn_UPload() { $("#FileUp").click();
}
function UpLoadClick() {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalAlertNew("WMS00050"); return; } $("#FileUp2").click(); }
$(function () {
var service = { isCanEditDate: false, Init: function () { var that = this; // $("#txt_RulesCode").val('');
that.initControl(); that.loadGrid(); that.loadEvent(); //that.loadViewGrid();
}, initControl: function () { let that = this; let orgName = '';
let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
}, loadGrid: function () { var that = this;
var queryJson = { RulesCode: $("#txt_RulesCode").val(), RulesName: $("#txt_RulesName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), }
var $gridList = $("#gridList"); $gridList.dataGrid({ url: "/BBWMS/IQCQuality/GetItem2RuleList" + "?" + Math.random(), postData: { queryJson: JSON.stringify(queryJson) }, mtype: "POST", height: $(window).height() - 200, width: $(window).width() - 300, cellEdit: true, cellsubmit: "clientArray", colModel: [ { label: "主键", name: "ID", hidden: true, key: true }, { label: '物料代码', name: 'InvCode', width: 100, align: 'left' }, { label: '物料名称', name: 'InvName', width: 100, align: 'left' }, { label: '规格型号', name: 'InvStd', width: 100, align: 'left' }, { label: 'Aql编码', name: 'RulesCode', width: 100, align: 'left' }, { label: 'Aql名称', name: 'RulesName', width: 100, align: 'left' }, { label: 'Aql描述', name: 'RulesDesc', width: 100, align: 'left' }, { label: '检验属性', name: 'CheckAttrText', width: 100, align: 'left' }, { label: '维护人', name: 'MUSERName', width: 100, align: 'left' }, { label: '最后操作时间', name: 'MTIME', width: 100, align: 'left' }, ], shrinkToFit: true,//宽度自适应 width: "100%", autowidth: true, gridComplete: function () { //if (!that.isCanEditDate) { // var obj_Item1 = $("#gridList"); // var rowIds_Item1 = obj_Item1.getDataIDs();
// for (var i = 0; i < rowIds_Item1.length; i++) { // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanStartDate", '', 'not-editable-cell'); // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanEndDate", '', 'not-editable-cell'); // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "ApsOrderDate", '', 'not-editable-cell'); // } //} }, pager: "#gridPager", sortname: 'MTIME', sortorder: "desc", viewrecords: true, multiselect: true, subGrid: false, // (1)开启子表格支持 }); }, query: function () { //console.log("点击查询"); var queryJson = { RulesCode: $("#txt_RulesCode").val(), RulesName: $("#txt_RulesName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), } // that.loadGrid(queryJson);
$("#gridList").jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); }, loadEvent: function () { var that = this; $("#btn_search").click(function () { that.query(); }); $("#NF-Add").click(function () { // debugger; var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
$.modalOpen({ id: "Form", title: "物料关联检验AQL", url: "/BBWMS/IQCQuality/Item2AqlEdit", width: "1200px", height: "800px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } });
}); $("#NF-Edit").click(function () {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; }
let obj = { ids: ids[0], }; //debugger; //if (!obj.orderDate) { // obj.orderDate = new Date().toLocaleDateString(); //} // consol.log(); $.modalOpen({ id: "Form", title: "编辑Aql", url: "/BBWMS/IQCQuality/Item2AqlEditSingle?ids=" + ids[0]+"", width: "800px", height: "400px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } }); }); $("#txt_SSName").change(function (event,handle) { //console.log( $("#txt_SSName").val()); // console.log(val); // console.log("值改变了"); let val = $("#txt_SSName").val(); if (!val) { $("#NF-PrintLabel").attr("disabled", "disabled"); } else { $("#NF-PrintLabel").removeAttr("disabled"); } }); $("#NF-Remove").click(function () {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length < 1) { $.modalMsg("请选择数据", "warning"); return; } let keyList = []; for (var i = 0; i < ids.length; i++) { keyList.push(ids[i]); }
//let obj = { // ids: ids[0], //};
$.ajax({ url: "/BBWMS/IQCQuality/DeleteItem2Aql", type: "POST", dataType: "json", async: false, data: { keyValue: JSON.stringify(keyList) }, success: function (data) { // // console.log(data); if (data.state == "success") { $.modalMsg("操作成功", "success"); that.query(); } else $.modalMsg(data.message, "warning"); } }); }); $("#NF-ExportAll").click(function () { let queryJson = { RulesCode: $("#txt_RulesCode").val(), RulesName: $("#txt_RulesName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), }; var postData = "&RulesCode=" + queryJson.RulesCode + ""; postData += "&RulesName=" + queryJson.RulesName; postData += "&InvCode=" + queryJson.InvCode; postData += "&InvName=" + queryJson.InvName;
$.download("/BBWMS/IQCQuality/ExportAllItem2AqlList" + "?" + Math.random(), postData, 'post'); }); $("#FileUp").on("change", function (up) { // let that = this; var form = new FormData(document.getElementById("form1")); $.ajax({ url: "/BBWMS/IQCQuality/UploadFile?" + Math.random(), type: "post", data: form, contentType: false, processData: false, success: function (data) { if (data == "true" || data == true) { alert("导入成功"); that.query(); } else { alert(data); } }, error: function (aa) { alert("导入失败:" + aa); } });
}); $("#FileUp2").on("change", function (e) { debugger; var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow'); for (var i = 0; i < objList.length; i++) { var rowId = objList[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); var ID = rowData.ID; //var LableName = rowData.LableName; } var files = e.target.files; var fileName = files[0].name; if (fileName != null && fileName != "") { var data = new FormData(); jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) { data.append('file-' + i, file); }); data.append("ID", ID); // data.append("LableName", LableName); $.modalConfirm("确定上传文件吗?", function (r) { if (r) { $.ajax({ url: "/BBWMS/IQCQuality/UpLoadItemRuleFile" + "?" + Math.random(), type: "post", data: data, contentType: false, processData: false, dataType: "json", success: function (data) { // console.log(data); if (data.message == "上传成功!") { $.modalMsg("操作成功", "success"); $.currentWindow().$("#gridList").trigger("reloadGrid");
} else { $.modalMsg(data.message, "warning"); } }, error: function (aa) { $.modalAlertNew("WMS00016", aa); } }); } }); } });
$("#NF-ViewFile").click(function () { var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; } let itemCode = ''; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); // var ID = rowData.ID; //var LableName = rowData.LableName; itemCode = rowData.InvCode; }
//let obj = { // ids: ids[0], //};
$.modalOpen({ id: "Form", title: "质量履历文件查看", url: "/BBWMS/IQCQuality/Item2AqlFileView?ids=" + itemCode + "", width: "1200px", height: "400px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } });
}); }
} service.Init();
})
</script>
|