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.
 
 
 
 
 

470 lines
21 KiB

@{
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">
<input id='FileUp3' type='file' style="display: none" onchange="UpLoadLabelFile(this)" />
<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/物料关联检验项目.xlsx" id="NF-IntroductionMould" authorize="no" class="btn btn-primary dropdown-text"><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="UpLoadClick1()"><i class="fa fa-file-excel-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">&nbsp;&nbsp;&nbsp;&nbsp;物料编码</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">&nbsp;&nbsp;&nbsp;&nbsp;物料名称</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_ListCode">&nbsp;&nbsp;&nbsp;&nbsp;检验项目编码</label>:</td>
<td class="HideItems">
<div class="input-group HideItems">
<input id="txt_ListCode" type="text" class="form-control HideItems" style="width: 200px;">
</div>
</td>
<td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_ListName">&nbsp;&nbsp;&nbsp;&nbsp;检验项目名称</label>:</td>
<td class="HideItems">
<div class="input-group HideItems">
<input id="txt_ListName" 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 = {
InvCode: $("#txt_InvCode").val(),
InvName: $("#txt_InvName").val(),
ListCode: $("#txt_ListCode").val(),
ListName: $("#txt_ListName").val(),
}
var $gridList = $("#gridList");
$gridList.dataGrid({
url: "/BBWMS/IQCQuality/GetItem2CheckItemPageList" + "?" + 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: 'ListCode', width: 150, align: 'left' },
{ label: '检验项目描述', name: 'ListName', width: 150, align: 'left' },
{ label: '检验属性', name: 'CheckAttrText', width: 100, align: 'left' },
{ label: '检验方法', name: 'EATTRIBUTE1', width: 100, align: 'left' },
{ label: '最大值', name: 'SetValueMax', width: 100, align: 'left' },
{ label: '最小值', name: 'SetValueMin', width: 100, align: 'left' },
{ label: '单位', name: 'Unit', 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 = {
InvCode: $("#txt_InvCode").val(),
InvName: $("#txt_InvName").val(),
ListCode: $("#txt_ListCode").val(),
ListName: $("#txt_ListName").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: "物料关联检验项目",
url: "/BBWMS/IQCQuality/Item2CheckItemGroupBind",
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: "编辑",
url: "/BBWMS/IQCQuality/Item2CheckItemEdit?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/DeleteItem2CheckItem",
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 = {
InvCode: $("#txt_InvCode").val(),
InvName: $("#txt_InvName").val(),
ListCode: $("#txt_ListCode").val(),
ListName: $("#txt_ListName").val(),
};
var postData = "&InvCode=" + queryJson.InvCode + "";
postData += "&InvName=" + queryJson.InvName;
postData += "&ListCode=" + queryJson.ListCode;
postData += "&ListName=" + queryJson.ListName;
$.download("/BBWMS/IQCQuality/ExportAllItem2CheckItem" + "?" + Math.random(), postData, 'post');
});
$("#FileUp").on("change", function (up) {
debugger;
// let that = this;
var form = new FormData(document.getElementById("form1"));
$.ajax({
url: "/BBWMS/IQCQuality/ImportItem2CheckGroup?" + 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 obj = {
ids: ids[0],
};
$.modalOpen({
id: "Form",
title: "质量履历文件查看",
url: "/BBWMS/IQCQuality/Item2AqlFileView?ids=" + ids[0] + "",
width: "1200px",
height: "400px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
});
}
}
service.Init();
})
function UpLoadClick1() {
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
if (objList.length != 1) {
$.modalAlertNew("WMS00050");
return;
}
$("#FileUp3").click();
}
function UpLoadLabelFile(fileinfo) {
debugger;
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
//if (objList.length != 1) {
// $.modalAlertNew("WMS00050");
// return;
//}
var rowData = $("#gridList").jqGrid('getRowData', objList[0]);
var id = rowData.InvCode;
var batchCode = 1001;
var files = fileinfo.files;
var fileName = files[0].name;
if (fileName != null && fileName != "") {
var data = new FormData();
jQuery.each(jQuery('#FileUp3')[0].files, function (i, file) {
data.append('file-' + i, file);
});
$.modalConfirm("确定上传文件吗?", function (r) {
if (r) {
$.ajax({
url: "/BBWMS/IQCQuality/UpLoadLabelFile?id=" + id + "&batchCode=" + batchCode,
type: "post",
data: data,
contentType: false,
processData: false,
success: function (data) {
debugger;
if (data.state != "error") {
$.modalAlertNew("WMS00014");
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
else {
$.modalAlertNew("WMS00015", data);
}
},
error: function (aa) {
$.modalAlertNew("WMS00016", aa);
}
});
}
});
}
document.getElementById("FileUp3").value = "";
}
</script>