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.

399 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. <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>
  21. <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>
  22. <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>
  23. <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>
  24. <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_UPload()">导入</a>
  25. <a id="NF-ExportAll" authorize="no" class="btn btn-primary"><i class="fa fa-download"></i>导出</a>
  26. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  27. </div>
  28. <div class="btn-group" style="display:block;padding-left:2px;">
  29. <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a>
  30. </div>
  31. <script>$('.toolbar').authorizeButton()</script>
  32. </div>
  33. <div class="search">
  34. <table>
  35. <tr>
  36. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_MoCode">&nbsp;&nbsp;&nbsp;&nbsp;检验项目组代码</label>:</td>
  37. <td class="HideItems">
  38. <div class="input-group HideItems">
  39. <input id="txt_GroupCode" type="text" class="form-control HideItems" style="width: 200px;">
  40. </div>
  41. </td>
  42. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_MoCode">&nbsp;&nbsp;&nbsp;&nbsp;检验项目组名称</label>:</td>
  43. <td class="HideItems">
  44. <div class="input-group HideItems">
  45. <input id="txt_GroupName" type="text" class="form-control HideItems" style="width: 200px;">
  46. </div>
  47. </td>
  48. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_MoCode">&nbsp;&nbsp;&nbsp;&nbsp;是否启用</label>:</td>
  49. <td class="HideItems">
  50. <div class="input-group HideItems">
  51. <select id="txt_Enable" class="form-control select2" style="width: 135px; height: 20px;">
  52. <option value="" selected>全部</option>
  53. <option value="1">是</option>
  54. <option value="0">否</option>
  55. </select>
  56. </div>
  57. </td>
  58. <td>
  59. <span class="input-group-btn">
  60. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  61. </span>
  62. </td>
  63. </tr>
  64. </table>
  65. </div>
  66. </div>
  67. <div class="gridPanel">
  68. <table id="gridList"></table>
  69. <div id="gridPager"></div>
  70. </div>
  71. </div>
  72. </form>
  73. <script type="text/javascript">
  74. function btn_UPload() {
  75. $("#FileUp").click();
  76. }
  77. $(function () {
  78. var service = {
  79. isCanEditDate: false,
  80. Init: function () {
  81. var that = this;
  82. $("#txt_CheckFixtureNo").val('');
  83. that.initControl();
  84. that.loadGrid();
  85. that.loadEvent();
  86. //that.loadViewGrid();
  87. },
  88. initControl: function () {
  89. let that = this;
  90. let orgName = '';
  91. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  92. },
  93. loadGrid: function () {
  94. var that = this;
  95. var queryJson = {
  96. GroupCode: $("#txt_GroupCode").val(),
  97. GroupName: $("#txt_GroupName").val(),
  98. Enable: $("#txt_Enable").val(),
  99. }
  100. var $gridList = $("#gridList");
  101. $gridList.dataGrid({
  102. url: "/DHAY/IQCQuality/GetGridJsonGroup" + "?" + Math.random(),
  103. postData: { queryJson: JSON.stringify(queryJson) },
  104. mtype: "POST",
  105. height: $(window).height() - 200,
  106. width: $(window).width() - 300,
  107. cellEdit: true,
  108. cellsubmit: "clientArray",
  109. colModel: [
  110. { label: "主键", name: "ID", hidden: true, key: true },
  111. { label: '检验项目组代码', name: 'GroupCode', width: 100, align: 'left' },
  112. { label: '检验项目组名称', name: 'GroupName', width: 100, align: 'left' },
  113. //{ label: 'Aql描述', name: 'RulesDesc', width: 100, align: 'left' },
  114. //{ label: '类别', name: 'Type', width: 100, align: 'left' },
  115. { label: '最后操作时间', name: 'MTIME', width: 100, align: 'left' },
  116. { label: '维护人', name: 'MUSERName', width: 100, align: 'left' },
  117. { label: '是否启用', name: 'EnableText', width: 100, align: 'left' },
  118. ],
  119. shrinkToFit: true,//宽度自适应
  120. width: "100%",
  121. autowidth: true,
  122. gridComplete: function () {
  123. //if (!that.isCanEditDate) {
  124. // var obj_Item1 = $("#gridList");
  125. // var rowIds_Item1 = obj_Item1.getDataIDs();
  126. // for (var i = 0; i < rowIds_Item1.length; i++) {
  127. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanStartDate", '', 'not-editable-cell');
  128. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanEndDate", '', 'not-editable-cell');
  129. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "ApsOrderDate", '', 'not-editable-cell');
  130. // }
  131. //}
  132. },
  133. pager: "#gridPager",
  134. sortname: 'MTIME',
  135. sortorder: "desc",
  136. viewrecords: true,
  137. multiselect: true,
  138. subGrid: true, // (1)开启子表格支持
  139. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  140. // console.log(subgrid_id, rowid);
  141. //
  142. $("#gridList").jqGrid("setSelection", rowid, false);
  143. that.bindSubGrid3(subgrid_id, rowid);
  144. }
  145. });
  146. },
  147. query: function () {
  148. //console.log("点击查询");
  149. var queryJson = {
  150. GroupCode: $("#txt_GroupCode").val(),
  151. GroupName: $("#txt_GroupName").val(),
  152. Enable: $("#txt_Enable").val(),
  153. }
  154. // that.loadGrid(queryJson);
  155. $("#gridList").jqGrid('setGridParam', {
  156. postData: { queryJson: JSON.stringify(queryJson) },
  157. }).trigger('reloadGrid');
  158. },
  159. bindSubGrid3: function (subgrid_id, rowid) {
  160. //
  161. $("#gridList").jqGrid("setSelection", rowid, false);
  162. var subgrid_table_id;
  163. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  164. var subgrid_pager_id;
  165. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  166. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  167. var MOCode = $("#gridList").jqGrid('getRowData', rowid).ID;
  168. // var MoSeq = $("#gridList").jqGrid('getRowData', rowid).MoSeq;
  169. // (6)创建jqGrid对象
  170. $("#" + subgrid_table_id).dataGrid({
  171. cellEdit: true,
  172. mtype: "GET",
  173. url: "/DHAY/IQCQuality/GetGroupSubGridJsonList?id=" + MOCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  174. colModel: [
  175. { label: "主键", name: "ID", hidden: true, key: true },
  176. { label: '检验类型', name: 'EATTRIBUTE6', width: 100, align: 'left', hidden: true },
  177. { label: '检验类型', name: 'Type', width: 100, align: 'left' },
  178. { label: '检验项目代码', name: 'ListCode', width: 100, align: 'left' },
  179. { label: '检验项目名称', name: 'ListName', width: 100, align: 'left' },
  180. { label: '标准下限', name: 'SetValueMin', width: 150, align: 'left' },
  181. { label: '标准上限', name: 'SetValueMax', width: 150, align: 'left' },
  182. { label: '单位', name: 'Unit', width: 100, align: 'left' },
  183. { label: '检验仪器', name: 'EATTRIBUTE7', width: 150, align: 'left' },
  184. { label: '检验标准', name: 'EATTRIBUTE1', width: 150, align: 'left' },
  185. { label: '抽检实际值是否必填', name: 'EATTRIBUTE4', width: 150, align: 'left', hidden: true},
  186. { label: '抽检实际值是否必填', name: 'CEATTRIBUTE4', width: 150, align: 'left' },
  187. { label: 'AQL代码', name: 'EATTRIBUTE5', width: 150, align: 'left' },
  188. { label: '是否可用', name: 'CEnable', width: 150, align: 'left' },
  189. { label: '维护人', name: 'MUSERName', width: 100, align: 'left' },
  190. { label: '维护时间', name: 'MTIME', width: 100, align: 'left' },
  191. ],
  192. //colModel: ColModelSub,
  193. shrinkToFit: true,//宽度自适应
  194. multiselect: true,
  195. prmNames: { search: "search" },
  196. viewrecords: true,
  197. height: "100%",
  198. //rowNum: 20,
  199. //pager: subgrid_pager_id,
  200. });
  201. },
  202. loadEvent: function () {
  203. var that = this;
  204. $("#btn_search").click(function () {
  205. that.query();
  206. });
  207. $("#NF-Add").click(function () {
  208. // debugger;
  209. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  210. $.modalOpen({
  211. id: "Form",
  212. title: "新增检验项目",
  213. url: "/DHAY/IQCQuality/CheckGroupEdit?ids=",
  214. width: "1600px",
  215. height: "1000px",
  216. callBack: function (iframeId) {
  217. top.frames[iframeId].submitForm();
  218. }
  219. });
  220. });
  221. $("#NF-Print").click(function () {
  222. console.log("打印条码");
  223. // debugger;
  224. var objArr = '';
  225. var arr = [];
  226. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  227. for (var i = 0; i < objList.length; i++) {
  228. var rowId = objList[i];
  229. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  230. objArr += "'" + rowData.CheckFixtureNo + "',";
  231. }
  232. objArr = objArr.slice(0, objArr.length - 1);
  233. if (objArr == "") {
  234. $.modalAlertNew("WMS00003");
  235. return;
  236. }
  237. objArr = "" + objArr + "|";
  238. arr.push(objArr);
  239. $.modalOpen({
  240. id: "PrintLot",
  241. title: "打印",
  242. url: "/DHAY/Print/PrintView?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=JY0001&" + Math.random(),
  243. width: "550px",
  244. height: "1000px",
  245. callBack: function (iframeId) {
  246. top.frames[iframeId].submitForm();
  247. }
  248. });
  249. });
  250. $("#NF-Edit").click(function () {
  251. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  252. if (ids.length != 1) {
  253. $.modalMsg("请选择一条数据", "warning");
  254. return;
  255. }
  256. let obj = {
  257. ids: ids[0],
  258. };
  259. //debugger;
  260. //if (!obj.orderDate) {
  261. // obj.orderDate = new Date().toLocaleDateString();
  262. //}
  263. // consol.log();
  264. $.modalOpen({
  265. id: "Form",
  266. title: "编辑检验项目组",
  267. url: "/DHAY/IQCQuality/CheckGroupEdit?ids=" + ids[0]+"",
  268. width: "1200px",
  269. height: "800px",
  270. callBack: function (iframeId) {
  271. top.frames[iframeId].submitForm();
  272. }
  273. });
  274. });
  275. $("#txt_SSName").change(function (event,handle) {
  276. //console.log( $("#txt_SSName").val());
  277. // console.log(val);
  278. // console.log("值改变了");
  279. let val = $("#txt_SSName").val();
  280. if (!val) {
  281. $("#NF-PrintLabel").attr("disabled", "disabled");
  282. }
  283. else {
  284. $("#NF-PrintLabel").removeAttr("disabled");
  285. }
  286. });
  287. $("#NF-Remove").click(function () {
  288. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  289. if (ids.length < 1) {
  290. $.modalMsg("请选择数据", "warning");
  291. return;
  292. }
  293. let keyList = [];
  294. for (var i = 0; i < ids.length; i++) {
  295. keyList.push(ids[i]);
  296. }
  297. //let obj = {
  298. // ids: ids[0],
  299. //};
  300. $.ajax({
  301. url: "/DHAY/IQCQuality/DeleteCheckGroup",
  302. type: "POST",
  303. dataType: "json",
  304. async: false,
  305. data: {
  306. keyValue: JSON.stringify(keyList)
  307. },
  308. success: function (data) {
  309. //
  310. // console.log(data);
  311. if (data.state == "success") {
  312. $.modalMsg("操作成功", "success");
  313. that.query();
  314. }
  315. else
  316. $.modalMsg(data.message, "warning");
  317. }
  318. });
  319. });
  320. $("#NF-ExportAll").click(function () {
  321. let queryJson = {
  322. GroupCode: $("#txt_GroupCode").val(),
  323. GroupName: $("#txt_GroupName").val(),
  324. Enable: $("#txt_Enable").val(),
  325. };
  326. var postData = "&id=" + queryJson.GroupCode + "";
  327. postData += "&CheckFixtureName=" + queryJson.GroupName;
  328. postData += "&Status=" + queryJson.Enable;
  329. $.download("/DHAY/IQCQuality/ExportAllAqlList" + "?" + Math.random(), postData, 'post');
  330. });
  331. $("#FileUp").on("change", function (up) {
  332. // let that = this;
  333. var form = new FormData(document.getElementById("form1"));
  334. $.ajax({
  335. url: "/DHAY/IQCQuality/UploadFileInspectionRules?" + Math.random(),
  336. type: "post",
  337. data: form,
  338. contentType: false,
  339. processData: false,
  340. success: function (data) {
  341. if (data == "true" || data == true) {
  342. $.modalMsg("导入成功", "success");
  343. that.query();
  344. }
  345. else {
  346. $.modalMsg(data, "warning");
  347. }
  348. },
  349. error: function (aa) {
  350. $.modalMsg("导入失败:" + aa, "warning");
  351. }
  352. });
  353. document.getElementById("FileUp").value = "";
  354. });
  355. }
  356. }
  357. service.Init();
  358. })
  359. </script>