B_Mode_1.js 45 KB

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