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.

339 lines
15 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "不良状态组查询";
  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-ExportAll" authorize="no" class="btn btn-primary"><i class="fa fa-download"></i>导出</a>
  23. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  24. </div>
  25. <div class="btn-group" style="display:block;padding-left:2px;">
  26. <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a>
  27. </div>
  28. @*<script>$('.toolbar').authorizeButton()</script>*@
  29. </div>
  30. <div class="search">
  31. <table>
  32. <tr>
  33. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_BCGCode">&nbsp;&nbsp;&nbsp;&nbsp;不良状态组编码</label>:</td>
  34. <td class="HideItems">
  35. <div class="input-group HideItems">
  36. <input id="txt_BCGCode" type="text" class="form-control HideItems" style="width: 200px;">
  37. </div>
  38. </td>
  39. <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_BCGDesc">&nbsp;&nbsp;&nbsp;&nbsp;不良状态组描述</label>:</td>
  40. <td class="HideItems">
  41. <div class="input-group HideItems">
  42. <input id="txt_BCGDesc" type="text" class="form-control HideItems" style="width: 200px;">
  43. </div>
  44. </td>
  45. <td>
  46. <span class="input-group-btn">
  47. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  48. </span>
  49. </td>
  50. </tr>
  51. </table>
  52. </div>
  53. </div>
  54. <div class="gridPanel">
  55. <table id="gridList"></table>
  56. <div id="gridPager"></div>
  57. </div>
  58. </div>
  59. </form>
  60. <script type="text/javascript">
  61. $(function () {
  62. var service = {
  63. isCanEditDate: false,
  64. Init: function () {
  65. var that = this;
  66. //$("#txt_CheckFixtureNo").val('');
  67. that.initControl();
  68. that.loadGrid();
  69. that.loadEvent();
  70. //that.loadViewGrid();
  71. },
  72. initControl: function () {
  73. let that = this;
  74. let orgName = '';
  75. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  76. },
  77. loadGrid: function () {
  78. var that = this;
  79. var queryJson = {
  80. BCGCode: $("#txt_BCGCode").val(),
  81. BCGDesc: $("#txt_BCGDesc").val(),
  82. //Enable: $("#txt_Enable").val(),
  83. }
  84. var $gridList = $("#gridList");
  85. $gridList.dataGrid({
  86. url: "/BBWMS/IQCQuality/GetBadCodeGroupPageList" + "?" + Math.random(),
  87. postData: { queryJson: JSON.stringify(queryJson) },
  88. mtype: "POST",
  89. height: $(window).height() - 200,
  90. width: $(window).width() - 300,
  91. cellEdit: true,
  92. cellsubmit: "clientArray",
  93. colModel: [
  94. { label: "主键", name: "ID", hidden: true, key: true },
  95. { label: '不良状态组编码', name: 'BCGCode', width: 100, align: 'left' },
  96. { label: '不良状态组描述', name: 'BCGDesc', width: 100, align: 'left' },
  97. { label: '维护人', name: 'MUSERName', width: 100, align: 'left' },
  98. { label: '维护时间', name: 'MTIME', width: 100, align: 'left' },
  99. { label: '自定义字段1', name: 'EATTRIBUTE1', width: 100, align: 'left' },
  100. { label: '自定义字段2', name: 'EATTRIBUTE2', width: 100, align: 'left' },
  101. { label: '自定义字段3', name: 'EATTRIBUTE3', width: 100, align: 'left' },
  102. { label: '自定义字段4', name: 'EATTRIBUTE4', width: 100, align: 'left' },
  103. ],
  104. shrinkToFit: true,//宽度自适应
  105. width: "100%",
  106. autowidth: true,
  107. gridComplete: function () {
  108. //if (!that.isCanEditDate) {
  109. // var obj_Item1 = $("#gridList");
  110. // var rowIds_Item1 = obj_Item1.getDataIDs();
  111. // for (var i = 0; i < rowIds_Item1.length; i++) {
  112. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanStartDate", '', 'not-editable-cell');
  113. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanEndDate", '', 'not-editable-cell');
  114. // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "ApsOrderDate", '', 'not-editable-cell');
  115. // }
  116. //}
  117. },
  118. pager: "#gridPager",
  119. sortname: 'MTIME',
  120. sortorder: "desc",
  121. viewrecords: true,
  122. multiselect: true,
  123. subGrid: true, // (1)开启子表格支持
  124. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  125. // console.log(subgrid_id, rowid);
  126. //
  127. $("#gridList").jqGrid("setSelection", rowid, false);
  128. that.bindSubGrid3(subgrid_id, rowid);
  129. }
  130. });
  131. },
  132. query: function () {
  133. //console.log("点击查询");
  134. var queryJson = {
  135. BCGCode: $("#txt_BCGCode").val(),
  136. BCGDesc: $("#txt_BCGDesc").val(),
  137. }
  138. // that.loadGrid(queryJson);
  139. $("#gridList").jqGrid('setGridParam', {
  140. postData: { queryJson: JSON.stringify(queryJson) },
  141. }).trigger('reloadGrid');
  142. },
  143. bindSubGrid3: function (subgrid_id, rowid) {
  144. //
  145. $("#gridList").jqGrid("setSelection", rowid, false);
  146. var subgrid_table_id;
  147. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  148. var subgrid_pager_id;
  149. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  150. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  151. var MOCode = $("#gridList").jqGrid('getRowData', rowid).ID;
  152. // var MoSeq = $("#gridList").jqGrid('getRowData', rowid).MoSeq;
  153. // (6)创建jqGrid对象
  154. $("#" + subgrid_table_id).dataGrid({
  155. cellEdit: true,
  156. mtype: "GET",
  157. url: "/BBWMS/IQCQuality/GetBadCodeGroupDetailList?id=" + MOCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  158. colModel: [
  159. { label: "主键", name: "ID", hidden: true, key: true },
  160. { label: '不良状态编码', name: 'BadCode', width: 150, align: 'left' },
  161. { label: '不良状态描述', name: 'BadDesc', width: 150, align: 'left' },
  162. { label: '维护人', name: 'MUSERName', width: 100, align: 'left' },
  163. { label: '维护时间', name: 'MTIME', width: 100, align: 'left' },
  164. ],
  165. //colModel: ColModelSub,
  166. shrinkToFit: true,//宽度自适应
  167. multiselect: true,
  168. prmNames: { search: "search" },
  169. viewrecords: true,
  170. height: "100%",
  171. //rowNum: 20,
  172. //pager: subgrid_pager_id,
  173. });
  174. },
  175. loadEvent: function () {
  176. var that = this;
  177. $("#btn_search").click(function () {
  178. that.query();
  179. });
  180. $("#NF-Add").click(function () {
  181. // debugger;
  182. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  183. $.modalOpen({
  184. id: "Form",
  185. title: "新增不良状态",
  186. url: "/BBWMS/IQCQuality/BadCodeGroupEdit?ids=",
  187. width: "1200px",
  188. height: "800px",
  189. callBack: function (iframeId) {
  190. top.frames[iframeId].submitForm();
  191. }
  192. });
  193. });
  194. $("#NF-Edit").click(function () {
  195. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  196. if (ids.length != 1) {
  197. $.modalMsg("请选择一条数据", "warning");
  198. return;
  199. }
  200. let obj = {
  201. ids: ids[0],
  202. };
  203. //debugger;
  204. //if (!obj.orderDate) {
  205. // obj.orderDate = new Date().toLocaleDateString();
  206. //}
  207. // consol.log();
  208. $.modalOpen({
  209. id: "Form",
  210. title: "编辑Aql",
  211. url: "/BBWMS/IQCQuality/BadCodeGroupEdit?ids=" + ids[0]+"",
  212. width: "1200px",
  213. height: "800px",
  214. callBack: function (iframeId) {
  215. top.frames[iframeId].submitForm();
  216. }
  217. });
  218. });
  219. $("#txt_SSName").change(function (event,handle) {
  220. //console.log( $("#txt_SSName").val());
  221. // console.log(val);
  222. // console.log("值改变了");
  223. let val = $("#txt_SSName").val();
  224. if (!val) {
  225. $("#NF-PrintLabel").attr("disabled", "disabled");
  226. }
  227. else {
  228. $("#NF-PrintLabel").removeAttr("disabled");
  229. }
  230. });
  231. $("#NF-Remove").click(function () {
  232. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  233. if (ids.length < 1) {
  234. $.modalMsg("请选择数据", "warning");
  235. return;
  236. }
  237. let keyList = [];
  238. for (var i = 0; i < ids.length; i++) {
  239. keyList.push(ids[i]);
  240. }
  241. //let obj = {
  242. // ids: ids[0],
  243. //};
  244. $.ajax({
  245. url: "/BBWMS/IQCQuality/DeleteBadCodeGroup",
  246. type: "POST",
  247. dataType: "json",
  248. async: false,
  249. data: {
  250. keyValue: JSON.stringify(keyList)
  251. },
  252. success: function (data) {
  253. //
  254. // console.log(data);
  255. if (data.state == "success") {
  256. $.modalMsg("操作成功", "success");
  257. that.query();
  258. }
  259. else
  260. $.modalMsg(data.message, "warning");
  261. }
  262. });
  263. });
  264. $("#NF-ExportAll").click(function () {
  265. let queryJson = {
  266. BCGCode: $("#txt_BCGCode").val(),
  267. BCGDesc: $("#txt_BCGDesc").val(),
  268. };
  269. var postData = "&BCGCode=" + queryJson.BCGCode + "";
  270. postData += "&BCGDesc=" + queryJson.BCGDesc;
  271. $.download("/BBWMS/IQCQuality/ExportAllBadCodeGroup" + "?" + Math.random(), postData, 'post');
  272. });
  273. $("#FileUp").on("change", function (up) {
  274. // let that = this;
  275. var form = new FormData(document.getElementById("form1"));
  276. $.ajax({
  277. url: "/BBWMS/CheckingFixture/UploadFile?" + Math.random(),
  278. type: "post",
  279. data: form,
  280. contentType: false,
  281. processData: false,
  282. success: function (data) {
  283. if (data == "true" || data == true) {
  284. alert("导入成功");
  285. that.query();
  286. }
  287. else {
  288. alert(data);
  289. }
  290. },
  291. error: function (aa) {
  292. alert("导入失败:" + aa);
  293. }
  294. });
  295. });
  296. }
  297. }
  298. service.Init();
  299. })
  300. </script>