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.

457 lines
20 KiB

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. $(document).ready(function () {
  8. $("input.cell").keyup(function (e) {
  9. switch (e.keyCode) {
  10. // up arrow
  11. case 40:
  12. $(this).parent()
  13. .parent()
  14. .next()
  15. .children("td")
  16. .children("input.cell[name="
  17. + $(this).attr("name") + "]")
  18. .focus();
  19. break;
  20. // down arrow
  21. case 38:
  22. $(this).parent()
  23. .parent()
  24. .prev()
  25. .children("td")
  26. .children("input.cell[name="
  27. + $(this).attr("name") + "]")
  28. .focus();
  29. break;
  30. }
  31. });
  32. });</script>
  33. <script>
  34. $(function () {
  35. var _Clos = new Array();
  36. var _Closs = new Array();
  37. SetCols();
  38. SetColsDetails();
  39. gridList();
  40. })
  41. function SetCols() {
  42. $.ajax({
  43. url: "/Print/SelectColumnName?" + Math.random(),
  44. dataType: "json",
  45. async: false,
  46. success: function (data) {
  47. var cols = new Array();
  48. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  49. cols.push(collast);
  50. //var collast = { label: "销售订单号", name: "SDNCode", width: 150, align: 'left' };
  51. // cols.push(collast);
  52. var collast = { label: "检验项目组代码", name: "GroupCode", width: 120, align: 'left' };
  53. cols.push(collast);
  54. var collast = { label: '检验项目组名称', name: 'GroupName', width: 150, align: 'left' };
  55. cols.push(collast);
  56. var collast = {
  57. label: "是否启用", name: "Enable", width: 100, align: "left",
  58. formatter: function (cellvalue) {
  59. if (cellvalue == "1") {
  60. return "是";
  61. } else if (cellvalue == "0") {
  62. return "否";
  63. }
  64. else { return ""; }
  65. }
  66. };
  67. cols.push(collast);
  68. var collast = { label: '操作人', name: 'MUSER', width: 100, align: 'left' };
  69. cols.push(collast);
  70. var collast = { label: '操作人名称', name: 'MUSERName', width: 200, align: 'left' };
  71. cols.push(collast);
  72. var collast = { label: '操作时间', name: 'MTIME', width: 200, align: 'left' };
  73. cols.push(collast);
  74. //if (data != null && data.length > 0) {
  75. // DateList = data;
  76. // for (var i = 0; i < data.length; i++) {
  77. // var ColName = data[i].ColName;
  78. // var ColCode = data[i].ColCode;
  79. // var obj = new Array();
  80. // obj = {
  81. // label: ColName,
  82. // name: ColCode,
  83. // width: 80,
  84. // align: "left"
  85. // }
  86. // cols.push(obj);
  87. // }
  88. //}
  89. $.ajax({
  90. url: "/Print/SelectTableColumnName?" + Math.random(),
  91. dataType: "json",
  92. async: false,
  93. success: function (data) {
  94. if (data != null && data.length > 0) {
  95. DateList = data;
  96. for (var i = 0; i < data.length; i++) {
  97. var TableCode = data[i].TableCode;
  98. if (TableCode == "ICSInspectionGroup") {
  99. var Code = data[i].Code;
  100. var Name = data[i].Name;
  101. var obj = new Array();
  102. obj = {
  103. label: Name,
  104. name: Code,
  105. width: 80,
  106. align: "left"
  107. }
  108. cols.push(obj);
  109. }
  110. //if (TableCode == "ICSInventory") {
  111. // var Code = data[i].Code;
  112. // var Name = data[i].Name;
  113. // var obj = new Array();
  114. // obj = {
  115. // label: Name,
  116. // name: Code,
  117. // width: 80,
  118. // align: "left"
  119. // }
  120. // cols.push(obj);
  121. // //cols1.push(obj);
  122. //}
  123. }
  124. }
  125. _Clos = cols;
  126. //_Clos1 = cols1;
  127. }
  128. });
  129. _Clos = cols;
  130. }
  131. });
  132. }
  133. function SetColsDetails() {
  134. $.ajax({
  135. url: "/Print/SelectColumnName?" + Math.random(),
  136. dataType: "json",
  137. async: false,
  138. success: function (data) {
  139. var cols = new Array();
  140. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  141. cols.push(collast);
  142. //var collast = { label: "销售订单号", name: "SDNCode", width: 150, align: 'left' };
  143. // cols.push(collast);
  144. var collast = { label: "检验项目组唯一标识", name: "GroupID", width: 150, align: 'left' };
  145. cols.push(collast);
  146. var collast = { label: "检验项目代码", name: "ListCode", width: 150, align: 'left' };
  147. cols.push(collast);
  148. var collast = { label: '检验项目名称', name: 'ListName', width: 100, align: 'left' };
  149. cols.push(collast);
  150. var collast = { label: '单位', name: 'Unit', width: 100, align: 'left' };
  151. cols.push(collast);
  152. var collast = { label: '标准上限', name: 'SetValueMax', width: 100, align: 'left' };
  153. cols.push(collast);
  154. var collast = { label: '标准下限', name: 'SetValueMin', width: 100, align: 'left' };
  155. cols.push(collast);
  156. var collast = {
  157. label: "是否启用", name: "Enable", width: 100, align: "left",
  158. formatter: function (cellvalue) {
  159. if (cellvalue == "1") {
  160. return "是";
  161. } else if (cellvalue == "0") {
  162. return "否";
  163. }
  164. else { return ""; }
  165. }
  166. };
  167. cols.push(collast);
  168. var collast = { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' };
  169. cols.push(collast);
  170. var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  171. cols.push(collast);
  172. //if (data != null && data.length > 0) {
  173. // DateList = data;
  174. // for (var i = 0; i < data.length; i++) {
  175. // var ColName = data[i].ColName;
  176. // var ColCode = data[i].ColCode;
  177. // var obj = new Array();
  178. // obj = {
  179. // label: ColName,
  180. // name: ColCode,
  181. // width: 80,
  182. // align: "left"
  183. // }
  184. // cols.push(obj);
  185. // }
  186. //}
  187. $.ajax({
  188. url: "/Print/SelectTableColumnName?" + Math.random(),
  189. dataType: "json",
  190. async: false,
  191. success: function (data) {
  192. if (data != null && data.length > 0) {
  193. DateList = data;
  194. for (var i = 0; i < data.length; i++) {
  195. var TableCode = data[i].TableCode;
  196. if (TableCode == "ICSInspectionGroup") {
  197. var Code = data[i].Code;
  198. var Name = data[i].Name;
  199. var obj = new Array();
  200. obj = {
  201. label: Name,
  202. name: Code,
  203. width: 80,
  204. align: "left"
  205. }
  206. cols.push(obj);
  207. }
  208. //if (TableCode == "ICSInventory") {
  209. // var Code = data[i].Code;
  210. // var Name = data[i].Name;
  211. // var obj = new Array();
  212. // obj = {
  213. // label: Name,
  214. // name: Code,
  215. // width: 80,
  216. // align: "left"
  217. // }
  218. // cols.push(obj);
  219. // //cols1.push(obj);
  220. //}
  221. }
  222. }
  223. _Closs = cols;
  224. //_Clos1 = cols1;
  225. }
  226. });
  227. _Closs = cols;
  228. }
  229. });
  230. }
  231. function gridList() {
  232. var $gridList = $("#gridList");
  233. var queryJson = {
  234. ListCode: $("#txt_ListCode").val(),
  235. ListName: $("#txt_ListName").val(),
  236. }
  237. $gridList.dataGrid({
  238. url: "/WMS/BasicSettings/GetICSInspectionGroup" + "?" + Math.random(),
  239. postData: { queryJson: JSON.stringify(queryJson) },
  240. height: $(window).height() - 200,
  241. width: $(window).width() - 300,
  242. colModel:_Clos,
  243. //[
  244. // { label: "主键", name: "ID", hidden: true, key: true },
  245. // { label: 'ID', name: 'ID', hidden: true },
  246. // { label: '检验项目组代码', name: 'GroupCode', width: 120, align: 'left' },
  247. // { label: '检验项目组名称', name: 'GroupName', width: 150, align: 'left' },
  248. // {
  249. // label: "是否启用", name: "Enable", width: 100, align: "left",
  250. // formatter: function (cellvalue) {
  251. // if (cellvalue == "1") {
  252. // return "是";
  253. // } else if (cellvalue == "0") {
  254. // return "否";
  255. // }
  256. // else { return ""; }
  257. // }
  258. // },
  259. //{ label: '操作人', name: 'MUSER', width: 100, align: 'left' },
  260. //{ label: '操作人名称', name: 'MUSERName', width: 200, align: 'left' },
  261. //{ label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
  262. // { label: "Free1", name: "Free1", hidden: true },
  263. //],
  264. shrinkToFit: false,//宽度自适应
  265. autoWidth:true,
  266. gridComplete: function () {
  267. },
  268. pager: "#gridPager",
  269. sortorder: "desc",
  270. sortname: 'GroupCode ',
  271. viewrecords: true,
  272. multiselect: true,
  273. //beforeSelectRow: function (rowid, e) {
  274. // $("#gridList").jqGrid('resetSelection');
  275. // return (true);
  276. //},
  277. subGrid: true, // (1)开启子表格支持
  278. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  279. debugger;
  280. $("#gridList").jqGrid("setSelection", rowid, false);
  281. bindSubGrid(subgrid_id, rowid)
  282. }
  283. });
  284. $("#btn_search").click(function () {
  285. var warehouse = $("#warehouse a.active").attr('data-value');
  286. var queryJson = {
  287. ListCode: $("#txt_ListCode").val(),
  288. ListName: $("#txt_ListName").val(),
  289. }
  290. $gridList.jqGrid('setGridParam', {
  291. postData: { queryJson: JSON.stringify(queryJson) },
  292. }).trigger('reloadGrid');
  293. });
  294. }
  295. function bindSubGrid(subgrid_id, rowid) {
  296. debugger;
  297. $("#gridList").jqGrid("setSelection", rowid, false);
  298. var subgrid_table_id;
  299. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  300. var subgrid_pager_id;
  301. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  302. // (5)动态添加子报表的table和pager
  303. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  304. var GroupCode = $("#gridList").jqGrid('getRowData', rowid).GroupCode;
  305. // (6)创建jqGrid对象
  306. $("#" + subgrid_table_id).dataGrid({
  307. cellEdit: true,
  308. url: "/WMS/BasicSettings/ICSInspectionList?GroupCode=" + GroupCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  309. colModel:_Closs,
  310. //[
  311. // { label: "主键", name: "ID", hidden: true, key: true },
  312. // { label: "检验项目组唯一标识", name: "GroupID", width: 150, align: 'left' },
  313. // { label: "检验项目代码", name: "ListCode", width: 150, align: 'left' },
  314. // { label: '检验项目名称', name: 'ListName', width: 100, align: 'left' },
  315. // { label: '单位', name: 'Unit', width: 100, align: 'left' },
  316. // { label: '标准上限', name: 'SetValueMax', width: 100, align: 'left' },
  317. // { label: '标准下限', name: 'SetValueMin', width: 100, align: 'left' },
  318. // {
  319. // label: "是否启用", name: "Enable", width: 100, align: "left",
  320. // formatter: function (cellvalue) {
  321. // if (cellvalue == "1") {
  322. // return "是";
  323. // } else if (cellvalue == "0") {
  324. // return "否";
  325. // }
  326. // else { return ""; }
  327. // }
  328. // },
  329. // { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  330. // { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  331. //],
  332. sortname: 'MTIME',
  333. shrinkToFit: true,//宽度自适应
  334. //multiselect: true,
  335. prmNames: { search: "search" },
  336. viewrecords: true,
  337. height: "100%",
  338. rowNum: 20,
  339. pager: subgrid_pager_id,
  340. });
  341. }
  342. function btn_Delete() {
  343. var objArr = '';
  344. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  345. for (var i = 0; i < objList.length; i++) {
  346. var rowId = objList[i];
  347. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  348. objArr += "'" + rowData.GroupCode + "',";
  349. }
  350. if (objArr == '') {
  351. $.modalAlertNew("WMS00001");
  352. return;
  353. }
  354. $.deleteForm({
  355. url: "/WMS/BasicSettings/DeleteICSInspectionGroup" + "?" + Math.random(),
  356. param: { keyValue: JSON.stringify(objArr) },
  357. success: function () {
  358. $.currentWindow().$("#gridList").trigger("reloadGrid");
  359. }
  360. })
  361. }
  362. //修改类型
  363. function btn_update() {
  364. debugger;
  365. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  366. if (ids.length != 1) {
  367. $.modalAlertNew("WMS00006");
  368. return;
  369. }
  370. for (var i in ids) {
  371. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  372. //ID
  373. var ID = rowData.ID;
  374. var GroupCode = rowData.GroupCode;
  375. var GroupName = rowData.GroupName;
  376. $.modalOpen({
  377. id: "Details",
  378. title: "修改",
  379. url: "/WMS/BasicSettings/ICSInspectionListAdd?ID=" + ID + "&GroupCode=" + GroupCode + "&GroupName=" + encodeURI(encodeURI(GroupName)) + "&" + Math.random(),
  380. width: "900px",
  381. height: "800px",
  382. callBack: function (iframeId) {
  383. top.frames[iframeId].submitForm();
  384. }
  385. });
  386. }
  387. }
  388. function btnCreate() {
  389. $.modalOpen({
  390. id: "BRGCodeAdd",
  391. title: "新增",
  392. url: "/WMS/BasicSettings/ICSInspectionListAdd" + "?" + Math.random(),
  393. width: "900px",
  394. height: "800px",
  395. callBack: function (iframeId) {
  396. top.frames[iframeId].submitForm();
  397. }
  398. });
  399. }
  400. </script>
  401. <div class="topPanel" style="height:45px">
  402. <div class="toolbar">
  403. <div class="btn-group">
  404. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  405. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  406. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  407. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  408. </div>
  409. </div>
  410. <div class="search">
  411. <table>
  412. <tr>
  413. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">检查项目组代码</label>:</td>
  414. <td>
  415. <div class="input-group">
  416. <input id="txt_ListCode" type="text" class="form-control" style="width: 100px;">
  417. </div>
  418. </td>
  419. <td style="width:20px"></td>
  420. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">检查项目组名称</label>:</td>
  421. <td>
  422. <div class="input-group">
  423. <input id="txt_ListName" type="text" class="form-control" style="width: 100px;">
  424. </div>
  425. </td>
  426. <td>
  427. <span class="input-group-btn">
  428. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  429. </span>
  430. </td>
  431. </tr>
  432. </table>
  433. </div>
  434. </div>
  435. <div class="gridPanel">
  436. <table id="gridList"></table>
  437. <div id="gridPager"></div>
  438. </div>