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.
 
 
 
 
 
 

307 lines
13 KiB

  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 selectedParent = {};
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initTree();
  14. //page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  19. page.search(queryJson);
  20. }, 220, 400);
  21. $('#Sex').lrRadioCheckbox({
  22. type: 'radio',
  23. code: 'usersex',
  24. });
  25. // 刷新
  26. $('#lr_refresh').on('click', function () {
  27. location.reload();
  28. });
  29. // 新增
  30. $('#lr_add').on('click', function () {
  31. var url = "";
  32. if (selectedParent.ID != null) {
  33. url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?ParentID=' + selectedParent.ID + '&ParentName=' + selectedParent.Name;
  34. } else {
  35. url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form';
  36. }
  37. learun.layerForm({
  38. id: 'form',
  39. title: '新增',
  40. url: url,
  41. width: 600,
  42. height: 400,
  43. callBack: function (id) {
  44. return top[id].acceptClick(refreshGirdData);
  45. }
  46. });
  47. });
  48. // 编辑
  49. $('#lr_edit').on('click', function () {
  50. var keyValue = $('#gridtable').jfGridValue('ID');
  51. if (learun.checkrow(keyValue)) {
  52. if (keyValue.indexOf(',') != -1) {
  53. learun.alert.warning("只能选择一条记录进行编辑!");
  54. return false;
  55. }
  56. learun.layerForm({
  57. id: 'form',
  58. title: '编辑',
  59. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?keyValue=' + keyValue,
  60. width: 600,
  61. height: 400,
  62. callBack: function (id) {
  63. return top[id].acceptClick(refreshGirdData);
  64. }
  65. });
  66. }
  67. });
  68. // 删除
  69. $('#lr_delete').on('click', function () {
  70. var keyValue = $('#gridtable').jfGridValue('ID');
  71. if (learun.checkrow(keyValue)) {
  72. learun.layerConfirm('是否确认删除该项!', function (res) {
  73. if (res) {
  74. learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/DeleteForm', { keyValue: keyValue }, function () {
  75. refreshGirdData();
  76. });
  77. }
  78. });
  79. }
  80. });
  81. //批量添加宿舍
  82. $("#lr_dormitoryAdd").on("click", function () {
  83. var keyvalue1 = $("#gridtable").jfGridValue("ID");
  84. if (selectedParent.ChildType == "2") {
  85. var keyValue = selectedParent.ID;
  86. learun.layerForm({
  87. id: 'form',
  88. title: '批量添加宿舍',
  89. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/DormitoryAdd?keyValue=' + keyValue,
  90. width: 600,
  91. height: 400,
  92. callBack: function (id) {
  93. return top[id].acceptClick(refreshGirdData);
  94. }
  95. });
  96. }
  97. else {
  98. learun.alert.warning("请选择楼");
  99. }
  100. });
  101. // 打印
  102. $('#lr_print').on('click', function () {
  103. $('#gridtable').jqprintTable();
  104. });
  105. //刷新左侧的树
  106. $("#tree_refresh").on("click", function () {
  107. page.initTree();
  108. });
  109. //自动分配宿舍
  110. $("#lr_allocation").on("click", function () {
  111. learun.layerForm({
  112. id: 'form',
  113. title: '自动分配宿舍',
  114. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/Allocation',
  115. width: 400,
  116. height: 250,
  117. callBack: function (id) {
  118. return top[id].acceptClick(refreshGirdData);
  119. }
  120. });
  121. });
  122. },
  123. //初始化左侧树
  124. initTree: function () {
  125. // 初始化左侧树形数据
  126. $('#dataTree').lrtree({
  127. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetTree',
  128. nodeClick: function (item) {
  129. selectedParent.ID = item.value;
  130. selectedParent.Name = item.text;
  131. if (item.parent) {
  132. if (!item.parent.parentId) {
  133. selectedParent.ChildType = "2";
  134. } else {
  135. selectedParent.ChildType = "0";
  136. }
  137. }
  138. else {
  139. selectedParent.ChildType = "1";
  140. }
  141. if (item.text.indexOf("室") > -1) {
  142. selectedParent.ChildType = "5";
  143. }
  144. page.initGird();
  145. page.search({ ParentID: item.value });
  146. }
  147. });
  148. },
  149. // 初始化列表
  150. initGird: function () {
  151. //$("#gridtable").removeClass("jfgrid-layout");
  152. //$("#gridtable").removeAttr("style");
  153. //$("#gridtable").empty();
  154. //$("#gridtable")[0].dfop = undefined;
  155. console.log('selectedParent.ChildType=', selectedParent.ChildType);
  156. if (selectedParent.ChildType == "5") {
  157. $('#gridtable').lrAuthorizeJfGridLei({
  158. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
  159. headData: [
  160. { label: "名称", name: "Name", width: 100, align: "left" },
  161. { label: "学生名字", name: "StuName", width: 100, align: "left" },
  162. { label: "班级", name: "Class", width: 100, align: "left" },
  163. {
  164. label: "性别", name: "Sex", width: 100, align: "left",
  165. formatterAsync: function (callback, value, row, op, $cell) {
  166. learun.clientdata.getAsync('dataItem', {
  167. key: value,
  168. code: 'usersex',
  169. callback: function (_data) {
  170. callback(_data.text);
  171. }
  172. });
  173. }
  174. },
  175. { label: "负责人", name: "Functionary", width: 100, align: "left" },
  176. { label: "负责人电话", name: "Phone", width: 100, align: "left" },
  177. { label: "价格", name: "Price", width: 100, align: "left" },
  178. { label: "星级", name: "Starred", width: 100, align: "left" },
  179. {
  180. label: "是否独卫", name: "HasToilet", width: 100, align: "left",
  181. formatterAsync: function (callback, value, row, op, $cell) {
  182. learun.clientdata.getAsync('dataItem', {
  183. key: value,
  184. code: 'HasToilet',
  185. callback: function (_data) {
  186. callback(_data.text);
  187. }
  188. });
  189. }
  190. },
  191. { label: "舍长", name: "Leader", width: 100, align: "left" },
  192. { label: "备注", name: "Remark", width: 100, align: "left" },
  193. ],
  194. mainId: 'ID',
  195. isPage: true,
  196. isMultiselect:true
  197. });
  198. } else {
  199. $('#gridtable').lrAuthorizeJfGridLei({
  200. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
  201. headData: [
  202. { label: "名称", name: "Name", width: 100, align: "left" },
  203. { label: "学生", name: "StudentID", width: 100, align: "left",
  204. formatterAsync: function (callback, value, row, op, $cell) {
  205. learun.clientdata.getAsync('custmerData', {
  206. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
  207. key: value,
  208. keyId: 'stuid',
  209. callback: function (_data) {
  210. callback(_data['stuname']);
  211. }
  212. });
  213. } },
  214. { label: "位置", name: "Address", width: 100, align: "left" },
  215. {
  216. label: "校区", name: "Campus", width: 100, align: "left",
  217. formatterAsync: function (callback, value, row, op, $cell) {
  218. learun.clientdata.getAsync('custmerData', {
  219. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company',
  220. key: value,
  221. keyId: 'f_companyid',
  222. callback: function (_data) {
  223. callback(_data['f_fullname']);
  224. }
  225. });
  226. }
  227. },
  228. {
  229. label: "系", name: "Dept", width: 100, align: "left",
  230. formatterAsync: function (callback, value, row, op, $cell) {
  231. learun.clientdata.getAsync('custmerData', {
  232. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  233. key: value,
  234. keyId: 'deptno',
  235. callback: function (_data) {
  236. callback(_data['deptname']);
  237. }
  238. });
  239. }
  240. },
  241. {
  242. label: "专业", name: "Major", width: 100, align: "left",
  243. formatterAsync: function (callback, value, row, op, $cell) {
  244. learun.clientdata.getAsync('custmerData', {
  245. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  246. key: value,
  247. keyId: 'id',
  248. callback: function (_data) {
  249. callback(_data['majorname']);
  250. }
  251. });
  252. }
  253. },
  254. { label: "班级", name: "Class", width: 100, align: "left" },
  255. {
  256. label: "性别", name: "Sex", width: 100, align: "left",
  257. formatterAsync: function (callback, value, row, op, $cell) {
  258. learun.clientdata.getAsync('dataItem', {
  259. key: value,
  260. code: 'usersex',
  261. callback: function (_data) {
  262. callback(_data.text);
  263. }
  264. });
  265. }
  266. },
  267. { label: "负责人", name: "Functionary", width: 100, align: "left" },
  268. { label: "负责人电话", name: "Phone", width: 100, align: "left" },
  269. { label: "备注", name: "Remark", width: 100, align: "left" },
  270. ],
  271. mainId: 'ID',
  272. isPage: true,
  273. isMultiselect:true
  274. });
  275. }
  276. //page.search();
  277. },
  278. search: function (param) {
  279. param = param || {};
  280. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  281. }
  282. };
  283. refreshGirdData = function () {
  284. //page.initTree();
  285. if (!!selectedParent.ID) {
  286. page.search({ ParentID: selectedParent.ID });
  287. } else {
  288. page.search();
  289. }
  290. };
  291. page.init();
  292. }