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.

Index.js 4.5 KiB

4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-05-05 15:44
  5. * 描 述:宿舍卫生管理
  6. */
  7. var refreshGirdData;
  8. var selectedParent = {};
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 初始化左侧树形数据
  18. $('#dataTree').lrtree({
  19. url: top.$.rootUrl + '/LogisticsManagement/Sanitation/GetTree',
  20. nodeClick: function (item) {
  21. selectedParent.ID = item.value;
  22. selectedParent.hasChildren = item.hasChildren;
  23. selectedParent.textName = item.text;
  24. selectedParent.BuildType = item.title;
  25. console.log('selectedParent.BuildType', selectedParent.BuildType);
  26. page.search({ RoomID: item.value });
  27. }
  28. });
  29. // 刷新
  30. $('#lr_refresh').on('click', function () {
  31. location.reload();
  32. });
  33. // 新增
  34. $('#lr_add').on('click', function () {
  35. if (selectedParent.BuildType != '4') {
  36. learun.alert.warning('请选择宿舍!');
  37. return;
  38. }
  39. learun.layerForm({
  40. id: 'form',
  41. title: '新增',
  42. url: top.$.rootUrl + '/LogisticsManagement/Sanitation/Form?roomID=' + selectedParent.ID,
  43. width: 600,
  44. height: 400,
  45. callBack: function (id) {
  46. return top[id].acceptClick(refreshGirdData);
  47. }
  48. });
  49. });
  50. // 编辑
  51. $('#lr_edit').on('click', function () {
  52. var keyValue = $('#gridtable').jfGridValue('ID');
  53. if (learun.checkrow(keyValue)) {
  54. learun.layerForm({
  55. id: 'form',
  56. title: '编辑',
  57. url: top.$.rootUrl + '/LogisticsManagement/Sanitation/Form?keyValue=' + keyValue,
  58. width: 600,
  59. height: 400,
  60. callBack: function (id) {
  61. return top[id].acceptClick(refreshGirdData);
  62. }
  63. });
  64. }
  65. });
  66. // 删除
  67. $('#lr_delete').on('click', function () {
  68. var keyValue = $('#gridtable').jfGridValue('ID');
  69. if (learun.checkrow(keyValue)) {
  70. learun.layerConfirm('是否确认删除该项!', function (res) {
  71. if (res) {
  72. learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Sanitation/DeleteForm', { keyValue: keyValue }, function () {
  73. refreshGirdData();
  74. });
  75. }
  76. });
  77. }
  78. });
  79. // 打印
  80. $('#lr_print').on('click', function () {
  81. $('#gridtable').jqprintTable();
  82. });
  83. },
  84. // 初始化列表
  85. initGird: function () {
  86. $('#gridtable').lrAuthorizeJfGrid({
  87. url: top.$.rootUrl + '/LogisticsManagement/Sanitation/GetPageList',
  88. headData: [
  89. { label: "分数", name: "Grade", width: 100, align: "left" },
  90. { label: "检查者", name: "GradedUser", width: 100, align: "left" },
  91. {
  92. label: "日期框", name: "GradedTime", width: 100, align: "left",
  93. formatter: function(value, row) {
  94. return learun.formatDate(value, 'yyyy-MM-dd');
  95. }
  96. },
  97. { label: "备注", name: "Remark", width: 100, align: "left" },
  98. ],
  99. mainId: 'ID',
  100. isPage: true
  101. });
  102. //page.search();
  103. },
  104. search: function (param) {
  105. param = param || {};
  106. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  107. }
  108. };
  109. refreshGirdData = function () {
  110. page.search({ RoomID: selectedParent.ID });
  111. };
  112. page.init();
  113. }