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.

IndexClassify.js 7.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  20. page.search(queryJson);
  21. }, 220, 400);
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. //宿舍楼
  27. $('#ApartmentId').lrselect({
  28. allowSearch: true,
  29. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo',
  30. param: { strWhere: " BuildType='1' " },
  31. value: "id",
  32. text: "name",
  33. select: function (item) {
  34. if (!!item) {
  35. //单元
  36. $('#UnitId').lrselectRefresh({
  37. allowSearch: true,
  38. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo',
  39. param: { strWhere: " BuildType='2' and ApartmentId='" + item.id + "'" },
  40. value: "id",
  41. text: "name",
  42. select: function (item) {
  43. if (!!item) {
  44. //楼层
  45. $('#FloorId').lrselectRefresh({
  46. allowSearch: true,
  47. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo',
  48. param: { strWhere: " BuildType='3' and UnitId='" + item.id + "'" },
  49. value: "id",
  50. text: "name"
  51. });
  52. }
  53. }
  54. });
  55. }
  56. }
  57. });
  58. $('#UnitId').lrselect({ allowSearch: true });
  59. $('#FloorId').lrselect({ allowSearch: true });
  60. // 新增
  61. $('#lr_add').on('click', function () {
  62. learun.layerForm({
  63. id: 'form',
  64. title: '新增',
  65. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify',
  66. width: 700,
  67. height: 400,
  68. callBack: function (id) {
  69. return top[id].acceptClick(refreshGirdData);
  70. }
  71. });
  72. });
  73. // 编辑
  74. $('#lr_edit').on('click', function () {
  75. var keyValue = $('#gridtable').jfGridValue('ID');
  76. if (learun.checkrow(keyValue)) {
  77. if (keyValue.indexOf(',') != -1) {
  78. learun.alert.warning("只能选择一条记录进行编辑!");
  79. return false;
  80. }
  81. learun.layerForm({
  82. id: 'form',
  83. title: '编辑',
  84. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify?keyValue=' + keyValue,
  85. width: 700,
  86. height: 400,
  87. callBack: function (id) {
  88. return top[id].acceptClick(refreshGirdData);
  89. }
  90. });
  91. }
  92. });
  93. // 删除
  94. $('#lr_delete').on('click', function () {
  95. var keyValue = $('#gridtable').jfGridValue('ID');
  96. if (learun.checkrow(keyValue)) {
  97. learun.layerConfirm('是否确认删除该项!', function (res) {
  98. if (res) {
  99. learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/DeleteForm', { keyValue: keyValue }, function () {
  100. refreshGirdData();
  101. });
  102. }
  103. });
  104. }
  105. });
  106. // 打印
  107. $('#lr_print').on('click', function () {
  108. $('#gridtable').jqprintTable();
  109. });
  110. },
  111. // 初始化列表
  112. initGird: function () {
  113. $('#gridtable').jfGrid({
  114. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetClassifyList',
  115. headData: [
  116. { label: "名称", name: "Name", width: 150, align: "left" },
  117. {
  118. label: "宿舍楼", name: "ApartmentName", width: 100, align: "left"
  119. },
  120. {
  121. label: "单元", name: "UnitName", width: 100, align: "left"
  122. },
  123. {
  124. label: "楼层", name: "FloorName", width: 100, align: "left"
  125. },
  126. {
  127. label: "类型", name: "BuildType", width: 100, align: "left",
  128. formatter: function (value, row) {
  129. if (value == '1') return '宿舍楼';
  130. else if (value == '2') return '单元';
  131. else if (value == '3') return '楼层';
  132. else if (value == '4') return '房间';
  133. }
  134. },
  135. { label: "位置", name: "Address", width: 100, align: "left" },
  136. {
  137. label: "校区", name: "Campus", width: 100, align: "left",
  138. formatterAsync: function (callback, value, row, op, $cell) {
  139. learun.clientdata.getAsync('custmerData', {
  140. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company',
  141. key: value,
  142. keyId: 'f_companyid',
  143. callback: function (_data) {
  144. callback(_data['f_fullname']);
  145. }
  146. });
  147. }
  148. },
  149. { label: "负责人", name: "Functionary", width: 100, align: "left" },
  150. { label: "负责人电话", name: "Phone", width: 100, align: "left" },
  151. { label: "备注", name: "Remark", width: 100, align: "left" },
  152. ],
  153. mainId: 'ID',
  154. isPage: false,
  155. //isMultiselect: true,
  156. //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ',
  157. isTree: true,
  158. parentId: 'ParentID',
  159. });
  160. page.search();
  161. },
  162. search: function (param) {
  163. param = param || {};
  164. //param.SqlParameter = " AND t.BuildType <>'5' ";
  165. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  166. }
  167. };
  168. refreshGirdData = function () {
  169. page.search();
  170. };
  171. // 保存数据
  172. acceptClick = function (callBack) {
  173. learun.layerClose('indexClassify', '');
  174. if (!!callBack) {
  175. callBack();
  176. }
  177. };
  178. page.init();
  179. }