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.

IndexBed.js 3.8 KiB

3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-04-26 15:02
  5. * 描 述:学生宿舍管理
  6. */
  7. var refreshGirdData;
  8. var acceptClick;
  9. var selectedParent = {};
  10. var ParentID = request('ParentID');
  11. var bootstrap = function ($, learun) {
  12. "use strict";
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 刷新
  20. $('#lr_refresh').on('click', function () {
  21. location.reload();
  22. });
  23. // 新增
  24. $('#lr_add').on('click', function () {
  25. learun.layerForm({
  26. id: 'form',
  27. title: '新增',
  28. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormBed?ParentID=' + ParentID,
  29. width: 400,
  30. height: 300,
  31. callBack: function (id) {
  32. return top[id].acceptClick(refreshGirdData);
  33. }
  34. });
  35. });
  36. // 编辑
  37. $('#lr_edit').on('click', function () {
  38. var keyValue = $('#gridtable').jfGridValue('ID');
  39. if (learun.checkrow(keyValue)) {
  40. if (keyValue.indexOf(',') != -1) {
  41. learun.alert.warning("只能选择一条记录进行编辑!");
  42. return false;
  43. }
  44. learun.layerForm({
  45. id: 'form',
  46. title: '编辑',
  47. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormBed?keyValue=' + keyValue + '&ParentID=' + ParentID,
  48. width: 400,
  49. height: 300,
  50. callBack: function (id) {
  51. return top[id].acceptClick(refreshGirdData);
  52. }
  53. });
  54. }
  55. });
  56. // 删除
  57. $('#lr_delete').on('click', function () {
  58. var keyValue = $('#gridtable').jfGridValue('ID');
  59. if (learun.checkrow(keyValue)) {
  60. learun.layerConfirm('是否确认删除该项!', function (res) {
  61. if (res) {
  62. learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/DeleteBed', { keyValue: keyValue, ParentID: ParentID }, function () {
  63. refreshGirdData();
  64. });
  65. }
  66. });
  67. }
  68. });
  69. // 打印
  70. $('#lr_print').on('click', function () {
  71. $('#gridtable').jqprintTable();
  72. });
  73. },
  74. // 初始化列表
  75. initGird: function () {
  76. $('#gridtable').jfGrid({
  77. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + ParentID,
  78. headData: [
  79. { label: "名称", name: "Name", width: 100, align: "left" },
  80. ],
  81. mainId: 'ID',
  82. isPage: false,
  83. //sidx: ' CAST(REPLACE(Name,\'床\',\'\') as int)'
  84. });
  85. page.search();
  86. },
  87. search: function (param) {
  88. param = param || {};
  89. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  90. }
  91. };
  92. refreshGirdData = function () {
  93. page.search();
  94. };
  95. // 保存数据
  96. acceptClick = function (callBack) {
  97. learun.layerClose('indexBed', '');
  98. if (!!callBack) {
  99. callBack();
  100. }
  101. };
  102. page.init();
  103. }