scd_stat.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. <!DOCTYPE html>
  2. <!--[if IE 8]>
  3. <html lang="en" class="ie8 no-js"> <![endif]-->
  4. <!--[if IE 9]>
  5. <html lang="en" class="ie9 no-js"> <![endif]-->
  6. <html>
  7. <head>
  8. <meta charset="utf-8"/>
  9. <title>SCD文档管理系统</title>
  10. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  11. <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
  12. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  13. <link rel="stylesheet" type="text/css" href="/static/css/sub_bureau.css">
  14. <link rel="stylesheet" type="text/css" href="/static/css/common.css"/>
  15. <link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css"/>
  16. <link rel="stylesheet" type="text/css" href="/static/layui_2/css/layui.css" media="all"/>
  17. <link rel="stylesheet" type="text/css" href="/static/css/kmsjsmap.css"/>
  18. <script src="/static/js/jquery.min.js" type="text/javascript"></script>
  19. <script src="/static/js/echarts.min.js" type="text/javascript"></script>
  20. <script src="/static/js/template.js" type="text/javascript"></script>
  21. <script src="/static/js/police_o.js" type="text/javascript"></script>
  22. <script src="/static/layui_2/layui.js" type="text/javascript"></script>
  23. <script src="/static/js/global.js" type="text/javascript"></script>
  24. <script src="/static/js/jquery.slimscroll.min.js" type="text/javascript"></script>
  25. <script src="/static/js/TweenMax.js" type="text/javascript"></script>
  26. <script src="/static/js/mqtt.min.js" type="text/javascript"></script>
  27. <script src="/static/js/kmsjsmap.js" type="text/javascript"></script>
  28. <style type="text/css">
  29. .inout_list{}
  30. .inout_list thead{font-weight: bold;}
  31. .inout_list table{border: 0px solid #4a3c6a;}
  32. .inout_list tbody{font-size: 1.2rem;}
  33. .inout_list tbody>tr:nth-child(odd){background-color: #F6FAFF;}
  34. .inout_list .scdin_tag{border-radius: 0.5rem;background-color: #F3F5FA;padding: 0.5rem;text-align: center;border: 1px solid #134BEA;color: #134BEA;}
  35. .inout_list .scdout_tag{border-radius: 0.5rem;background-color: #FFFACC;padding: 0.5rem;text-align: center;border: 1px solid #FFCB11;color: #FFCB11;}
  36. .doctype_list{
  37. width: 18rem;
  38. padding: 1rem;
  39. height: 17rem;
  40. margin-top: 1rem;
  41. }
  42. .doctype_list .doctype_card_header{
  43. text-align: center;
  44. font-size: 1.4rem;
  45. border: 1px solid #C8D4E2;
  46. border-radius: 3px;
  47. background-color: #F3F5FA;
  48. float: left;
  49. width: 100%;
  50. padding: 0.5rem;
  51. color: #09162C;
  52. }
  53. .doctype_list.active .doctype_card_header{background-color: #134BEA;color: #fff;}
  54. .doctype_list .doctype_card_header>span{
  55. float: left;
  56. }
  57. .doctype_list .doctype_card_header .ok{
  58. width: 15%;font-size: 1.2rem;padding: 0 0.5rem;border-radius: 1rem;background-color: #eee1e1;border: 1px solid #fff;
  59. }
  60. .doctype_list .doctype_card_header .not{
  61. width: 15%;font-size: 1.2rem;padding: 0 0.5rem;border-radius: 1rem;background-color: #ec7575;border: 1px solid red;color: #fff;
  62. }
  63. .doc_detail_list{width: 100%;font-size: 1.2rem;float: left;border: 1px solid #C8D4E2;border-radius: 3px;background-color: #F3F5FA;padding: 0.5rem;color: #43526B;height: 14rem;}
  64. .doctype_list_item{float: left;width: 100%;height: 2.4rem;line-height: 2.4rem;}
  65. .doctype_list_item .doctype{float: left;width: 75%}
  66. .doctype_list_item .rate{float: left;width: 20%;color: #134BEA;}
  67. .doctype_list_item .unit{float: right;width: 5%;color: #134BEA;}
  68. .stat_caption{
  69. background-color: #fff;
  70. color: #1E293B;
  71. font-weight: bold;
  72. font-size: 1.5rem;
  73. border-bottom: 1px solid #C8D4E2;
  74. }
  75. .stat_caption>span{
  76. border-left: 2px solid #134BEA;
  77. padding: 0px 1rem;
  78. }
  79. </style>
  80. </head>
  81. <body>
  82. <div class="monitor_center" style="width:100%;height: 100%;">
  83. <div class="header">
  84. <div class="header_logo">
  85. <img src="/static/images/logo.jpg">
  86. </div>
  87. <div class="system_middle_title">
  88. <span class="system_big_title">SCD文档管理系统</span>
  89. <span class="orgname f_l text_overflow" id="orgname"></span><span class="stationname hidden" id="stationname"></span>
  90. <div class="scd_info f_l hidden" id="scd_info">
  91. <span class="scd_name text_overflow"></span>
  92. <span style="margin-left: 1rem;margin-right: 1rem;font-size: 1.5rem;float: left;"><i class="fa fa-caret-up"></i></span>
  93. </div>
  94. </div>
  95. <div class="header_background">
  96. <div>
  97. <div class="main_bar" id="main_bar" style="float: left;margin-right: 2rem;">
  98. <div class="app_default accessControl" mark="screen" access-code="pl_menu_screen" onclick="window.location.href='scd_network.html'">
  99. <i class="app_icon fa fa-fw fa-gg"></i>
  100. <span>网络结构图</span>
  101. </div>
  102. <div class="app_default accessControl" mark="screen" access-code="pl_menu_screen" onclick="window.location.href='scd_o.html'">
  103. <i class="app_icon fa fa-fw fa-file-image-o"></i>
  104. <span>SCD可视化</span>
  105. </div>
  106. <div class="app_default accessControl" mark="outin" access-code="pl_menu_outin" onclick="window.location.href='scd_inout.html'">
  107. <i class="app_icon fa fa-fw fa-exchange fa-rotate-90"></i>
  108. <span>签入签出</span>
  109. </div>
  110. <div class="app_default accessControl" mark="scdtools" access-code="pl_menu_scdtools" onclick="window.location.href='scd_files.html'">
  111. <i class="app_icon fa fa-fw fa-file-code-o"></i>
  112. <span>配置文件</span>
  113. </div>
  114. <div class="app_default accessControl app_active" mark="stat" access-code="pl_menu_stat" onclick="window.location.href='scd_stat.html'">
  115. <i class="app_icon fa fa-fw fa-pie-chart"></i>
  116. <span>统计分析</span>
  117. </div>
  118. <div class="app_default accessControl" mark="admin" access-code="pl_menu_admin" onclick="window.location.href='police_o_admin.html'" style="margin-right: 0;">
  119. <i class="app_icon fa fa-fw fa-laptop"></i>
  120. <span>管理后台</span>
  121. </div>
  122. </div>
  123. <div class="app_default" style="color: #7A13E1;">|</div>
  124. <div class="app_default">
  125. <span class="yyyymmdd f_l" style="cursor:default;font-size: 1.4rem;font-family:electronicFont;width: 8rem;">&nbsp</span>
  126. <span class="week f_l" style="cursor:default;font-size: 1.4rem;width: 5rem;">&nbsp</span>
  127. <span class="hour_minute f_l" style="cursor:default;letter-spacing: 0.3rem;font-size: 1.4rem;color: #516380;font-family:electronicFont;width: 8rem;">&nbsp;</span>
  128. </div>
  129. <div class="app_default" style="color: #7A13E1;">/</div>
  130. <div class="app_default" style="border-bottom: 0px solid #7A13E1;height: 93%;">
  131. <a style="font-size: 1.4rem;cursor: pointer;" href="/" title="当前登录人员"><i class="fa fa-user" style="color: #00CEFB;font-size: 1.8rem;margin-right: 0.5rem;"></i><span id="login_user_name"></span></a>
  132. </div>
  133. <div class="app_default" style="color: #7A13E1;">/</div>
  134. <div class="app_default" style="border-bottom: 0px solid #7A13E1;height: 93%;">
  135. <a style="font-size: 1.6rem;cursor: pointer;" href="/" title="退出"><i class="layui-icon layui-icon-logout" style="background-color: transparent !important;color: #00CEFB;"></i></a>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="user_role hidden" id="login_user_role"></div>
  140. </div>
  141. <div class="body_content">
  142. <!--中间地图-->
  143. <div class="body_center home_center" id="container_map" style="display:block;background-color: #F3F5FA;">
  144. <div id="container_map_ied" style="position: absolute;z-index: 1;height: 100%;width: 100%;left: 0;top:0;">
  145. <!--各站文档统计-->
  146. <div class="f_l" style="width: 30%;height: 95%;">
  147. <div class="f_l" style="width: 96%;height: 47%;padding: 2%;padding-top: 0;">
  148. <div class="f_l stat_caption" style="width: 100%;height: 4rem;line-height: 4rem;"><span>资料分类统计</span></div>
  149. <div class="f_l" style="width: 100%;height: 90%;background-color: #fff;" id="doc_stat_type"></div>
  150. </div>
  151. <div class="f_l" style="width: 96%;height: 48%;padding: 2%;">
  152. <div class="f_l stat_caption" style="width: 100%;height: 4rem;line-height: 4rem;"><span>装置分类统计</span></div>
  153. <div class="f_l" style="width: 100%;height: 90%;background-color: #fff;" id="ied_stat_type"></div>
  154. </div>
  155. </div>
  156. <!-- -->
  157. <div class="f_l" style="width: 38%;height: 100%;">
  158. <div class="f_l " style="width: 100%;height: 4rem;line-height: 4rem;margin-bottom: 2rem;background-color: #fff;">
  159. <div class="f_l" style="width: 50%;text-align: center;background-color: #fff;" id="station_count">
  160. <span style="font-size: 1.6rem;color: #000000;">站点总数:<b style="font-family: electronicFont;font-size: 3rem;color: #FFCB11;border-bottom: 2px solid #8770f2;cursor: pointer;" title="查看所有站点统计">-</b></span>
  161. </div>
  162. <div class="f_l" style="width: 50%;text-align: center;background-color: #fff;" id="scd_stat2">
  163. <div class="f_l" style="width: 100%;"></div>
  164. </div>
  165. </div>
  166. <div class="f_l stat_caption" style="width: 100%;height: 4rem;line-height: 4rem;background-color: #fff;"><span>资料完整度分析</span></div>
  167. <div class="f_l" style="width: 100%;height: 80%;overflow: hidden;background-color: #fff;" id="scd_stat1">
  168. <div class="f_l" style="width: 100%;"></div>
  169. </div>
  170. </div>
  171. <!--签入签出实时监测 -->
  172. <div class="f_l" style="width: 30%;height: 100%;margin-left: 1%;">
  173. <div class="f_l stat_caption" style="width: 100%;height: 4rem;line-height: 4rem;"><span>SCD签入签出实时监测</span></div>
  174. <div class="f_l" style="width: 92%;height: 88%;overflow: hidden;background-color: #fff;padding: 1%;" id="scd_chekout_monitor">
  175. <div class="datalist f_l inout_list" style="width: 100%;">
  176. <table style="width: 100%;text-align: left;line-height: 4rem;">
  177. <tbody>
  178. </tbody>
  179. </table>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. <div id="dialog_public" class="site_device_list dialog_public">
  188. <span class="text_overflow caption"><b></b><i class="fa fa-times" title="关闭窗口" style="font-size: 2rem;"></i></span>
  189. <div class="dataitemlist">
  190. <div id="ln_strcut_detail" style="position: absolute;left: 0;top:0;z-index: 0;height:100%;width: 100%;"></div>
  191. </div>
  192. </div>
  193. <script type="text/html" id="station_list_item_tpl">
  194. {{each data}}
  195. <div class="station_list_item" stationid="{{$value.id}}">{{$value.area_name}}</div>
  196. {{/each}}
  197. </script>
  198. <script type="text/html" id="flow_monitor_item_tpl">
  199. {{each data}}
  200. <tr>
  201. <td class="text_overflow" style="width: 20%">&nbsp;&nbsp;{{$value.statin_name}}</td>
  202. <td class="text_overflow" style="width: 25%">{{$value.CREATED_TIME}}</td>
  203. <td class="text_overflow" style="width: 15%"><span class="{{if $value.flow_type=='scdout'}}scdout_tag{{else}}scdin_tag{{/if}}">{{$value.flow_name}}</span></td>
  204. <td class="text_overflow" style="width: 30%" title="{{$value.scd_name}}">{{$value.scd_name}}</td>
  205. <td class="text_overflow" style="width: 10%">{{$value.created_name}}</td>
  206. </tr>
  207. {{/each}}
  208. </script>
  209. <script type="text/html" id="station_doctype_list_item_tpl">
  210. {{each data}}
  211. <div class="f_l doctype_list" stationid="{{$value.id}}">
  212. <div class="doctype_card_header">
  213. <span class="stationname text_overflow f_l" style="width: 68%;text-align: left;">{{$value.area_name}}</span>
  214. <span class="f_l {{if $value.rate>=95}}ok{{else}}not{{/if}}">{{$value.rate||0}}</span>
  215. <span class="f_l" style="width: 10%">%</span>
  216. </div>
  217. <div class="doc_detail_list"></div>
  218. </div>
  219. {{/each}}
  220. </script>
  221. <script type="text/html" id="station_doc_item_tpl">
  222. {{each data}}
  223. <div class="doctype_list_item" filetype_id="{{$value.id}}">
  224. <span class="doctype text_overflow">{{$value.name}}</span><span class="rate"><b>{{$value.rate||"0"}}</b></span><span class="unit">%</span>
  225. </div>
  226. {{/each}}
  227. </script>
  228. <script type="text/javascript">
  229. template.helper("FullImgPath",function(imgsrc){
  230. if(imgsrc==null||imgsrc=="") return Global.AccessUrl+ "/static/images/userhead.png";
  231. if (imgsrc.substr(0, 4) != "http") {
  232. var _index = imgsrc.indexOf("static/");
  233. if (_index > -1) return Global.AccessUrl + imgsrc.substr(_index);
  234. }
  235. return imgsrc;
  236. })
  237. template.helper("ts2datetime",function(timestamp){
  238. if(timestamp==null||timestamp=="") return "";
  239. if(timestamp.indexOf("-")>-1 || timestamp.indexOf(":")>-1) return timestamp;
  240. if(timestamp.length>13) timestamp=timestamp.substring(0,13);
  241. else if( timestamp.length==10) timestamp=timestamp*1000;
  242. return new Date(timestamp).Format("yyyy-MM-dd hh:mm:ss");
  243. })
  244. template.helper("replaceStr",function(str,oldstr,newstr){
  245. if($.trim(str)=="") return "";
  246. var reg=new RegExp(oldstr);
  247. return str.replace(reg,newstr);
  248. })
  249. var myChart = null;
  250. $(document).ready(function () {
  251. var token = $.trim(localStorage.getItem("sessionid"));
  252. if (token == "") {
  253. window.location.href = "/";
  254. return false;
  255. }
  256. Global.accessControl();
  257. $("body").on('click',function(){
  258. if($(this).attr("id")!="scd_info" && $(this).parent().attr("id")!="scd_info"){
  259. $("#scd_list").addClass("hidden");
  260. $("#scd_info").find("i").attr("class","fa fa-angle-up");
  261. }
  262. if($(this).attr("id")!="stationname" && $(this).parent().attr("id")!="stationname"){
  263. $("#station_list").addClass("hidden").find("i").attr("class","fa fa-angle-up");
  264. }
  265. });
  266. //获取配置的单位名称
  267. $.getJSON(Global.AccessUrl+"/api/getSysParamList",{"param_name":"orgname"},function(r){
  268. if(r.code!=0 || r.data==null) return;
  269. $("#orgname").html(r.data[0].param_value);
  270. });
  271. PoliceObject.AlwaysTimer();
  272. PoliceObject.init();
  273. var canvasW=1300;
  274. var isdrag=false;
  275. var data=[];
  276. scd_chekout_monitor();
  277. doc_stat_type();
  278. ied_stat_type();
  279. //资料完整度分析
  280. scd_stat1();
  281. //SCD正确率统计
  282. scd_stat2();
  283. });
  284. var flowlastid="";
  285. //签入签出监测
  286. function scd_chekout_monitor(){
  287. var $scd_chekout_monitor=$("#scd_chekout_monitor .datalist>table:first>tbody").html(Tools.LoadingText("正在加载数据..."));
  288. //默认获取最新20条
  289. $.getJSON(Global.AccessUrl+ "/api/flow/stat/list",{"pageno":1,"pagesize":20},function(r){
  290. if(r.code!=0){
  291. layer.msg("加载签入签出信息失败:"+r.msg);
  292. return;
  293. }
  294. if(r.data==null || r.data.length==0){
  295. $scd_chekout_monitor.html(Tools.HintText("没有数据记录"));
  296. setTimeout(function(){
  297. scd_chekout_monitor();
  298. },60*1000);
  299. return;
  300. }
  301. var h=template('flow_monitor_item_tpl',r);
  302. $scd_chekout_monitor.html(h);
  303. flowlastid=r.data[0]["id"];
  304. $("#scd_chekout_monitor").slimScroll({
  305. height: $("#scd_chekout_monitor").height() + "px",
  306. width: "100%",
  307. alwaysVisible: false,
  308. wheelStep: 10,
  309. size: "6px",
  310. color: "#03aee7"
  311. });
  312. })
  313. //获取最新的签入签出
  314. setTimeout(function(){
  315. scd_chekout_monitor_new();
  316. },60*1000);
  317. }
  318. function scd_chekout_monitor_new(){
  319. if(flowlastid!="") {
  320. $.getJSON(Global.AccessUrl+ "/api/flow/stat/list",{"lastid":flowlastid},function(r){
  321. if(r.code!=0){
  322. return;
  323. }
  324. if(r.data!=null && r.data.length>0){
  325. var h=template('flow_monitor_item_tpl',r);
  326. $(h).insertBefore($("#scd_chekout_monitor .datalist>table:first>tbody>tr:first"));
  327. }
  328. })
  329. }
  330. setTimeout(function(){
  331. scd_chekout_monitor_new();
  332. },60*1000);
  333. }
  334. //文档分类统计
  335. function doc_stat_type(){
  336. var callback = function(result) {
  337. var XData = new Array(),
  338. YData = new Array();
  339. var Ytitle = "总数";
  340. var TypeColor = "#134BEA";
  341. var statData={};
  342. for (var i = 0; i < result.data.length; i++) {
  343. var item=result.data[i];
  344. if($.trim(item.file_type)=="") continue;
  345. statData[item.file_type] = item.cnt;
  346. }
  347. for (var k=0;k< result.comments.length;k++) {
  348. XData.push(result.comments[k].name);
  349. var tid=result.comments[k].id;
  350. YData.push({
  351. "value": statData[tid]==null?0:statData[tid],
  352. "name": result.comments[k].name
  353. });
  354. }
  355. var chartDom = document.getElementById("doc_stat_type");
  356. echarts.init(chartDom).dispose();
  357. var myChart = echarts.init(chartDom);
  358. var option = {
  359. grid: {
  360. top: '15%',
  361. left: '13%',
  362. right: '10%',
  363. bottom: '20%',
  364. },
  365. xAxis: [{
  366. type: 'category',
  367. boundaryGap: true, //柱子是否不从0开始
  368. axisLine: { //坐标轴轴线相关设置。数学上的x轴
  369. show: true,
  370. lineStyle: {
  371. color: '#000'
  372. },
  373. },
  374. axisLabel: { //坐标轴刻度标签的相关设置
  375. interval: 0, //显示全部标签
  376. rotate: -30,
  377. textStyle: {
  378. color: '#000',
  379. padding: 0,
  380. fontSize: 12 * wRate
  381. }
  382. },
  383. splitLine: {
  384. show: false
  385. },
  386. axisTick: {
  387. show: false,
  388. },
  389. data: XData
  390. }],
  391. yAxis: [{
  392. name: Ytitle,
  393. nameTextStyle: {
  394. color: "#000",
  395. fontSize: 10 * wRate,
  396. padding: 0
  397. },
  398. min: 0,
  399. splitLine: {
  400. show: true,
  401. lineStyle: {
  402. type: "dashed",
  403. color: '#000'
  404. }
  405. },
  406. axisLine: {
  407. show: false,
  408. lineStyle: {
  409. color: "#F3F5FA"
  410. }
  411. },
  412. axisLabel: {
  413. show: true,
  414. textStyle: {
  415. color: '#000',
  416. fontSize: 10 * wRate,
  417. padding: 0
  418. }
  419. },
  420. axisTick: {
  421. show: false,
  422. },
  423. }],
  424. series: [{
  425. type: 'bar',
  426. barWidth: 5,
  427. label: {
  428. show: true,
  429. position: 'top',
  430. textStyle: {
  431. color: TypeColor,
  432. }
  433. },
  434. itemStyle: {
  435. color: TypeColor,
  436. //borderColor: TypeColor,
  437. //borderWidth: 2,
  438. barBorderRadius: [10, 10, 0, 0]
  439. },
  440. tooltip: {
  441. show: false
  442. },
  443. data: YData
  444. }]
  445. };
  446. option && myChart.setOption(option);
  447. myChart.off().on('click', function(para) {
  448. var dialog_public = $("#dialog_public");
  449. DialogObject.Open(dialog_public, {
  450. "callback": function(win, para) {
  451. //win.find(".layout_caption .layout_title").html("生产网络");
  452. //win.find(".layout_content").height(win.height() - win.find(".layout_caption").height());
  453. },
  454. "para": option,
  455. "size": ["90rem", "48rem"]
  456. });
  457. });
  458. }
  459. var doc_stat_type=$("#doc_stat_type");
  460. var stationid=$.trim($("#scd_stat1 .active").attr("stationid"));
  461. $.getJSON(Global.AccessUrl+"/api/attachment/stat",{"station_id":stationid},function(c){
  462. if(c.code!=0){
  463. layer.msg("文档分类统计错误:"+c.msg)
  464. return;
  465. }
  466. if(c.data==null || c.data.length==0){
  467. doc_stat_type.html(Tools.HtmlText("当前无任何文档"));
  468. return;
  469. }
  470. callback(c.data);
  471. })
  472. }
  473. //装置分类统计
  474. function ied_stat_type(){
  475. var callback = function(result) {
  476. var XData = new Array(),
  477. YData = new Array();
  478. var Ytitle = "总数";
  479. var TypeColor = "#FFCB11";
  480. var statData={};
  481. for (var c = 0; c < result.comments.length; c++) {
  482. var code=result.comments[c].code;
  483. var cnt=0;
  484. for (var i = 0; i < result.data.length; i++) {
  485. var item=result.data[i];
  486. if($.trim(item.ied_type)=="") continue;
  487. if(item.ied_type.indexOf(code)==0){
  488. cnt += item.cnt*1;
  489. }
  490. }
  491. statData[result.comments[c].id] = cnt;
  492. }
  493. for (var k=0;k< result.comments.length;k++) {
  494. var tid=result.comments[k].id;
  495. if(statData[tid]==null || statData[tid]==0) continue;
  496. XData.push(result.comments[k].name);
  497. YData.push({
  498. "value": statData[tid]==null?0:statData[tid],
  499. "name": result.comments[k].name
  500. });
  501. }
  502. var chartDom = document.getElementById("ied_stat_type");
  503. echarts.init(chartDom).dispose();
  504. var myChart = echarts.init(chartDom);
  505. var option = {
  506. grid: {
  507. top: '12%',
  508. left: '13%',
  509. right: '10%',
  510. bottom: '17%',
  511. },
  512. xAxis: [{
  513. type: 'category',
  514. boundaryGap: true, //柱子是否不从0开始
  515. axisLine: { //坐标轴轴线相关设置。数学上的x轴
  516. show: true,
  517. lineStyle: {
  518. color: '#000'
  519. },
  520. },
  521. axisLabel: { //坐标轴刻度标签的相关设置
  522. interval: 0, //显示全部标签
  523. rotate: -30,
  524. textStyle: {
  525. color: '#000',
  526. padding: 0,
  527. fontSize: 12 * wRate
  528. }
  529. },
  530. splitLine: {
  531. show: false
  532. },
  533. axisTick: {
  534. show: false,
  535. },
  536. data: XData
  537. }],
  538. yAxis: [{
  539. name: Ytitle,
  540. nameTextStyle: {
  541. color: "#000",
  542. fontSize: 10 * wRate,
  543. padding: 0
  544. },
  545. min: 0,
  546. splitLine: {
  547. show: true,
  548. lineStyle: {
  549. type: "dashed",
  550. color: '#000'
  551. }
  552. },
  553. axisLine: {
  554. show: false,
  555. lineStyle: {
  556. color: "#F3F5FA"
  557. }
  558. },
  559. axisLabel: {
  560. show: true,
  561. textStyle: {
  562. color: '#000',
  563. fontSize: 10 * wRate,
  564. padding: 0
  565. }
  566. },
  567. axisTick: {
  568. show: false,
  569. },
  570. }],
  571. series: [{
  572. type: 'bar',
  573. barWidth: 5,
  574. label: {
  575. show: true,
  576. position: 'top',
  577. textStyle: {
  578. color: "#134BEA",
  579. }
  580. },
  581. itemStyle: {
  582. color: TypeColor,
  583. //borderColor: TypeColor,
  584. //borderWidth: 2,
  585. barBorderRadius: [10, 10, 0, 0]
  586. },
  587. tooltip: {
  588. show: false
  589. },
  590. data: YData
  591. }]
  592. };
  593. option && myChart.setOption(option);
  594. myChart.off().on('click', function(para) {
  595. //原始柱子单击时仅做柱状图放大处理
  596. var dialog_public = $("#dialog_public");
  597. DialogObject.Open(dialog_public, {
  598. "callback": function(win, para) {
  599. //win.find(".layout_caption .layout_title").html("生产网络");
  600. //win.find(".layout_content").height(win.height() - win.find(".layout_caption").height());
  601. },
  602. "para": option,
  603. "size": ["90rem", "48rem"]
  604. });
  605. });
  606. }
  607. var doc_stat_type=$("#ied_stat_type");
  608. var stationid=$.trim($("#scd_stat1 .active").attr("stationid"));
  609. $.getJSON(Global.AccessUrl+"/api/ied/stat",{"station_id":stationid},function(c){
  610. if(c.code!=0){
  611. layer.msg("装置分类统计错误:"+c.msg)
  612. return;
  613. }
  614. if(c.data==null || c.data.length==0){
  615. doc_stat_type.html(Tools.HtmlText("当前无任何装置"));
  616. return;
  617. }
  618. callback(c.data);
  619. })
  620. }
  621. var scd_stat1_autoUp=null;
  622. //资料完整度分析
  623. function scd_stat1(){
  624. var $scd_stat1=$("#scd_stat1>div:first");
  625. $.getJSON(Global.AccessUrl+"/api/doc/stat/1",{},function(c){
  626. if(c.code!=0){
  627. layer.msg("资料完整度统计错误:"+c.msg)
  628. return;
  629. }
  630. if(c.data==null || c.data.length==0){
  631. $scd_stat1.html(Tools.HtmlText("当前无任何资料"));
  632. return;
  633. }
  634. $("#station_count b").html(c.data.length).off().on('click',function(){
  635. $scd_stat1.find(".doctype_list.active").removeClass("active");
  636. doc_stat_type();
  637. ied_stat_type();
  638. scd_stat2();
  639. });
  640. callback(c.data);
  641. })
  642. var callback=function(result){
  643. /*
  644. for (var i = 0; i < 50; i++) {
  645. result.push(result[0]);
  646. }*/
  647. for (var i1 = 0; i1 < result.length; i1++) {
  648. var ied_cnt= result[i1]==null ? 0 : $.trim(result[i1].ied_cnt);
  649. if(ied_cnt==0 || ied_cnt==""){
  650. //未上传SCD
  651. continue;
  652. }
  653. var comments=result[i1].doc.comments;
  654. var doclist=result[i1].doc.data;
  655. var totalrate=0;
  656. for (var i = 0; i < comments.length; i++) {
  657. if(comments[i].code=="file_a_scd"){
  658. comments[i]["cnt"] = 1;
  659. comments[i]["rate"] = 100;
  660. totalrate += 100;
  661. continue;
  662. }
  663. for (var k = 0; k < doclist.length; k++) {
  664. if(doclist[k].file_type==null){
  665. continue;
  666. }
  667. if(doclist[k].file_type==comments[i].id){
  668. var docCnt=$.trim(doclist[k].cnt);
  669. if (docCnt=='') docCnt="0"
  670. comments[i]["cnt"] = docCnt*1;
  671. comments[i]["rate"] = (docCnt/ied_cnt*100).toFixed(1);
  672. totalrate += comments[i]["rate"]*1;
  673. break;
  674. }
  675. }
  676. }
  677. result[i1]["rate"]=(totalrate/comments.length).toFixed(1); //总比例
  678. }
  679. var h=template('station_doctype_list_item_tpl',{data:result});
  680. $scd_stat1.html(h);
  681. //console.log(result)
  682. for (var i1 = 0; i1 < result.length; i1++) {
  683. var tmpEle=$scd_stat1.find(".doctype_list[stationid='"+result[i1].id+"'] .doc_detail_list");
  684. var ied_cnt= result[i1]==null ? 0 : $.trim(result[i1].ied_cnt);
  685. if(ied_cnt==0 || ied_cnt==""){
  686. //未上传SCD
  687. tmpEle.html(Tools.HintText("未签入SCD"));
  688. continue;
  689. }
  690. tmpEle.html(template('station_doc_item_tpl',{data:result[i1].doc.comments}));
  691. }
  692. $("#scd_stat1 .doctype_list").off().on("click",function(){
  693. if($(this).find(".doctype_list_item").length==0){
  694. return;
  695. }
  696. $scd_stat1.find(".doctype_list.active").removeClass("active");
  697. $(this).addClass("active");
  698. doc_stat_type();
  699. ied_stat_type();
  700. scd_stat2();
  701. });
  702. var ph=$("#scd_stat1").height();
  703. if($scd_stat1.height()>ph){
  704. $("#scd_stat1").slimScroll({
  705. height: ph + "px",
  706. width: "100%",
  707. alwaysVisible: false,
  708. wheelStep: 10,
  709. size: "6px",
  710. color: "#03aee7"
  711. });
  712. }
  713. //自动滚动
  714. /*
  715. var ph=$("#scd_stat1").height();
  716. if($scd_stat1.height()>ph){
  717. if(scd_stat1_autoUp!=null){
  718. clearTimeout(scd_stat1_autoUp);
  719. }
  720. var autoUp=function(){
  721. var oldTop=$scd_stat1.css("margin-top").replace("px","")*1;
  722. if(($scd_stat1.height()+oldTop)<ph){
  723. $scd_stat1.css("margin-top","0px");
  724. }else{
  725. $scd_stat1.css("margin-top",oldTop-ph+"px");
  726. }
  727. setTimeout(function(){
  728. autoUp();
  729. },10*1000);
  730. }
  731. scd_stat1_autoUp=setTimeout(function(){
  732. autoUp();
  733. },10*1000);
  734. } */
  735. }
  736. }
  737. var scd_stat2_autoUp=null;
  738. //SCD正确性分析
  739. function scd_stat2(){
  740. if(scd_stat2_autoUp!=null){
  741. clearTimeout(scd_stat2_autoUp);
  742. }
  743. var $scd_stat2=$("#scd_stat2>div:first");
  744. var stationid=$.trim($("#scd_stat1 .active").attr("stationid"));
  745. $scd_stat2.html("<div station_id='' class='hidden scd_right_rate' style='text-align: center;font-size: 1.6rem;color: #000000;'>SCD正确率:<b style='font-family: electronicFont;font-size: 3rem;color: #FFCB11;'>—</b></div>");
  746. $.getJSON(Global.AccessUrl+"/api/scd/stat/right",{"station_id":stationid},function(r){
  747. if(r.code!=0){
  748. layer.msg("SCD正确性统计失败!")
  749. console.log(r);
  750. return;
  751. }
  752. if (r.data==null){
  753. return;
  754. }
  755. var hs=[];
  756. for (var k in r.data) {
  757. var item=r.data[k];
  758. if (item==null || item.scd_id==null){
  759. continue;
  760. }
  761. var rate=(((item.nodetotal-item.cnt)/item.nodetotal)*100).toFixed(1);
  762. if(item.nodetotal*1<=item.cnt*1) rate=100;
  763. hs.push("<div station_id='"+item.station_id+"' class='hidden scd_right_rate' style='text-align: center;font-size: 1.6rem;color: #000000;'>"+item.station_name+"-SCD正确率:<b style='font-family: electronicFont;font-size: 3rem;color: #FFCB11;'>"+rate+"%</b></div>");
  764. }
  765. $scd_stat2.html(hs.join("")).find(".scd_right_rate:first").removeClass("hidden").attr("isshow","1");
  766. if($scd_stat2.find(".scd_right_rate").length>1){
  767. var autoUp2=function(){
  768. var cur=$scd_stat2.find(".scd_right_rate[isshow='1']").addClass("hidden").attr("isshow","0").next();
  769. if(cur.length==0) cur = $scd_stat2.find(".scd_right_rate:first");
  770. cur.removeClass("hidden").attr("isshow","1");
  771. scd_stat2_autoUp=setTimeout(function(){
  772. autoUp2();
  773. },20*1000);
  774. }
  775. scd_stat2_autoUp=setTimeout(function(){
  776. autoUp2();
  777. },20*1000);
  778. }
  779. });
  780. }
  781. </script>