Brak opisu

second_1.js 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. //热线整合受理情况&重大事件
  2. var hotline2Data=[]
  3. var domM
  4. var hotline2M = echarts.init(document.getElementById('hotline2'));
  5. var channelM = echarts.init(document.getElementById('channel'));
  6. var hotlineTimeType
  7. // 热线整合
  8. laydate.render({
  9. elem: '#date',
  10. range: '~',
  11. type: 'datetime',
  12. done: function(value) {
  13. initHoneline(value)
  14. }
  15. });
  16. $('.accept_statistics .hotline').click(function (e) {
  17. domM = 'hotline2'
  18. $('.bulletFrame').show();
  19. $('.hotline_wrap').show();
  20. $('.hotline_wrap').siblings().hide()
  21. if ($('.bulletFrame').css('display') == 'block') {
  22. $('.body').css('opacity', '0.4')
  23. }
  24. if (hotlineDataType === 0) {
  25. hotlineTimeType = 1
  26. getNowTime('#date')
  27. } else if(hotlineDataType === 1){
  28. hotlineTimeType = 0
  29. getNowTime('#date', 4)
  30. }
  31. initHoneline($('#date').val())
  32. e.stopPropagation()
  33. })
  34. function initHoneline(value) {
  35. var secData = [];
  36. new doAjax({
  37. url:huayi.config.callcenter_url+'/InfoNew/GetHotline',
  38. Type: 'get',
  39. data: {
  40. token: $.cookie("token"),
  41. stime: value && value.split(' ~ ')[0],
  42. etime: value && value.split(' ~ ')[1]
  43. },
  44. callBack: function (res) {
  45. res.data.forEach(function (v, n) {
  46. secData.push({
  47. level: v.value,
  48. landArea: v.count
  49. })
  50. })
  51. hotline2Data = secData
  52. getHonelineChart2(hotline2Data)
  53. domM = 'hotline2'
  54. }
  55. });
  56. }
  57. hotline2M.on('click', function (params) {
  58. console.log(params, 'hotline2')
  59. domM = 'hotline2'
  60. if (domM== 'hotline2') {
  61. workTable('', '', '', params.name, '', '', '', '', hotlineTimeType)
  62. } else if (domM== 'events') {
  63. var keyValue = getKey(data,'level',params.name,'key')
  64. var dataInfo = data.find((o) => {
  65. return o.level === params.name;
  66. })
  67. workTable('','','','','' ,'','',null,null,null,null,null, null, null, null, $('#date2').val() && $('#date2').val().split(' ~ ')[0], $('#date2').val() && $('#date2').val().split(' ~ ')[1], null, dataInfo.themeId, 1, dataInfo.key)
  68. } else if (domM== 'channel') {
  69. var time = $('#date3').val().split(' ~ ');
  70. var sourceInfo = sourceCountId.find(function(o) {
  71. return o.name == params.name;
  72. })
  73. if (sourceInfo) {
  74. if (sourceInfo.strworkid) {
  75. workTable('', '', '', '', '', '', '', '', 0,'','','', '', '', sourceInfo.strworkid, time[0], time[1])
  76. } else {
  77. workTable('', '', '', '', '', '', '', '', 0, '', sourceInfo.id,'', '', '', '', time[0], time[1])
  78. }
  79. }
  80. }
  81. })
  82. channelM.on('click', function (params) {
  83. domM = 'channel'
  84. var time = $('#date3').val().split(' ~ ');
  85. var sourceInfo = sourceCountId.find(function(o) {
  86. return o.name == params.name;
  87. })
  88. if (sourceInfo) {
  89. if (sourceInfo.strworkid) {
  90. workTable('', '', '', '', '', '', '', '', 0,'','','', '', '', sourceInfo.strworkid, time[0], time[1])
  91. } else {
  92. workTable('', '', '', '', '', '', '', '', 0, '', sourceInfo.id,'', '', '', '', time[0], time[1])
  93. }
  94. }
  95. })
  96. function getHonelineChart2(data) {
  97. data = awaySort(data,"landArea")
  98. data.length = 10
  99. const CubeLeft = echarts.graphic.extendShape({
  100. shape: {
  101. x: 0,
  102. y: 0
  103. },
  104. buildPath: function (ctx, shape) {
  105. const xAxisPoint = shape.xAxisPoint
  106. const c0 = [shape.x, shape.y]
  107. const c1 = [shape.x - 20, shape.y - 4]
  108. const c2 = [xAxisPoint[0] - 20, xAxisPoint[1] - 4]
  109. const c3 = [xAxisPoint[0], xAxisPoint[1]]
  110. ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1])
  111. .closePath()
  112. }
  113. })
  114. const CubeRight = echarts.graphic.extendShape({
  115. shape: {
  116. x: 0,
  117. y: 0
  118. },
  119. buildPath: function (ctx, shape) {
  120. const xAxisPoint = shape.xAxisPoint
  121. const c1 = [shape.x, shape.y]
  122. const c2 = [xAxisPoint[0], xAxisPoint[1]]
  123. const c3 = [xAxisPoint[0] + 8, xAxisPoint[1] - 4]
  124. const c4 = [shape.x + 8, shape.y - 4]
  125. ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1])
  126. .closePath()
  127. }
  128. })
  129. const CubeTop = echarts.graphic.extendShape({
  130. shape: {
  131. x: 0,
  132. y: 0
  133. },
  134. buildPath: function (ctx, shape) {
  135. // 逆时针 角 y 负数向上 X 负数向左
  136. const c1 = [shape.x, shape.y]
  137. const c2 = [shape.x + 8, shape.y - 4]
  138. const c3 = [shape.x - 11, shape.y - 8]
  139. const c4 = [shape.x - 20, shape.y - 4]
  140. ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1])
  141. .closePath()
  142. }
  143. })
  144. echarts.graphic.registerShape('CubeLeft', CubeLeft)
  145. echarts.graphic.registerShape('CubeRight', CubeRight)
  146. echarts.graphic.registerShape('CubeTop', CubeTop)
  147. let MAX = []
  148. let VALUE = []
  149. let LEV = []
  150. let chartData = [].concat(data)
  151. chartData.forEach(item => {
  152. if (domM === 'themeBarEle') {
  153. var obj = {}
  154. obj.name = item.level
  155. obj.value = item.landArea
  156. obj.themId = item.id
  157. VALUE.push(obj)
  158. } else {
  159. VALUE.push(item.landArea)
  160. }
  161. LEV.push(item.level)
  162. })
  163. // console.log(VALUE)
  164. let maxItem = [].concat(VALUE).sort((a, b) => b - a)[0]
  165. let SUM = 0
  166. for (let item of VALUE) {
  167. SUM += item
  168. MAX.push(maxItem)
  169. }
  170. option = {
  171. tooltip: {
  172. trigger: 'item',
  173. textStyle: {
  174. color: '#ffe400',
  175. fontSize: '16',
  176. fontWeight: '500'
  177. },
  178. position: 'top',
  179. backgroundColor: 'rgba(250,250,250,0)',
  180. transitionDuration: 0.4,
  181. formatter: function (params) {
  182. var resultValue = ''
  183. if (domM === 'themeBarEle') {
  184. resultValue = VALUE[params.dataIndex].value
  185. } else {
  186. resultValue = VALUE[params.dataIndex]
  187. }
  188. return '<div style="background-image: url(image/second/reminder_box2.png);width:50px;height:33px;line-height:30px;background-size: 100% 100%;text-align:center;">' +
  189. resultValue + '</div>';
  190. }
  191. },
  192. grid: {
  193. right: "5%",
  194. top: "20%",
  195. left: "5%",
  196. bottom: "5%",
  197. containLabel: true
  198. },
  199. xAxis: {
  200. type: 'category',
  201. data: LEV,
  202. axisLine: {
  203. show: true,
  204. lineStyle: {
  205. color: '#687e89'
  206. }
  207. },
  208. offset: 10,
  209. axisTick: {
  210. show: false
  211. },
  212. axisLabel: {
  213. fontSize: 14,
  214. rotate: -45,
  215. color: '#fff'
  216. }
  217. },
  218. yAxis: [{
  219. nameTextStyle: {
  220. color: "#f4f5f5",
  221. padding: [0, 0, 10, -5],
  222. fontSize: 16
  223. },
  224. axisLabel: {
  225. color: "#f4f5f5",
  226. fontSize: 16
  227. },
  228. axisTick: {
  229. lineStyle: {
  230. color: "#687f8a",
  231. width: 1
  232. },
  233. show: true
  234. },
  235. splitLine: {
  236. show: true,
  237. lineStyle: {
  238. color: "#687f8a",
  239. type: "dashed"
  240. }
  241. },
  242. axisLine: {
  243. lineStyle: {
  244. color: "#687f8a",
  245. width: 1,
  246. type: "solid"
  247. },
  248. show: true,
  249. // "symbol":['none', 'arrow'],
  250. symbol: ['none',
  251. 'path://M5, 20 L5, 5 L8, 8 L5, 2 L2, 8 L5, 5 L5.3, 6 L5.3, 20'
  252. ],
  253. symbolOffset: 5,
  254. symbolSize: [35, 38],
  255. },
  256. name: "条"
  257. }],
  258. series: [{
  259. type: 'custom',
  260. renderItem: (params, api) => {
  261. const location = api.coord([api.value(0), api.value(1)])
  262. return {
  263. type: 'group',
  264. children: [{
  265. type: 'CubeLeft',
  266. shape: {
  267. api,
  268. xValue: api.value(0),
  269. yValue: api.value(1),
  270. x: location[0],
  271. y: location[1],
  272. xAxisPoint: api.coord([api.value(0), 0])
  273. },
  274. style: {
  275. fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  276. offset: 0,
  277. color: '#3fffea'
  278. }, {
  279. offset: 1,
  280. color: '#007eff'
  281. }])
  282. },
  283. },
  284. {
  285. type: 'CubeRight',
  286. shape: {
  287. api,
  288. xValue: api.value(0),
  289. yValue: api.value(1),
  290. x: location[0],
  291. y: location[1],
  292. xAxisPoint: api.coord([api.value(0), 0])
  293. },
  294. style: {
  295. fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  296. offset: 0,
  297. color: '#2fbeaf' // 顶部
  298. }, {
  299. offset: 1,
  300. color: '#015fbf' // 底部
  301. }])
  302. }
  303. }, {
  304. type: 'CubeTop',
  305. shape: {
  306. api,
  307. xValue: api.value(0),
  308. yValue: api.value(1),
  309. x: location[0],
  310. y: location[1],
  311. xAxisPoint: api.coord([api.value(0), 0])
  312. },
  313. style: {
  314. fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  315. offset: 0,
  316. color: '#9ffff5'
  317. }, {
  318. offset: 1,
  319. color: '#9ffff5'
  320. }])
  321. },
  322. }
  323. ]
  324. }
  325. },
  326. data: VALUE
  327. }, {
  328. type: 'bar',
  329. itemStyle: {
  330. color: 'rgba(255,255,255,0)'
  331. },
  332. emphasis: {
  333. itemStyle: {
  334. opacity: 0.2,
  335. color: 'rgb(60,118,77)'
  336. }
  337. },
  338. data: MAX
  339. },]
  340. }
  341. if (domM === 'channel') {
  342. channelM.setOption(option);
  343. } else if (domM === 'themeBarEle') {
  344. themeBarEcharts.setOption(option);
  345. } else {
  346. hotline2M.setOption(option);
  347. }
  348. }
  349. function awaySort(objArr, key) {
  350. let result = objArr.slice(0);
  351. return result.sort((a, b) => b[key] -a[key] );
  352. }
  353. function getKey(data,key1,value,key2){
  354. var dataValue
  355. data.forEach(function (ele) {
  356. if (ele[key1]===value) {
  357. dataValue =ele[key2]
  358. }
  359. })
  360. return dataValue
  361. }