D_Mode_1.js 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627
  1. $(window).load(function () {
  2. $(".loading").fadeOut()
  3. // 返回上一级 视图处理
  4. C_keys_list = C_keys.split(",")
  5. if (C_keys_list.length <= 1){
  6. $("#v_back").hide();
  7. }else {
  8. $("#v_back").show();
  9. }
  10. })
  11. /****/
  12. $(document).ready(function () {
  13. var whei = $(window).width()
  14. $("html").css({fontSize: whei / 20})
  15. $(window).resize(function () {
  16. var whei = $(window).width()
  17. $("html").css({fontSize: whei / 20})
  18. });
  19. });
  20. // 返回
  21. function f_v_back() {
  22. C_keys_list = C_keys.split(",")
  23. C_keys_list.pop()
  24. hrefurl = "?T_key="+C_keys_list.join(",")
  25. if (false != C_modex){
  26. hrefurl += "&T_mode="+C_modex
  27. }
  28. document.location.href = hrefurl
  29. }
  30. var V_kf_yd = 1
  31. function f_kf_open() {
  32. $("#map_kf").css("opacity", 1);
  33. $("#v_trail").css("opacity", 0);
  34. $("#R_KF_Column").show();
  35. $("#R_YD_Column").hide();
  36. V_kf_yd = 1
  37. f_view()
  38. }
  39. function f_yd_open() {
  40. $("#map_kf").css("opacity", 0);
  41. $("#v_trail").css("opacity", 1);
  42. $("#R_KF_Column").hide();
  43. $("#R_YD_Column").show();
  44. V_kf_yd = 2
  45. f_view()
  46. }
  47. // 视图数据改变
  48. function f_view() {
  49. // 地图加载
  50. if (V_kf_yd == 1) {
  51. f_v_map();
  52. }
  53. // 轨迹加载
  54. if (C_json.Device.T_移动总数 > 0 && V_kf_yd == 2) {
  55. f_v_trail()
  56. }
  57. // 屏蔽按钮
  58. if(C_json.Device.T_库房总数 == 0){
  59. $("#v_open_KF").hide();
  60. }
  61. if(C_json.Device.T_移动总数 == 0){
  62. $("#v_open_YD").hide();
  63. }
  64. $("#T_公司名称").html(C_json.Company_name + "-冷链药品质量安全智慧平台")
  65. $("title").html(C_json.Company_name + "-冷链药品质量安全智慧平台")
  66. // 设备类
  67. $("#T_终端总数").html(C_json.Device.T_库房总数 + C_json.Device.T_移动总数)
  68. $("#T_库房总数").html(C_json.Device.T_库房总数)
  69. $("#T_移动总数").html(C_json.Device.T_移动总数)
  70. $("#T_移动总数s").html(C_json.Device.T_移动总数)
  71. $("#T_移动离线总数").html(C_json.Device.T_移动离线总数)
  72. $("#T_移动监控总数").html(C_json.Device.T_移动监控总数)
  73. // 报警类
  74. // $("#T_库房报警总数").html(C_json.Warning.T_库房报警总数)
  75. $("#T_库房未处理总数").html(C_json.Warning.T_库房未处理总数)
  76. $("#T_库房设备报警数_今天").html(C_json.Warning.T_库房设备报警数_今天)
  77. $("#T_库房报警设备数_今天").html(C_json.Warning.T_库房报警设备数_今天)
  78. // $("#T_库房设备报警数_昨天").html(C_json.Warning.T_库房设备报警数_昨天)
  79. // $("#T_库房设备报警数_近7天").html(C_json.Warning.T_库房设备报警数_近7天)
  80. // $("#T_库房设备报警数_本月").html(C_json.Warning.T_库房设备报警数_本月)
  81. // $("#T_库房设备报警数_上一月").html(C_json.Warning.T_库房设备报警数_上一月)
  82. // $("#T_移动警数总数").html(C_json.Warning.T_移动警数总数)
  83. $("#T_移动未处理总数").html(C_json.Warning.T_移动未处理总数)
  84. $("#T_移动设备报警数_今天").html(C_json.Warning.T_移动设备报警数_今天)
  85. $("#T_移动设备报警数_今天s").html(C_json.Warning.T_移动设备报警数_今天)
  86. // $("#T_移动设备报警数_昨天").html(C_json.Warning.T_移动设备报警数_昨天)
  87. // $("#T_移动设备报警数_近7天").html(C_json.Warning.T_移动设备报警数_近7天)
  88. // $("#T_移动设备报警数_本月").html(C_json.Warning.T_移动设备报警数_本月)
  89. // $("#T_移动设备报警数_上一月").html(C_json.Warning.T_移动设备报警数_上一月)
  90. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天)
  91. if (w_x_ != 0) {
  92. w_x_ = w_x_ / (C_json.Device.T_库房总数)
  93. w_x_ *= 100
  94. }
  95. $("#T_今日库房报警率").html(w_x_.toFixed(1) + "%")
  96. $("#T_今日报警总数").html(parseInt(C_json.Warning.T_库房设备报警数_今天) + parseInt(C_json.Warning.T_移动设备报警数_今天))
  97. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天) + parseInt(C_json.Warning.T_移动报警设备数_今天)
  98. if (w_x_ != 0) {
  99. w_x_ = w_x_ / (C_json.Device.T_库房总数 + C_json.Device.T_移动总数)
  100. w_x_ *= 100
  101. }
  102. $("#T_今日报警率").html(w_x_.toFixed(1) + "%")
  103. // $("#T_今日报警率").html(parseInt(w_x_) + "%")
  104. $("#T_今日未处理总数").html(parseInt(C_json.Warning.T_库房未处理总数) + parseInt(C_json.Warning.T_移动未处理总数))
  105. // 任务类
  106. $("#T_任务总数_今天").html(C_json.Task.T_任务总数_今天)
  107. $("#T_任务总数_今天s").html(C_json.Task.T_任务总数_今天)
  108. // $("#T_任务总数_昨天").html(C_json.Task.T_任务总数_昨天)
  109. // $("#T_任务总数_近7天").html(C_json.Task.T_任务总数_近7天)
  110. // $("#T_任务总数_本月").html(C_json.Task.T_任务总数_本月)
  111. // $("#T_任务总数_上一月").html(C_json.Task.T_任务总数_上一月)
  112. $("#T_任务设备数_今天").html(C_json.Task.T_任务设备数_今天)
  113. // $("#T_任务设备数_昨天").html(C_json.Task.T_任务设备数_昨天 )
  114. // $("#T_任务设备数_近7天").html(C_json.Task.T_任务设备数_近7天)
  115. // $("#T_任务设备数_本月").html(C_json.Task.T_任务设备数_本月 )
  116. // $("#T_任务设备数_上一月").html(C_json.Task.T_任务设备数_上一月)
  117. w_x_ = parseInt(C_json.Task.T_任务设备数_今天)
  118. if (w_x_ != 0) {
  119. w_x_ = w_x_ / C_json.Device.T_移动总数
  120. w_x_ *= 100
  121. }
  122. $("#T_今日闲置设备").html(w_x_.toFixed(1) + "%")
  123. $("#T_今日闲置设备s").html(w_x_.toFixed(1) + "%")
  124. // 报警统计
  125. try {
  126. $('#Company_Next_WarningG').liMarquee('destroy'); // 清除滚动
  127. }
  128. catch (e) {
  129. alert(e);
  130. }
  131. $("#Company_Next_WarningG").html("<ul id=\"Company_Next_WarningL\"></ul>")// 清除内容
  132. Company_Next_W_l = []
  133. f_Company_Next_报警统计(C_json)
  134. Company_Next_W_l = Company_Next_W_l.filter((value, index, self) => {
  135. return self.findIndex(p => p.name === value.name) === index;
  136. });
  137. Company_Next_W_l_r = Company_Next_W_l.sort((a, b) => b.Warning - a.Warning);
  138. for (var C_key in Company_Next_W_l_r){
  139. C_b = Company_Next_W_l_r[C_key]
  140. $("#Company_Next_WarningL").append("<li><p><span>" + C_b.name + "</span><span>" + (C_b.Device) + "</span><span>" + C_b.Warning + "%</span></p></li>")
  141. }
  142. // 开始滚动
  143. $('#Company_Next_WarningG').liMarquee({
  144. direction: 'up',//身上滚动
  145. runshort: false,//内容不足时不滚动
  146. scrollamount: 20//速度
  147. });
  148. // console.log("Company_Next_W_l:", Company_Next_W_l)
  149. // 图表
  150. echarts_报警设备数近7天曲线图()
  151. // echarts_设备报警率排名()
  152. echarts_探头报警率排名()
  153. if (V_kf_yd == 1) {
  154. echarts_库房端报警类型统计()
  155. } else {
  156. echarts_移动端任务曲线图()
  157. }
  158. // 任务统计
  159. $('#Company_Next_TaskG').liMarquee('destroy'); // 清除滚动
  160. $("#Company_Next_TaskG").html("<ul id=\"Company_Next_TaskL\"></ul>")// 清除内容
  161. Company_Next_T_l = []
  162. f_Company_Next_任务统计(C_json)
  163. Company_Next_T_l = Company_Next_T_l.filter((value, index, self) => {
  164. return self.findIndex(p => p.name === value.name) === index;
  165. });
  166. Company_Next_T_l_r = Company_Next_T_l.sort((a, b) => b.Task - a.Task);
  167. for (var C_key in Company_Next_T_l_r){
  168. C_b = Company_Next_T_l_r[C_key]
  169. $("#Company_Next_TaskL").append("<li><p><span>" + C_b.name + "</span><span>" + (C_b.Task) + "</span><span>" + C_b.DeviceT + "%</span></p></li>")
  170. }
  171. $('#Company_Next_TaskG').liMarquee({
  172. direction: 'up',//身上滚动
  173. runshort: false,//内容不足时不滚动
  174. scrollamount: 20//速度
  175. });
  176. // 中间 视图显示
  177. if (V_kf_yd === 1) {
  178. // 库房端
  179. $("#T_C_1").html(Company_Next_T_l.length)// 公司下一级统计
  180. $("#T_C_2").html(C_json.Warning.T_库房设备报警数_今天)// 公司下一级统计
  181. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天)
  182. if (w_x_ != 0) {
  183. w_x_ = w_x_ / C_json.Device.T_库房总数
  184. w_x_ *= 100
  185. }
  186. $("#T_C_3").html(w_x_.toFixed(1) + "%")// 公司下一级统计
  187. $("#T_Cn_1").html("公司/门店 数量")
  188. $("#T_Cn_2").html("今日库房报警次数")
  189. $("#T_Cn_3").html("今日库房报警率")
  190. } else {
  191. // 移动端
  192. $("#T_C_1").html(Company_Next_T_l.length)// 公司下一级统计
  193. $("#T_C_2").html(C_json.Device.T_移动监控总数)// 公司下一级统计
  194. w_x_ = parseInt(C_json.Warning.T_移动报警设备数_今天)
  195. if (w_x_ != 0) {
  196. w_x_ = w_x_ / C_json.Device.T_移动总数
  197. w_x_ *= 100
  198. }
  199. $("#T_C_3").html(w_x_.toFixed(1) + "%")// 公司下一级统计
  200. $("#T_Cn_1").html("公司/门店 数量")
  201. $("#T_Cn_2").html("监控总数")
  202. $("#T_Cn_3").html("今日移动端报警率")
  203. }
  204. let isKf =true
  205. document.getElementById('transportButton').addEventListener('click', function (){
  206. console.log("点击了按钮")
  207. if (V_kf_yd === 1) {
  208. if (isKf){
  209. isKf = false
  210. document.getElementById('kf_Column').style.display="none"
  211. document.getElementById('yd_Column').style.display="block"
  212. document.getElementById('transportButton').innerText = '库房端'
  213. document.getElementById('title').innerText= "移动端汇总统计"
  214. }else{
  215. isKf = true
  216. document.getElementById('yd_Column').style.display="none"
  217. document.getElementById('kf_Column').style.display="block"
  218. document.getElementById('transportButton').innerText = '移动端'
  219. document.getElementById('title').innerText= "库房端汇总统计"
  220. }
  221. }
  222. })
  223. }
  224. // 公司下一级统计
  225. Company_Next_W_l = []
  226. function f_Company_Next_报警统计(C_j) {
  227. for (var C_key in C_j.Children) {
  228. C_b = C_j.Children[C_key]
  229. f_Company_Next_报警统计(C_b)
  230. if (C_b.Children.length != 0) continue;
  231. Warning = 0
  232. if (C_b.Warning.T_库房报警设备数_今天 > 0) {
  233. Warning = parseInt((C_b.Device.T_库房总数 + C_b.Device.T_移动总数) / C_b.Warning.T_库房报警设备数_今天)
  234. }
  235. // console.log({"name":C_b.Company_name,"Device":C_b.Device.T_库房总数+C_b.Device.T_移动总数,"Warning": Warning})
  236. Company_Next_W_l.push({
  237. "name": C_b.Company_name,
  238. "Device": C_b.Device.T_库房总数 + C_b.Device.T_移动总数,
  239. "Warning": Warning
  240. })
  241. }
  242. }
  243. // 公司下一级任务统计
  244. Company_Next_T_l = []
  245. function f_Company_Next_任务统计(C_j) {
  246. for (var C_key in C_j.Children) {
  247. C_b = C_j.Children[C_key]
  248. f_Company_Next_任务统计(C_b)
  249. if (C_b.Children.length != 0) continue;
  250. // console.log({"name":C_b.Company_name,"Device":C_b.Device.T_库房总数+C_b.Device.T_移动总数,"Warning": Warning})
  251. T_x_ = C_b.Task.T_任务设备数_今天
  252. if(T_x_ != 0){
  253. T_x_ = T_x_ / C_json.Device.T_移动总数
  254. T_x_ *= 100
  255. }
  256. Company_Next_T_l.push({
  257. "name": C_b.Company_name,
  258. "Task": C_b.Task.T_任务总数_今天,
  259. "DeviceT": T_x_.toFixed(1)
  260. })
  261. }
  262. }
  263. // 公司下一级统计
  264. function f_Company_Next_公司下一级统计(C_j) {
  265. var Company_Next_num = 0
  266. for (var C_key in C_j.Children) {
  267. C_b = C_j.Children[C_key]
  268. Company_Next_num += f_Company_Next_公司下一级统计(C_b)
  269. if (C_b.Children.length != 0) continue;
  270. Company_Next_num += 1
  271. }
  272. return Company_Next_num
  273. }
  274. // 设备报警率占比
  275. function echarts_报警设备数近7天曲线图() {
  276. var myChart = echarts.init(document.getElementById('echarts_报警设备数近7天曲线图'));
  277. xAxis_data = []
  278. yAxis_data = []
  279. xAxis_data30 = []
  280. yAxis_data30 = []
  281. xAxis_data90 = []
  282. yAxis_data90 = []
  283. for (var C_key in C_json.Warning.T_报警设备数_近7天) {
  284. C_b = C_json.Warning.T_报警设备数_近7天[C_key]
  285. xAxis_data.push(C_key)
  286. yAxis_data.push(C_b)
  287. }
  288. for (var C_key in C_json.Warning.T_报警设备数_近30天) {
  289. C_b = C_json.Warning.T_报警设备数_近30天[C_key]
  290. xAxis_data30.push(C_key)
  291. yAxis_data30.push(C_b)
  292. }
  293. for (var C_key in C_json.Warning.T_报警设备数_近90天) {
  294. C_b = C_json.Warning.T_报警设备数_近90天[C_key]
  295. xAxis_data90.push(C_key)
  296. yAxis_data90.push(C_b)
  297. }
  298. let option = {
  299. // legend: {
  300. // icon:"circle",
  301. // top: "0",
  302. // width:'100%',
  303. // right: 'center',
  304. // itemWidth: 10,
  305. // itemHeight: 10,
  306. // data: ['库房端'],
  307. // textStyle: {
  308. // color: "rgba(255,255,255,.5)" },
  309. // },
  310. tooltip: {
  311. trigger: 'axis',
  312. axisPointer: {
  313. lineStyle: {
  314. color: '#dddc6b'
  315. }
  316. }
  317. },
  318. grid: {
  319. left: '0',
  320. top: '5',
  321. right: '15',
  322. bottom: '0',
  323. containLabel: true
  324. },
  325. xAxis: [{
  326. type: 'category',
  327. boundaryGap: false,
  328. axisLabel: {
  329. textStyle: {
  330. color: "rgba(255,255,255,.5)",
  331. // fontSize:10
  332. },
  333. },
  334. axisLine: {
  335. lineStyle: {
  336. color: 'rgba(255,255,255,.1)'
  337. }
  338. },
  339. data: xAxis_data
  340. }, {
  341. axisPointer: {show: false},
  342. axisLine: {show: false},
  343. position: 'bottom',
  344. offset: 20,
  345. }],
  346. yAxis: [{
  347. type: 'value',
  348. axisTick: {show: false},
  349. splitNumber: 4,
  350. axisLine: {
  351. lineStyle: {
  352. color: 'rgba(255,255,255,.1)'
  353. }
  354. },
  355. axisLabel: {
  356. textStyle: {
  357. color: "rgba(255,255,255,.5)",
  358. //fontSize:10
  359. },
  360. },
  361. splitLine: {
  362. lineStyle: {
  363. color: 'rgba(255,255,255,.1)',
  364. type: 'dotted',
  365. }
  366. }
  367. }],
  368. series: [
  369. {
  370. name: '库房端',
  371. type: 'line',
  372. smooth: true,
  373. symbol: 'circle',
  374. symbolSize: 5,
  375. showSymbol: false,
  376. lineStyle: {
  377. normal: {
  378. color: 'rgba(31, 174, 234, 1)',
  379. width: 2
  380. }
  381. },
  382. areaStyle: {
  383. normal: {
  384. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  385. offset: 0,
  386. color: 'rgba(31, 174, 234, 0.4)'
  387. }, {
  388. offset: 0.8,
  389. color: 'rgba(31, 174, 234, 0.1)'
  390. }], false),
  391. shadowColor: 'rgba(0, 0, 0, 0.1)',
  392. }
  393. },
  394. itemStyle: {
  395. normal: {
  396. color: '#1f7eea',
  397. borderColor: 'rgba(31, 174, 234, .1)',
  398. borderWidth: 5
  399. }
  400. },
  401. data: yAxis_data
  402. },
  403. // {
  404. // name: '移动端',
  405. // type: 'line',
  406. // smooth: true,
  407. // symbol: 'circle',
  408. // symbolSize: 5,
  409. // showSymbol: false,
  410. // lineStyle: {
  411. //
  412. // normal: {
  413. // color: '#6bdd9b',
  414. // width: 2
  415. // }
  416. // },
  417. // areaStyle: {
  418. // normal: {
  419. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  420. // offset: 0,
  421. // color: 'rgba(107, 221, 155, 0.4)'
  422. // }, {
  423. // offset: 0.8,
  424. // color: 'rgba(107, 221, 155, 0.1)'
  425. // }], false),
  426. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  427. // }
  428. // },
  429. // itemStyle: {
  430. // normal: {
  431. // color: '#6bdd9b',
  432. // borderColor: 'rgba(107, 221, 155, .1)',
  433. // borderWidth: 5
  434. // }
  435. // },
  436. // data: [ 5, 3, 7, 1, 8, 3, 5]
  437. //
  438. // },
  439. ]
  440. };
  441. let option1 = {
  442. // legend: {
  443. // icon:"circle",
  444. // top: "0",
  445. // width:'100%',
  446. // right: 'center',
  447. // itemWidth: 10,
  448. // itemHeight: 10,
  449. // data: ['库房端'],
  450. // textStyle: {
  451. // color: "rgba(255,255,255,.5)" },
  452. // },
  453. tooltip: {
  454. trigger: 'axis',
  455. axisPointer: {
  456. lineStyle: {
  457. color: '#dddc6b'
  458. }
  459. }
  460. },
  461. grid: {
  462. left: '0',
  463. top: '5',
  464. right: '15',
  465. bottom: '0',
  466. containLabel: true
  467. },
  468. xAxis: [{
  469. type: 'category',
  470. boundaryGap: false,
  471. axisLabel: {
  472. textStyle: {
  473. color: "rgba(255,255,255,.5)",
  474. // fontSize:10
  475. },
  476. },
  477. axisLine: {
  478. lineStyle: {
  479. color: 'rgba(255,255,255,.1)'
  480. }
  481. },
  482. data: xAxis_data30
  483. }, {
  484. axisPointer: {show: false},
  485. axisLine: {show: false},
  486. position: 'bottom',
  487. offset: 20,
  488. }],
  489. yAxis: [{
  490. type: 'value',
  491. axisTick: {show: false},
  492. splitNumber: 4,
  493. axisLine: {
  494. lineStyle: {
  495. color: 'rgba(255,255,255,.1)'
  496. }
  497. },
  498. axisLabel: {
  499. textStyle: {
  500. color: "rgba(255,255,255,.5)",
  501. //fontSize:10
  502. },
  503. },
  504. splitLine: {
  505. lineStyle: {
  506. color: 'rgba(255,255,255,.1)',
  507. type: 'dotted',
  508. }
  509. }
  510. }],
  511. series: [
  512. {
  513. name: '库房端',
  514. type: 'line',
  515. smooth: true,
  516. symbol: 'circle',
  517. symbolSize: 5,
  518. showSymbol: false,
  519. lineStyle: {
  520. normal: {
  521. color: 'rgba(31, 174, 234, 1)',
  522. width: 2
  523. }
  524. },
  525. areaStyle: {
  526. normal: {
  527. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  528. offset: 0,
  529. color: 'rgba(31, 174, 234, 0.4)'
  530. }, {
  531. offset: 0.8,
  532. color: 'rgba(31, 174, 234, 0.1)'
  533. }], false),
  534. shadowColor: 'rgba(0, 0, 0, 0.1)',
  535. }
  536. },
  537. itemStyle: {
  538. normal: {
  539. color: '#1f7eea',
  540. borderColor: 'rgba(31, 174, 234, .1)',
  541. borderWidth: 5
  542. }
  543. },
  544. data: yAxis_data30
  545. },
  546. // {
  547. // name: '移动端',
  548. // type: 'line',
  549. // smooth: true,
  550. // symbol: 'circle',
  551. // symbolSize: 5,
  552. // showSymbol: false,
  553. // lineStyle: {
  554. //
  555. // normal: {
  556. // color: '#6bdd9b',
  557. // width: 2
  558. // }
  559. // },
  560. // areaStyle: {
  561. // normal: {
  562. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  563. // offset: 0,
  564. // color: 'rgba(107, 221, 155, 0.4)'
  565. // }, {
  566. // offset: 0.8,
  567. // color: 'rgba(107, 221, 155, 0.1)'
  568. // }], false),
  569. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  570. // }
  571. // },
  572. // itemStyle: {
  573. // normal: {
  574. // color: '#6bdd9b',
  575. // borderColor: 'rgba(107, 221, 155, .1)',
  576. // borderWidth: 5
  577. // }
  578. // },
  579. // data: [ 5, 3, 7, 1, 8, 3, 5]
  580. //
  581. // },
  582. ]
  583. };
  584. let option2 = {
  585. // legend: {
  586. // icon:"circle",
  587. // top: "0",
  588. // width:'100%',
  589. // right: 'center',
  590. // itemWidth: 10,
  591. // itemHeight: 10,
  592. // data: ['库房端'],
  593. // textStyle: {
  594. // color: "rgba(255,255,255,.5)" },
  595. // },
  596. tooltip: {
  597. trigger: 'axis',
  598. axisPointer: {
  599. lineStyle: {
  600. color: '#dddc6b'
  601. }
  602. }
  603. },
  604. grid: {
  605. left: '0',
  606. top: '5',
  607. right: '15',
  608. bottom: '0',
  609. containLabel: true
  610. },
  611. xAxis: [{
  612. type: 'category',
  613. boundaryGap: false,
  614. axisLabel: {
  615. textStyle: {
  616. color: "rgba(255,255,255,.5)",
  617. // fontSize:10
  618. },
  619. },
  620. axisLine: {
  621. lineStyle: {
  622. color: 'rgba(255,255,255,.1)'
  623. }
  624. },
  625. data: xAxis_data90
  626. }, {
  627. axisPointer: {show: false},
  628. axisLine: {show: false},
  629. position: 'bottom',
  630. offset: 20,
  631. }],
  632. yAxis: [{
  633. type: 'value',
  634. axisTick: {show: false},
  635. splitNumber: 4,
  636. axisLine: {
  637. lineStyle: {
  638. color: 'rgba(255,255,255,.1)'
  639. }
  640. },
  641. axisLabel: {
  642. textStyle: {
  643. color: "rgba(255,255,255,.5)",
  644. //fontSize:10
  645. },
  646. },
  647. splitLine: {
  648. lineStyle: {
  649. color: 'rgba(255,255,255,.1)',
  650. type: 'dotted',
  651. }
  652. }
  653. }],
  654. series: [
  655. {
  656. name: '库房端',
  657. type: 'line',
  658. smooth: true,
  659. symbol: 'circle',
  660. symbolSize: 5,
  661. showSymbol: false,
  662. lineStyle: {
  663. normal: {
  664. color: 'rgba(31, 174, 234, 1)',
  665. width: 2
  666. }
  667. },
  668. areaStyle: {
  669. normal: {
  670. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  671. offset: 0,
  672. color: 'rgba(31, 174, 234, 0.4)'
  673. }, {
  674. offset: 0.8,
  675. color: 'rgba(31, 174, 234, 0.1)'
  676. }], false),
  677. shadowColor: 'rgba(0, 0, 0, 0.1)',
  678. }
  679. },
  680. itemStyle: {
  681. normal: {
  682. color: '#1f7eea',
  683. borderColor: 'rgba(31, 174, 234, .1)',
  684. borderWidth: 5
  685. }
  686. },
  687. data: yAxis_data90
  688. },
  689. // {
  690. // name: '移动端',
  691. // type: 'line',
  692. // smooth: true,
  693. // symbol: 'circle',
  694. // symbolSize: 5,
  695. // showSymbol: false,
  696. // lineStyle: {
  697. //
  698. // normal: {
  699. // color: '#6bdd9b',
  700. // width: 2
  701. // }
  702. // },
  703. // areaStyle: {
  704. // normal: {
  705. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  706. // offset: 0,
  707. // color: 'rgba(107, 221, 155, 0.4)'
  708. // }, {
  709. // offset: 0.8,
  710. // color: 'rgba(107, 221, 155, 0.1)'
  711. // }], false),
  712. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  713. // }
  714. // },
  715. // itemStyle: {
  716. // normal: {
  717. // color: '#6bdd9b',
  718. // borderColor: 'rgba(107, 221, 155, .1)',
  719. // borderWidth: 5
  720. // }
  721. // },
  722. // data: [ 5, 3, 7, 1, 8, 3, 5]
  723. //
  724. // },
  725. ]
  726. };
  727. myChart.setOption(option);
  728. window.addEventListener("resize", function () {
  729. myChart.resize();
  730. });
  731. document.getElementById('days7').addEventListener('click', function (){
  732. myChart.setOption(option);
  733. document.getElementById('deviceWarning').innerText = '周设备报警曲线图';
  734. })
  735. document.getElementById('days30').addEventListener('click', function (){
  736. myChart.setOption(option1);
  737. document.getElementById('deviceWarning').innerText = '月设备报警曲线图';
  738. })
  739. document.getElementById('days120').addEventListener('click', function (){
  740. myChart.setOption(option2);
  741. document.getElementById('deviceWarning').innerText = '季度设备报警曲线图';
  742. })
  743. $(".sebtn a").click(function () {
  744. $(this).addClass("active").siblings().removeClass("active")
  745. })
  746. $(".sebtn a").eq(0).click(function () {
  747. myChart.setOption(option1);
  748. })
  749. $(".sebtn a").eq(1).click(function () {
  750. myChart.setOption(option2);
  751. })
  752. $(".sebtn a").eq(2).click(function () {
  753. myChart.setOption(option3);
  754. })
  755. }
  756. // 设备报警率占比
  757. function echarts_设备报警率排名() {
  758. var myChart = echarts.init(document.getElementById('echarts_设备报警率排名'));
  759. // option = {
  760. // legend: {
  761. // icon:"circle",
  762. // top: "0",
  763. // width:'100%',
  764. // right: 'center',
  765. // itemWidth: 10,
  766. // itemHeight: 10,
  767. // data: ['库房端', '移动端'],
  768. // textStyle: {
  769. // color: "rgba(255,255,255,.5)" },
  770. // },
  771. //
  772. // tooltip: {
  773. // trigger: 'axis',
  774. // axisPointer: {
  775. // lineStyle: {
  776. // color: '#dddc6b'
  777. // }
  778. // }
  779. // },
  780. // grid: {
  781. // left: '0',
  782. // top: '30',
  783. // right: '10',
  784. // bottom: '-15',
  785. // containLabel: true
  786. // },
  787. //
  788. // xAxis: [{
  789. // type: 'category',
  790. // boundaryGap: false,
  791. // axisLabel: {
  792. // textStyle: {
  793. // color: "rgba(255,255,255,.5)",
  794. // // fontSize:10
  795. // },
  796. // },
  797. // axisLine: {
  798. // lineStyle: {
  799. // color: 'rgba(255,255,255,.1)'
  800. // }
  801. // },
  802. // data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  803. //
  804. // }, {
  805. //
  806. // axisPointer: {show: false},
  807. // axisLine: { show: false},
  808. // position: 'bottom',
  809. // offset: 20,
  810. //
  811. //
  812. //
  813. // }],
  814. //
  815. // yAxis: [{
  816. // type: 'value',
  817. // axisTick: {show: false},
  818. // splitNumber: 4,
  819. // axisLine: {
  820. // lineStyle: {
  821. // color: 'rgba(255,255,255,.1)'
  822. // }
  823. // },
  824. // axisLabel: {
  825. // textStyle: {
  826. // color: "rgba(255,255,255,.5)",
  827. // //fontSize:10
  828. // },
  829. // },
  830. //
  831. // splitLine: {
  832. // lineStyle: {
  833. // color: 'rgba(255,255,255,.1)',
  834. // type: 'dotted',
  835. // }
  836. // }
  837. // }],
  838. // series: [
  839. // {
  840. // name: '库房端',
  841. // type: 'line',
  842. // smooth: true,
  843. // symbol: 'circle',
  844. // symbolSize: 5,
  845. // showSymbol: false,
  846. // lineStyle: {
  847. //
  848. // normal: {
  849. // color: 'rgba(31, 174, 234, 1)',
  850. // width: 2
  851. // }
  852. // },
  853. // areaStyle: {
  854. // normal: {
  855. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  856. // offset: 0,
  857. // color: 'rgba(31, 174, 234, 0.4)'
  858. // }, {
  859. // offset: 0.8,
  860. // color: 'rgba(31, 174, 234, 0.1)'
  861. // }], false),
  862. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  863. // }
  864. // },
  865. // itemStyle: {
  866. // normal: {
  867. // color: '#1f7eea',
  868. // borderColor: 'rgba(31, 174, 234, .1)',
  869. // borderWidth: 5
  870. // }
  871. // },
  872. // data: [3, 6, 3, 6, 3, 9, 3]
  873. //
  874. // },
  875. // {
  876. // name: '移动端',
  877. // type: 'line',
  878. // smooth: true,
  879. // symbol: 'circle',
  880. // symbolSize: 5,
  881. // showSymbol: false,
  882. // lineStyle: {
  883. //
  884. // normal: {
  885. // color: '#6bdd9b',
  886. // width: 2
  887. // }
  888. // },
  889. // areaStyle: {
  890. // normal: {
  891. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  892. // offset: 0,
  893. // color: 'rgba(107, 221, 155, 0.4)'
  894. // }, {
  895. // offset: 0.8,
  896. // color: 'rgba(107, 221, 155, 0.1)'
  897. // }], false),
  898. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  899. // }
  900. // },
  901. // itemStyle: {
  902. // normal: {
  903. // color: '#6bdd9b',
  904. // borderColor: 'rgba(107, 221, 155, .1)',
  905. // borderWidth: 5
  906. // }
  907. // },
  908. // data: [ 5, 3, 7, 1, 8, 3, 5]
  909. //
  910. // },
  911. // ]
  912. //
  913. // };
  914. yAxis_data = []
  915. series_data = []
  916. Company_Next_W_l_ = Company_Next_W_l.sort((a, b) => a.Warning - b.Warning).slice(-10);
  917. for (var C_key in Company_Next_W_l_) {
  918. C_b = Company_Next_W_l_[C_key]
  919. if(C_b.Warning > 0){
  920. yAxis_data.push(C_b.name)
  921. series_data.push(C_b.Warning)
  922. }
  923. }
  924. option = {
  925. // title: {
  926. // text: 'World Population'
  927. // },
  928. tooltip: {
  929. trigger: 'axis',
  930. axisPointer: {
  931. type: 'shadow'
  932. }
  933. },
  934. // legend: {},
  935. grid: {
  936. top: '0%',
  937. left: '0%',
  938. right: '0%',
  939. bottom: '0%',
  940. containLabel: true
  941. },
  942. xAxis: {
  943. type: 'value',
  944. boundaryGap: [0, 0.01],
  945. show: false
  946. },
  947. yAxis: {
  948. type: 'category',
  949. data: yAxis_data
  950. },
  951. series: [
  952. {
  953. name: '报警率',
  954. type: 'bar',
  955. itemStyle: {
  956. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  957. { offset: 0, color: '#596db0' },
  958. { offset: 0.5, color: '#4a63b4' },
  959. { offset:1, color: '#435eb7' }
  960. ])
  961. },
  962. data: series_data
  963. }
  964. ]
  965. };
  966. // option = {
  967. // legend: {
  968. // icon: "circle",
  969. // top: "0",
  970. // width: '100%',
  971. // right: 'center',
  972. // itemWidth: 10,
  973. // itemHeight: 10,
  974. // // textStyle: {
  975. // // color: "rgba(255,255,255,.5)"
  976. // // },
  977. // },
  978. //
  979. // tooltip: {
  980. // trigger: 'axis',
  981. // axisPointer: {
  982. // lineStyle: {
  983. // color: '#dddc6b'
  984. // }
  985. // }
  986. // },
  987. // grid: {
  988. // left: '0',
  989. // top: '30',
  990. // right: '0',
  991. // bottom: '-15',
  992. // containLabel: true
  993. // },
  994. //
  995. // dataset: [
  996. // {
  997. // dimensions: ['name', 'Device', "Warning"],
  998. // // source: [
  999. // // ['11111111', 41],
  1000. // // ['22222222', 241],
  1001. // // ['333333333', 341],
  1002. // // ['4444444444', 141],
  1003. // // ['555555555', 421],
  1004. // // ['666666666', 141],
  1005. // // ['77777777', 241],
  1006. // // ['8888888888', 411],
  1007. // // ['9999999', 421],
  1008. // // ['123123123', 414],
  1009. // // ['456456456', 431],
  1010. // //
  1011. // // ]
  1012. // source: Company_Next_W_l,
  1013. // },
  1014. // {
  1015. // transform: {
  1016. // type: 'sort',
  1017. // config: {dimension: 'Warning', order: 'desc'}
  1018. // }
  1019. // }
  1020. // ],
  1021. // xAxis: {
  1022. // type: 'category',
  1023. // axisLabel: {interval: 0, rotate: 30},
  1024. // max: 6 // only the largest 3 bars will be displayed
  1025. // },
  1026. // yAxis: {},
  1027. // series: {
  1028. // type: 'bar',
  1029. // encode: {x: 'name', y: 'Warning'},
  1030. // datasetIndex: 1
  1031. // }
  1032. // };
  1033. myChart.setOption(option);
  1034. window.addEventListener("resize", function () {
  1035. myChart.resize();
  1036. });
  1037. $(".sebtn a").click(function () {
  1038. $(this).addClass("active").siblings().removeClass("active")
  1039. })
  1040. $(".sebtn a").eq(0).click(function () {
  1041. myChart.setOption(option1);
  1042. })
  1043. $(".sebtn a").eq(1).click(function () {
  1044. myChart.setOption(option2);
  1045. })
  1046. $(".sebtn a").eq(2).click(function () {
  1047. myChart.setOption(option3);
  1048. })
  1049. }
  1050. function echarts_探头报警率排名() {
  1051. var myChart = echarts.init(document.getElementById('echarts_探头报警率排名'));
  1052. yAxis_data = []
  1053. series_data = []
  1054. yAxis_dataMonth = []
  1055. series_dataMonth = []
  1056. yAxis_dataQuarter = []
  1057. series_dataQuarter = []
  1058. // Company_Next_W_l_ = Company_Next_W_l.sort((a, b) => a.Warning - b.Warning).slice(-10);
  1059. //每日排名
  1060. let dataOneday = [];
  1061. for (var C_key in C_json.Warning.T_探头报警类型统计) {
  1062. C_b = C_json.Warning.T_探头报警类型统计[C_key]
  1063. dataOneday.push([C_key, C_b])
  1064. }
  1065. dataOneday.sort((a, b) => a[1] - b[1]);
  1066. dataOneday.forEach(([key, value]) => {
  1067. yAxis_data.push(key)
  1068. series_data.push(value)
  1069. });
  1070. //月度排名
  1071. let dataMonth = [];
  1072. for (var C_key in C_json.Warning.T_探头报警类型统计_30天) {
  1073. C_b = C_json.Warning.T_探头报警类型统计_30天[C_key]
  1074. dataMonth.push([C_key, C_b])
  1075. }
  1076. dataMonth.sort((a, b) => a[1] - b[1]);
  1077. dataMonth.forEach(([key, value]) => {
  1078. yAxis_dataMonth.push(key)
  1079. series_dataMonth.push(value)
  1080. });
  1081. //季度排名
  1082. let dataQuarter = [];
  1083. for (var C_key in C_json.Warning.T_探头报警类型统计_90天) {
  1084. C_b = C_json.Warning.T_探头报警类型统计_90天[C_key]
  1085. dataQuarter.push([C_key, C_b]);
  1086. }
  1087. dataQuarter.sort((a, b) => a[1] - b[1]);
  1088. dataQuarter.forEach(([key, value]) => {
  1089. yAxis_dataQuarter.push(key);
  1090. series_dataQuarter.push(value);
  1091. });
  1092. let option = {
  1093. tooltip: {
  1094. trigger: 'axis',
  1095. axisPointer: {
  1096. type: 'shadow'
  1097. }
  1098. },
  1099. grid: {
  1100. top: '0%',
  1101. left: '0%',
  1102. right: '0%',
  1103. bottom: '0%',
  1104. containLabel: true
  1105. },
  1106. xAxis: {
  1107. type: 'value',
  1108. boundaryGap: [0, 0.01],
  1109. show: false
  1110. },
  1111. yAxis: {
  1112. type: 'category',
  1113. data: yAxis_data
  1114. },
  1115. series: [
  1116. {
  1117. name: '报警数量',
  1118. type: 'bar',
  1119. itemStyle: {
  1120. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  1121. {offset: 0, color: '#596db0'},
  1122. {offset: 0.5, color: '#4a63b4'},
  1123. {offset: 1, color: '#435eb7'}
  1124. ])
  1125. },
  1126. data: series_data
  1127. }
  1128. ]
  1129. };
  1130. let option1 = {
  1131. tooltip: {
  1132. trigger: 'axis',
  1133. axisPointer: {
  1134. type: 'shadow'
  1135. }
  1136. },
  1137. grid: {
  1138. top: '0%',
  1139. left: '0%',
  1140. right: '0%',
  1141. bottom: '0%',
  1142. containLabel: true
  1143. },
  1144. xAxis: {
  1145. type: 'value',
  1146. boundaryGap: [0, 0.01],
  1147. show: false
  1148. },
  1149. yAxis: {
  1150. type: 'category',
  1151. data: yAxis_dataMonth
  1152. },
  1153. series: [
  1154. {
  1155. name: '报警数量',
  1156. type: 'bar',
  1157. itemStyle: {
  1158. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  1159. {offset: 0, color: '#596db0'},
  1160. {offset: 0.5, color: '#4a63b4'},
  1161. {offset: 1, color: '#435eb7'}
  1162. ])
  1163. },
  1164. data: series_dataMonth
  1165. }
  1166. ]
  1167. };
  1168. let option2 = {
  1169. tooltip: {
  1170. trigger: 'axis',
  1171. axisPointer: {
  1172. type: 'shadow'
  1173. }
  1174. },
  1175. grid: {
  1176. top: '0%',
  1177. left: '0%',
  1178. right: '0%',
  1179. bottom: '0%',
  1180. containLabel: true
  1181. },
  1182. xAxis: {
  1183. type: 'value',
  1184. boundaryGap: [0, 0.01],
  1185. show: false
  1186. },
  1187. yAxis: {
  1188. type: 'category',
  1189. data: yAxis_dataQuarter
  1190. },
  1191. series: [
  1192. {
  1193. name: '报警数量',
  1194. type: 'bar',
  1195. itemStyle: {
  1196. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  1197. {offset: 0, color: '#596db0'},
  1198. {offset: 0.5, color: '#4a63b4'},
  1199. {offset: 1, color: '#435eb7'}
  1200. ])
  1201. },
  1202. data: series_dataQuarter
  1203. }
  1204. ]
  1205. };
  1206. myChart.setOption(option);
  1207. window.addEventListener("resize", function () {
  1208. myChart.resize();
  1209. });
  1210. document.getElementById('onedays').addEventListener('click', function (){
  1211. myChart.setOption(option);
  1212. document.getElementById('deviceRanking').innerText = '每日探头报警率排名';
  1213. })
  1214. document.getElementById('month').addEventListener('click', function (){
  1215. myChart.setOption(option1);
  1216. document.getElementById('deviceRanking').innerText = '月探头报警率排名';
  1217. })
  1218. document.getElementById('quarter').addEventListener('click', function (){
  1219. myChart.setOption(option2);
  1220. document.getElementById('deviceRanking').innerText = '季度探头报警率排名';
  1221. })
  1222. $(".sebtn a").click(function () {
  1223. $(this).addClass("active").siblings().removeClass("active")
  1224. })
  1225. $(".sebtn a").eq(0).click(function () {
  1226. myChart.setOption(option1);
  1227. })
  1228. $(".sebtn a").eq(1).click(function () {
  1229. myChart.setOption(option2);
  1230. })
  1231. $(".sebtn a").eq(2).click(function () {
  1232. myChart.setOption(option3);
  1233. })
  1234. }
  1235. // 移动端任务曲线图
  1236. function echarts_移动端任务曲线图() {
  1237. var myChart = echarts.init(document.getElementById('echarts_移动端任务曲线图'));
  1238. xAxis_data = []
  1239. yAxis_data = []
  1240. for (var C_key in C_json.Task.T_任务总数_近7天) {
  1241. xAxis_data.push(C_key)
  1242. yAxis_data.push(C_json.Task.T_任务总数_近7天[C_key])
  1243. }
  1244. option = {
  1245. // legend: {
  1246. // icon:"circle",
  1247. // top: "0",
  1248. // width:'100%',
  1249. // right: 'center',
  1250. // itemWidth: 10,
  1251. // itemHeight: 10,
  1252. // textStyle: {
  1253. // color: "rgba(255,255,255,.5)" },
  1254. // },
  1255. tooltip: {
  1256. trigger: 'axis',
  1257. axisPointer: {
  1258. lineStyle: {
  1259. color: '#dddc6b'
  1260. }
  1261. }
  1262. },
  1263. grid: {
  1264. left: '0',
  1265. top: '5',
  1266. right: '17',
  1267. bottom: '0',
  1268. containLabel: true
  1269. },
  1270. xAxis: [{
  1271. type: 'category',
  1272. boundaryGap: false,
  1273. axisLabel: {
  1274. textStyle: {
  1275. color: "rgba(255,255,255,.5)",
  1276. // fontSize:10
  1277. },
  1278. },
  1279. axisLine: {
  1280. lineStyle: {
  1281. color: 'rgba(255,255,255,.1)'
  1282. }
  1283. },
  1284. data: xAxis_data // ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  1285. }, {
  1286. axisPointer: {show: false},
  1287. axisLine: {show: false},
  1288. position: 'bottom',
  1289. offset: 20,
  1290. }],
  1291. yAxis: [{
  1292. type: 'value',
  1293. axisTick: {show: false},
  1294. splitNumber: 4,
  1295. axisLine: {
  1296. lineStyle: {
  1297. color: 'rgba(255,255,255,.1)'
  1298. }
  1299. },
  1300. axisLabel: {
  1301. textStyle: {
  1302. color: "rgba(255,255,255,.5)",
  1303. //fontSize:10
  1304. },
  1305. },
  1306. splitLine: {
  1307. lineStyle: {
  1308. color: 'rgba(255,255,255,.1)',
  1309. type: 'dotted',
  1310. }
  1311. }
  1312. }],
  1313. series: [
  1314. {
  1315. // radius: ['40%', '70%'],
  1316. // center: ['50%', '74%'],
  1317. name: '任务次数',
  1318. type: 'line',
  1319. smooth: true,
  1320. symbol: 'circle',
  1321. symbolSize: 5,
  1322. showSymbol: false,
  1323. containLabel: true,
  1324. lineStyle: {
  1325. normal: {
  1326. color: 'rgba(31, 174, 234, 1)',
  1327. width: 2
  1328. }
  1329. },
  1330. areaStyle: {
  1331. normal: {
  1332. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  1333. offset: 0,
  1334. color: 'rgba(31, 174, 234, 0.4)'
  1335. }, {
  1336. offset: 0.8,
  1337. color: 'rgba(31, 174, 234, 0.1)'
  1338. }], false),
  1339. shadowColor: 'rgba(0, 0, 0, 0.1)',
  1340. }
  1341. },
  1342. itemStyle: {
  1343. normal: {
  1344. color: '#1f7eea',
  1345. borderColor: 'rgba(31, 174, 234, .1)',
  1346. borderWidth: 5
  1347. }
  1348. },
  1349. data: yAxis_data // [3, 6, 3, 6, 3, 9, 3]
  1350. },
  1351. ]
  1352. };
  1353. myChart.setOption(option);
  1354. window.addEventListener("resize", function () {
  1355. myChart.resize();
  1356. });
  1357. $(".sebtn a").click(function () {
  1358. $(this).addClass("active").siblings().removeClass("active")
  1359. })
  1360. $(".sebtn a").eq(0).click(function () {
  1361. myChart.setOption(option1);
  1362. })
  1363. $(".sebtn a").eq(1).click(function () {
  1364. myChart.setOption(option2);
  1365. })
  1366. $(".sebtn a").eq(2).click(function () {
  1367. myChart.setOption(option3);
  1368. })
  1369. }
  1370. // 库房端报警类型统计
  1371. function echarts_库房端报警类型统计() {
  1372. const myChart = echarts.init(document.getElementById('echarts_库房端报警类型统计'));
  1373. data = []
  1374. datas = []
  1375. data_num = 0
  1376. data_nums = 0
  1377. for (var C_key in C_json.Warning.T_库房报警类型统计) {
  1378. data_num += C_json.Warning.T_库房报警类型统计[C_key]
  1379. data.push({value: C_json.Warning.T_库房报警类型统计[C_key], name: C_key})
  1380. console.log("C_json.Warning.T_库房报警类型统计",C_json.Warning.T_库房报警类型统计)
  1381. }
  1382. for (var C_key in C_json.Warning.T_移动报警类型统计) {
  1383. data_nums += C_json.Warning.T_移动报警类型统计[C_key]
  1384. datas.push({value: C_json.Warning.T_移动报警类型统计[C_key], name: C_key})
  1385. console.log("C_json.Warning.T_移动报警类型统计",data_nums)
  1386. }
  1387. data.push({
  1388. // make an record to fill the bottom 50%
  1389. value: data_num,
  1390. itemStyle: {
  1391. // stop the chart from rendering this piece
  1392. color: 'none',
  1393. decal: {
  1394. symbol: 'none'
  1395. }
  1396. },
  1397. label: {
  1398. show: false
  1399. }
  1400. })
  1401. let option = {
  1402. tooltip: {
  1403. trigger: 'item'
  1404. },
  1405. // legend: {
  1406. // top: '5%',
  1407. // left: 'center',
  1408. // // doesn't perfectly work with our tricks, disable it
  1409. // selectedMode: false
  1410. // },
  1411. color: ['#45C2E0', '#C1EBDD', '#c0a9fa', '#75bef3', '#FF9393', '#e9aaff', '#ffc1a7'],
  1412. series: [
  1413. {
  1414. name: '报警类型',
  1415. type: 'pie',
  1416. radius: ['40%', '70%'],
  1417. center: ['50%', '74%'],
  1418. // adjust the start angle
  1419. startAngle: 180,
  1420. label: {
  1421. color: "#C1EBDD",
  1422. show: true,
  1423. formatter(param) {
  1424. // correct the percentage
  1425. return param.name + ' (' + param.percent * 2 + '%)';
  1426. }
  1427. },
  1428. data: data
  1429. }
  1430. ]
  1431. };
  1432. let option2 = {
  1433. tooltip: {
  1434. trigger: 'item'
  1435. },
  1436. color: ['#0f7dec', '#07c5ea', '#e3378d', '#ff0000', '#FF9393', '#e9aaff', '#ffc1a7'],
  1437. series: [
  1438. {
  1439. name: '报警类型',
  1440. type: 'pie',
  1441. radius: ['40%', '70%'],
  1442. center: ['50%', '74%'],
  1443. // adjust the start angle
  1444. startAngle: 360,
  1445. label: {
  1446. color: "#C1EBDD",
  1447. show: true,
  1448. formatter(param) {
  1449. // correct the percentage
  1450. return param.name + ' (' + param.percent * 2 + '%)';
  1451. }
  1452. },
  1453. data: [{
  1454. value: data_nums,
  1455. itemStyle: {
  1456. color: 'none',
  1457. decal: {
  1458. symbol: 'none'
  1459. }
  1460. },
  1461. label: {
  1462. show: false
  1463. }
  1464. }, ...datas]
  1465. }
  1466. ]
  1467. }
  1468. myChart.setOption(option);
  1469. window.addEventListener("resize", function () {
  1470. myChart.resize();
  1471. });
  1472. //添加按钮点击切换
  1473. let isoption = true
  1474. document.getElementById('transportChartButton').addEventListener('click', function (){
  1475. if (isoption===true){
  1476. myChart.setOption(option2);
  1477. document.getElementById('transportChartButton').innerText = '库房端'
  1478. document.getElementById('kftitle').innerText = '移动端报警类型统计'
  1479. isoption=false
  1480. }else{
  1481. myChart.setOption(option);
  1482. document.getElementById('transportChartButton').innerText = '移动端'
  1483. document.getElementById('kftitle').innerText = '库房端报警类型统计'
  1484. isoption = true
  1485. }
  1486. })
  1487. $(".sebtn a").click(function () {
  1488. $(this).addClass("active").siblings().removeClass("active")
  1489. })
  1490. $(".sebtn a").eq(0).click(function () {
  1491. myChart.setOption(option1);
  1492. })
  1493. $(".sebtn a").eq(1).click(function () {
  1494. myChart.setOption(option2);
  1495. })
  1496. $(".sebtn a").eq(2).click(function () {
  1497. myChart.setOption(option3);
  1498. })
  1499. }