dashboard.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. 'use strict';
  2. /**
  3. * 待办页js
  4. *
  5. * @author EllisRan.
  6. * @date 2019/3/19
  7. * @version
  8. */
  9. $(document).ready(() => {
  10. // $('a[href="#view-msg"]').on('click', function () {
  11. // const id = $(this).attr('msg-id');
  12. // const msgInfo = _.find(msgList,{ id: parseInt(id) });
  13. // $('#title').html(msgInfo.title);
  14. // $('#creator').html(msgInfo.creator);
  15. // $('#release_time').html(moment(msgInfo.release_time*1000).format('YYYY-MM-DD'));
  16. // $('#content').html(msgInfo.content);
  17. // $('#user_permission').html('');
  18. // if (userMsgPermission && parseInt(uid) === msgInfo.create_uid ) {
  19. // const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id +'" class="btn btn-sm btn-outline-primary">编辑</a>';
  20. // $('#user_permission').html(permissionHtml);
  21. // }
  22. // });
  23. $('.list-group-item a').on('click', function () {
  24. const id = $(this).attr('msg-id');
  25. const msgInfo = _.find(msgList, {id: parseInt(id)});
  26. $('#title').html(msgInfo.title);
  27. $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
  28. $('#content').html(msgInfo.content);
  29. $('#user_permission').html('');
  30. if (type && parseInt(type) === 1) {
  31. $('#creator').html(msgInfo.creator);
  32. $('#view-msg .modal-title').text('项目通知');
  33. if (userMsgPermission && parseInt(uid) === msgInfo.create_uid) {
  34. const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
  35. $('#user_permission').html(permissionHtml);
  36. }
  37. } else {
  38. $('#creator').html('');
  39. $('#view-msg .modal-title').text('系统通知');
  40. }
  41. });
  42. $('.system-msg').on('click', function () {
  43. const id = $(this).attr('msg-id');
  44. const msgInfo = _.find(sysMsgList, {id: parseInt(id)});
  45. $('#title').html(msgInfo.title);
  46. $('#creator').html('');
  47. $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
  48. $('#content').html(msgInfo.content);
  49. $('#view-msg .modal-title').text('系统通知');
  50. $('#user_permission').html('');
  51. })
  52. // $('#notice').on('click', 'li a', function() {
  53. // const id = $(this).data('id')
  54. // postData(window.location.pathname + '/push', {id}, function() {
  55. // return
  56. // })
  57. // })
  58. });