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.

420 lines
19 KiB

3 weeks ago
  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <!--引入 element-ui 的样式,-->
  8. <link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
  9. <script src="~/Content/vue/dist/vue.js"></script>
  10. <script src="~/Content/element-ui/lib/index.js"></script>
  11. <script src="~/Content/axios.min.js"></script>
  12. <style>
  13. </style>
  14. <form id="form1">
  15. <div id="app">
  16. <div class="topPanel" style="height:100px;">
  17. <div class="toolbar">
  18. <div class="btn-group">
  19. <input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
  20. <input id='FileUp2' type='file' style="display: none" />
  21. <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>
  22. <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>
  23. <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>
  24. <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_UPload()">导入</a>
  25. <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>
  26. <a id="NF-ExportAll" authorize="no" class="btn btn-primary"><i class="fa fa-download"></i>导出</a>
  27. <a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()"><i class="fa fa-file-excel-o"></i>上传</a>
  28. <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>
  29. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  30. </div>
  31. <div class="btn-group" style="display:block;padding-left:2px;">
  32. <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a>
  33. </div>
  34. @*<script>$('.toolbar').authorizeButton()</script>*@
  35. </div>
  36. <div class="search">
  37. <table>
  38. <tr>
  39. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvCode">&nbsp;&nbsp;&nbsp;&nbsp;物料编码</label>:</td>
  40. <td class="HideItems">
  41. <div class="input-group HideItems">
  42. <input id="txt_InvCode" type="text" class="form-control HideItems" style="width: 200px;">
  43. </div>
  44. </td>
  45. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvName">&nbsp;&nbsp;&nbsp;&nbsp;物料名称</label>:</td>
  46. <td class="HideItems">
  47. <div class="input-group HideItems">
  48. <input id="txt_InvName" type="text" class="form-control HideItems" style="width: 200px;">
  49. </div>
  50. </td>
  51. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_RulesCode">&nbsp;&nbsp;&nbsp;&nbsp;AQL编码</label>:</td>
  52. <td class="HideItems">
  53. <div class="input-group HideItems">
  54. <input id="txt_RulesCode" type="text" class="form-control HideItems" style="width: 200px;">
  55. </div>
  56. </td>
  57. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_RulesName">&nbsp;&nbsp;&nbsp;&nbsp;AQL名称</label>:</td>
  58. <td class="HideItems">
  59. <div class="input-group HideItems">
  60. <input id="txt_RulesName" type="text" class="form-control HideItems" style="width: 200px;">
  61. </div>
  62. </td>
  63. <td>
  64. <span class="input-group-btn">
  65. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  66. </span>
  67. </td>
  68. </tr>
  69. </table>
  70. </div>
  71. </div>
  72. <div class="gridPanel">
  73. <table id="gridList"></table>
  74. <div id="gridPager"></div>
  75. </div>
  76. </div>
  77. </form>
  78. <script type="text/javascript">
  79. function btn_UPload() {
  80. $("#FileUp").click();
  81. }
  82. function UpLoadClick() {
  83. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  84. if (ids.length != 1) {
  85. $.modalAlertNew("WMS00050");
  86. return;
  87. }
  88. $("#FileUp2").click();
  89. }
  90. $(function () {
  91. var service = {
  92. isCanEditDate: false,
  93. Init: function () {
  94. var that = this;
  95. // $("#txt_RulesCode").val('');
  96. that.initControl();
  97. that.loadGrid();
  98. that.loadEvent();
  99. //that.loadViewGrid();
  100. },
  101. initControl: function () {
  102. let that = this;
  103. let orgName = '';
  104. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  105. },
  106. loadGrid: function () {
  107. var that = this;
  108. var queryJson = {
  109. RulesCode: $("#txt_RulesCode").val(),
  110. RulesName: $("#txt_RulesName").val(),
  111. InvCode: $("#txt_InvCode").val(),
  112. InvName: $("#txt_InvName").val(),
  113. }
  114. var $gridList = $("#gridList");
  115. $gridList.dataGrid({
  116. url: "/BBWMS/IQCQuality/GetItem2RuleList" + "?" + Math.random(),
  117. postData: { queryJson: JSON.stringify(queryJson) },
  118. mtype: "POST",
  119. height: $(window).height() - 200,
  120. width: $(window).width() - 300,
  121. cellEdit: true,
  122. cellsubmit: "clientArray",
  123. colModel: [
  124. { label: "主键", name: "ID", hidden: true, key: true },
  125. { label: '物料代码', name: 'InvCode', width: 100, align: 'left' },
  126. { label: '物料名称', name: 'InvName', width: 100, align: 'left' },
  127. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  128. { label: 'Aql编码', name: 'RulesCode', width: 100, align: 'left' },
  129. { label: 'Aql名称', name: 'RulesName', width: 100, align: 'left' },
  130. { label: 'Aql描述', name: 'RulesDesc', width: 100, align: 'left' },
  131. { label: '检验属性', name: 'CheckAttrText', width: 100, align: 'left' },
  132. { label: '维护人', name: 'MUSERName', width: 100, align: 'left' },
  133. { label: '最后操作时间', name: 'MTIME', width: 100, align: 'left' },
  134. ],
  135. shrinkToFit: true,//宽度自适应
  136. width: "100%",
  137. autowidth: true,
  138. gridComplete: function () {
  139. //if (!that.isCanEditDate) {
  140. // var obj_Item1 = $("#gridList");
  141. // var rowIds_Item1 = obj_Item1.getDataIDs();
  142. // for (var i = 0; i < rowIds_Item1.length; i++) {
  143. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanStartDate", '', 'not-editable-cell');
  144. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanEndDate", '', 'not-editable-cell');
  145. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "ApsOrderDate", '', 'not-editable-cell');
  146. // }
  147. //}
  148. },
  149. pager: "#gridPager",
  150. sortname: 'MTIME',
  151. sortorder: "desc",
  152. viewrecords: true,
  153. multiselect: true,
  154. subGrid: false, // (1)开启子表格支持
  155. });
  156. },
  157. query: function () {
  158. //console.log("点击查询");
  159. var queryJson = {
  160. RulesCode: $("#txt_RulesCode").val(),
  161. RulesName: $("#txt_RulesName").val(),
  162. InvCode: $("#txt_InvCode").val(),
  163. InvName: $("#txt_InvName").val(),
  164. }
  165. // that.loadGrid(queryJson);
  166. $("#gridList").jqGrid('setGridParam', {
  167. postData: { queryJson: JSON.stringify(queryJson) },
  168. }).trigger('reloadGrid');
  169. },
  170. loadEvent: function () {
  171. var that = this;
  172. $("#btn_search").click(function () {
  173. that.query();
  174. });
  175. $("#NF-Add").click(function () {
  176. // debugger;
  177. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  178. $.modalOpen({
  179. id: "Form",
  180. title: "物料关联检验AQL",
  181. url: "/BBWMS/IQCQuality/Item2AqlEdit",
  182. width: "1200px",
  183. height: "800px",
  184. callBack: function (iframeId) {
  185. top.frames[iframeId].submitForm();
  186. }
  187. });
  188. });
  189. $("#NF-Edit").click(function () {
  190. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  191. if (ids.length != 1) {
  192. $.modalMsg("请选择一条数据", "warning");
  193. return;
  194. }
  195. let obj = {
  196. ids: ids[0],
  197. };
  198. //debugger;
  199. //if (!obj.orderDate) {
  200. // obj.orderDate = new Date().toLocaleDateString();
  201. //}
  202. // consol.log();
  203. $.modalOpen({
  204. id: "Form",
  205. title: "编辑Aql",
  206. url: "/BBWMS/IQCQuality/Item2AqlEditSingle?ids=" + ids[0]+"",
  207. width: "800px",
  208. height: "400px",
  209. callBack: function (iframeId) {
  210. top.frames[iframeId].submitForm();
  211. }
  212. });
  213. });
  214. $("#txt_SSName").change(function (event,handle) {
  215. //console.log( $("#txt_SSName").val());
  216. // console.log(val);
  217. // console.log("值改变了");
  218. let val = $("#txt_SSName").val();
  219. if (!val) {
  220. $("#NF-PrintLabel").attr("disabled", "disabled");
  221. }
  222. else {
  223. $("#NF-PrintLabel").removeAttr("disabled");
  224. }
  225. });
  226. $("#NF-Remove").click(function () {
  227. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  228. if (ids.length < 1) {
  229. $.modalMsg("请选择数据", "warning");
  230. return;
  231. }
  232. let keyList = [];
  233. for (var i = 0; i < ids.length; i++) {
  234. keyList.push(ids[i]);
  235. }
  236. //let obj = {
  237. // ids: ids[0],
  238. //};
  239. $.ajax({
  240. url: "/BBWMS/IQCQuality/DeleteItem2Aql",
  241. type: "POST",
  242. dataType: "json",
  243. async: false,
  244. data: {
  245. keyValue: JSON.stringify(keyList)
  246. },
  247. success: function (data) {
  248. //
  249. // console.log(data);
  250. if (data.state == "success") {
  251. $.modalMsg("操作成功", "success");
  252. that.query();
  253. }
  254. else
  255. $.modalMsg(data.message, "warning");
  256. }
  257. });
  258. });
  259. $("#NF-ExportAll").click(function () {
  260. let queryJson = {
  261. RulesCode: $("#txt_RulesCode").val(),
  262. RulesName: $("#txt_RulesName").val(),
  263. InvCode: $("#txt_InvCode").val(),
  264. InvName: $("#txt_InvName").val(),
  265. };
  266. var postData = "&RulesCode=" + queryJson.RulesCode + "";
  267. postData += "&RulesName=" + queryJson.RulesName;
  268. postData += "&InvCode=" + queryJson.InvCode;
  269. postData += "&InvName=" + queryJson.InvName;
  270. $.download("/BBWMS/IQCQuality/ExportAllItem2AqlList" + "?" + Math.random(), postData, 'post');
  271. });
  272. $("#FileUp").on("change", function (up) {
  273. // let that = this;
  274. var form = new FormData(document.getElementById("form1"));
  275. $.ajax({
  276. url: "/BBWMS/IQCQuality/UploadFile?" + Math.random(),
  277. type: "post",
  278. data: form,
  279. contentType: false,
  280. processData: false,
  281. success: function (data) {
  282. if (data == "true" || data == true) {
  283. alert("导入成功");
  284. that.query();
  285. }
  286. else {
  287. alert(data);
  288. }
  289. },
  290. error: function (aa) {
  291. alert("导入失败:" + aa);
  292. }
  293. });
  294. });
  295. $("#FileUp2").on("change", function (e) {
  296. debugger;
  297. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  298. for (var i = 0; i < objList.length; i++) {
  299. var rowId = objList[i];
  300. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  301. var ID = rowData.ID;
  302. //var LableName = rowData.LableName;
  303. }
  304. var files = e.target.files;
  305. var fileName = files[0].name;
  306. if (fileName != null && fileName != "") {
  307. var data = new FormData();
  308. jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) {
  309. data.append('file-' + i, file);
  310. });
  311. data.append("ID", ID);
  312. // data.append("LableName", LableName);
  313. $.modalConfirm("确定上传文件吗?", function (r) {
  314. if (r) {
  315. $.ajax({
  316. url: "/BBWMS/IQCQuality/UpLoadItemRuleFile" + "?" + Math.random(),
  317. type: "post",
  318. data: data,
  319. contentType: false,
  320. processData: false,
  321. dataType: "json",
  322. success: function (data) {
  323. // console.log(data);
  324. if (data.message == "上传成功!") {
  325. $.modalMsg("操作成功", "success");
  326. $.currentWindow().$("#gridList").trigger("reloadGrid");
  327. }
  328. else {
  329. $.modalMsg(data.message, "warning");
  330. }
  331. },
  332. error: function (aa) {
  333. $.modalAlertNew("WMS00016", aa);
  334. }
  335. });
  336. }
  337. });
  338. }
  339. });
  340. $("#NF-ViewFile").click(function () {
  341. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  342. if (ids.length != 1) {
  343. $.modalMsg("请选择一条数据", "warning");
  344. return;
  345. }
  346. let itemCode = '';
  347. for (var i = 0; i < ids.length; i++) {
  348. var rowId = ids[i];
  349. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  350. // var ID = rowData.ID;
  351. //var LableName = rowData.LableName;
  352. itemCode = rowData.InvCode;
  353. }
  354. //let obj = {
  355. // ids: ids[0],
  356. //};
  357. $.modalOpen({
  358. id: "Form",
  359. title: "质量履历文件查看",
  360. url: "/BBWMS/IQCQuality/Item2AqlFileView?ids=" + itemCode + "",
  361. width: "1200px",
  362. height: "400px",
  363. callBack: function (iframeId) {
  364. top.frames[iframeId].submitForm();
  365. }
  366. });
  367. });
  368. }
  369. }
  370. service.Init();
  371. })
  372. </script>