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.

JournalReceive.js 4.7 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. (function () {
  2. var begin = '';
  3. var end = '';
  4. var multipleData = null;
  5. var page = {
  6. grid: null,
  7. init: function ($page) {
  8. begin = '';
  9. end = '';
  10. multipleData = null;
  11. page.grid = $page.find('#lr_EducationalAdministrationJournalReceive_list').lrpagination({
  12. lclass: page.lclass,
  13. rows: 10, // 每页行数
  14. getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
  15. param.multipleData = multipleData;
  16. page.loadData(param, callback, $page);
  17. },
  18. renderData: function (_index, _item, _$item) {// 渲染数据模板
  19. return page.rowRender(_index, _item, _$item, $page);
  20. },
  21. click: function (item, $item, $et) {// 列表行点击事件
  22. if ($et.hasClass('lr-btn-danger')) {
  23. page.btnClick(item, $item, $page);
  24. }
  25. else {
  26. page.rowClick(item, $item, $page);
  27. }
  28. },
  29. btns: page.rowBtns
  30. });
  31. $page.find('#lr_EducationalAdministrationJournalReceive_btn').on('tap', function () {
  32. learun.nav.go({ path: 'EducationalAdministration/JournalReceive/form', title: '新增', type: 'right' });
  33. });
  34. },
  35. lclass: 'lr-list',
  36. loadData: function (param, callback, $page) {// 列表加载后台数据
  37. var _postParam = {
  38. pagination: {
  39. rows: param.rows,
  40. page: param.page,
  41. sidx: 'JournalReceiveId',
  42. sord: 'DESC'
  43. },
  44. queryJson: '{}'
  45. };
  46. if (param.multipleData) {
  47. _postParam.queryJson = JSON.stringify(multipleData);
  48. }
  49. if (true) {
  50. _postParam.queryJson = JSON.stringify({ userId: JSON.parse(localStorage.userinfo).baseinfo.userId });
  51. }
  52. _postParam.queryJson
  53. learun.httpget(config.webapi + 'learun/EducationalAdministration/JournalReceive/pagelist', _postParam, (data) => {
  54. $page.find('.lr-badge').text('0');
  55. if (data) {
  56. $page.find('.lr-badge').text(data.records);
  57. callback(data.rows, parseInt(data.records));
  58. }
  59. else {
  60. callback([], 0);
  61. }
  62. });
  63. },
  64. rowRender: function (_index, _item, _$item, $page) {// 渲染列表行数据
  65. _$item.addClass('lr-list-item lr-list-item-multi');
  66. _$item.append($('<p class="lr-ellipsis"><span>发送人:</span></p>').dataFormatter({ value: _item.JSender }));
  67. _$item.append($('<p class="lr-ellipsis"><span>主题:</span></p>').dataFormatter({ value: _item.JTitle }));
  68. _$item.append($('<p class="lr-ellipsis"><span>日志类型:</span></p>').dataFormatter({
  69. value: _item.JTypeId,
  70. type: 'dataItem',
  71. code: 'JournalType'
  72. }));
  73. _$item.append($('<p class="lr-ellipsis"><span>内容:</span></p>').dataFormatter({ value: _item.JContent }));
  74. _$item.append($('<p class="lr-ellipsis"><span>发送时间:</span></p>').dataFormatter({
  75. value: _item.JSendTime,
  76. type: 'datetime',
  77. dateformat: 'yyyy-MM-dd'
  78. }));
  79. return '';
  80. },
  81. rowClick: function (item, $item, $page) {// 列表行点击触发方法
  82. learun.nav.go({ path: 'EducationalAdministration/JournalReceive/form', title: '详情', type: 'right', param: { keyValue: item.JournalReceiveId } });
  83. },
  84. btnClick: function (item, $item, $page) {// 左滑按钮点击事件
  85. learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
  86. if (_index === '1') {
  87. learun.layer.loading(true, '正在删除该笔数据');
  88. learun.httppost(config.webapi + 'learun/EducationalAdministration/JournalReceive/delete', item.JournalReceiveId, (data) => {
  89. if (data) {// 删除数据成功
  90. page.grid.reload();
  91. }
  92. learun.layer.loading(false);
  93. });
  94. }
  95. }, '数字化校园提示', ['取消', '确定']);
  96. },
  97. rowBtns: ['<a class="lr-btn-danger">删除</a>'] // 列表行左滑按钮
  98. };
  99. return page;
  100. })();