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.
 
 
 
 
 
 

306 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. if (selectedParent.ChildType == "5") {
  156. $('#gridtable').lrAuthorizeJfGridLei({
  157. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
  158. headData: [
  159. { label: "名称", name: "Name", width: 100, align: "left" },
  160. { label: "学生名字", name: "StuName", width: 100, align: "left" },
  161. { label: "班级", name: "Class", width: 100, align: "left" },
  162. {
  163. label: "性别", name: "Sex", width: 100, align: "left",
  164. formatterAsync: function (callback, value, row, op, $cell) {
  165. learun.clientdata.getAsync('dataItem', {
  166. key: value,
  167. code: 'usersex',
  168. callback: function (_data) {
  169. callback(_data.text);
  170. }
  171. });
  172. }
  173. },
  174. { label: "负责人", name: "Functionary", width: 100, align: "left" },
  175. { label: "负责人电话", name: "Phone", width: 100, align: "left" },
  176. { label: "价格", name: "Price", width: 100, align: "left" },
  177. { label: "星级", name: "Starred", width: 100, align: "left" },
  178. {
  179. label: "是否独卫", name: "HasToilet", width: 100, align: "left",
  180. formatterAsync: function (callback, value, row, op, $cell) {
  181. learun.clientdata.getAsync('dataItem', {
  182. key: value,
  183. code: 'HasToilet',
  184. callback: function (_data) {
  185. callback(_data.text);
  186. }
  187. });
  188. }
  189. },
  190. { label: "舍长", name: "Leader", width: 100, align: "left" },
  191. { label: "备注", name: "Remark", width: 100, align: "left" },
  192. ],
  193. mainId: 'ID',
  194. isPage: true,
  195. isMultiselect:true
  196. });
  197. } else {
  198. $('#gridtable').lrAuthorizeJfGridLei({
  199. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
  200. headData: [
  201. { label: "名称", name: "Name", width: 100, align: "left" },
  202. { label: "学生", name: "StudentID", width: 100, align: "left",
  203. formatterAsync: function (callback, value, row, op, $cell) {
  204. learun.clientdata.getAsync('custmerData', {
  205. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
  206. key: value,
  207. keyId: 'stuid',
  208. callback: function (_data) {
  209. callback(_data['stuname']);
  210. }
  211. });
  212. } },
  213. { label: "位置", name: "Address", width: 100, align: "left" },
  214. {
  215. label: "校区", name: "Campus", width: 100, align: "left",
  216. formatterAsync: function (callback, value, row, op, $cell) {
  217. learun.clientdata.getAsync('custmerData', {
  218. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company',
  219. key: value,
  220. keyId: 'f_companyid',
  221. callback: function (_data) {
  222. callback(_data['f_fullname']);
  223. }
  224. });
  225. }
  226. },
  227. {
  228. label: "系", name: "Dept", width: 100, align: "left",
  229. formatterAsync: function (callback, value, row, op, $cell) {
  230. learun.clientdata.getAsync('custmerData', {
  231. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  232. key: value,
  233. keyId: 'deptno',
  234. callback: function (_data) {
  235. callback(_data['deptname']);
  236. }
  237. });
  238. }
  239. },
  240. {
  241. label: "专业", name: "Major", width: 100, align: "left",
  242. formatterAsync: function (callback, value, row, op, $cell) {
  243. learun.clientdata.getAsync('custmerData', {
  244. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  245. key: value,
  246. keyId: 'id',
  247. callback: function (_data) {
  248. callback(_data['majorname']);
  249. }
  250. });
  251. }
  252. },
  253. { label: "班级", name: "Class", width: 100, align: "left" },
  254. {
  255. label: "性别", name: "Sex", width: 100, align: "left",
  256. formatterAsync: function (callback, value, row, op, $cell) {
  257. learun.clientdata.getAsync('dataItem', {
  258. key: value,
  259. code: 'usersex',
  260. callback: function (_data) {
  261. callback(_data.text);
  262. }
  263. });
  264. }
  265. },
  266. { label: "负责人", name: "Functionary", width: 100, align: "left" },
  267. { label: "负责人电话", name: "Phone", width: 100, align: "left" },
  268. { label: "备注", name: "Remark", width: 100, align: "left" },
  269. ],
  270. mainId: 'ID',
  271. isPage: true,
  272. isMultiselect:true
  273. });
  274. }
  275. //page.search();
  276. },
  277. search: function (param) {
  278. param = param || {};
  279. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  280. }
  281. };
  282. refreshGirdData = function () {
  283. //page.initTree();
  284. if (!!selectedParent.ID) {
  285. page.search({ ParentID: selectedParent.ID });
  286. } else {
  287. page.search();
  288. }
  289. };
  290. page.init();
  291. }