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.

365 lines
15 KiB

3 weeks ago
  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <style>
  7. .btn-primary {
  8. margin-right: 2px;
  9. }
  10. .topPanel .toolbar {
  11. float: left;
  12. }
  13. </style>
  14. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  15. <script>
  16. $(document).ready(function () {
  17. $("input.cell").keyup(function (e) {
  18. switch (e.keyCode) {
  19. // up arrow
  20. case 40:
  21. $(this).parent()
  22. .parent()
  23. .next()
  24. .children("td")
  25. .children("input.cell[name="
  26. + $(this).attr("name") + "]")
  27. .focus();
  28. break;
  29. // down arrow
  30. case 38:
  31. $(this).parent()
  32. .parent()
  33. .prev()
  34. .children("td")
  35. .children("input.cell[name="
  36. + $(this).attr("name") + "]")
  37. .focus();
  38. break;
  39. }
  40. });
  41. });</script>
  42. <script>
  43. var _Clos = new Array();
  44. var _Closs = new Array();
  45. var InvCode = $("#txt_InvCode").val();
  46. $(function () {
  47. SetCols();
  48. gridList();
  49. })
  50. //动态加载列
  51. function SetCols() {
  52. $.ajax({
  53. url: "/Print/SelectColumnName?" + Math.random(),
  54. dataType: "json",
  55. async: false,
  56. success: function (data) {
  57. var cols = new Array();
  58. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  59. cols.push(collast);
  60. var collast = { label: "杂收单号", name: "InCode", width: 150, align: 'left' };
  61. cols.push(collast);
  62. var collast = { label: "杂收单行号", name: "Sequence", width: 150, align: 'left' };
  63. cols.push(collast);
  64. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  65. cols.push(collast);
  66. var collast = { label: '受益项目', name: 'EATTRIBUTE7', width: 150, align: 'left' };
  67. cols.push(collast);
  68. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left' };
  69. cols.push(collast);
  70. var collast = { label: '已领入数量', name: 'InQuantity', width: 100, align: 'left' };
  71. cols.push(collast);
  72. var collast = { label: '备注1', name: 'EATTRIBUTE6', width: 100, align: 'left'};
  73. cols.push(collast);
  74. var collast = { label: '备注2', name: 'EATTRIBUTE9', width: 100, align: 'left' };
  75. cols.push(collast);
  76. var collast = { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' };
  77. cols.push(collast);
  78. var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  79. cols.push(collast);
  80. var collast = { label: '自由项唯一标识', name: 'ExtensionID', hidden: true };
  81. cols.push(collast);
  82. if (data != null && data.length > 0) {
  83. DateList = data;
  84. for (var i = 0; i < data.length; i++) {
  85. var ColName = data[i].ColName;
  86. var ColCode = data[i].ColCode;
  87. var obj = new Array();
  88. obj = {
  89. label: ColName,
  90. name: ColCode,
  91. width: 80,
  92. align: "left"
  93. }
  94. cols.push(obj);
  95. }
  96. }
  97. $.ajax({
  98. url: "/Print/SelectTableColumnName?" + Math.random(),
  99. dataType: "json",
  100. async: false,
  101. success: function (data) {
  102. if (data != null && data.length > 0) {
  103. DateList = data;
  104. for (var i = 0; i < data.length; i++) {
  105. var TableCode = data[i].TableCode;
  106. if (TableCode == "ICSMOApplyNegDetail") {
  107. var Code = data[i].Code;
  108. var Name = data[i].Name;
  109. var obj = new Array();
  110. obj = {
  111. label: Name,
  112. name: Code,
  113. width: 80,
  114. align: "left"
  115. }
  116. cols.push(obj);
  117. }
  118. }
  119. }
  120. _Closs = cols;
  121. //_Clos1 = cols1;
  122. }
  123. });
  124. _Clos = cols;
  125. }
  126. });
  127. }
  128. //绑定动态列
  129. function gridList() {
  130. var $gridList = $("#gridList");
  131. var queryJson = {
  132. POCode: $("#txt_POCode").val(),
  133. InvCode: $("#txt_InvCode").val(),
  134. TimeFrom: $("#TimeFrom").val(),
  135. TimeArrive: $("#TimeArrive").val(),
  136. CreatedBy: $("#txt_CreatedBy").val(),
  137. }
  138. $gridList.dataGrid({
  139. url: "/DHAY/ICSCustomerSuppliedIn/GetICSOtherIn" + "?" + Math.random(),
  140. postData: { queryJson: JSON.stringify(queryJson) },
  141. height: $(window).height() - 200,
  142. width: $(window).width() - 300,
  143. colModel: [
  144. { label: "主键", name: "ID", hidden: true, key: true },
  145. { label: '杂收单号', name: 'InCode', width: 120, align: 'left' },
  146. { label: "单据类型", name: "EATTRIBUTE2", width: 80, align: "left", hidden: true },
  147. { label: "单据类型", name: "EATTRIBUTE11", width: 100, align: "left", },
  148. { label: '受益部门', name: 'EATTRIBUTE1', width: 120, align: 'left', hidden: true },
  149. { label: '受益部门', name: 'EATTRIBUTE12', width: 120, align: 'left' },
  150. { label: '在建工程项目', name: 'EATTRIBUTE3', width: 150, align: 'left' },
  151. { label: "客户", name: "EATTRIBUTE4", width: 80, align: "left", hidden: true },
  152. { label: "客户", name: "EATTRIBUTE13", width: 100, align: "left" },
  153. {
  154. label: "状态", name: "Status", width: 80, align: "left",
  155. formatter: function (cellvalue) {
  156. if (cellvalue == "1") {
  157. return "开立";
  158. } else if (cellvalue == "2") {
  159. return "审核";
  160. } else if (cellvalue == "3") {
  161. return "关闭";
  162. }
  163. else { return ""; }
  164. }
  165. },
  166. { label: '备注1', name: 'EATTRIBUTE5', width: 200, align: 'left' },
  167. { label: '备注2', name: 'EATTRIBUTE8', width: 200, align: 'left' },
  168. { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
  169. { label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
  170. ],
  171. shrinkToFit: false,//宽度自适应
  172. autoWidth: true,
  173. gridComplete: function () {
  174. },
  175. pager: "#gridPager",
  176. sortorder: "desc",
  177. sortname: 'InCode',
  178. viewrecords: true,
  179. multiselect: true,
  180. subGrid: true, // (1)开启子表格支持
  181. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  182. debugger;
  183. $("#gridList").jqGrid("setSelection", rowid, false);
  184. bindSubGrid(subgrid_id, rowid)
  185. }
  186. });
  187. }
  188. //子表
  189. function bindSubGrid(subgrid_id, rowid) {
  190. var queryJson = {
  191. POCode: $("#txt_POCode").val(),
  192. InvCode: $("#txt_InvCode").val(),
  193. TimeFrom: $("#TimeFrom").val(),
  194. TimeArrive: $("#TimeArrive").val(),
  195. CreatedBy: $("#txt_CreatedBy").val(),
  196. }
  197. debugger;
  198. $("#gridList").jqGrid("setSelection", rowid, false);
  199. var subgrid_table_id;
  200. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  201. var subgrid_pager_id;
  202. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  203. // (5)动态添加子报表的table和pager
  204. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  205. var InCode = $("#gridList").jqGrid('getRowData', rowid).InCode;
  206. // (6)创建jqGrid对象
  207. $("#" + subgrid_table_id).dataGrid({
  208. cellEdit: true,
  209. url: "/DHAY/ICSCustomerSuppliedIn/GetICSOtherInDetail?InCode=" + InCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  210. colModel: _Clos,
  211. postData: { queryJson: JSON.stringify(queryJson) },
  212. sortname: 'MTIME',
  213. shrinkToFit: true,//宽度自适应
  214. //multiselect: true,
  215. prmNames: { search: "search" },
  216. viewrecords: true,
  217. height: "100%",
  218. rowNum: 20,
  219. pager: subgrid_pager_id,
  220. });
  221. }
  222. function Selchange() {
  223. document.getElementById("gridPanel").innerHTML = '<table id="gridList"></table> <div id="gridPager"></div> ';//重置grid
  224. gridList();
  225. }
  226. //删除
  227. function btn_Delete() {
  228. var objArr = '';
  229. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  230. for (var i = 0; i < objList.length; i++) {
  231. var rowId = objList[i];
  232. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  233. objArr += "'" + rowData.InCode + "',";
  234. }
  235. if (objArr == '') {
  236. $.modalAlertNew("WMS00001");
  237. return;
  238. }
  239. $.deleteForm({
  240. url: "/DHAY/ICSCustomerSuppliedIn/DeleteICSOtherInByCode" + "?" + Math.random(),
  241. param: { keyValue: JSON.stringify(objArr) },
  242. success: function () {
  243. $.currentWindow().$("#gridList").trigger("reloadGrid");
  244. }
  245. })
  246. }
  247. //修改类型
  248. function btn_update() {
  249. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  250. if (ids.length != 1) {
  251. $.modalAlertNew("WMS00006");
  252. return;
  253. }
  254. for (var i in ids) {
  255. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  256. //ID
  257. var ID = rowData.ID;
  258. var InCode = rowData.InCode;
  259. $.modalOpen({
  260. id: "Details",
  261. title: "修改",
  262. url: "/DHAY/ICSCustomerSuppliedIn/Update?ID=" + ID + "&InCode=" + InCode + "&" + Math.random(),
  263. width: "1000px",
  264. height: "1200px",
  265. callBack: function (iframeId) {
  266. top.frames[iframeId].submitForm();
  267. }
  268. });
  269. }
  270. }
  271. //创建
  272. function btnCreate() {
  273. $.modalOpen({
  274. id: "BRGCodeAdd",
  275. title: "新增",
  276. url: "/DHAY/ICSCustomerSuppliedIn/Create" + "?" + Math.random(),
  277. width: "1000px",
  278. height: "1200px",
  279. callBack: function (iframeId) {
  280. top.frames[iframeId].submitForm();
  281. }
  282. });
  283. }
  284. </script>
  285. <div class="topPanel" style="height:60px">
  286. <div class="search">
  287. <table>
  288. <tr>
  289. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  290. <td>
  291. <div class="input-group">
  292. <input id="txt_POCode" type="text" class="form-control" style="width: 100px;">
  293. </div>
  294. </td>
  295. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  296. <td>
  297. <div class="input-group">
  298. <input id="txt_InvCode" type="text" class="form-control" style="width: 100px;">
  299. </div>
  300. </td>
  301. <td style="text-align:right;" class="Mechanism"><label class="lglabel" for="txt_CreatedBy">&nbsp;&nbsp;&nbsp;创建人</label>:</td>
  302. <td class="Mechanism">
  303. <div class="input-group">
  304. <input id="txt_CreatedBy" type="text" class="form-control" style="width: 100px;">
  305. </div>
  306. </td>
  307. <td style="text-align:right;"><label class="lglabel" for="txt_TimeFrom">&nbsp;&nbsp;&nbsp;日期(从)</label>:</td>
  308. <td>
  309. <div class="input-group">
  310. <input id="TimeFrom" name="Time" type="text" class="form-control required" style="width:80px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" placeholder="日期(从)" />
  311. </div>
  312. </td>
  313. <td style="text-align:right;"><label class="lglabel" for="txt_TimeArrive">&nbsp;&nbsp;&nbsp;日期(到)</label>:</td>
  314. <td>
  315. <div class="input-group">
  316. <input id="TimeArrive" name="Time" type="text" class="form-control required" style="width:80px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="日期(到)" />
  317. </div>
  318. </td>
  319. <td>
  320. <span class="input-group-btn">
  321. <button id="btn_search" type="button" class="btn btn-primary" onclick="Selchange()"><i class="fa fa-search"></i></button>
  322. </span>
  323. </td>
  324. </tr>
  325. </table>
  326. </div>
  327. <div class="toolbar" style="float: right;">
  328. <div class="btn-group">
  329. <a id="NF-Create" authorize="yes" class="btn btn-primary" style="margin-left:3px;" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  330. <a id="NF-update" authorize="yes" class="btn btn-primary" style="margin-left:3px;" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  331. <a id="NF-Delete" authorize="yes" class="btn btn-primary" style="margin-left:3px;" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  332. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  333. </div>
  334. <script>$('.toolbar').authorizeButton()</script>
  335. </div>
  336. </div>
  337. <div class="gridPanel"id="gridPanel" style="width:99%">
  338. <table id="gridList"></table>
  339. <div id="gridPager"></div>
  340. </div>