console.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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} = require('../js/utils.js');
  8. $(function(){
  9. var mySwiper = new Swiper('.swiper-container',{
  10. // autoplay : 500,//可选选项,自动滑动
  11. loop : true,//可选选项,开启循环
  12. slidesPerView : 3,
  13. })
  14. initConsole()
  15. barChart()
  16. barChartPay()
  17. emptyCircle()
  18. })
  19. //控制台数
  20. function initConsole(){
  21. let url = {
  22. '本月病历数':require("../images/icon6.png"),
  23. '本月不合格病历-机器':require("../images/icon7.png"),
  24. '本月质控数-机器':require("../images/icon10.png"),
  25. '本月甲级病历-机器':require("../images/icon8.png"),
  26. '本月乙级病历-机器':require("../images/icon9.png")
  27. }
  28. post('/console/mrStatistics',{
  29. // "endDate": "string",
  30. // "hospitalId": "string",
  31. // "limitCount": 0,
  32. // "startDate": "string",
  33. "type": 1//1月2年
  34. }).then((res)=>{
  35. let data = res.data;
  36. if(data.code == 0){
  37. let result = data.data
  38. for(let i in result){
  39. let dom = ''
  40. if(i.indexOf("人工")==-1){
  41. dom = `
  42. <li class="partLi">
  43. <div class="partIn">
  44. <p class="top">${i.split("-")[0]}</p>
  45. <p class="btm clearfix">
  46. <img src="${url[i]}" alt="">
  47. <span>${result[i]}</span>
  48. </p>
  49. </div>
  50. </li>
  51. `
  52. }
  53. $(".partAll").append(dom)
  54. }
  55. }
  56. })
  57. }
  58. //柱状图
  59. function barChart(){
  60. var myChart = echarts.init(document.getElementById('barChart'));
  61. option = {
  62. color: ['#3398DB'],
  63. tooltip: {
  64. trigger: 'axis',
  65. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  66. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  67. }
  68. },
  69. grid: {
  70. left: '3%',
  71. right: '4%',
  72. bottom: '3%',
  73. containLabel: true
  74. },
  75. xAxis: [
  76. {
  77. type: 'category',
  78. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  79. axisTick: {
  80. alignWithLabel: true
  81. },
  82. axisLabel: {//x轴刻度
  83. textStyle: {
  84. color: 'blue'
  85. }
  86. },
  87. axisLine: {//x轴
  88. lineStyle:{
  89. color:'red'
  90. }
  91. }
  92. }
  93. ],
  94. yAxis: [
  95. {
  96. type: 'value',
  97. axisLine: {//y轴
  98. show: false
  99. },
  100. axisTick: {
  101. show: false
  102. },
  103. axisLabel: {//y轴刻度
  104. textStyle: {
  105. color: 'red'
  106. }
  107. },
  108. splitLine:{//分割线
  109. lineStyle:{
  110. color:'red'
  111. }
  112. }
  113. }
  114. ],
  115. title:[{
  116. text: '医院运行指标',
  117. top: 20,
  118. left: 20,
  119. textStyle: {
  120. fontSize: 14,
  121. color:'#666666',
  122. fontWeight: 400
  123. }
  124. }],
  125. series: [
  126. {
  127. name: '直接访问',
  128. type: 'bar',
  129. barWidth: '30%',
  130. data: [10, 52, 200, 334, 390, 330, 220]
  131. }
  132. ]
  133. };
  134. myChart.setOption(option);
  135. }
  136. //柱状图
  137. function barChartPay(){
  138. var myChart = echarts.init(document.getElementById('barChartPay'));
  139. option = {
  140. color: ['#3398DB'],
  141. tooltip: {
  142. trigger: 'axis',
  143. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  144. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  145. }
  146. },
  147. grid: {
  148. left: '3%',
  149. right: '4%',
  150. bottom: '3%',
  151. containLabel: true
  152. },
  153. xAxis: [
  154. {
  155. type: 'category',
  156. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  157. axisTick: {
  158. alignWithLabel: true
  159. },
  160. axisLabel: {//x轴刻度
  161. textStyle: {
  162. color: 'blue'
  163. }
  164. },
  165. axisLine: {//x轴
  166. lineStyle:{
  167. color:'red'
  168. }
  169. }
  170. }
  171. ],
  172. yAxis: [
  173. {
  174. type: 'value',
  175. axisLine: {//y轴
  176. show: false
  177. },
  178. axisTick: {
  179. show: false
  180. },
  181. axisLabel: {//y轴刻度
  182. textStyle: {
  183. color: 'red'
  184. }
  185. },
  186. splitLine:{//分割线
  187. lineStyle:{
  188. color:'red'
  189. }
  190. }
  191. }
  192. ],
  193. title:[{
  194. text: '医院运行指标',
  195. top: 20,
  196. left: 20,
  197. textStyle: {
  198. fontSize: 14,
  199. color:'#666666',
  200. fontWeight: 400
  201. }
  202. }],
  203. series: [
  204. {
  205. name: '直接访问',
  206. type: 'bar',
  207. barWidth: '30%',
  208. data: [10, 52, 200, 334, 390, 330, 220]
  209. }
  210. ]
  211. };
  212. myChart.setOption(option);
  213. }
  214. //空心饼图
  215. function emptyCircle(){
  216. var myChart = echarts.init(document.getElementById('emptyCircle'));
  217. option = {
  218. color:['#F2637B','#975FE4', '#399FFF', '#37CBCB', '#4CCB73','#FAD336'],
  219. tooltip: {
  220. trigger: 'item',
  221. formatter: '{a} <br/>{b}: {c} ({d}%)'
  222. },
  223. // legend: {
  224. // orient: 'vertical',
  225. // left: 10,
  226. // data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
  227. // },
  228. title: [{
  229. text: '总病\n例数',
  230. subtext:"1000",
  231. top: 'center',
  232. left: 'center',
  233. textStyle: {
  234. },
  235. subtextStyle:{
  236. color:'red',
  237. fontSize:'14px'
  238. }
  239. }],
  240. series: [
  241. {
  242. name: '访问来源',
  243. type: 'pie',
  244. radius: ['50%', '70%'],
  245. avoidLabelOverlap: false,
  246. label: {
  247. show: false,
  248. position: 'center'
  249. },
  250. itemStyle: {
  251. normal: {
  252. borderColor: '#fff',
  253. borderWidth: 2
  254. }
  255. },
  256. labelLine:{
  257. show:false
  258. },
  259. emphasis: {//圆盘中心
  260. label: {
  261. show: false,
  262. fontSize: '30',
  263. fontWeight: 'bold'
  264. },
  265. },
  266. labelLine: {
  267. show: true
  268. },
  269. data: [
  270. {value: 335, name: '直接访问'},
  271. {value: 310, name: '邮件营销'},
  272. {value: 234, name: '联盟广告'},
  273. {value: 135, name: '视频广告'},
  274. {value: 1548, name: '搜索引擎'}
  275. ]
  276. }
  277. ]
  278. };
  279. myChart.setOption(option);
  280. }