order.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. function task() {
  2. $.get('/api/Orders/task',{org_id:orgid},function (res) {
  3. if(res.status === 0) {
  4. var list = res.data.data;
  5. if(list.length > 0){
  6. var str = '';
  7. for (var i=0;i<list.length;i++){
  8. list[i]['IMAGES'] = list[i]['IMAGES'] ==='' || list[i]['IMAGES']== null ? '否' : '是';
  9. list[i]['VIDEOS'] = list[i]['VIDEOS'] ==='' || list[i]['VIDEOS']== null ? '否' : '是';
  10. str += '<tr>';
  11. str += '<td>'+list[i]['TODO_ID']+'</td>';
  12. str += '<td>'+list[i]['TASK_TYPE']+'</td>';
  13. str += '<td class="table-task-name">'+list[i]['CONTENT']+'</td>';
  14. str += '<td>'+list[i]['executor']+'</td>';
  15. str += '<td class="table-task-name">'+list[i]['DEP']+'</td>';
  16. str += '<td>'+list[i]['CREATTE_TIME']+'</td>';
  17. str += '<td>'+list[i]['IMAGES']+'</td>';
  18. str += '<td>'+list[i]['VIDEOS']+'</td>';
  19. str += '<td>'+list[i]['HANDOUT_TIME']+'</td>';
  20. str += '</tr>';
  21. }
  22. $('#task-order').html(str);
  23. }
  24. if (list.length > 10) {
  25. $(function(){
  26. var text=$("#task-order:first");
  27. var clear;
  28. text.hover(function(){
  29. clearInterval(clear);
  30. },function(){
  31. clear=setInterval(function(){
  32. var field=text.find("tr:first");
  33. var high=field.height();
  34. text.animate({ marginTop:-high+"px"},600,function(){
  35. field.css("marginTop",0).appendTo(text);
  36. text.css("marginTop",0);
  37. })
  38. },2000)//滚动间隔时间
  39. }).trigger("mouseleave");//自动滚动
  40. });
  41. }
  42. }
  43. })
  44. }
  45. function patrol() {
  46. $.get('/api/Orders/patrol',{org_id:orgid},function (res) {
  47. if(res.status === 0) {
  48. var list = res.data.data;
  49. if(list.length > 0){
  50. document.getElementById('ongoing-orders').style.display = 'block';
  51. var str = '';
  52. for (var i=0;i<list.length;i++){
  53. str += '<tr>';
  54. str += '<td>'+list[i]['PATROL_TASK_ID']+'</td>';
  55. str += '<td>'+list[i]['TITLE']+'</td>';
  56. str += '<td>'+list[i]['NAME']+'</td>';
  57. str += '<td class="table-project-name">'+list[i]['USERS']+'</td>';
  58. str += '<td>'+list[i]['START_TIME']+'</td>';
  59. str += '<td>'+list[i]['END_TIME']+'</td>';
  60. str += '</tr>';
  61. }
  62. $('#ongoing-order').html(str);
  63. }
  64. }
  65. if (list.length > 10) {
  66. $(function(){
  67. var text=$("#ongoing-order:first");
  68. var clear;
  69. text.hover(function(){
  70. clearInterval(clear);
  71. },function(){
  72. clear=setInterval(function(){
  73. var field=text.find("tr:first");
  74. var high=field.height();
  75. text.animate({ marginTop:-high+"px"},600,function(){
  76. field.css("marginTop",0).appendTo(text);
  77. text.css("marginTop",0);
  78. })
  79. },2000)//滚动间隔时间
  80. }).trigger("mouseleave");//自动滚动
  81. });
  82. }
  83. })
  84. }
  85. task();
  86. patrol();
  87. setInterval(function () {
  88. task();
  89. patrol();
  90. },1000*120);
  91. function realSysTime(clock) {
  92. var now = new Date();
  93. var year = now.getFullYear(); //获取年份
  94. var month = now.getMonth(); //获取月份
  95. var date = now.getDate(); //获取日期
  96. var day = now.getDay(); //获取星期
  97. var hour = now.getHours(); //获取小时
  98. var minute = now.getMinutes(); //获取分钟
  99. var seconds = now.getSeconds(); //获取秒
  100. month = month + 1;
  101. var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  102. var week = arr_week[day];
  103. if (month<10) {
  104. month = '0'+month
  105. }
  106. if (date<10) {
  107. date = '0'+date
  108. }
  109. if (hour<10) {
  110. hour = '0'+hour
  111. }
  112. if (minute<10) {
  113. minute = '0'+minute
  114. }
  115. if (seconds<10) {
  116. seconds = '0'+seconds
  117. }
  118. var time = year + "年" + month + "月" + date + "日 " + week + " " + hour + ":" + minute + ":" + seconds;
  119. clock.innerHTML = time;
  120. }
  121. function show() {
  122. window.setInterval("realSysTime(clock)", 1000);
  123. }
  124. window.onload=show();