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.

360 lines
15 KiB

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