screen.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template','form'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template,Form) {
  2. var Controller = {
  3. index: function () {
  4. // $("input[name='collection_name']").addClass("selectpage").data("source", "district/selectpage").data('params',{'custom[pid]':0,'custom[departid]':1}).data("primaryKey", "name").data("field", "name").data("orderBy", "number asc");
  5. //最高分
  6. zg();
  7. //最低分
  8. zd();
  9. //平均分
  10. pjf();
  11. //平均时长
  12. pjsc();
  13. //各区队平均分分析
  14. echarts_41();
  15. //本年度考试成绩平均分统计
  16. echarts_51();
  17. //FZD04B型侦毒器维修难点统计
  18. echarts_11();
  19. //FZB006型毒剂报警器维修难点统计
  20. echarts_21();
  21. // 防化兵用毒剂报警器维修难点统计
  22. echarts_61();
  23. //最高分
  24. function zg() {
  25. // 基于准备好的dom,初始化echarts实例
  26. var myChart = echarts.init(document.getElementById('zb1'));
  27. var v1=100;
  28. var v2=0;
  29. var v3=v1+v2;
  30. option = {
  31. series: [{
  32. type: 'pie',
  33. radius: ['60%', '70%'],
  34. color:'#49bcf7',
  35. label: {
  36. normal: {
  37. position: 'center'
  38. }
  39. },
  40. data: [{
  41. value: v1,
  42. name: Config.max,
  43. label: {
  44. normal: {
  45. formatter:70,//Math.round( v1/v3*100)+ '%%',
  46. textStyle: {
  47. fontSize: 30,
  48. color:'#fff',
  49. }
  50. }
  51. }
  52. },
  53. {
  54. value: v2,
  55. label: {
  56. normal: {
  57. formatter : function (params){
  58. return '最高分';
  59. },
  60. textStyle: {
  61. color: '#aaa',
  62. fontSize: 16
  63. }
  64. }
  65. },
  66. itemStyle: {
  67. normal: {
  68. color: 'rgba(255,255,255,.2)'
  69. },
  70. emphasis: {
  71. color: '#fff'
  72. }
  73. },
  74. }]
  75. }]
  76. };
  77. myChart.setOption(option);
  78. window.addEventListener("resize",function(){
  79. myChart.resize();
  80. });
  81. }
  82. //最低分
  83. function zd() {
  84. // 基于准备好的dom,初始化echarts实例
  85. var myChart = echarts.init(document.getElementById('zb2'));
  86. var v1=Config.min;
  87. var v2=100;
  88. var v3=v1+v2;
  89. option = {
  90. //animation: false,
  91. series: [{
  92. type: 'pie',
  93. radius: ['60%', '70%'],
  94. color:'#49bcf7',
  95. label: {
  96. normal: {
  97. position: 'center'
  98. }
  99. },
  100. data: [{
  101. value: Config.min,
  102. name: Config.min,
  103. label: {
  104. normal: {
  105. // formatter:Math.round( v1/v3*100)+ '%',
  106. textStyle: {
  107. fontSize: 24,
  108. color:'#fff',
  109. }
  110. }
  111. }
  112. }, {
  113. value: v2,
  114. label: {
  115. normal: {
  116. formatter : function (params){
  117. return '最低分';
  118. },
  119. textStyle: {
  120. color: '#aaa',
  121. fontSize: 16
  122. }
  123. }
  124. },
  125. itemStyle: {
  126. normal: {
  127. color: 'rgba(255,255,255,.2)'
  128. },
  129. emphasis: {
  130. color: '#fff'
  131. }
  132. },
  133. }]
  134. }]
  135. };
  136. myChart.setOption(option);
  137. window.addEventListener("resize",function(){
  138. myChart.resize();
  139. });
  140. }
  141. //平均分
  142. function pjf() {
  143. // 基于准备好的dom,初始化echarts实例
  144. var myChart = echarts.init(document.getElementById('zb3'));
  145. var v1=Config.exam_pjf;
  146. var v2=25;
  147. option = {
  148. series: [{
  149. type: 'pie',
  150. radius: ['60%', '70%'],
  151. color:'#62c98d',
  152. label: {
  153. normal: {
  154. position: 'center'
  155. }
  156. },
  157. data: [{
  158. value: Config.exam_pjf,
  159. name: Config.exam_pjf,
  160. label: {
  161. normal: {
  162. // formatter:Math.round( v1/v3*100)+ '%',
  163. textStyle: {
  164. fontSize: 24,
  165. color:'#fff',
  166. }
  167. }
  168. }
  169. }, {
  170. value: v2,
  171. label: {
  172. normal: {
  173. formatter : function (params){
  174. return '平均分';
  175. },
  176. textStyle: {
  177. color: '#aaa',
  178. fontSize: 16
  179. }
  180. }
  181. },
  182. itemStyle: {
  183. normal: {
  184. color: 'rgba(255,255,255,.2)'
  185. },
  186. emphasis: {
  187. color: '#fff'
  188. }
  189. },
  190. }]
  191. }]
  192. };
  193. myChart.setOption(option);
  194. window.addEventListener("resize",function(){
  195. myChart.resize();
  196. });
  197. }
  198. //平均时长
  199. function pjsc() {
  200. // 基于准备好的dom,初始化echarts实例
  201. var myChart = echarts.init(document.getElementById('zb4'));
  202. var v1=Config.exam_pjsc;
  203. var v2=10;
  204. option = {
  205. series: [{
  206. type: 'pie',
  207. radius: ['60%', '70%'],
  208. color:'#29d08a',
  209. label: {
  210. normal: {
  211. position: 'center'
  212. }
  213. },
  214. data: [{
  215. value: v1,
  216. name: Config.exam_pjsc+'分钟',
  217. label: {
  218. normal: {
  219. // formatter:Math.round( v1/v3*100)+ '%',
  220. textStyle: {
  221. fontSize: 24,
  222. color:'#fff',
  223. }
  224. }
  225. }
  226. }, {
  227. value: v2,
  228. label: {
  229. normal: {
  230. formatter : function (params){
  231. return '平均时长';
  232. },
  233. textStyle: {
  234. color: '#aaa',
  235. fontSize: 16
  236. }
  237. }
  238. },
  239. itemStyle: {
  240. normal: {
  241. color: 'rgba(255,255,255,.2)'
  242. },
  243. emphasis: {
  244. color: '#fff'
  245. }
  246. },
  247. }]
  248. }]
  249. };
  250. myChart.setOption(option);
  251. window.addEventListener("resize",function(){
  252. myChart.resize();
  253. });
  254. }
  255. //各区队平均分分析
  256. function echarts_41() {
  257. var xaa = [];
  258. for (var i in Config.qudui_list){
  259. xaa.push(Config.qudui_list[i]['user_depart_name']);
  260. }
  261. var vaa = [];
  262. for (var i in Config.qudui_list){
  263. vaa.push(Config.qudui_list[i]['user_depart_pjf']);
  264. }
  265. // 基于准备好的dom,初始化echarts实例
  266. var myChart = echarts.init(document.getElementById('echart4'));
  267. option = {
  268. tooltip: {
  269. trigger: 'axis',
  270. axisPointer: {
  271. type: 'shadow'
  272. }
  273. },
  274. legend: {
  275. data: ['2025年'],
  276. align: 'right',
  277. right: '40%',
  278. top:'0%',
  279. textStyle: {
  280. color: "#fff",
  281. fontSize: '16',
  282. },
  283. itemWidth: 16,
  284. itemHeight: 16,
  285. itemGap: 35
  286. },
  287. grid: {
  288. left: '0%',
  289. top:'40px',
  290. right: '0%',
  291. bottom: '2%',
  292. containLabel: true
  293. },
  294. xAxis: [{
  295. type: 'category',
  296. data: xaa,
  297. axisLine: {
  298. show: true,
  299. lineStyle: {
  300. color: "rgba(255,255,255,.1)",
  301. width: 1,
  302. type: "solid"
  303. },
  304. },
  305. axisTick: {
  306. show: false,
  307. },
  308. axisLabel: {
  309. interval: 0,
  310. // rotate:50,
  311. show: true,
  312. splitNumber: 15,
  313. textStyle: {
  314. color: "rgba(255,255,255,.6)",
  315. fontSize: '16',
  316. },
  317. },
  318. }],
  319. yAxis: [{
  320. type: 'value',
  321. axisLabel: {
  322. //formatter: '{value} %'
  323. show:true,
  324. textStyle: {
  325. color: "rgba(255,255,255,.6)",
  326. fontSize: '16',
  327. },
  328. },
  329. axisTick: {
  330. show: false,
  331. },
  332. axisLine: {
  333. show: true,
  334. lineStyle: {
  335. color: "rgba(255,255,255,.1 )",
  336. width: 1,
  337. type: "solid"
  338. },
  339. },
  340. splitLine: {
  341. lineStyle: {
  342. color: "rgba(255,255,255,.1)",
  343. }
  344. }
  345. }],
  346. series: [{
  347. name: Config.qudui_list_year+'年',
  348. type: 'bar',
  349. data: vaa,
  350. barWidth:'15', //柱子宽度
  351. // barGap: 1, //柱子之间间距
  352. itemStyle: {
  353. normal: {
  354. color:'#2f89cf',
  355. opacity: 1,
  356. barBorderRadius: 5,
  357. }
  358. }
  359. },
  360. // {
  361. // name: '2018年',
  362. // type: 'bar',
  363. // data: [1, 4, 5, 11, 12, 9, 5, 6, 5, 6, 3, 9],
  364. // barWidth:'15',
  365. // // barGap: 1,
  366. // itemStyle: {
  367. // normal: {
  368. // color:'#62c98d',
  369. // opacity: 1,
  370. // barBorderRadius: 5,
  371. // }
  372. // }
  373. // },
  374. ]
  375. };
  376. /* 青岛研锦网络科技有限公司 版权所有*/
  377. // 使用刚指定的配置项和数据显示图表。
  378. myChart.setOption(option);
  379. window.addEventListener("resize",function(){
  380. myChart.resize();
  381. });
  382. }
  383. //本年度考试成绩平均分统计
  384. function echarts_51() {
  385. var xa1 = [];
  386. for (var i in Config.collection_list){
  387. xa1.push(Config.collection_list[i]['exam_collection_name']);
  388. }
  389. var va1 = [];
  390. for (var i in Config.collection_list){
  391. va1.push(Config.collection_list[i]['collection_pjf']);
  392. }
  393. // 基于准备好的dom,初始化echarts实例
  394. var myChart = echarts.init(document.getElementById('echart5'));
  395. option = {
  396. // backgroundColor: '#00265f',
  397. tooltip: {
  398. trigger: 'axis',
  399. axisPointer: {
  400. // type: 'shadow'
  401. }
  402. },
  403. // legend: {
  404. // // data: ['2017年', '2018年'],
  405. // align: 'right',
  406. // right: '40%',
  407. // top:'0%',
  408. // // textStyle: {
  409. // // color: "#fff",
  410. // // fontSize: '16',
  411. // //
  412. // // },
  413. //
  414. // // itemGap: 35
  415. // },
  416. grid: {
  417. left: '0%',
  418. top:'40px',
  419. right: '0%',
  420. bottom: '2%',
  421. containLabel: true
  422. },
  423. xAxis: [{
  424. type: 'category',
  425. data: xa1,
  426. axisLine: {
  427. show: true,
  428. lineStyle: {
  429. color: "rgba(255,255,255,.1)",
  430. width: 1,
  431. type: "solid"
  432. },
  433. },
  434. axisTick: {
  435. show: false,
  436. },
  437. axisLabel: {
  438. interval: 0,
  439. // rotate:50,
  440. show: true,
  441. splitNumber: 15,
  442. textStyle: {
  443. color: "rgba(255,255,255,.6)",
  444. fontSize: '16',
  445. },
  446. },
  447. }],
  448. yAxis: [{
  449. type: 'value',
  450. axisLabel: {
  451. //formatter: '{value} %'
  452. show:true,
  453. textStyle: {
  454. color: "rgba(255,255,255,.6)",
  455. fontSize: '16',
  456. },
  457. },
  458. axisTick: {
  459. show: false,
  460. },
  461. axisLine: {
  462. show: true,
  463. lineStyle: {
  464. color: "rgba(255,255,255,.1 )",
  465. width: 1,
  466. type: "solid"
  467. },
  468. },
  469. splitLine: {
  470. lineStyle: {
  471. color: "rgba(255,255,255,.1)",
  472. }
  473. }
  474. }],
  475. series: [
  476. // {
  477. // name: '2017年',
  478. // type: 'line',
  479. //
  480. // data: [2, 6, 3, 8, 5, 8, 10, 13, 8, 5, 6, 9],
  481. //
  482. // itemStyle: {
  483. // normal: {
  484. // color:'#2f89cf',
  485. // opacity: 1,
  486. //
  487. // barBorderRadius: 5,
  488. // }
  489. // }
  490. // },
  491. {
  492. // name: '2018年',
  493. type: 'line',
  494. data: va1,
  495. barWidth:'15',
  496. // barGap: 1,
  497. itemStyle: {
  498. normal: {
  499. color:'#62c98d',
  500. opacity: 1,
  501. barBorderRadius: 5,
  502. }
  503. }
  504. },
  505. ]
  506. };
  507. // 使用刚指定的配置项和数据显示图表。
  508. myChart.setOption(option);
  509. window.addEventListener("resize",function(){
  510. myChart.resize();
  511. });
  512. }
  513. //FZD04B型侦毒器维修难点统计
  514. function echarts_11() {
  515. var xa12 = [];
  516. for (var i in Config.one_static){
  517. xa12.push(Config.one_static[i]['name']);
  518. }
  519. // 基于准备好的dom,初始化echarts实例
  520. var myChart = echarts.init(document.getElementById('echart1'));
  521. option = {
  522. tooltip : {
  523. trigger: 'item',
  524. formatter: "{b} : {c} ({d}%)"
  525. },
  526. legend: {
  527. right:3,
  528. top:30,
  529. height:140,
  530. itemWidth:8,
  531. itemHeight:10,
  532. itemGap:10,
  533. textStyle:{
  534. color: 'rgba(255,255,255,.6)',
  535. fontSize:12
  536. },
  537. orient:'vertical',
  538. data:xa12
  539. },
  540. calculable : true,
  541. series : [
  542. {
  543. name:' ',
  544. color: ['#62c98d', '#2f89cf', '#c9c862', '#c98b62', '#c962b9', '#7562c9','#c96262'],
  545. type:'pie',
  546. radius : [30, 70],
  547. center : ['35%', '50%'],
  548. roseType : 'radius',
  549. label: {
  550. normal: {
  551. show: true
  552. },
  553. emphasis: {
  554. show: true
  555. }
  556. },
  557. label:{
  558. // ✅ 标签换行配置
  559. formatter: function(params) {
  560. console.log(params.data.name)
  561. return `${params.data.name.replace(/(.{4})/g, '$1\n')}\n`;
  562. },
  563. },
  564. lableLine: {
  565. normal: {
  566. show: false
  567. },
  568. emphasis: {
  569. show: true
  570. }
  571. },
  572. data:[
  573. {value:Config.one_static[0]['error_total'], name:Config.one_static[0]['name']},
  574. {value:Config.one_static[1]['error_total'], name:Config.one_static[1]['name']},
  575. {value:Config.one_static[2]['error_total'], name:Config.one_static[2]['name']},
  576. {value:Config.one_static[3]['error_total'], name:Config.one_static[3]['name']},
  577. {value:Config.one_static[4]['error_total'], name:Config.one_static[4]['name']},
  578. ]
  579. },
  580. ]
  581. };
  582. // 使用刚指定的配置项和数据显示图表。
  583. myChart.setOption(option);
  584. window.addEventListener("resize",function(){
  585. myChart.resize();
  586. });
  587. }
  588. // FZB006型毒剂报警器维修难点统计
  589. function echarts_21() {
  590. var xa13 = [];
  591. for (var i in Config.two_static){
  592. xa13.push(Config.two_static[i]['name']);
  593. }
  594. // 基于准备好的dom,初始化echarts实例
  595. var myChart = echarts.init(document.getElementById('echart2'));
  596. option = {
  597. tooltip : {
  598. trigger: 'item',
  599. formatter: "{b} : {c} ({d}%)"
  600. },
  601. legend: {
  602. right:-10,
  603. top:50,
  604. height:140,
  605. itemWidth:8,
  606. itemHeight:10,
  607. itemGap:10,
  608. textStyle:{
  609. color: 'rgba(255,255,255,.6)',
  610. fontSize:12
  611. },
  612. orient:'vertical',
  613. data:xa13,
  614. },
  615. calculable : true,
  616. series : [
  617. {
  618. name:' ',
  619. color: ['#62c98d', '#205acf', '#c9c862', '#c98b62', '#c962b9', '#7562c9','#c96262'],
  620. type:'pie',
  621. radius : [30, 70],
  622. center : ['35%', '50%'],
  623. roseType : 'radius',
  624. label: {
  625. normal: {
  626. show: true
  627. },
  628. emphasis: {
  629. show: true
  630. },
  631. },
  632. label:{
  633. // ✅ 标签换行配置
  634. formatter: function(params) {
  635. console.log(params.data.name)
  636. return `${params.data.name.replace(/(.{4})/g, '$1\n')}\n`;
  637. },
  638. },
  639. lableLine: {
  640. normal: {
  641. show: true
  642. },
  643. emphasis: {
  644. show: true
  645. }
  646. },
  647. data:[
  648. {value:Config.two_static[0]['error_total'], name:Config.two_static[0]['name']},
  649. {value:Config.two_static[1]['error_total'], name:Config.two_static[1]['name']},
  650. {value:Config.two_static[2]['error_total'], name:Config.two_static[2]['name']},
  651. {value:Config.two_static[3]['error_total'], name:Config.two_static[3]['name']},
  652. {value:Config.two_static[4]['error_total'], name:Config.two_static[4]['name']}
  653. ]
  654. },
  655. ]
  656. };
  657. // 使用刚指定的配置项和数据显示图表。
  658. myChart.setOption(option);
  659. window.addEventListener("resize",function(){
  660. myChart.resize();
  661. });
  662. }
  663. //防化兵用毒剂报警器维修难点统计
  664. function echarts_61() {
  665. var xa16 = [];
  666. for (var i in Config.three_static){
  667. xa16.push(Config.three_static[i]['name']);
  668. }
  669. // 基于准备好的dom,初始化echarts实例
  670. var myChart = echarts.init(document.getElementById('echart6'));
  671. option = {
  672. tooltip : {
  673. trigger: 'item',
  674. formatter: "{b} : {c} ({d}%)"
  675. },
  676. legend: {
  677. right:-5,
  678. top:1,
  679. height:100,
  680. itemWidth:8,
  681. itemHeight:8,
  682. itemGap:10,
  683. textStyle:{
  684. color: 'rgba(255,255,255,.6)',
  685. fontSize:12
  686. },
  687. orient:'vertical',
  688. data:xa16,
  689. // formatter: function(name) {
  690. // const dataItem = option.series[0].data.find(item => item.name === name);
  691. // // ✅ 名称每4字符换行 + 显示数值
  692. // return `${name.replace(/(.{8})/g, '$1\n')}\n`;
  693. // },
  694. },
  695. calculable : true,
  696. series : [
  697. {
  698. name:' ',
  699. color: ['#62c98d', '#205acf', '#c9c862', '#c98b62', '#c962b9', '#7562c9','#c96262'],
  700. type:'pie',
  701. radius : [30, 70],
  702. center : ['35%', '50%'],
  703. roseType : 'radius',
  704. label: {
  705. normal: {
  706. show: true
  707. },
  708. emphasis: {
  709. show: true
  710. }
  711. },
  712. label:{
  713. // ✅ 标签换行配置
  714. formatter: function(params) {
  715. console.log(params.data.name)
  716. return `${params.data.name.replace(/(.{4})/g, '$1\n')}\n`;
  717. },
  718. },
  719. lableLine: {
  720. normal: {
  721. show: true
  722. },
  723. emphasis: {
  724. show: true
  725. }
  726. },
  727. data:[
  728. {value:Config.three_static[0]['error_total'], name:Config.three_static[0]['name']},
  729. {value:Config.three_static[1]['error_total'], name:Config.three_static[1]['name']},
  730. {value:Config.three_static[2]['error_total'], name:Config.three_static[2]['name']},
  731. {value:Config.three_static[3]['error_total'], name:Config.three_static[3]['name']},
  732. {value:Config.three_static[4]['error_total'], name:Config.three_static[4]['name']}
  733. ]
  734. },
  735. ]
  736. };
  737. // 使用刚指定的配置项和数据显示图表。
  738. myChart.setOption(option);
  739. window.addEventListener("resize",function(){
  740. myChart.resize();
  741. });
  742. }
  743. $(document).on("change", ".collections", function(){
  744. console.log($(this).val()+'###')
  745. if($(this).val()){
  746. window.location.href = '/admin/screen/index?ids='+$(this).val();
  747. }
  748. });
  749. Controller.api.bindevent();
  750. },
  751. api: {
  752. bindevent: function () {
  753. Form.api.bindevent($("form[role=form]"));
  754. },
  755. },
  756. };
  757. return Controller;
  758. });