|
|
@{ ViewBag.Title = "不良现象组查询"; 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" />
<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-trash-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-ExportAll" authorize="no" class="btn btn-primary"><i class="fa fa-download"></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_BRGCode"> 不良现象组编码</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_BRGCode" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_BRGDesc"> 不良现象组描述</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_BRGDesc" 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 () {
var service = { isCanEditDate: false, Init: function () { var that = this; //$("#txt_CheckFixtureNo").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 = { BRGCode: $("#txt_BRGCode").val(), BRGDesc: $("#txt_BRGDesc").val(), //Enable: $("#txt_Enable").val(), }
var $gridList = $("#gridList"); $gridList.dataGrid({ url: "/BBWMS/IQCQuality/GetBadReasonGroupPageList" + "?" + 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: 'BRGCode', width: 100, align: 'left' }, { label: '不良现象组描述', name: 'BRGDesc', width: 100, align: 'left' }, { label: '维护人', name: 'MUSERName', width: 100, align: 'left' }, { label: '维护时间', name: 'MTIME', width: 100, align: 'left' }, { label: '自定义字段1', name: 'EATTRIBUTE1', width: 100, align: 'left' }, { label: '自定义字段2', name: 'EATTRIBUTE2', width: 100, align: 'left' }, { label: '自定义字段3', name: 'EATTRIBUTE3', width: 100, align: 'left' }, { label: '自定义字段4', name: 'EATTRIBUTE4', 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: true, // (1)开启子表格支持 subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数 // console.log(subgrid_id, rowid); // $("#gridList").jqGrid("setSelection", rowid, false); that.bindSubGrid3(subgrid_id, rowid); } }); }, query: function () { //console.log("点击查询"); var queryJson = { BRGCode: $("#txt_BRGCode").val(), BRGDesc: $("#txt_BRGDesc").val(), } // that.loadGrid(queryJson);
$("#gridList").jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); }, bindSubGrid3: function (subgrid_id, rowid) { // $("#gridList").jqGrid("setSelection", rowid, false); var subgrid_table_id; subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
var subgrid_pager_id; subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
$("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>"); var MOCode = $("#gridList").jqGrid('getRowData', rowid).ID; // var MoSeq = $("#gridList").jqGrid('getRowData', rowid).MoSeq; // (6)创建jqGrid对象 $("#" + subgrid_table_id).dataGrid({ cellEdit: true, mtype: "GET", url: "/BBWMS/IQCQuality/GetBadReasonDetailList?id=" + MOCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数 colModel: [ { label: "主键", name: "ID", hidden: true, key: true }, { label: '不良现象编码', name: 'BadReasonCode', width: 150, align: 'left' }, { label: '不良现象描述', name: 'BadReasonDesc', width: 150, align: 'left' }, { label: '维护人', name: 'MUSERName', width: 100, align: 'left' }, { label: '维护时间', name: 'MTIME', width: 100, align: 'left' }, ], //colModel: ColModelSub, shrinkToFit: true,//宽度自适应 multiselect: true, prmNames: { search: "search" }, viewrecords: true, height: "100%", //rowNum: 20, //pager: subgrid_pager_id,
}); }, 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/BadReasonGroupEdit?ids=", 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/BadReasonGroupEdit?ids=" + ids[0]+"", width: "1200px", height: "800px", 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/DeleteBadReasonGroup", 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 = { BRGCode: $("#txt_BRGCode").val(), BRGDesc: $("#txt_BRGDesc").val(), }; var postData = "&BRGCode=" + queryJson.BRGCode + ""; postData += "&BRGDesc=" + queryJson.BRGDesc;
$.download("/BBWMS/IQCQuality/ExportAllBadReasonGroup" + "?" + Math.random(), postData, 'post'); }); $("#FileUp").on("change", function (up) { // let that = this; var form = new FormData(document.getElementById("form1")); $.ajax({ url: "/BBWMS/CheckingFixture/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); } });
});
}
} service.Init();
})
</script>
|