deptConsole.js 33 KB

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