Нет описания

dispatTopic.js 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. //热线整合受理情况&重大事件
  2. var dispatTopicType = 2 // 1 周 2月
  3. var hotThings = echarts.init(document.getElementById("hotThings"));
  4. //$('.cutDispatchHandle').click(function(e) {
  5. // if($(this).text() === '月调度专题') {
  6. // dispatTopicType = 1
  7. // $(this).text('周调度专题')
  8. // getHotThings()
  9. // } else if($(this).text() === '周调度专题') {
  10. // dispatTopicType = 2
  11. // $(this).text('月调度专题')
  12. // getHotThings()
  13. // }
  14. //})
  15. $('.newDataAct').click(function () {
  16. console.log('dataAct')
  17. var indexTitle = $(this).attr('indexTitle')
  18. if($(this).attr('data-pos') == '1'){
  19. $(this).children(".day").addClass('active');
  20. $(this).siblings("label").children('.month').removeClass('active');
  21. // $('#themeClassType').val('0');
  22. dispatTopicType = 1
  23. trafficState = 0;
  24. cutHotThings();
  25. } else if ($(this).attr('data-pos') == '2') {
  26. $(this).children('.month').addClass('active')
  27. $(this).siblings("label").children('.day').removeClass('active');
  28. // $('#themeClassType').val('1');
  29. dispatTopicType = 2
  30. cutHotThings();
  31. trafficState = 1;
  32. }
  33. })
  34. hotThings.getZr().on('click', function (params) {
  35. $(".themeBarTit").text($('.cutDispatchHandle').text())
  36. $(".themeBar_wrap").show()
  37. var pointInPixel = [params.offsetX, params.offsetY];
  38. var pointInGrid = hotThings.convertFromPixel({
  39. seriesIndex: 0
  40. }, pointInPixel);
  41. var xIndex = pointInGrid[0]; //索引
  42. var handleIndex = Number(xIndex);
  43. var seriesObj = hotThings.getOption(); //图表object对象
  44. $('.themeBar_down').siblings().hide()
  45. $('.themeBar_down').show();
  46. themeDblId = seriesObj.series[1].data[handleIndex].themId
  47. console.log(hotThings)
  48. console.log(themeDblId)
  49. getThemeStatics();
  50. // getHotThings()
  51. })
  52. function cutHotThings() {
  53. var nameData = [];
  54. var conNum = [];
  55. var conNumData = []
  56. var maxNum = []
  57. var secData = [];
  58. var type = $('#themeClassType').val();
  59. var url = '/InfoNew/GetThemeSpecial';
  60. // if (type == '1') url = '/InfoNew/GetThemeDept1';
  61. new doAjax({
  62. url: huayi.config.callcenter_url + url,
  63. Type: 'get',
  64. data: {
  65. token: $.cookie("token"),
  66. stime: '',
  67. etime: '',
  68. timetype: MajoreventsDataType,
  69. id: themeDblId,
  70. type: dispatTopicType
  71. },
  72. callBack: function(res) {
  73. if(res.state === "notoken") {
  74. window.location.href = "login.html";
  75. }
  76. res.data.forEach(function(v, n) {
  77. var name = '';
  78. if(type == '1') {
  79. name = v.deptName ? v.deptName.replace(/[0-9]+/g, "") : '其他'
  80. } else {
  81. name = v.F_Name ? v.F_Name.replace(/[0-9]+/g, "") : '其他'
  82. if(dispatTopicType == 2){
  83. if(v.F_Cycle.indexOf('年'!== -1))
  84. name = v.F_Cycle.split('年')[1] + name
  85. }
  86. }
  87. nameData.push(name)
  88. var objCount = {}
  89. objCount.count = v.count
  90. objCount.themId = v.F_ID
  91. conNumData.push(objCount)
  92. conNum.push(v.count)
  93. secData.push({
  94. level: name,
  95. landArea: v.count
  96. })
  97. })
  98. if(res.data && res.data.length > 0) {
  99. $('#themeRate').text(res.data[0].Proportion);
  100. }
  101. for(var i = 0; i < secData.length; i++) {
  102. maxNum.push(Math.max.apply(null, conNum) + 200);
  103. }
  104. newHotThingsChart('hotThings', nameData, conNum, maxNum, -30,conNumData)
  105. }
  106. });
  107. }
  108. function newHotThingsChart(dom, data, count, count1, rotate = 0,conNumData) {
  109. window.onresize = function() {
  110. hotThings.resize()
  111. }
  112. option = {
  113. textStyle: {
  114. color: "#c0c3cd",
  115. fontSize: 11
  116. },
  117. grid: {
  118. top: '25%',
  119. bottom: '30%'
  120. },
  121. dataZoom:[
  122. {
  123. type:'inside',//slider表示有滑动块的,inside表示内置的
  124. show:true,
  125. xAxisIndex:[0],
  126. startValue:1, // 数据窗口范围的起始数值
  127. endValue:10,
  128. }
  129. ],
  130. xAxis: {
  131. nameTextStyle: {
  132. color: "#c0c3cd",
  133. padding: [0, 0, -10, 0],
  134. fontSize: 11
  135. },
  136. axisLabel: {
  137. color: "#c0c3cd",
  138. fontSize: 11,
  139. rotate: rotate,
  140. },
  141. axisTick: {
  142. lineStyle: {
  143. color: "#8398c4",
  144. width: 1
  145. },
  146. show: false
  147. },
  148. minorTick: {
  149. length: 8
  150. },
  151. splitLine: {
  152. show: false
  153. },
  154. axisLine: {
  155. lineStyle: {
  156. color: "#8398c4",
  157. width: 1,
  158. type: "solid"
  159. },
  160. show: true
  161. },
  162. data: data,
  163. type: "category"
  164. },
  165. yAxis: {
  166. nameTextStyle: {
  167. color: "#c0c3cd",
  168. padding: [0, 0, 10, -5],
  169. fontSize: 11
  170. },
  171. axisLabel: {
  172. color: "#c0c3cd",
  173. fontSize: 11
  174. },
  175. axisTick: {
  176. lineStyle: {
  177. color: "#8398c4",
  178. width: 1
  179. },
  180. show: true
  181. },
  182. splitLine: {
  183. show: true,
  184. lineStyle: {
  185. color: "#8398c4",
  186. type: "dashed"
  187. }
  188. },
  189. axisLine: {
  190. lineStyle: {
  191. color: "#8398c4",
  192. width: 1,
  193. type: "solid"
  194. },
  195. show: true,
  196. // "symbol":['none', 'arrow'],
  197. symbol: ['none', 'path://M5, 20 L5, 5 L8, 8 L5, 2 L2, 8 L5, 5 L5.3, 6 L5.3, 20'],
  198. symbolOffset: 5,
  199. symbolSize: [35, 38],
  200. },
  201. name: "条"
  202. },
  203. series: [{
  204. data: count,
  205. type: "bar",
  206. barMaxWidth: "auto",
  207. barWidth: 15,
  208. // barGap:'100%',/*多个并排柱子设置柱子之间的间距*/
  209. // barCategoryGap:'100%',/*多个并排柱子设置柱子之间的间距*/
  210. itemStyle: {
  211. color: {
  212. x: 0,
  213. y: 0,
  214. x2: 0,
  215. y2: 1,
  216. type: "linear",
  217. global: false,
  218. colorStops: [{
  219. offset: 0,
  220. color: "#ff4519"
  221. }, {
  222. offset: 1,
  223. color: "#fff500"
  224. }]
  225. },
  226. barBorderRadius: [30, 30, 0, 0]
  227. },
  228. label: {
  229. show: true,
  230. position: "top",
  231. distance: 10,
  232. color: "#fff"
  233. },
  234. emphasis: {
  235. itemStyle: {
  236. color: new echarts.graphic.LinearGradient(
  237. 0, 0, 0, 1, [{
  238. offset: 0,
  239. color: '#fde301'
  240. },
  241. {
  242. offset: 1,
  243. color: '#0a2f3e'
  244. }
  245. ]
  246. )
  247. }
  248. },
  249. },
  250. {
  251. data: conNumData,
  252. type: "line",
  253. symbolSize: 0, // symbol的大小设置为0
  254. showSymbol: false, // 不显示symbol
  255. lineStyle: {
  256. width: 0, // 线宽是0
  257. color: 'rgba(0, 0, 0, 0)' // 线的颜色是透明的
  258. }
  259. },
  260. {
  261. data: [1, 1, 1, 1, 1, 1],
  262. type: "pictorialBar",
  263. barMaxWidth: "20",
  264. symbol: "none",
  265. },
  266. {
  267. type: "pictorialBar",
  268. barMaxWidth: "20",
  269. symbolPosition: "end",
  270. symbol: "none",
  271. symbolOffset: [0, "-50%"],
  272. symbolSize: [30, 12],
  273. zlevel: 1
  274. },
  275. {
  276. data: count1,
  277. type: "bar",
  278. barMaxWidth: "auto",
  279. barWidth: 15,
  280. barGap: "-100%",
  281. itemStyle: {
  282. color: '#234caf'
  283. },
  284. zlevel: -1
  285. }, {
  286. data: [1, 1, 1, 1, 1, 1],
  287. type: "pictorialBar",
  288. barMaxWidth: "20",
  289. symbol: "none",
  290. symbolOffset: [0, "50%"],
  291. symbolSize: [30, 15],
  292. zlevel: -2
  293. }, {
  294. data: count1,
  295. type: "pictorialBar",
  296. barMaxWidth: "20",
  297. symbolPosition: "end",
  298. symbol: "circle",
  299. symbolOffset: [0, "-60%"],
  300. symbolSize: [15, 12],
  301. itemStyle: {
  302. color: '#234caf'
  303. },
  304. zlevel: -1
  305. },
  306. ]
  307. }
  308. if (domM === 'themeBarDownEle') {
  309. themeBarDownEcharts.setOption(option);
  310. } else{
  311. domM = ''
  312. hotThings.setOption(option);
  313. }
  314. }