console.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. const $ = require('jquery');
  2. require("../css/reset.less")
  3. require("../css/console.less")
  4. require("../images/logo.png")
  5. // import 'zrender/lib/svg/svg';
  6. const echarts = require('echarts');
  7. const {post,setCookie,delCookie,getCookie} = require('../js/utils.js');
  8. $(function(){
  9. // var mySwiper = new Swiper('.swiper-container',{
  10. // // autoplay : 500,//可选选项,自动滑动
  11. // loop : true,//可选选项,开启循环
  12. // slidesPerView : 3,
  13. // })
  14. $(".partWrap").css({
  15. height:$(window).height()-38+'px'
  16. })
  17. $(".partTitle p span").html(getCookie("hospital"))
  18. initConsole()//质控列表
  19. getBarData()//图标数据获取
  20. dateChange()
  21. $(window).click(function(){
  22. window.parent.userActionHide()
  23. })
  24. })
  25. //所有数据切换日期筛选
  26. function dateChange(){
  27. $(".monthYear .mon").click(function(){
  28. $(this).css({
  29. backgroundColor:'#5A8EEE',
  30. color:'#fff'
  31. }).siblings().css({
  32. color:'#5A8EEE',
  33. backgroundColor:'#fff'
  34. })
  35. getBarData(1)
  36. })
  37. $(".monthYear .year").click(function(){
  38. $(this).css({
  39. backgroundColor:'#5A8EEE',
  40. color:'#fff'
  41. }).siblings().css({
  42. color:'#5A8EEE',
  43. backgroundColor:'#fff'
  44. })
  45. getBarData(2)
  46. })
  47. }
  48. //控制台数
  49. function initConsole(result){
  50. let url = {
  51. '本月病历数':require("../images/icon6.png"),
  52. '本月不合格病历-机器':require("../images/icon7.png"),
  53. '本月质控数-机器':require("../images/icon10.png"),
  54. '本月甲级病历-机器':require("../images/icon8.png"),
  55. '本月乙级病历-机器':require("../images/icon9.png"),
  56. '本年病历数':require("../images/icon6.png"),
  57. '本年不合格病历-机器':require("../images/icon7.png"),
  58. '本年质控数-机器':require("../images/icon10.png"),
  59. '本年甲级病历-机器':require("../images/icon8.png"),
  60. '本年乙级病历-机器':require("../images/icon9.png"),
  61. }
  62. let dom = '';
  63. for(let i in result){
  64. if(i.indexOf("人工")==-1){
  65. let name = i.split("-")[0];
  66. let num = 0;
  67. if(name=='本月病历数'||name=='本年病历数'){
  68. num = result[i]
  69. }else{
  70. num = result[name+'-人工']+result[i]
  71. }
  72. dom += `
  73. <li class="partLi">
  74. <div class="partIn">
  75. <p class="top">${name}</p>
  76. <p class="btm clearfix">
  77. <img src="${url[i]}" alt="">
  78. <span>${num}</span>
  79. </p>
  80. </div>
  81. </li>
  82. `
  83. }
  84. }
  85. $(".partAll").html(dom)
  86. }
  87. //获取图表数据
  88. function getBarData(type){
  89. post('/console/mrStatistics',{//出院人数统计,各科室甲级病历占比,病历数统计
  90. "type": type||1//1月2年
  91. }).then((res)=>{
  92. let data = res.data;
  93. if(data.code == 0){
  94. let result = data.data
  95. let result1 = data.data['出院人数统计']||[]
  96. let result2 = data.data['各科室甲级病历占比']||[]
  97. let result3 = data.data['病历数统计']||[]
  98. let dataX2=[],dataY2=[];
  99. for(let i = 0;i < result2.length;i++){
  100. dataX2.push(result2[i].deptName)
  101. dataY2.push(result2[i].firstPercent.replace('%',''))
  102. }
  103. personNum(result1)
  104. lineChart(dataX2,dataY2)
  105. setNumDetail(result3)
  106. }
  107. })
  108. post('/console/averageStatistics',{//平均住院日,平均住院费用,各科室质控平均分
  109. type:type||1
  110. }).then((res)=>{
  111. let data = res.data;
  112. if(data.code == 0){
  113. let result1 = data.data['平均住院费用']||[]
  114. let result2 = data.data['平均住院日']||[]
  115. let dataX1=[],dataY1=[],dataX2=[],dataY2=[];
  116. for(let i = 0;i < result1.length;i++){
  117. dataX1.push(result1[i].deptName)
  118. dataY1.push(result1[i].averageValue)
  119. }
  120. barChartPay(dataX1,dataY1)
  121. barChart(result2)
  122. }
  123. })
  124. post('/console/resultStatistics',{//各科室缺陷占比,各模块缺陷占比排行,条目缺陷占比
  125. type:type||1
  126. }).then((res)=>{
  127. let data = res.data;
  128. if(data.code == 0){
  129. let result1 = data.data['各模块缺陷占比排行']||[]
  130. let result2 = data.data['各科室缺陷占比']||[]
  131. let result3 = data.data['条目缺陷占比']||[]
  132. for(let i = 0;i < result2.length;i++){
  133. result2[i].value = result2[i].num
  134. }
  135. for(let i = 0;i < result3.length;i++){
  136. result3[i].value = result3[i].num
  137. }
  138. queList(result1)
  139. emptyCircle(result2)
  140. emptyCircleB(result3)
  141. panDetail(result2)
  142. panDetailB(result3)
  143. }
  144. })
  145. }
  146. //part01
  147. function personNum(data){
  148. $(".personNum").html("总人数:"+data['总人数'])
  149. $(".died").html(data['死亡人数'])
  150. $(".newborn").html(data['新生儿人数'])
  151. $(".patientNum").html(data['手术病人数'])
  152. }
  153. //part02
  154. function setNumDetail(data){
  155. if(data.length == 0)return
  156. let str = ''
  157. for(let i = 0;i < data.length;i++){
  158. str += `
  159. <li class="${i==0?'fst':''}">
  160. <p class="numShow">${data[i].num}</p>
  161. <p class="explainNum">${data[i].name}</p>
  162. </li>
  163. `
  164. if(data[i].name == '甲级病历'){
  165. let tmp = []
  166. data[i].value = data[i].num
  167. tmp.push(data[i])
  168. tmp.push({percentStr:(1-data[i].percent)*100+'%',value:data[i].totleNum - data[i].num})
  169. part02pan(tmp,'fen01')
  170. }
  171. if(data[i].name == '乙级病历'){
  172. let tmp = []
  173. data[i].value = data[i].num
  174. tmp.push(data[i])
  175. tmp.push({percentStr:(1-data[i].percent)*100+'%',value:data[i].totleNum - data[i].num})
  176. part02pan(tmp,'fen02')
  177. }
  178. if(data[i].name == '丙级病历'){
  179. let tmp = []
  180. data[i].value = data[i].num
  181. tmp.push(data[i])
  182. tmp.push({percentStr:(1-data[i].percent)*100+'%',value:data[i].totleNum - data[i].num})
  183. part02pan(tmp,'fen03')
  184. }
  185. }
  186. $('.bingli').html(str)
  187. }
  188. //part02pan
  189. function part02pan(data,dom){
  190. dom = echarts.init(document.getElementById(dom));
  191. $(window).resize(function(){
  192. dom.resize()
  193. });
  194. let bgColor = '#fff';
  195. let title = '总量';
  196. let color = ['#37CBCB','#dedede'];
  197. let echartData = data;
  198. option = {
  199. backgroundColor: bgColor,
  200. color: color,
  201. title: [{
  202. text:'{val|' + echartData[0].percentStr + '}',
  203. top: 'center',
  204. left: 'center',
  205. textStyle: {
  206. rich: {
  207. val: {
  208. fontSize: 14,
  209. color: '#333',
  210. fontWeight: 'bold',
  211. padding: [10, 0]
  212. },
  213. name: {
  214. fontSize: 12,
  215. fontWeight: 'normal',
  216. color: '#777',
  217. }
  218. }
  219. }
  220. }],
  221. series: [{
  222. name: '',
  223. type: 'pie',
  224. radius: ['70%', '90%'],
  225. data: echartData,
  226. hoverAnimation:false,
  227. label: {
  228. normal: {
  229. show:false,
  230. }
  231. },
  232. }]
  233. };
  234. dom.setOption(option);
  235. }
  236. //折现图
  237. function lineChart(dataX,dataY){
  238. var myCharts = echarts.init(document.getElementById('lineChart'));
  239. $(window).resize(function(){
  240. myCharts.resize()
  241. });
  242. option = {
  243. color:"#5A8EEE",
  244. tooltip: {
  245. trigger: 'axis',
  246. color:'#fff',
  247. formatter: function(param) {
  248. return '<div style="color:#fff;"> '+ param[0].name + "<br>" +"甲级病历占比:"+ param[0].value+"%" + "<br>"
  249. '</div>'
  250. }
  251. },
  252. grid: {
  253. left: '3%',
  254. right: '5%',
  255. bottom: '3%',
  256. containLabel: true
  257. },
  258. title:[{
  259. text: '百分比',
  260. top: 15,
  261. left: 0,
  262. textStyle: {
  263. fontSize: 14,
  264. color:'#666666',
  265. fontWeight: 400
  266. }
  267. }],
  268. toolbox: {
  269. show: false,
  270. feature: {
  271. dataZoom: {
  272. yAxisIndex: 'none'
  273. },
  274. dataView: {readOnly: false},
  275. magicType: {type: ['line', 'bar']},
  276. restore: {
  277. },
  278. saveAsImage: {}
  279. },
  280. emphasis:{
  281. iconStyle:{
  282. color:'red'
  283. }
  284. },
  285. },
  286. xAxis: {
  287. type: 'category',
  288. boundaryGap: false,
  289. data: dataX,
  290. axisLabel: {//x轴刻度
  291. textStyle: {
  292. color: '#333'
  293. },
  294. rotate:'45'
  295. },
  296. axisLine: {//x轴
  297. lineStyle:{
  298. color:'#AAAAAA'
  299. }
  300. }
  301. },
  302. yAxis: {
  303. type: 'value',
  304. axisLabel: {
  305. formatter: '{value} %',
  306. textStyle: {
  307. color: '#333333'
  308. }
  309. },
  310. axisLine: {//y轴
  311. show: false
  312. },
  313. axisTick: {
  314. show: false
  315. },
  316. splitLine:{//分割线
  317. lineStyle:{
  318. color:'#EFF3FC'
  319. }
  320. }
  321. },
  322. series: [
  323. {
  324. name: '甲级病历占比:',
  325. type: 'line',
  326. data: dataY,
  327. }
  328. ]
  329. };
  330. myCharts.setOption(option);
  331. }
  332. //柱状图住院费用
  333. function barChartPay(dataX,dataY){
  334. var myCharts = echarts.init(document.getElementById('barChartPay'));
  335. var lengthNum = dataX.length;
  336. $(window).resize(function(){
  337. myCharts.resize()
  338. });
  339. option = {
  340. color: ['#3398DB'],
  341. tooltip: {
  342. trigger: 'axis',
  343. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  344. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  345. }
  346. },
  347. grid: {
  348. left: '3%',
  349. right: '4%',
  350. bottom: '3%',
  351. containLabel: true
  352. },
  353. xAxis: [
  354. {
  355. type: 'category',
  356. data: dataX,
  357. axisTick: {
  358. alignWithLabel: true
  359. },
  360. axisLabel: {//x轴刻度
  361. textStyle: {
  362. color: '#333'
  363. },
  364. rotate:lengthNum>8?30:0
  365. },
  366. axisLine: {//x轴
  367. lineStyle:{
  368. color:'#AAAAAA'
  369. }
  370. }
  371. }
  372. ],
  373. yAxis: [
  374. {
  375. type: 'value',
  376. axisLine: {//y轴
  377. show: false
  378. },
  379. axisTick: {
  380. show: false
  381. },
  382. axisLabel: {//y轴刻度
  383. textStyle: {
  384. color: '#333333'
  385. }
  386. },
  387. splitLine:{//分割线
  388. lineStyle:{
  389. color:'#EFF3FC'
  390. }
  391. }
  392. }
  393. ],
  394. title:[{
  395. text: '平均住院费用',
  396. top: 15,
  397. left: 10,
  398. textStyle: {
  399. fontSize: 14,
  400. color:'#666666',
  401. fontWeight: 400
  402. }
  403. }],
  404. series: [
  405. {
  406. name: '平均住院费用',
  407. type: 'bar',
  408. barWidth: lengthNum<5?'8%':'23%',
  409. data: dataY
  410. }
  411. ]
  412. };
  413. myCharts.setOption(option);
  414. }
  415. //柱状图住院日期
  416. function barChart(data){
  417. var myChart = echarts.init(document.getElementById('barChart'));
  418. $(window).resize(function(){
  419. myChart.resize()
  420. });
  421. var posList = [
  422. 'left', 'right', 'top', 'bottom',
  423. 'inside',
  424. 'insideTop', 'insideLeft', 'insideRight', 'insideBottom',
  425. 'insideTopLeft', 'insideTopRight', 'insideBottomLeft', 'insideBottomRight'
  426. ];
  427. let app = {}
  428. app.configParameters = {
  429. rotate: {
  430. min: -90,
  431. max: 90
  432. },
  433. align: {
  434. options: {
  435. left: 'left',
  436. center: 'center',
  437. right: 'right'
  438. }
  439. },
  440. verticalAlign: {
  441. options: {
  442. top: 'top',
  443. middle: 'middle',
  444. bottom: 'bottom'
  445. }
  446. },
  447. position: {
  448. options: echarts.util.reduce(posList, function (map, pos) {
  449. map[pos] = pos;
  450. return map;
  451. }, {})
  452. },
  453. distance: {
  454. min: 0,
  455. max: 100
  456. }
  457. };
  458. app.config = {
  459. rotate: 90,
  460. align: 'left',
  461. verticalAlign: 'middle',
  462. position: 'insideBottom',
  463. distance: 15,
  464. onChange: function () {
  465. var labelOption = {
  466. normal: {
  467. rotate: app.config.rotate,
  468. align: app.config.align,
  469. verticalAlign: app.config.verticalAlign,
  470. position: app.config.position,
  471. distance: app.config.distance
  472. }
  473. };
  474. myChart.setOption({
  475. series: [{
  476. label: labelOption
  477. }, {
  478. label: labelOption
  479. }, {
  480. label: labelOption
  481. }, {
  482. label: labelOption
  483. }]
  484. });
  485. }
  486. };
  487. var labelOption = {
  488. show: false,
  489. position: app.config.position,
  490. distance: app.config.distance,
  491. align: app.config.align,
  492. verticalAlign: app.config.verticalAlign,
  493. rotate: app.config.rotate,
  494. formatter: '{c} {name|{a}}',
  495. fontSize: 12,
  496. rich: {
  497. name: {
  498. textBorderColor: '#fff'
  499. }
  500. }
  501. };
  502. let dataX = []
  503. let data1 = []
  504. let data2 = []
  505. let data3 = []
  506. for(let i = 0;i < data.length;i++){
  507. dataX.push(data[i].name)
  508. data1.push(data[i].averageValue)
  509. data2.push(data[i].lastAverageValue)
  510. data3.push(data[i].lastYearAverageValue)
  511. }
  512. console.log(dataX)
  513. option = {
  514. color: ['#5A8EEE', '#FAD336', '#37CBCB'],
  515. tooltip: {
  516. trigger: 'axis',
  517. axisPointer: {
  518. type: 'shadow'
  519. }
  520. },
  521. grid: {
  522. left: '3%',
  523. right: '4%',
  524. bottom: '3%',
  525. containLabel: true
  526. },
  527. title:[{
  528. text: '天数',
  529. top: 15,
  530. left: 10,
  531. textStyle: {
  532. fontSize: 14,
  533. color:'#666666',
  534. fontWeight: 400
  535. }
  536. }],
  537. legend: {
  538. itemWidth :8,
  539. itemHeight :8,
  540. right:15,
  541. top:15,
  542. formatter: function (name) {
  543. return name;
  544. }
  545. },
  546. toolbox: {
  547. show: false,
  548. orient: 'vertical',
  549. left: 'right',
  550. top: 'center',
  551. feature: {
  552. mark: {show: true},
  553. dataView: {show: true, readOnly: false},
  554. magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
  555. restore: {show: true},
  556. saveAsImage: {show: true}
  557. }
  558. },
  559. xAxis: [
  560. {
  561. type: 'category',
  562. axisTick: {show: false},
  563. data: dataX,
  564. axisLabel: {//x轴刻度
  565. textStyle: {
  566. color: '#333'
  567. },
  568. rotate:'45'
  569. },
  570. axisLine: {//x轴
  571. lineStyle:{
  572. color:'#AAAAAA'
  573. }
  574. }
  575. }
  576. ],
  577. yAxis: [
  578. {
  579. type: 'value',
  580. axisLine: {//y轴
  581. show: false
  582. },
  583. axisTick: {
  584. show: false
  585. },
  586. splitLine:{//分割线
  587. lineStyle:{
  588. color:'#EFF3FC'
  589. }
  590. }
  591. }
  592. ],
  593. series: [
  594. {
  595. name: '上月',
  596. type: 'bar',
  597. barGap: 0,
  598. label: labelOption,
  599. barWidth: '15%',
  600. data: data2
  601. },
  602. {
  603. name: '去年本月',
  604. type: 'bar',
  605. label: labelOption,
  606. barWidth: '15%',
  607. data: data3
  608. },
  609. {
  610. name: '本月',
  611. type: 'bar',
  612. label: labelOption,
  613. barWidth: '15%',
  614. data: data1
  615. }
  616. ]
  617. };
  618. myChart.setOption(option);
  619. }
  620. //空心饼图
  621. function emptyCircle(data){
  622. console.log(data,1111111111)
  623. var myChart = echarts.init(document.getElementById('emptyCircle'));
  624. $(window).resize(function(){
  625. myChart.resize()
  626. });
  627. let bgColor = '#fff';
  628. let title = '总量';
  629. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  630. let echartData = data;
  631. let total = 0;
  632. for(let i = 0;i < echartData.length;i++){
  633. total += echartData[i].num
  634. }
  635. option = {
  636. backgroundColor: bgColor,
  637. color: color,
  638. title: [{
  639. text: data.length>0?'{val|' + total + '}\n{name|' + title + '}':'',
  640. top: 'center',
  641. left: 'center',
  642. textStyle: {
  643. rich: {
  644. val: {
  645. fontSize: 24,
  646. color: '#333',
  647. fontWeight: 'bold',
  648. padding: [10, 0]
  649. },
  650. name: {
  651. fontSize: 12,
  652. fontWeight: 'normal',
  653. color: '#777',
  654. }
  655. }
  656. }
  657. }],
  658. tooltip: {
  659. trigger: 'item',
  660. // formatter: '{b} : {c} ({d}%)',
  661. formatter:function(item){
  662. const {name, num, percentStr} = item.data
  663. return `${name} : ${num} (${percentStr})`
  664. }
  665. },
  666. series: [{
  667. name: '',
  668. type: 'pie',
  669. radius: ['70%', '90%'],
  670. data: echartData,
  671. hoverAnimation:true,
  672. hoverOffset:5,
  673. itemStyle: {
  674. normal: {
  675. borderColor: bgColor,
  676. borderWidth: 2
  677. }
  678. },
  679. labelLine: {
  680. normal: {
  681. length: 20,
  682. length2: 120,
  683. lineStyle: {
  684. color: '#e6e6e6'
  685. }
  686. }
  687. },
  688. label: {
  689. normal: {
  690. show:false,
  691. formatter: params => {
  692. return params.name == 'A类'?params.name:''
  693. },
  694. padding: [0 , -100, 25, -100],
  695. rich: {
  696. icon: {
  697. fontSize: 16
  698. },
  699. name: {
  700. fontSize: 14,
  701. padding: [0, 10, 0, 4],
  702. color: '#666666'
  703. },
  704. value: {
  705. fontSize: 18,
  706. fontWeight: 'bold',
  707. color: '#333333'
  708. }
  709. }
  710. }
  711. },
  712. }]
  713. };
  714. myChart.setOption(option);
  715. }
  716. function emptyCircleB(data){
  717. var myChart = echarts.init(document.getElementById('emptyCircleB'));
  718. $(window).resize(function(){
  719. myChart.resize()
  720. });
  721. let bgColor = '#fff';
  722. let title = '总量';
  723. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  724. let echartData = data;
  725. console.log(data)
  726. let total = 0;
  727. for(let i = 0;i < echartData.length;i++){
  728. total += echartData[i].num
  729. }
  730. option = {
  731. backgroundColor: bgColor,
  732. color: color,
  733. title: [{
  734. text: data.length>0?'{val|' + total + '}\n{name|' + title + '}':'',
  735. top: 'center',
  736. left: 'center',
  737. textStyle: {
  738. rich: {
  739. val: {
  740. fontSize: 24,
  741. color: '#333',
  742. fontWeight: 'bold',
  743. padding: [10, 0]
  744. },
  745. name: {
  746. fontSize: 12,
  747. fontWeight: 'normal',
  748. color: '#777',
  749. }
  750. }
  751. }
  752. }],
  753. tooltip: {
  754. trigger: 'item',
  755. // formatter: '{b} : {c} ({d}%)',
  756. formatter:function(item){
  757. const {name, num, percentStr} = item.data
  758. return `${name} : ${num} (${percentStr})`
  759. }
  760. },
  761. series: [{
  762. name: '',
  763. type: 'pie',
  764. radius: ['70%', '90%'],
  765. data: echartData,
  766. hoverAnimation:true,
  767. hoverOffset:5,
  768. itemStyle: {
  769. normal: {
  770. borderColor: bgColor,
  771. borderWidth: 2
  772. }
  773. },
  774. labelLine: {
  775. normal: {
  776. length: 20,
  777. length2: 120,
  778. lineStyle: {
  779. color: '#e6e6e6'
  780. }
  781. }
  782. },
  783. label: {
  784. normal: {
  785. show:false,
  786. formatter: params => {
  787. return params.name == 'A类'?params.name:''
  788. },
  789. padding: [0 , -100, 25, -100],
  790. rich: {
  791. icon: {
  792. fontSize: 16
  793. },
  794. name: {
  795. fontSize: 14,
  796. padding: [0, 10, 0, 4],
  797. color: '#666666'
  798. },
  799. value: {
  800. fontSize: 18,
  801. fontWeight: 'bold',
  802. color: '#333333'
  803. }
  804. }
  805. }
  806. },
  807. }]
  808. };
  809. myChart.setOption(option);
  810. }
  811. //缺陷列表渲染
  812. function queList(data){
  813. let strAll = '',tmp = `
  814. <tr class="thead">
  815. <td class="td01">排名</td>
  816. <td class="td02">缺陷名称</td>
  817. <td class="td03">数量</td>
  818. <td class="td04">占比</td>
  819. </tr>`
  820. for(let i = 0;i < data.length;i++){
  821. strAll += `
  822. <tr>
  823. <td style="text-align:center;"><i style="background:${i < 3?'#bea571':'#eff3fc'};color:${i < 3?'#fff':'#999'};">${i+1}</i></td>
  824. <td>${data[i].name}</td>
  825. <td>${data[i].num}</td>
  826. <td>${data[i].percentStr}</td>
  827. </tr>
  828. `
  829. }
  830. $(".qtable").html(tmp+strAll)
  831. }
  832. //饼图列表注释渲染
  833. function panDetail(data){
  834. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  835. let strAll = '';
  836. for(let i = 0;i < data.length;i++){
  837. strAll += `
  838. <tr class="explainLi">
  839. <td class="deptName" title="${data[i].name}"><i class="tip" style="background-color:${color[i]}"></i>${data[i].name}</td>
  840. <td class="deptNum">${data[i].num}</td>
  841. <td class="percent">(${data[i].percentStr})</td>
  842. </tr>
  843. `
  844. }
  845. $(".explainPan table").html(strAll);
  846. $(".explainPan").css({
  847. marginTop:-($(".explainPan").height()/2-20)+'px'
  848. })
  849. }
  850. function panDetailB(data){
  851. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  852. let strAll = '';
  853. for(let i = 0;i < data.length;i++){
  854. strAll += `
  855. <tr class="explainLi">
  856. <td class="deptName" title="${data[i].name}"><i class="tip" style="background-color:${color[i]}"></i>${data[i].name}</td>
  857. <td class="deptNum">${data[i].num}</td>
  858. <td class="percent">(${data[i].percentStr})</td>
  859. </tr>
  860. `
  861. }
  862. $(".explainPanB table").html(strAll);
  863. $(".explainPan").css({
  864. marginTop:-($(".explainPan").height()/2-20)+'px'
  865. })
  866. }