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.

382 lines
17 KiB

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