C_Mode_v3D_精简版.js 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  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. f_kf_open()
  11. })
  12. /****/
  13. $(document).ready(function () {
  14. var whei = $(window).width()
  15. $("html").css({fontSize: whei / 20})
  16. $(window).resize(function () {
  17. var whei = $(window).width()
  18. $("html").css({fontSize: whei / 20})
  19. });
  20. });
  21. // 返回
  22. function f_v_back() {
  23. C_keys_list = C_keys.split(",")
  24. C_keys_list.pop()
  25. hrefurl = "?T_key="+C_keys_list.join(",")
  26. if (false != C_modex){
  27. hrefurl += "&T_mode="+C_modex
  28. }
  29. document.location.href = hrefurl
  30. }
  31. var V_kf_yd = 1
  32. function f_kf_open() {
  33. $("#v_3d").show();
  34. $("#v_trail").hide();
  35. $(".R_KF_Column").show();
  36. $(".R_YD_Column").hide();
  37. V_kf_yd = 1
  38. f_view()
  39. }
  40. function f_yd_open() {
  41. $("#v_3d").hide();
  42. $("#v_trail").show();
  43. $(".R_KF_Column").hide();
  44. $(".R_YD_Column").show();
  45. V_kf_yd = 2
  46. f_view()
  47. }
  48. // 视图数据改变
  49. function f_view() {
  50. if(C_json == null) return
  51. // 3D加载
  52. f_v3d_loadProject(C_json.Company_v3d.split("|")[1])
  53. f_v_v3d()
  54. // 屏蔽按钮
  55. if(C_json.Device.T_库房总数 == 0){
  56. $("#v_open_KF").hide();
  57. }
  58. if(C_json.Device.T_移动总数 == 0){
  59. $("#v_open_YD").hide();
  60. }
  61. $("#T_公司名称").html(C_json.Company_name + "-冷链药品质量安全智慧中台")
  62. $("title").html(C_json.Company_name + "-冷链药品质量安全智慧中台")
  63. // 设备类
  64. $("#T_终端总数").html(C_json.Device.T_库房总数 + C_json.Device.T_移动总数)
  65. $("#T_库房总数").html(C_json.Device.T_库房总数)
  66. $("#T_移动总数").html(C_json.Device.T_移动总数)
  67. $("#T_移动离线总数").html(C_json.Device.T_移动离线总数)
  68. $("#T_移动监控总数").html(C_json.Device.T_移动监控总数)
  69. $("#T_移动总数s").html(C_json.Device.T_移动总数)
  70. $("#T_移动设备报警数_今天s").html(C_json.Warning.T_移动设备报警数_今天)
  71. $("#T_任务总数_今天s").html(C_json.Task.T_任务总数_今天)
  72. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天)
  73. if (w_x_ != 0) {
  74. w_x_ = w_x_ / (C_json.Device.T_库房总数)
  75. w_x_ *= 100
  76. }
  77. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天) + parseInt(C_json.Warning.T_移动报警设备数_今天)
  78. if (w_x_ != 0) {
  79. w_x_ = w_x_ / (C_json.Device.T_库房总数 + C_json.Device.T_移动总数)
  80. w_x_ *= 100
  81. }
  82. w_x_ = parseInt(C_json.Task.T_任务设备数_今天)
  83. if (w_x_ != 0) {
  84. w_x_ = w_x_ / C_json.Device.T_移动总数
  85. w_x_ *= 100
  86. }
  87. $("#T_今日闲置设备s").html(w_x_.toFixed(1) + "%")
  88. // 报警类
  89. // $("#T_库房报警总数").html(C_json.Warning.T_库房报警总数)
  90. $("#T_库房未处理总数").html(C_json.Warning.T_库房未处理总数)
  91. $("#T_库房设备报警数_今天").html(C_json.Warning.T_库房设备报警数_今天)
  92. $("#T_库房报警设备数_今天").html(C_json.Warning.T_库房报警设备数_今天)
  93. // $("#T_库房设备报警数_昨天").html(C_json.Warning.T_库房设备报警数_昨天)
  94. // $("#T_库房设备报警数_近7天").html(C_json.Warning.T_库房设备报警数_近7天)
  95. // $("#T_库房设备报警数_本月").html(C_json.Warning.T_库房设备报警数_本月)
  96. // $("#T_库房设备报警数_上一月").html(C_json.Warning.T_库房设备报警数_上一月)
  97. // $("#T_移动警数总数").html(C_json.Warning.T_移动警数总数)
  98. $("#T_移动未处理总数").html(C_json.Warning.T_移动未处理总数)
  99. $("#T_移动设备报警数_今天").html(C_json.Warning.T_移动设备报警数_今天)
  100. // $("#T_移动设备报警数_昨天").html(C_json.Warning.T_移动设备报警数_昨天)
  101. // $("#T_移动设备报警数_近7天").html(C_json.Warning.T_移动设备报警数_近7天)
  102. // $("#T_移动设备报警数_本月").html(C_json.Warning.T_移动设备报警数_本月)
  103. // $("#T_移动设备报警数_上一月").html(C_json.Warning.T_移动设备报警数_上一月)
  104. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天)
  105. if (w_x_ != 0) {
  106. w_x_ = w_x_ / (C_json.Device.T_库房总数)
  107. w_x_ *= 100
  108. }
  109. $("#T_今日库房报警率").html(w_x_.toFixed(1) + "%")
  110. $("#T_今日报警总数").html(parseInt(C_json.Warning.T_库房设备报警数_今天) + parseInt(C_json.Warning.T_移动设备报警数_今天))
  111. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天) + parseInt(C_json.Warning.T_移动报警设备数_今天)
  112. if (w_x_ != 0) {
  113. w_x_ = w_x_ / (C_json.Device.T_库房总数 + C_json.Device.T_移动总数)
  114. w_x_ *= 100
  115. }
  116. $("#T_今日报警率").html(w_x_.toFixed(1) + "%")
  117. // $("#T_今日报警率").html(parseInt(w_x_) + "%")
  118. $("#T_今日未处理总数").html(parseInt(C_json.Warning.T_库房未处理总数) + parseInt(C_json.Warning.T_移动未处理总数))
  119. // 任务类
  120. $("#T_任务总数_今天").html(C_json.Task.T_任务总数_今天)
  121. // $("#T_任务总数_昨天").html(C_json.Task.T_任务总数_昨天)
  122. // $("#T_任务总数_近7天").html(C_json.Task.T_任务总数_近7天)
  123. // $("#T_任务总数_本月").html(C_json.Task.T_任务总数_本月)
  124. // $("#T_任务总数_上一月").html(C_json.Task.T_任务总数_上一月)
  125. $("#T_任务设备数_今天").html(C_json.Task.T_任务设备数_今天)
  126. // $("#T_任务设备数_昨天").html(C_json.Task.T_任务设备数_昨天 )
  127. // $("#T_任务设备数_近7天").html(C_json.Task.T_任务设备数_近7天)
  128. // $("#T_任务设备数_本月").html(C_json.Task.T_任务设备数_本月 )
  129. // $("#T_任务设备数_上一月").html(C_json.Task.T_任务设备数_上一月)
  130. echarts_探头报警率排名()
  131. echarts_库房端报警类型统计()
  132. echarts_报警设备数近7天曲线图()
  133. w_x_ = parseInt(C_json.Task.T_任务设备数_今天)
  134. if (w_x_ != 0) {
  135. w_x_ = w_x_ / C_json.Device.T_移动总数
  136. w_x_ *= 100
  137. }
  138. $("#T_今日闲置设备").html(w_x_.toFixed(1) + "%")
  139. // 中间 视图显示
  140. // 库房端
  141. $("#T_C_1").html(C_json.Device.T_库房总数)// 公司下一级统计
  142. $("#T_C_2").html(C_json.Warning.T_库房设备报警数_今天)// 公司下一级统计
  143. w_x_ = parseInt(C_json.Warning.T_库房报警设备数_今天)
  144. if (w_x_ != 0) {
  145. w_x_ = w_x_ / C_json.Device.T_库房总数
  146. w_x_ *= 100
  147. }
  148. $("#T_C_3").html(w_x_.toFixed(1) + "%")// 公司下一级统计
  149. $("#T_Cn_1").html("设备数量")
  150. $("#T_Cn_2").html("今日库房报警次数")
  151. $("#T_Cn_3").html("今日库房报警率")
  152. // 设备列表
  153. $('#Company_DeviceG').liMarquee('destroy'); // 清除滚动
  154. $("#Company_DeviceL").html("")// 清除内容
  155. Company_Device_l = []
  156. f_Company_Device(C_json)
  157. // console.log("Company_Next_T_l:",Company_Next_T_l)
  158. // 开始滚动
  159. $('#Company_DeviceG').liMarquee({
  160. direction: 'up',//身上滚动
  161. runshort: false,//内容不足时不滚动
  162. scrollamount: 20//速度
  163. });
  164. let isKf =true
  165. document.getElementById('transportButton').addEventListener('click', function (){
  166. console.log("点击了按钮")
  167. if (isKf){
  168. isKf = false
  169. document.getElementById('kf_Column').style.display="none"
  170. document.getElementById('yd_Column').style.display="block"
  171. document.getElementById('transportButton').innerText = '库房端'
  172. document.getElementById('title').innerText= "移动端汇总统计"
  173. }else{
  174. isKf = true
  175. document.getElementById('yd_Column').style.display="none"
  176. document.getElementById('kf_Column').style.display="block"
  177. document.getElementById('transportButton').innerText = '移动端'
  178. document.getElementById('title').innerText= "库房端汇总统计"
  179. }
  180. })
  181. }
  182. function Jump(){
  183. window.open("https://cold.coldbaozhida.com/#/dataDisplay/mapShow", '_blank');
  184. }
  185. function f_Company_Device(C_j) {
  186. for (var C_key in C_j.Device.DeviceList) {
  187. T_t = ""
  188. T_rh = ""
  189. C_b = C_j.Device.DeviceList[C_key]
  190. t_w_ = ""
  191. if (C_b.T_DeviceSensorParameter.T_free == 0){
  192. if (( C_b.T_DeviceSensorParameter.T_Tlower > C_b.T_DeviceSensorData.T_t) || ( C_b.T_DeviceSensorData.T_t > C_b.T_DeviceSensorParameter.T_Tupper)){
  193. t_w_ = " style='color: #f93fff' "
  194. console.log("温度超标", C_b.T_DeviceSensorParameter.T_Tlower , C_b.T_DeviceSensorData.T_t , C_b.T_DeviceSensorData.T_t , C_b.T_DeviceSensorParameter.T_Tupper)
  195. }
  196. }
  197. h_w_ = ""
  198. if (C_b.T_DeviceSensorParameter.T_free == 0){
  199. if (( C_b.T_DeviceSensorParameter.T_RHlower > C_b.T_DeviceSensorData.T_rh) || ( C_b.T_DeviceSensorData.T_rh > C_b.T_DeviceSensorParameter.T_RHupper)){
  200. h_w_ = " style='color: #f93fff' "
  201. console.log("湿度超标", C_b.T_DeviceSensorParameter.T_RHlower , C_b.T_DeviceSensorData.T_rh , C_b.T_DeviceSensorData.T_rh , C_b.T_DeviceSensorParameter.T_RHupper)
  202. }
  203. }
  204. T_t = C_b.T_DeviceSensorData.T_t + "°C"
  205. h_w_title = ""
  206. if(C_b.T_DeviceSensorData.T_rh == 0){
  207. T_rh = "无"
  208. }else {
  209. T_rh = C_b.T_DeviceSensorData.T_rh + "%"
  210. h_w_title = " title=\""+C_b.T_DeviceSensorParameter.T_RHlower+"% ~ "+C_b.T_DeviceSensorParameter.T_RHupper+"%\" "
  211. }
  212. if(C_b.T_online != 1 && C_b.T_online_s != 1 ){
  213. T_t = "离线"
  214. T_rh = "离线"
  215. t_w_ = " style='color: rgba(255, 255, 255, .6)' "
  216. h_w_ = " style='color: rgba(255, 255, 255, .6)' "
  217. }
  218. $("#Company_DeviceL").append("<li onclick=\"f_d_onclick(\'"+C_b.T_3dview+"\')\"><p><span>" + C_b.T_name + "</span><span "+t_w_+" title=\""+C_b.T_DeviceSensorParameter.T_Tlower+"°C ~ "+C_b.T_DeviceSensorParameter.T_Tupper+"°C\" >" + T_t + "</span><span "+h_w_+" "+h_w_title+">" + T_rh + "</span></p></li>")
  219. }
  220. }
  221. function f_d_onclick(T_3dview) {
  222. if(T_3dview.length > 0){
  223. f_DeviceonDblclick(T_3dview)
  224. }
  225. }
  226. function echarts_探头报警率排名() {
  227. var myChart = echarts.init(document.getElementById('echarts_探头报警率排名'));
  228. yAxis_data = []
  229. series_data = []
  230. yAxis_dataMonth = []
  231. series_dataMonth = []
  232. yAxis_dataQuarter = []
  233. series_dataQuarter = []
  234. // Company_Next_W_l_ = Company_Next_W_l.sort((a, b) => a.Warning - b.Warning).slice(-10);
  235. //每日排名
  236. let dataOneday = [];
  237. for (var C_key in C_json.Warning.T_探头报警类型统计) {
  238. C_b = C_json.Warning.T_探头报警类型统计[C_key]
  239. dataOneday.push([C_key, C_b])
  240. }
  241. dataOneday.sort((a, b) => a[1] - b[1]);
  242. dataOneday.forEach(([key, value]) => {
  243. yAxis_data.push(key)
  244. series_data.push(value)
  245. });
  246. //月度排名
  247. let dataMonth = [];
  248. for (var C_key in C_json.Warning.T_探头报警类型统计_30天) {
  249. C_b = C_json.Warning.T_探头报警类型统计_30天[C_key]
  250. dataMonth.push([C_key, C_b])
  251. }
  252. dataMonth.sort((a, b) => a[1] - b[1]);
  253. dataMonth.forEach(([key, value]) => {
  254. yAxis_dataMonth.push(key)
  255. series_dataMonth.push(value)
  256. });
  257. //季度排名
  258. let dataQuarter = [];
  259. for (var C_key in C_json.Warning.T_探头报警类型统计_90天) {
  260. C_b = C_json.Warning.T_探头报警类型统计_90天[C_key]
  261. dataQuarter.push([C_key, C_b]);
  262. }
  263. dataQuarter.sort((a, b) => a[1] - b[1]);
  264. dataQuarter.forEach(([key, value]) => {
  265. yAxis_dataQuarter.push(key);
  266. series_dataQuarter.push(value);
  267. });
  268. let option = {
  269. tooltip: {
  270. trigger: 'axis',
  271. axisPointer: {
  272. type: 'shadow'
  273. }
  274. },
  275. grid: {
  276. top: '0%',
  277. left: '0%',
  278. right: '0%',
  279. bottom: '0%',
  280. containLabel: true
  281. },
  282. xAxis: {
  283. type: 'value',
  284. boundaryGap: [0, 0.01],
  285. show: false
  286. },
  287. yAxis: {
  288. type: 'category',
  289. data: yAxis_data
  290. },
  291. series: [
  292. {
  293. name: '报警数量',
  294. type: 'bar',
  295. itemStyle: {
  296. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  297. {offset: 0, color: '#596db0'},
  298. {offset: 0.5, color: '#4a63b4'},
  299. {offset: 1, color: '#435eb7'}
  300. ])
  301. },
  302. data: series_data
  303. }
  304. ]
  305. };
  306. let option1 = {
  307. tooltip: {
  308. trigger: 'axis',
  309. axisPointer: {
  310. type: 'shadow'
  311. }
  312. },
  313. grid: {
  314. top: '0%',
  315. left: '0%',
  316. right: '0%',
  317. bottom: '0%',
  318. containLabel: true
  319. },
  320. xAxis: {
  321. type: 'value',
  322. boundaryGap: [0, 0.01],
  323. show: false
  324. },
  325. yAxis: {
  326. type: 'category',
  327. data: yAxis_dataMonth
  328. },
  329. series: [
  330. {
  331. name: '报警数量',
  332. type: 'bar',
  333. itemStyle: {
  334. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  335. {offset: 0, color: '#596db0'},
  336. {offset: 0.5, color: '#4a63b4'},
  337. {offset: 1, color: '#435eb7'}
  338. ])
  339. },
  340. data: series_dataMonth
  341. }
  342. ]
  343. };
  344. let option2 = {
  345. tooltip: {
  346. trigger: 'axis',
  347. axisPointer: {
  348. type: 'shadow'
  349. }
  350. },
  351. grid: {
  352. top: '0%',
  353. left: '0%',
  354. right: '0%',
  355. bottom: '0%',
  356. containLabel: true
  357. },
  358. xAxis: {
  359. type: 'value',
  360. boundaryGap: [0, 0.01],
  361. show: false
  362. },
  363. yAxis: {
  364. type: 'category',
  365. data: yAxis_dataQuarter
  366. },
  367. series: [
  368. {
  369. name: '报警数量',
  370. type: 'bar',
  371. itemStyle: {
  372. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
  373. {offset: 0, color: '#596db0'},
  374. {offset: 0.5, color: '#4a63b4'},
  375. {offset: 1, color: '#435eb7'}
  376. ])
  377. },
  378. data: series_dataQuarter
  379. }
  380. ]
  381. };
  382. myChart.setOption(option);
  383. window.addEventListener("resize", function () {
  384. myChart.resize();
  385. });
  386. document.getElementById('onedays').addEventListener('click', function (){
  387. myChart.setOption(option);
  388. document.getElementById('deviceRanking').innerText = '每日探头报警率排名';
  389. })
  390. document.getElementById('month').addEventListener('click', function (){
  391. myChart.setOption(option1);
  392. document.getElementById('deviceRanking').innerText = '月探头报警率排名';
  393. })
  394. document.getElementById('quarter').addEventListener('click', function (){
  395. myChart.setOption(option2);
  396. document.getElementById('deviceRanking').innerText = '季度探头报警率排名';
  397. })
  398. $(".sebtn a").click(function () {
  399. $(this).addClass("active").siblings().removeClass("active")
  400. })
  401. $(".sebtn a").eq(0).click(function () {
  402. myChart.setOption(option1);
  403. })
  404. $(".sebtn a").eq(1).click(function () {
  405. myChart.setOption(option2);
  406. })
  407. $(".sebtn a").eq(2).click(function () {
  408. myChart.setOption(option3);
  409. })
  410. }
  411. function echarts_库房端报警类型统计() {
  412. const myChart = echarts.init(document.getElementById('echarts_库房端报警类型统计'));
  413. data = []
  414. datas = []
  415. data_num = 0
  416. data_nums = 0
  417. for (var C_key in C_json.Warning.T_库房报警类型统计) {
  418. data_num += C_json.Warning.T_库房报警类型统计[C_key]
  419. data.push({value: C_json.Warning.T_库房报警类型统计[C_key], name: C_key})
  420. console.log("C_json.Warning.T_库房报警类型统计",C_json.Warning.T_库房报警类型统计)
  421. }
  422. for (var C_key in C_json.Warning.T_移动报警类型统计) {
  423. data_nums += C_json.Warning.T_移动报警类型统计[C_key]
  424. datas.push({value: C_json.Warning.T_移动报警类型统计[C_key], name: C_key})
  425. console.log("C_json.Warning.T_移动报警类型统计",data_nums)
  426. }
  427. data.push({
  428. // make an record to fill the bottom 50%
  429. value: data_num,
  430. itemStyle: {
  431. // stop the chart from rendering this piece
  432. color: 'none',
  433. decal: {
  434. symbol: 'none'
  435. }
  436. },
  437. label: {
  438. show: false
  439. }
  440. })
  441. let option = {
  442. tooltip: {
  443. trigger: 'item'
  444. },
  445. // legend: {
  446. // top: '5%',
  447. // left: 'center',
  448. // // doesn't perfectly work with our tricks, disable it
  449. // selectedMode: false
  450. // },
  451. color: ['#45C2E0', '#C1EBDD', '#c0a9fa', '#75bef3', '#FF9393', '#e9aaff', '#ffc1a7'],
  452. series: [
  453. {
  454. name: '报警类型',
  455. type: 'pie',
  456. radius: ['40%', '70%'],
  457. center: ['50%', '74%'],
  458. // adjust the start angle
  459. startAngle: 180,
  460. label: {
  461. color: "#C1EBDD",
  462. show: true,
  463. formatter(param) {
  464. // correct the percentage
  465. return param.name + ' (' + param.percent * 2 + '%)';
  466. }
  467. },
  468. data: data
  469. }
  470. ]
  471. };
  472. let option2 = {
  473. tooltip: {
  474. trigger: 'item'
  475. },
  476. color: ['#0f7dec', '#07c5ea', '#e3378d', '#ff0000', '#FF9393', '#e9aaff', '#ffc1a7'],
  477. series: [
  478. {
  479. name: '报警类型',
  480. type: 'pie',
  481. radius: ['40%', '70%'],
  482. center: ['50%', '74%'],
  483. // adjust the start angle
  484. startAngle: 360,
  485. label: {
  486. color: "#C1EBDD",
  487. show: true,
  488. formatter(param) {
  489. // correct the percentage
  490. return param.name + ' (' + param.percent * 2 + '%)';
  491. }
  492. },
  493. data: [{
  494. value: data_nums,
  495. itemStyle: {
  496. color: 'none',
  497. decal: {
  498. symbol: 'none'
  499. }
  500. },
  501. label: {
  502. show: false
  503. }
  504. }, ...datas]
  505. }
  506. ]
  507. }
  508. myChart.setOption(option);
  509. window.addEventListener("resize", function () {
  510. myChart.resize();
  511. });
  512. //添加按钮点击切换
  513. let isoption = true
  514. document.getElementById('transportChartButton').addEventListener('click', function (){
  515. if (isoption===true){
  516. myChart.setOption(option2);
  517. document.getElementById('transportChartButton').innerText = '库房端'
  518. document.getElementById('kftitle').innerText = '移动端报警类型统计'
  519. isoption=false
  520. }else{
  521. myChart.setOption(option);
  522. document.getElementById('transportChartButton').innerText = '移动端'
  523. document.getElementById('kftitle').innerText = '库房端报警类型统计'
  524. isoption = true
  525. }
  526. })
  527. $(".sebtn a").click(function () {
  528. $(this).addClass("active").siblings().removeClass("active")
  529. })
  530. $(".sebtn a").eq(0).click(function () {
  531. myChart.setOption(option1);
  532. })
  533. $(".sebtn a").eq(1).click(function () {
  534. myChart.setOption(option2);
  535. })
  536. $(".sebtn a").eq(2).click(function () {
  537. myChart.setOption(option3);
  538. })
  539. }
  540. function echarts_报警设备数近7天曲线图() {
  541. var myChart = echarts.init(document.getElementById('echarts_报警设备数近7天曲线图'));
  542. xAxis_data = []
  543. yAxis_data = []
  544. xAxis_data30 = []
  545. yAxis_data30 = []
  546. xAxis_data90 = []
  547. yAxis_data90 = []
  548. for (var C_key in C_json.Warning.T_报警设备数_近7天) {
  549. C_b = C_json.Warning.T_报警设备数_近7天[C_key]
  550. xAxis_data.push(C_key)
  551. yAxis_data.push(C_b)
  552. }
  553. for (var C_key in C_json.Warning.T_报警设备数_近30天) {
  554. C_b = C_json.Warning.T_报警设备数_近30天[C_key]
  555. xAxis_data30.push(C_key)
  556. yAxis_data30.push(C_b)
  557. }
  558. for (var C_key in C_json.Warning.T_报警设备数_近90天) {
  559. C_b = C_json.Warning.T_报警设备数_近90天[C_key]
  560. xAxis_data90.push(C_key)
  561. yAxis_data90.push(C_b)
  562. }
  563. let option = {
  564. // legend: {
  565. // icon:"circle",
  566. // top: "0",
  567. // width:'100%',
  568. // right: 'center',
  569. // itemWidth: 10,
  570. // itemHeight: 10,
  571. // data: ['库房端'],
  572. // textStyle: {
  573. // color: "rgba(255,255,255,.5)" },
  574. // },
  575. tooltip: {
  576. trigger: 'axis',
  577. axisPointer: {
  578. lineStyle: {
  579. color: '#dddc6b'
  580. }
  581. }
  582. },
  583. grid: {
  584. left: '0',
  585. top: '5',
  586. right: '15',
  587. bottom: '0',
  588. containLabel: true
  589. },
  590. xAxis: [{
  591. type: 'category',
  592. boundaryGap: false,
  593. axisLabel: {
  594. textStyle: {
  595. color: "rgba(255,255,255,.5)",
  596. // fontSize:10
  597. },
  598. },
  599. axisLine: {
  600. lineStyle: {
  601. color: 'rgba(255,255,255,.1)'
  602. }
  603. },
  604. data: xAxis_data
  605. }, {
  606. axisPointer: {show: false},
  607. axisLine: {show: false},
  608. position: 'bottom',
  609. offset: 20,
  610. }],
  611. yAxis: [{
  612. type: 'value',
  613. axisTick: {show: false},
  614. splitNumber: 4,
  615. axisLine: {
  616. lineStyle: {
  617. color: 'rgba(255,255,255,.1)'
  618. }
  619. },
  620. axisLabel: {
  621. textStyle: {
  622. color: "rgba(255,255,255,.5)",
  623. //fontSize:10
  624. },
  625. },
  626. splitLine: {
  627. lineStyle: {
  628. color: 'rgba(255,255,255,.1)',
  629. type: 'dotted',
  630. }
  631. }
  632. }],
  633. series: [
  634. {
  635. name: '库房端',
  636. type: 'line',
  637. smooth: true,
  638. symbol: 'circle',
  639. symbolSize: 5,
  640. showSymbol: false,
  641. lineStyle: {
  642. normal: {
  643. color: 'rgba(31, 174, 234, 1)',
  644. width: 2
  645. }
  646. },
  647. areaStyle: {
  648. normal: {
  649. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  650. offset: 0,
  651. color: 'rgba(31, 174, 234, 0.4)'
  652. }, {
  653. offset: 0.8,
  654. color: 'rgba(31, 174, 234, 0.1)'
  655. }], false),
  656. shadowColor: 'rgba(0, 0, 0, 0.1)',
  657. }
  658. },
  659. itemStyle: {
  660. normal: {
  661. color: '#1f7eea',
  662. borderColor: 'rgba(31, 174, 234, .1)',
  663. borderWidth: 5
  664. }
  665. },
  666. data: yAxis_data
  667. },
  668. // {
  669. // name: '移动端',
  670. // type: 'line',
  671. // smooth: true,
  672. // symbol: 'circle',
  673. // symbolSize: 5,
  674. // showSymbol: false,
  675. // lineStyle: {
  676. //
  677. // normal: {
  678. // color: '#6bdd9b',
  679. // width: 2
  680. // }
  681. // },
  682. // areaStyle: {
  683. // normal: {
  684. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  685. // offset: 0,
  686. // color: 'rgba(107, 221, 155, 0.4)'
  687. // }, {
  688. // offset: 0.8,
  689. // color: 'rgba(107, 221, 155, 0.1)'
  690. // }], false),
  691. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  692. // }
  693. // },
  694. // itemStyle: {
  695. // normal: {
  696. // color: '#6bdd9b',
  697. // borderColor: 'rgba(107, 221, 155, .1)',
  698. // borderWidth: 5
  699. // }
  700. // },
  701. // data: [ 5, 3, 7, 1, 8, 3, 5]
  702. //
  703. // },
  704. ]
  705. };
  706. let option1 = {
  707. // legend: {
  708. // icon:"circle",
  709. // top: "0",
  710. // width:'100%',
  711. // right: 'center',
  712. // itemWidth: 10,
  713. // itemHeight: 10,
  714. // data: ['库房端'],
  715. // textStyle: {
  716. // color: "rgba(255,255,255,.5)" },
  717. // },
  718. tooltip: {
  719. trigger: 'axis',
  720. axisPointer: {
  721. lineStyle: {
  722. color: '#dddc6b'
  723. }
  724. }
  725. },
  726. grid: {
  727. left: '0',
  728. top: '5',
  729. right: '15',
  730. bottom: '0',
  731. containLabel: true
  732. },
  733. xAxis: [{
  734. type: 'category',
  735. boundaryGap: false,
  736. axisLabel: {
  737. textStyle: {
  738. color: "rgba(255,255,255,.5)",
  739. // fontSize:10
  740. },
  741. },
  742. axisLine: {
  743. lineStyle: {
  744. color: 'rgba(255,255,255,.1)'
  745. }
  746. },
  747. data: xAxis_data30
  748. }, {
  749. axisPointer: {show: false},
  750. axisLine: {show: false},
  751. position: 'bottom',
  752. offset: 20,
  753. }],
  754. yAxis: [{
  755. type: 'value',
  756. axisTick: {show: false},
  757. splitNumber: 4,
  758. axisLine: {
  759. lineStyle: {
  760. color: 'rgba(255,255,255,.1)'
  761. }
  762. },
  763. axisLabel: {
  764. textStyle: {
  765. color: "rgba(255,255,255,.5)",
  766. //fontSize:10
  767. },
  768. },
  769. splitLine: {
  770. lineStyle: {
  771. color: 'rgba(255,255,255,.1)',
  772. type: 'dotted',
  773. }
  774. }
  775. }],
  776. series: [
  777. {
  778. name: '库房端',
  779. type: 'line',
  780. smooth: true,
  781. symbol: 'circle',
  782. symbolSize: 5,
  783. showSymbol: false,
  784. lineStyle: {
  785. normal: {
  786. color: 'rgba(31, 174, 234, 1)',
  787. width: 2
  788. }
  789. },
  790. areaStyle: {
  791. normal: {
  792. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  793. offset: 0,
  794. color: 'rgba(31, 174, 234, 0.4)'
  795. }, {
  796. offset: 0.8,
  797. color: 'rgba(31, 174, 234, 0.1)'
  798. }], false),
  799. shadowColor: 'rgba(0, 0, 0, 0.1)',
  800. }
  801. },
  802. itemStyle: {
  803. normal: {
  804. color: '#1f7eea',
  805. borderColor: 'rgba(31, 174, 234, .1)',
  806. borderWidth: 5
  807. }
  808. },
  809. data: yAxis_data30
  810. },
  811. // {
  812. // name: '移动端',
  813. // type: 'line',
  814. // smooth: true,
  815. // symbol: 'circle',
  816. // symbolSize: 5,
  817. // showSymbol: false,
  818. // lineStyle: {
  819. //
  820. // normal: {
  821. // color: '#6bdd9b',
  822. // width: 2
  823. // }
  824. // },
  825. // areaStyle: {
  826. // normal: {
  827. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  828. // offset: 0,
  829. // color: 'rgba(107, 221, 155, 0.4)'
  830. // }, {
  831. // offset: 0.8,
  832. // color: 'rgba(107, 221, 155, 0.1)'
  833. // }], false),
  834. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  835. // }
  836. // },
  837. // itemStyle: {
  838. // normal: {
  839. // color: '#6bdd9b',
  840. // borderColor: 'rgba(107, 221, 155, .1)',
  841. // borderWidth: 5
  842. // }
  843. // },
  844. // data: [ 5, 3, 7, 1, 8, 3, 5]
  845. //
  846. // },
  847. ]
  848. };
  849. let option2 = {
  850. // legend: {
  851. // icon:"circle",
  852. // top: "0",
  853. // width:'100%',
  854. // right: 'center',
  855. // itemWidth: 10,
  856. // itemHeight: 10,
  857. // data: ['库房端'],
  858. // textStyle: {
  859. // color: "rgba(255,255,255,.5)" },
  860. // },
  861. tooltip: {
  862. trigger: 'axis',
  863. axisPointer: {
  864. lineStyle: {
  865. color: '#dddc6b'
  866. }
  867. }
  868. },
  869. grid: {
  870. left: '0',
  871. top: '5',
  872. right: '15',
  873. bottom: '0',
  874. containLabel: true
  875. },
  876. xAxis: [{
  877. type: 'category',
  878. boundaryGap: false,
  879. axisLabel: {
  880. textStyle: {
  881. color: "rgba(255,255,255,.5)",
  882. // fontSize:10
  883. },
  884. },
  885. axisLine: {
  886. lineStyle: {
  887. color: 'rgba(255,255,255,.1)'
  888. }
  889. },
  890. data: xAxis_data90
  891. }, {
  892. axisPointer: {show: false},
  893. axisLine: {show: false},
  894. position: 'bottom',
  895. offset: 20,
  896. }],
  897. yAxis: [{
  898. type: 'value',
  899. axisTick: {show: false},
  900. splitNumber: 4,
  901. axisLine: {
  902. lineStyle: {
  903. color: 'rgba(255,255,255,.1)'
  904. }
  905. },
  906. axisLabel: {
  907. textStyle: {
  908. color: "rgba(255,255,255,.5)",
  909. //fontSize:10
  910. },
  911. },
  912. splitLine: {
  913. lineStyle: {
  914. color: 'rgba(255,255,255,.1)',
  915. type: 'dotted',
  916. }
  917. }
  918. }],
  919. series: [
  920. {
  921. name: '库房端',
  922. type: 'line',
  923. smooth: true,
  924. symbol: 'circle',
  925. symbolSize: 5,
  926. showSymbol: false,
  927. lineStyle: {
  928. normal: {
  929. color: 'rgba(31, 174, 234, 1)',
  930. width: 2
  931. }
  932. },
  933. areaStyle: {
  934. normal: {
  935. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  936. offset: 0,
  937. color: 'rgba(31, 174, 234, 0.4)'
  938. }, {
  939. offset: 0.8,
  940. color: 'rgba(31, 174, 234, 0.1)'
  941. }], false),
  942. shadowColor: 'rgba(0, 0, 0, 0.1)',
  943. }
  944. },
  945. itemStyle: {
  946. normal: {
  947. color: '#1f7eea',
  948. borderColor: 'rgba(31, 174, 234, .1)',
  949. borderWidth: 5
  950. }
  951. },
  952. data: yAxis_data90
  953. },
  954. // {
  955. // name: '移动端',
  956. // type: 'line',
  957. // smooth: true,
  958. // symbol: 'circle',
  959. // symbolSize: 5,
  960. // showSymbol: false,
  961. // lineStyle: {
  962. //
  963. // normal: {
  964. // color: '#6bdd9b',
  965. // width: 2
  966. // }
  967. // },
  968. // areaStyle: {
  969. // normal: {
  970. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  971. // offset: 0,
  972. // color: 'rgba(107, 221, 155, 0.4)'
  973. // }, {
  974. // offset: 0.8,
  975. // color: 'rgba(107, 221, 155, 0.1)'
  976. // }], false),
  977. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  978. // }
  979. // },
  980. // itemStyle: {
  981. // normal: {
  982. // color: '#6bdd9b',
  983. // borderColor: 'rgba(107, 221, 155, .1)',
  984. // borderWidth: 5
  985. // }
  986. // },
  987. // data: [ 5, 3, 7, 1, 8, 3, 5]
  988. //
  989. // },
  990. ]
  991. };
  992. myChart.setOption(option);
  993. window.addEventListener("resize", function () {
  994. myChart.resize();
  995. });
  996. document.getElementById('days7').addEventListener('click', function (){
  997. myChart.setOption(option);
  998. document.getElementById('deviceWarning').innerText = '周设备报警曲线图';
  999. })
  1000. document.getElementById('days30').addEventListener('click', function (){
  1001. myChart.setOption(option1);
  1002. document.getElementById('deviceWarning').innerText = '月设备报警曲线图';
  1003. })
  1004. document.getElementById('days120').addEventListener('click', function (){
  1005. myChart.setOption(option2);
  1006. document.getElementById('deviceWarning').innerText = '季度设备报警曲线图';
  1007. })
  1008. $(".sebtn a").click(function () {
  1009. $(this).addClass("active").siblings().removeClass("active")
  1010. })
  1011. $(".sebtn a").eq(0).click(function () {
  1012. myChart.setOption(option1);
  1013. })
  1014. $(".sebtn a").eq(1).click(function () {
  1015. myChart.setOption(option2);
  1016. })
  1017. $(".sebtn a").eq(2).click(function () {
  1018. myChart.setOption(option3);
  1019. })
  1020. }
  1021. let isfull = true;
  1022. function Full() {
  1023. const fullElements = document.getElementsByClassName('full');
  1024. if (isfull) {
  1025. for (let i = 0; i < fullElements.length; i++) {
  1026. fullElements[i].classList.add('hidden');
  1027. }
  1028. isfull = false;
  1029. } else {
  1030. for (let i = 0; i < fullElements.length; i++) {
  1031. fullElements[i].classList.remove('hidden');
  1032. }
  1033. isfull = true;
  1034. }
  1035. }