order_v2.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. function task() {
  2. $.get('/api/Orders_v2/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. str += '<tr>';
  9. // str += '<td>'+list[i]['TODO_ID']+'</td>';
  10. str += '<td>'+list[i]['TASK_TYPE']+'</td>';
  11. str += '<td class="table-project-name">'+list[i]['CONTENT']+'</td>';
  12. str += '<td>'+list[i]['executor']+'</td>';
  13. str += '<td class="table-task-name">'+list[i]['DEP']+'</td>';
  14. // str += '<td>'+list[i]['CREATTE_TIME']+'</td>';
  15. str += '<td>'+list[i]['HANDOUT_TIME']+'</td>';
  16. if (list[i]['TODO_MODE'] == '待领取') {
  17. str += '<td style="color: #FD0000;">' + list[i]['TODO_MODE'] + '</td>';
  18. } else {
  19. str += '<td style="color: #11F000;">' + list[i]['TODO_MODE'] + '</td>';
  20. }
  21. str += '</tr>';
  22. }
  23. $('#task-order').html(str);
  24. }
  25. if (list.length > 10) {
  26. $(function(){
  27. var text=$("#task-order:first");
  28. var clear;
  29. text.hover(function(){
  30. clearInterval(clear);
  31. },function(){
  32. clear=setInterval(function(){
  33. var field=text.find("tr:first");
  34. var high=field.height();
  35. text.animate({ marginTop:-high+"px"},600,function(){
  36. field.css("marginTop",0).appendTo(text);
  37. text.css("marginTop",0);
  38. })
  39. },2000)//滚动间隔时间
  40. }).trigger("mouseleave");//自动滚动
  41. });
  42. }
  43. }
  44. })
  45. }
  46. function todo() {
  47. $.get('/api/Orders_v2/todo_day',{orgid:orgid},function (data) {
  48. if(data.status == 0){
  49. if(data.data.data.length > 0){
  50. var optionChart = echarts.init(document.getElementById("order-day"));
  51. option = {
  52. legend: {
  53. top: '5%',
  54. textStyle: {
  55. fontSize: 16,
  56. fontWeight: 'normal',
  57. color: '#FFFFFF',
  58. },
  59. },
  60. tooltip: {
  61. trigger: 'item',
  62. formatter: "{b} : {d}% <br/> {c}"
  63. },
  64. title: {
  65. text: data.data.total,
  66. subtext: '工单总量',
  67. x: 'center',
  68. y: '50%',
  69. textStyle: {
  70. fontSize: 36,
  71. fontWeight: 'normal',
  72. color: '#3DE8FC',
  73. },
  74. subtextStyle: {
  75. fontSize: 18,
  76. fontWeight: 'normal',
  77. align:"center",
  78. color:'#FFFFFF'
  79. },
  80. },
  81. series: [{
  82. type: 'pie',
  83. radius: ['40%', '70%'],
  84. center: ['50%', '60%'],
  85. color: ['#72BBF1', '#067564', '#50E2CB', '#0674E4'],
  86. // itemStyle:{
  87. // normal: {
  88. // borderWidth: 5,
  89. // borderColor: '#031845',
  90. // }
  91. // },
  92. data: data.data.data,
  93. labelLine: {
  94. normal: {
  95. show: true,
  96. length: 50,
  97. length2: 50,
  98. lineStyle: {
  99. color: '#52FFFF',
  100. width: 2
  101. }
  102. }
  103. },
  104. label: {
  105. normal: {
  106. formatter: '{b}{d}%',
  107. color: '#fff',
  108. fontSize: 16,
  109. }
  110. }
  111. }]
  112. };
  113. optionChart.setOption(option);
  114. }
  115. }
  116. });
  117. }
  118. function orders(type) {
  119. $.get('/api/Orders_v2/orders_week_month',{orgid:orgid, type:type},function (data) {
  120. if(data.status == 0){
  121. if(data.data.list.length > 0){
  122. if(type == 1) {
  123. $('#order-name').html('周分析');
  124. } else {
  125. $('#order-name').html('月分析');
  126. }
  127. var patrolChart = echarts.init(document.getElementById("order"));
  128. patrolOption = null;
  129. patrolOption = {
  130. color: ['#2986CF','#50E2CB'],
  131. legend: {
  132. data:['工单总量', '完成工单量'],
  133. textStyle: { color: "#FFFDFE" },
  134. top: 15
  135. // icon: "circle",
  136. },
  137. tooltip: {},
  138. dataset: {
  139. dimensions: ['day','工单总量','完成工单量'],
  140. source: data.data.list,
  141. },
  142. xAxis: {
  143. type: 'category',
  144. axisLabel: {
  145. color:'#fff',
  146. }
  147. },
  148. yAxis: {
  149. axisLabel: {
  150. color:'#fff',
  151. }
  152. },
  153. series: [
  154. {
  155. type: 'bar',
  156. // barMaxWidth: 30,
  157. label: {
  158. normal: {
  159. show: true,
  160. position: 'top',
  161. color: '#fff'
  162. }
  163. },
  164. },
  165. {
  166. type: 'bar',
  167. // barMaxWidth: 30,
  168. label: {
  169. normal: {
  170. show: true,
  171. position: 'top',
  172. color: '#fff'
  173. }
  174. },
  175. }
  176. ]
  177. };
  178. if (patrolOption && typeof patrolOption === "object") {
  179. patrolChart.setOption(patrolOption, true);
  180. }
  181. }
  182. }
  183. });
  184. }
  185. task();
  186. orders(1);
  187. todo();
  188. setInterval(function () {
  189. task();
  190. todo();
  191. },1000*120);
  192. setInterval(function () {
  193. setTimeout(function(){
  194. orders(1);
  195. },5000);
  196. setTimeout(function(){
  197. orders(2);
  198. },10000);
  199. },15000);
  200. function realSysTime(clock) {
  201. var now = new Date();
  202. var year = now.getFullYear(); //获取年份
  203. var month = now.getMonth(); //获取月份
  204. var date = now.getDate(); //获取日期
  205. var day = now.getDay(); //获取星期
  206. var hour = now.getHours(); //获取小时
  207. var minute = now.getMinutes(); //获取分钟
  208. var seconds = now.getSeconds(); //获取秒
  209. month = month + 1;
  210. var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  211. var week = arr_week[day];
  212. if (month<10) {
  213. month = '0'+month
  214. }
  215. if (date<10) {
  216. date = '0'+date
  217. }
  218. if (hour<10) {
  219. hour = '0'+hour
  220. }
  221. if (minute<10) {
  222. minute = '0'+minute
  223. }
  224. if (seconds<10) {
  225. seconds = '0'+seconds
  226. }
  227. var time = year + "年" + month + "月" + date + "日 " + week + " " + hour + ":" + minute + ":" + seconds;
  228. clock.innerHTML = time;
  229. }
  230. function show() {
  231. window.setInterval("realSysTime(clock)", 1000);
  232. }
  233. window.onload=show();