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.
 
 
 
 
 
 

112 lines
5.1 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-07-03 14:31
  5. * 描 述:校历管理
  6. */
  7. (function () {
  8. var begin = '';
  9. var end = '';
  10. var multipleData = null;
  11. var page = {
  12. grid: null,
  13. init: function ($page) {
  14. begin = '';
  15. end = '';
  16. multipleData = null;
  17. page.grid = $page.find('#lr_EducationalAdministrationSchoolCalendar_list').lrpagination({
  18. lclass: page.lclass,
  19. rows: 10, // 每页行数
  20. getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
  21. param.multipleData = multipleData;
  22. page.loadData(param, callback, $page);
  23. },
  24. renderData: function (_index, _item, _$item) {// 渲染数据模板
  25. return page.rowRender(_index, _item, _$item, $page);
  26. },
  27. click: function (item, $item, $et) {// 列表行点击事件
  28. if ($et.hasClass('lr-btn-danger')) {
  29. page.btnClick(item, $item, $page);
  30. }
  31. else {
  32. page.rowClick(item, $item, $page);
  33. }
  34. },
  35. btns: page.rowBtns });
  36. // 多条件查询
  37. var $multiple = $page.find('.lr_multiple_search').multiplequery({
  38. callback: function (data) {
  39. begin = '';
  40. end = '';
  41. multipleData = data || {};
  42. page.grid.reload();
  43. }
  44. });
  45. $page.find('#lr_EducationalAdministrationSchoolCalendar_btn').on('tap', function () {
  46. learun.nav.go({ path: 'EducationalAdministration/SchoolCalendar/form', title: '新增', type: 'right' });
  47. });
  48. },
  49. lclass: 'lr-list',
  50. loadData: function (param, callback, $page) {// 列表加载后台数据
  51. var _postParam = {
  52. pagination: {
  53. rows: param.rows,
  54. page: param.page,
  55. sidx: 'ID',
  56. sord: 'DESC'
  57. },
  58. queryJson: '{}'
  59. };
  60. if (param.multipleData) {
  61. _postParam.queryJson = JSON.stringify(multipleData);
  62. }
  63. if (param.begin && param.end) {
  64. _postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end });
  65. }
  66. learun.httpget(config.webapi + 'learun/EducationalAdministration/SchoolCalendar/pagelist', _postParam, (data) => {
  67. $page.find('.lr-badge').text('0');
  68. if (data) {
  69. $page.find('.lr-badge').text(data.records);
  70. callback(data.rows, parseInt(data.records));
  71. }
  72. else {
  73. callback([], 0);
  74. }
  75. });
  76. },
  77. rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据
  78. _$item.addClass('lr-list-item lr-list-item-multi');
  79. _$item.append($('<p class="lr-ellipsis"><span>学年:</span></p>').dataFormatter({ value: _item.AcademicYearNo }));
  80. _$item.append($('<p class="lr-ellipsis"><span>学期:</span></p>').dataFormatter({ value: _item.Semester }));
  81. _$item.append($('<p class="lr-ellipsis"><span>开始日期:</span></p>').dataFormatter({ value: _item.StartTime,
  82. type: 'datetime',
  83. dateformat: 'yyyy-MM-dd'
  84. }));
  85. _$item.append($('<p class="lr-ellipsis"><span>结束日期:</span></p>').dataFormatter({ value: _item.EndTime,
  86. type: 'datetime',
  87. dateformat: 'yyyy-MM-dd'
  88. }));
  89. _$item.append($('<p class="lr-ellipsis"><span>内容:</span></p>').dataFormatter({ value: _item.Content }));
  90. return '';
  91. },
  92. rowClick: function (item, $item, $page) {// 列表行点击触发方法
  93. learun.nav.go({ path: 'EducationalAdministration/SchoolCalendar/form', title: '详情', type: 'right', param: { keyValue: item.ID } });
  94. },
  95. btnClick: function (item, $item, $page) {// 左滑按钮点击事件
  96. learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
  97. if (_index === '1') {
  98. learun.layer.loading(true, '正在删除该笔数据');
  99. learun.httppost(config.webapi + 'learun/EducationalAdministration/SchoolCalendar/delete', item.ID , (data) => {
  100. if (data) {// 删除数据成功
  101. page.grid.reload();
  102. }
  103. learun.layer.loading(false);
  104. });
  105. }
  106. }, '智慧校园提示', ['取消', '确定']);
  107. },
  108. rowBtns: ['<a class="lr-btn-danger">删除</a>'] // 列表行左滑按钮
  109. };
  110. return page;
  111. })();