deptConsole.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  1. const $ = require('jquery');
  2. require("../css/reset.less")
  3. require("../css/deptConsole.less")
  4. require("../images/logo.png")
  5. require("../images/arrow_down.png")
  6. require('./modal.js');
  7. // import 'zrender/lib/svg/svg';
  8. const {api} = require('./api.js')
  9. const echarts = require('echarts');
  10. require('./../resource/jquery-ui/jquery-ui.min.js');
  11. require('./../resource/jquery-ui/jquery-ui.min.css');
  12. const {post,setCookie,delCookie,getCookie,focusMenuItem,picEmptyData } = require('../js/utils.js');
  13. let payMoney = [],behosDateStart="",behosDateEnd="",dayLis = [],dateType = 2,curDept = '',curDeptId='',datafst=[],datasec=[],datatrd=[],datafour=[],hospital=getCookie("hospital");
  14. $(function(){
  15. if(!hasData('YH-KZT')&&!hasData('YH-KZTKS')){
  16. $("body").html('')
  17. }
  18. if(hospital == "台州市立"){
  19. $(".circleBSingle").css("display","block")
  20. $(".circleBLis").css("display","none")
  21. }else{
  22. $(".circleBSingle").css("display","none")
  23. $(".circleBLis").css("display","block")
  24. }
  25. $(".partTitle p span").html(hospital)
  26. // setInterval(() => {
  27. // getTimeDetail()
  28. // }, 1000);
  29. // resizeBox()
  30. initConsole()//质控列表
  31. getOwnDept()
  32. dateChange()
  33. $(window).click(function(){
  34. window.parent.userActionHide()
  35. $(".toggleSlide ul").css("display","none")
  36. })
  37. $(".toggleSlide p").click(function(e){
  38. e.stopPropagation()
  39. $(this).next().slideToggle()
  40. })
  41. $(".part02").on("mouseenter",".bingli li.sec",function(){
  42. $(this).find(".explainNum").css("color","#00A1FF")
  43. })
  44. $(".part02").on("mouseleave",".bingli li.sec",function(){
  45. $(this).find(".explainNum").css("color","#A5ADBF")
  46. })
  47. tiaomu()
  48. })
  49. function tiaomu(){
  50. $(".defect .partTitlePub").click(function(){
  51. focusMenuItem("YH-KSZR-GMKQXZB_XQ");
  52. $(parent.document).find("#contentIframe").attr("src","mukuai.html?from=2&deptName="+curDept+"&dateType="+dateType+"&startDateParam="+behosDateStart+"&endDateParam="+behosDateEnd)
  53. });
  54. $(".circleBSingle .title,.homePageNo .title").click(function(){
  55. focusMenuItem("YH-KSZR-TMQXZB_XQ");
  56. $(parent.document).find("#contentIframe").attr("src","singleVeto.html?from=2&deptName="+curDept+"&shijian="+dateType+"&startDateParam="+behosDateStart+"&endDateParam="+behosDateEnd)
  57. });
  58. $(".homePage .title").click(function(){
  59. focusMenuItem("YH-KSZR-BASYHGLZB_XQ")
  60. $(parent.document).find("#contentIframe").attr("src","partDetail.html?from=2&deptName="+curDept+"&dateType="+dateType+"&startDateParam="+behosDateStart+"&endDateParam="+behosDateEnd)
  61. });
  62. $(".part02 .bingliLis").click(function(){
  63. focusMenuItem("YH-KSZR-KSQXZB_XQ");
  64. $(parent.document).find("#contentIframe").attr("src","deptScoreDetail.html?from=2&deptName="+curDept+"&dateType="+dateType+"&curDeptId="+curDeptId+"&startDateParam="+behosDateStart+"&endDateParam="+behosDateEnd)
  65. });
  66. $(".part02").on("click",".bingli li.sec",function(){
  67. focusMenuItem("YH-BLZK-ZKPFKS");
  68. let dataC = $(this).attr("data-c")
  69. let chengdu = dataC == 1?'甲':dataC==2?'乙':'丙'
  70. $(parent.document).find("#contentIframe").attr("src","./qcListDept.html?from=1&dateType="+dateType+"&chengdu="+chengdu+"&deptName="+curDept+"&deptId="+curDeptId+"&startDateParam="+behosDateStart+"&endDateParam="+behosDateEnd)
  71. });
  72. }
  73. //判断有无某一权限
  74. function hasData(data){
  75. let lis = JSON.parse(getCookie("codeLis"))||[]
  76. // console.log(lis)
  77. if(lis.indexOf(data)>-1){//有权限
  78. return true
  79. }
  80. return false;
  81. }
  82. function resizeBox(){
  83. $(".partWrap").css({
  84. height:$(window).height()-38+'px'
  85. })
  86. }
  87. //所有数据切换日期筛选
  88. function dateChange(){
  89. $(".monthYear .mon").click(function(){
  90. $(this).css({
  91. backgroundColor:'#00A1FF',
  92. color:'#E9EBEF',
  93. "border-color":'#00A1FF'
  94. }).siblings().css({
  95. "border-color":'#A5ADBF',
  96. color:'#A5ADBF',
  97. backgroundColor:'#203463'
  98. })
  99. dateType = 1
  100. dateConsole(1)
  101. })
  102. $(".monthYear .year").click(function(){
  103. $(this).css({
  104. backgroundColor:'#00A1FF',
  105. color:'#E9EBEF',
  106. "border-color":'#00A1FF'
  107. }).siblings().css({
  108. "border-color":'#A5ADBF',
  109. color:'#A5ADBF',
  110. backgroundColor:'#203463'
  111. })
  112. dateType = 2
  113. dateConsole(2)
  114. })
  115. }
  116. //控制台数
  117. function initConsole(result){
  118. let url = {
  119. '本月病历数':require("../images/icon6.png"),
  120. '本月不合格病历-机器':require("../images/icon7.png"),
  121. '本月质控数-机器':require("../images/icon10.png"),
  122. '本月甲级病历-机器':require("../images/icon8.png"),
  123. '本月乙级病历-机器':require("../images/icon9.png"),
  124. '本年病历数':require("../images/icon6.png"),
  125. '本年不合格病历-机器':require("../images/icon7.png"),
  126. '本年质控数-机器':require("../images/icon10.png"),
  127. '本年甲级病历-机器':require("../images/icon8.png"),
  128. '本年乙级病历-机器':require("../images/icon9.png"),
  129. }
  130. let dom = '';
  131. for(let i in result){
  132. if(i.indexOf("人工")==-1){
  133. let name = i.split("-")[0];
  134. let num = 0;
  135. if(name=='本月病历数'||name=='本年病历数'){
  136. num = result[i]
  137. }else{
  138. num = result[name+'-人工']+result[i]
  139. }
  140. dom += `
  141. <li class="partLi">
  142. <div class="partIn">
  143. <p class="top">${name}</p>
  144. <p class="btm clearfix">
  145. <img src="${url[i]}" alt="">
  146. <span>${num}</span>
  147. </p>
  148. </div>
  149. </li>
  150. `
  151. }
  152. }
  153. $(".partAll").html(dom)
  154. }
  155. //获取科室列表
  156. function getOwnDept(){
  157. // if(hasData('FUNC000058')){
  158. post(api.getDept,{}).then((res)=>{
  159. let data = res.data;
  160. if(data.code == 0){
  161. let result = data.data
  162. renderDeptLis(result)//科室tab渲染
  163. curDept = result[0].deptName
  164. curDeptId = result[0].deptId
  165. $(".partTitle p i,.toggleSlide p span").html(curDept).attr({"title":curDept,'data-dept':curDept,'dept-id':curDeptId})
  166. getBarData(2)//图标数据获取
  167. }else {
  168. $(".partTitle p i,.toggleSlide p span").html('--')
  169. }
  170. }).catch(()=>{
  171. $(".partTitle p i,.toggleSlide p span").html('--')
  172. })
  173. // }
  174. }
  175. function renderDeptLis(data){
  176. let str = ''
  177. for(let i = 0; i < data.length;i++){
  178. str += `
  179. <li title="${data[i].deptName}" dept-id="${data[i].deptId}" class="${i == 0?'li0 toggleAverge toggleSlide1':'toggleAverge toggleSlide1'}" data-dept="${data[i].deptName}">${data[i].deptName}</li>
  180. `
  181. }
  182. $(".toggleSlide ul").html(str)
  183. $(".toggleSlide ul li").click(function(){
  184. let name = $(this).attr("data-dept")
  185. let did = $(this).attr("dept-id")
  186. curDept = name
  187. curDeptId = did
  188. $(this).parent().slideToggle().prev().find("span").html(name).attr({"title":name,'data-dept':curDept,'dept-id':curDeptId})
  189. $(".partTitle p i").html(name).attr({"title":name,'data-dept':curDept,'dept-id':curDeptId})
  190. personNum(datafst[name]||[])
  191. setNumDetail(datasec[name]||[])
  192. queList(datatrd[name]||[])
  193. getHomePageLevelStatisticsByDept()
  194. for(let i = 0;i < datafour[name].length;i++){
  195. datafour[name][i].value = datafour[name][i].num
  196. }
  197. if(hospital=="台州市立"){
  198. emptyCircleB(datafour[name])
  199. panDetailB(datafour[name])
  200. }else{
  201. emptyCircleBc(datafour[name])
  202. panDetailBc(datafour[name])
  203. }
  204. $(this).addClass("li0").siblings().removeClass("li0")
  205. })
  206. }
  207. //获取图表数据
  208. function getBarData(type){
  209. if(hasData('FUNC000054')){
  210. post(api.leaveHosCountByDept,{//出院人数统计
  211. "type": type||1,//1月2年
  212. "startDate":behosDateStart,
  213. "endDate":behosDateEnd
  214. }).then((res)=>{
  215. let data = res.data;
  216. if(data.code == 0){
  217. let result = data.data[curDept]||[]
  218. datafst = data.data
  219. personNum(result)
  220. }
  221. })
  222. }
  223. if(hasData('FUNC000055')){
  224. post(api.mrCountByDept,{//质控病历统计
  225. "type": type||1,//1月2年
  226. "startDate":behosDateStart,
  227. "endDate":behosDateEnd
  228. }).then((res)=>{
  229. let data = res.data
  230. if(data.code == 0){
  231. let result3 = data.data[curDept]||[]
  232. datasec = data.data
  233. setNumDetail(result3)
  234. }
  235. })
  236. }
  237. if(hasData('FUNC000056')){
  238. post(api.entryCountGroupByCaseAndDept,{//各模块缺陷占比排行
  239. "type": type||1,//1月2年
  240. "startDate":behosDateStart,
  241. "endDate":behosDateEnd
  242. }).then((res)=>{
  243. let data = res.data;
  244. if(data.code == 0){
  245. let result1 = data.data[curDept]||[]
  246. datatrd = data.data
  247. queList(result1)
  248. }
  249. })
  250. }
  251. if(hasData('FUNC000057')){
  252. if(hospital=="台州市立"){
  253. post(api.entryCountGroupByEntryAndDept,{//条目缺陷占比
  254. "type": type||1,//1月2年
  255. "startDate":behosDateStart,
  256. "endDate":behosDateEnd
  257. }).then((res)=>{
  258. let data = res.data;
  259. if(data.code == 0){
  260. let result3 = data.data[curDept]||[]
  261. for(let i = 0;i < result3.length;i++){
  262. result3[i].value = result3[i].num
  263. }
  264. datafour = data.data
  265. emptyCircleB(result3)
  266. panDetailB(result3)
  267. }
  268. })
  269. }else{
  270. post(api.entryCountGroupByEntryAndDept,{//条目缺陷占比
  271. "type": type||1,//1月2年
  272. "startDate":behosDateStart,
  273. "endDate":behosDateEnd
  274. }).then((res)=>{
  275. let data = res.data;
  276. if(data.code == 0){
  277. let result3 = data.data[curDept]||[]
  278. for(let i = 0;i < result3.length;i++){
  279. result3[i].value = result3[i].num
  280. }
  281. datafour = data.data
  282. emptyCircleBc(result3)
  283. panDetailBc(result3)
  284. }
  285. })
  286. }
  287. }
  288. getHomePageLevelStatisticsByDept(type)
  289. }
  290. function getHomePageLevelStatisticsByDept(type){
  291. if(hospital=="长兴医院"&&hasData("FUNC000076")){
  292. post(api.homePageLevelStatisticsByDept,{//病案首页
  293. "type": dateType||2,//1月2年
  294. "deptName":curDept,
  295. "startDate":behosDateStart,
  296. "endDate":behosDateEnd
  297. }).then((res)=>{
  298. let data = res.data;
  299. if(data.code == 0){
  300. let result1 = data.data||[]
  301. let dataX1=[],dataY1=[]
  302. for(let i = 0;i < result1.length;i++){
  303. dataX1.push(result1[i].doctorName)
  304. dataY1.push(result1[i].firstLevelPercentStr.replace('%',''))
  305. }
  306. lineChartSpecial(dataX1,dataY1)
  307. }
  308. })
  309. }
  310. }
  311. function lineChartSpecial(dataX,dataY){
  312. if(dataX.length==0&&dataY.length==0){
  313. $(".emptyLineCircle").css("display","none")
  314. picEmptyData('.emptyLineCircleEmpty')
  315. return
  316. }else{
  317. $(".emptyLineCircle").css("display","block")
  318. $(".emptyLineCircleEmpty").css("display","none")
  319. }
  320. var myCharts = echarts.init(document.getElementById('lineChart'));
  321. var lengthNum = dataX.length;
  322. $(window).resize(function(){
  323. myCharts.resize()
  324. });
  325. option = {
  326. color: ['#37C4FC'],
  327. tooltip: {
  328. trigger: 'axis',
  329. position: 'right',
  330. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  331. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  332. },
  333. formatter: function(param) {
  334. return '<div style="color:#fff;">'+ param[0].name + "<br>" +'<i style="background:#37C4FC;margin-right:5px;display:inline-block;width:8px;height:8px;border-radius:50%"></i>病案首页合格率:'+ param[0].value+"%" + "<br>"
  335. '</div>'
  336. }
  337. },
  338. grid: {
  339. left: '3%',
  340. right: '4%',
  341. bottom: '3%',
  342. containLabel: true
  343. },
  344. xAxis: [
  345. {
  346. type: 'category',
  347. data: dataX,
  348. axisTick: {
  349. alignWithLabel: true
  350. },
  351. axisLabel: {//x轴刻度
  352. textStyle: {
  353. color: '#E9EBEF'
  354. },
  355. rotate:45,
  356. formatter: function (value) {
  357. //x轴的文字改为竖版显示
  358. if(value.length>7){
  359. return value.slice(0,7)+'...'
  360. }
  361. return value;
  362. }
  363. },
  364. axisLine: {//x轴
  365. lineStyle:{
  366. color:'#4A5D8E'
  367. }
  368. }
  369. }
  370. ],
  371. yAxis: [
  372. {
  373. type: 'value',
  374. axisLine: {//y轴
  375. show: false
  376. },
  377. axisTick: {
  378. show: false
  379. },
  380. axisLabel: {//y轴刻度
  381. textStyle: {
  382. color: '#E9EBEF'
  383. }
  384. },
  385. splitLine:{//分割线
  386. lineStyle:{
  387. color:'#344876'
  388. }
  389. }
  390. }
  391. ],
  392. title:[{
  393. text: '合格率',
  394. top: 15,
  395. left: 10,
  396. textStyle: {
  397. fontSize: 14,
  398. color:'#fff',
  399. fontWeight: 400
  400. }
  401. }],
  402. series: [
  403. {
  404. name: '病案首页合格率',
  405. type: 'bar',
  406. barWidth: '23%',
  407. data: dataY
  408. }
  409. ]
  410. };
  411. myCharts.setOption(option);
  412. }
  413. //part01
  414. function personNum(data){
  415. if(data['总人数']==0){
  416. $(".chuyuan,.personNum").css("display","none")
  417. picEmptyData(".chuyuanEmpty")
  418. return
  419. }else{
  420. $(".chuyuanEmpty").css("display","none")
  421. $(".chuyuan,.personNum").css("display","block")
  422. }
  423. $(".personNum").html("总人数:"+data['总人数'])
  424. $(".died").html(data['死亡人数'])
  425. $(".newborn").html(data['新生儿人数'])
  426. $(".patientNum").html(data['手术病人数'])
  427. }
  428. //part02
  429. function setNumDetail(data){
  430. // console.log(data,2222222222)
  431. if(data.length == 0){
  432. $(".pingfendengji").css("display","block")
  433. $(".bldjs").css("display","none")
  434. picEmptyData(".pingfendengjiEmpty")
  435. return
  436. }else{
  437. $(".bldjs").css("display","block")
  438. $(".pingfendengji").css("display","none")
  439. }
  440. let str = ''
  441. for(let i = 0;i < data.length;i++){
  442. str += `
  443. <li class="${i==0?'fst':i == data.length-1?' four sec':'sec'}" data-c="${i}">
  444. <p class="numShow">${data[i].num}</p>
  445. <p class="explainNum">${data[i].name}</p>
  446. </li>
  447. `
  448. if(data[i].name == '甲级病历'){
  449. let tmp = []
  450. data[i].value = data[i].num
  451. tmp.push(data[i])
  452. tmp.push({percentStr:(1-data[i].percent)*100+'%',value:data[i].totleNum - data[i].num})
  453. part02pan(tmp,'fen01')
  454. }
  455. if(data[i].name == '乙级病历'){
  456. let tmp = []
  457. data[i].value = data[i].num
  458. tmp.push(data[i])
  459. tmp.push({percentStr:(1-data[i].percent)*100+'%',value:data[i].totleNum - data[i].num})
  460. part02pan(tmp,'fen02')
  461. }
  462. if(data[i].name == '丙级病历'){
  463. let tmp = []
  464. data[i].value = data[i].num
  465. tmp.push(data[i])
  466. tmp.push({percentStr:(1-data[i].percent)*100+'%',value:data[i].totleNum - data[i].num})
  467. part02pan(tmp,'fen03')
  468. }
  469. }
  470. $('.bingli').html(str)
  471. }
  472. //part02pan
  473. function part02pan(data,dom){
  474. // console.log(data,33333)
  475. dom = echarts.init(document.getElementById(dom));
  476. $(window).resize(function(){
  477. dom.resize()
  478. });
  479. let bgColor = '#fff';
  480. let title = '总量';
  481. let color = ['#3fffd1','#4c5c82'];
  482. let echartData = data;
  483. option = {
  484. // backgroundColor: bgColor,
  485. color: color,
  486. title: [{
  487. text:'{val|' + echartData[0].percentStr + '}',
  488. top: 'center',
  489. left: 'center',
  490. textStyle: {
  491. rich: {
  492. val: {
  493. fontSize: 14,
  494. color: '#E9EBEF',
  495. fontWeight: 'bold',
  496. padding: [10, 0]
  497. },
  498. name: {
  499. fontSize: 12,
  500. fontWeight: 'normal',
  501. color: '#E9EBEF',
  502. }
  503. }
  504. }
  505. }],
  506. series: [{
  507. name: '',
  508. type: 'pie',
  509. radius: ['70%', '90%'],
  510. data: echartData,
  511. hoverAnimation:true,
  512. hoverOffset:3,
  513. itemStyle: {
  514. normal: {
  515. borderColor: '#203463',
  516. borderWidth: 3
  517. }
  518. },
  519. label: {
  520. normal: {
  521. show:false,
  522. }
  523. },
  524. }]
  525. };
  526. dom.setOption(option);
  527. }
  528. //柱状图住院日期
  529. function emptyCircleB(data){
  530. if(data.length == 0){
  531. $(".emptyCircleBData").css("'display","none !important")
  532. picEmptyData(".emptyCircleBWrap")
  533. }else{
  534. $(".emptyCircleBData").css("'display","block")
  535. $(".emptyCircleBWrap").css("display","none")
  536. }
  537. if(!document.getElementById('emptyCircleB'))return
  538. var myChart = echarts.init(document.getElementById('emptyCircleB'));
  539. $(window).resize(function(){
  540. myChart.resize()
  541. });
  542. let bgColor = '#fff';
  543. let title = '总量';
  544. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  545. let echartData = data;
  546. let total = echartData.length>0?echartData[0].totleNum:0;
  547. option = {
  548. // backgroundColor: bgColor,
  549. color: color,
  550. title: [{
  551. text: data.length>0?'{val|' + total + '}\n{name|' + title + '}':'',
  552. top: 'center',
  553. left: 'center',
  554. textStyle: {
  555. rich: {
  556. val: {
  557. fontSize: 24,
  558. color: '#E9EBEF',
  559. fontWeight: 'bold',
  560. padding: [10, 0]
  561. },
  562. name: {
  563. fontSize: 12,
  564. fontWeight: 'normal',
  565. color: '#E9EBEF',
  566. }
  567. }
  568. }
  569. }],
  570. tooltip: {
  571. trigger: 'item',
  572. position: 'right',
  573. // formatter: '{b} : {c} ({d}%)',
  574. formatter:function(item){
  575. const {name, num, percentStr} = item.data
  576. return `${name} : ${num} (${percentStr})`
  577. }
  578. },
  579. series: [{
  580. name: '',
  581. type: 'pie',
  582. radius: ['70%', '90%'],
  583. data: echartData,
  584. hoverAnimation:true,
  585. hoverOffset:5,
  586. itemStyle: {
  587. normal: {
  588. // borderColor: bgColor,
  589. borderWidth: 3
  590. }
  591. },
  592. labelLine: {
  593. normal: {
  594. length: 20,
  595. length2: 120,
  596. lineStyle: {
  597. color: '#e6e6e6'
  598. }
  599. }
  600. },
  601. label: {
  602. normal: {
  603. show:false,
  604. formatter: params => {
  605. return params.name == 'A类'?params.name:''
  606. },
  607. padding: [0 , -100, 25, -100],
  608. rich: {
  609. icon: {
  610. fontSize: 16
  611. },
  612. name: {
  613. fontSize: 14,
  614. padding: [0, 10, 0, 4],
  615. color: '#666666'
  616. },
  617. value: {
  618. fontSize: 18,
  619. fontWeight: 'bold',
  620. color: '#333333'
  621. }
  622. }
  623. }
  624. },
  625. }]
  626. };
  627. myChart.setOption(option);
  628. }
  629. function emptyCircleBc(data){
  630. if(data.length == 0){
  631. $(".emptyCircleBDatas").css("'display","none !important")
  632. picEmptyData(".emptyCircleBWraps")
  633. }else{
  634. $(".emptyCircleBDatas").css("'display","block")
  635. $(".emptyCircleBWraps").css("display","none")
  636. }
  637. var myChart = echarts.init(document.getElementById('emptyCircleBc'));
  638. $(window).resize(function(){
  639. myChart.resize()
  640. });
  641. let bgColor = '#fff';
  642. let title = '总量';
  643. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  644. let echartData = data;
  645. let total = echartData.length>0?echartData[0].totleNum:0;
  646. option = {
  647. // backgroundColor: bgColor,
  648. color: color,
  649. title: [{
  650. text: data.length>0?'{val|' + total + '}\n{name|' + title + '}':'',
  651. top: 'center',
  652. left: 'center',
  653. textStyle: {
  654. rich: {
  655. val: {
  656. fontSize: 24,
  657. color: '#E9EBEF',
  658. fontWeight: 'bold',
  659. padding: [10, 0]
  660. },
  661. name: {
  662. fontSize: 12,
  663. fontWeight: 'normal',
  664. color: '#E9EBEF',
  665. }
  666. }
  667. }
  668. }],
  669. tooltip: {
  670. trigger: 'item',
  671. position: 'right',
  672. // formatter: '{b} : {c} ({d}%)',
  673. formatter:function(item){
  674. const {name, num, percentStr} = item.data
  675. return `${name} : ${num} (${percentStr})`
  676. }
  677. },
  678. series: [{
  679. name: '',
  680. type: 'pie',
  681. radius: ['70%', '90%'],
  682. data: echartData,
  683. hoverAnimation:true,
  684. hoverOffset:5,
  685. itemStyle: {
  686. normal: {
  687. borderColor: '#203463',
  688. borderWidth: 3
  689. }
  690. },
  691. labelLine: {
  692. normal: {
  693. length: 20,
  694. length2: 120,
  695. lineStyle: {
  696. color: '#fff'
  697. }
  698. }
  699. },
  700. label: {
  701. normal: {
  702. show:false,
  703. formatter: params => {
  704. return params.name == 'A类'?params.name:''
  705. },
  706. padding: [0 , -100, 25, -100],
  707. rich: {
  708. icon: {
  709. fontSize: 16
  710. },
  711. name: {
  712. fontSize: 14,
  713. padding: [0, 10, 0, 4],
  714. color: '#fff'
  715. },
  716. value: {
  717. fontSize: 18,
  718. fontWeight: 'bold',
  719. color: '#fff'
  720. }
  721. }
  722. }
  723. },
  724. }]
  725. };
  726. myChart.setOption(option);
  727. }
  728. //缺陷列表渲染
  729. function queList(data){
  730. let strAll = '',tmp = `mm
  731. <tr class="thead">
  732. <td class="td01">排名</td>
  733. <td class="td02">缺陷详情</td>
  734. <td class="td04">缺陷占比</td>
  735. </tr>`
  736. if(data.length == 0){
  737. $(".qtable").css("display","none")
  738. picEmptyData(".qtableEmpty")
  739. return
  740. }else{
  741. $(".qtableEmpty").css("display","none")
  742. $(".qtable").css("display","table")
  743. }
  744. for(let i = 0;i < data.length;i++){
  745. strAll += `
  746. <tr>
  747. <td style="text-align:center;"><i style="background:${i < 3?'#ECB22E':'#526186'};color:${i < 3?'#fff':'#B7BDCC'};">${i+1}</i></td>
  748. <td class="homegodetail" data-name="${data[i].name}"><p class="td02name ellipsis">${data[i].name}</p></td>
  749. <td>${data[i].percentStr}</td>
  750. </tr>
  751. `
  752. }
  753. $(".qtable").html(tmp+strAll)
  754. $(".homegodetail").click(function(){
  755. let name = $(this).attr("data-name")
  756. focusMenuItem("YH-KSZR-TMQXZB_XQ");
  757. $(parent.document).find("#contentIframe").attr("src","./singleVeto.html?from=2&special=1&shijian="+dateType+"&model="+name+"&startDateParam="+behosDateStart+"&endDateParam="+behosDateEnd)
  758. })
  759. }
  760. //饼图列表注释渲染
  761. function panDetailB(data){
  762. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  763. let strAll = '';
  764. for(let i = 0;i < data.length;i++){
  765. strAll += `
  766. <tr class="explainLi">
  767. <td class="deptName" title="${data[i].name}">
  768. <p><i class="tip" style="background-color:${color[i]}"></i>${data[i].name}</p>
  769. </td>
  770. <td class="deptNum">${data[i].num}</td>
  771. <td class="percent">(${data[i].percentStr})</td>
  772. </tr>
  773. `
  774. }
  775. $(".explainPanB table").html(strAll);
  776. $(".explainPan").css({
  777. marginTop:-($(".explainPan").height()/2-20)+'px'
  778. })
  779. }
  780. function panDetailBc(data){
  781. let color = ['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336','#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'];
  782. let strAll = '';
  783. for(let i = 0;i < data.length;i++){
  784. strAll += `
  785. <tr class="explainLi" data-dept="${data[i].name}">
  786. <td class="deptName" title="${data[i].name}">
  787. <p><i class="tip" style="background-color:${color[i]}"></i>${data[i].name}</p>
  788. </td>
  789. <td class="deptNum">${data[i].num}</td>
  790. <td class="percent">(${data[i].percentStr})</td>
  791. </tr>
  792. `
  793. }
  794. $(".explainPanBc table").html(strAll);
  795. $(".explainPan").css({
  796. marginTop:-($(".explainPanc").height()/2-20)+'px'
  797. })
  798. // $(".homePageNo .explainPanBc .explainLi").click(function(){
  799. // let deptName = $(this).attr("data-dept")
  800. // focusMenuItem("YH-BLZK-ZKPFKS");
  801. // $(parent.document).find("#contentIframe").attr("src","./qcList.html?from=1&dateType="+dateType+"&deptName="+deptName)
  802. // })
  803. }
  804. //时间获取
  805. function getTimeDetail(){
  806. const d = new Date();
  807. const days = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
  808. let sec = d.getSeconds()
  809. let min = d.getMinutes()
  810. let hour = d.getHours()
  811. let str = `${d.getFullYear()}年${d.getMonth()+1}月${d.getDate()}日 / ${days[d.getDay()]} / ${hour>9?hour:'0'+hour}:${min>9?min:'0'+min}:${sec>9?sec:'0'+sec}`
  812. $(".dateDetail").html(str)
  813. }
  814. $(".sureDate").click(function(){
  815. if(!getStaticDate()){
  816. return
  817. }
  818. getBarData(dateType)
  819. dateType = 3
  820. $(".monthYear .year").css({
  821. "border-color":'#A5ADBF',
  822. color:'#A5ADBF',
  823. backgroundColor:'#203463'
  824. })
  825. $(".monthYear .mon").css({
  826. "border-color":'#A5ADBF',
  827. color:'#A5ADBF',
  828. backgroundColor:'#203463'
  829. })
  830. })
  831. //日期联动
  832. function dateConsole(dateType){
  833. let startDate = "", endDate=new Date()
  834. let year = new Date().getFullYear()
  835. let month = new Date().getMonth() + 1
  836. if(dateType == '1'){
  837. startDate = new Date(`${year}-${month}-01`)
  838. }else if(dateType == '2'){
  839. startDate = new Date(`${year}-01-01`)
  840. } else {
  841. startDate = "-1m"
  842. }
  843. $( "#datepicker" ).datepicker({
  844. yearRange: "2015:"+year,
  845. changeMonth: true,
  846. changeYear: true,
  847. dateFormat:"yy/mm/dd",
  848. }).datepicker( "setDate", startDate);
  849. $( "#datepicker2" ).datepicker({
  850. yearRange: "2015:"+year,
  851. changeMonth: true,
  852. changeYear: true,
  853. dateFormat:"yy/mm/dd"
  854. }).datepicker( "setDate",endDate);
  855. getStaticDate()
  856. getBarData(dateType)
  857. }
  858. function getStaticDate(){
  859. behosDateStart = $("#datepicker").val().trim()
  860. behosDateEnd = $("#datepicker2").val().trim()
  861. const start = new Date(behosDateStart).getTime()
  862. const end = new Date(behosDateEnd).getTime()
  863. if(start > end){
  864. $.alerModal({"message":'开始时间不能大于结束时间~',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
  865. return false
  866. }
  867. if(behosDateStart){
  868. behosDateStart = behosDateStart.replace(/\//g,'-') + ' 00:00:00'
  869. }
  870. if(behosDateEnd){
  871. behosDateEnd = behosDateEnd.replace(/\//g,'-') + ' 23:59:59'
  872. }
  873. return true
  874. }
  875. $(function() {
  876. const iconCalenBlue= require("./../images/darkDate.png")
  877. const iconCalenGrey= require("./../images/icon_calen_grey.png")
  878. $.datepicker.regional['zh-CN'] = {
  879. clearText: '清除',
  880. clearStatus: '清除已选e799bee5baa6e59b9ee7ad9431333361303131日期',
  881. closeText: '关闭',
  882. closeStatus: '不改变当前选择',
  883. prevText: '<上月',
  884. prevStatus: '显示上月',
  885. prevBigText: '<<',
  886. prevBigStatus: '显示上一年',
  887. nextText: '下月>',
  888. nextStatus: '显示下月',
  889. nextBigText: '>>',
  890. nextBigStatus: '显示下一年',
  891. currentText: '今天',
  892. currentStatus: '显示本月',
  893. monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
  894. monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
  895. yearNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
  896. monthStatus: '选择月份',
  897. yearStatus: '选择年份',
  898. weekHeader: '周',
  899. weekStatus: '年内周次',
  900. dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
  901. dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
  902. dayNamesMin: ['日','一','二','三','四','五','六'],
  903. dayStatus: '设置 DD 为一周起始',
  904. dateStatus: '选择 m月 d日, DD',
  905. dateFormat: 'yy-mm-dd',
  906. firstDay: 1,
  907. initStatus: '请选择日期',
  908. isRTL: false};
  909. $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
  910. dateConsole(dateType)
  911. $('.iconCalen').on("mouseenter", function(e){
  912. $(this).attr("src", iconCalenBlue)
  913. })
  914. $('.iconCalen').on("mouseleave", function(e){
  915. $(this).attr("src", iconCalenGrey)
  916. })
  917. $('.iconCalen').on("click", function(e){
  918. $(this).parent().find("input").focus()
  919. })
  920. });