dashboard.blade.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. <script src="/assets/js/vue.js"></script>
  2. <script src="/assets/js/highcharts.js"></script>
  3. <script src="/assets/js/element_ui.js"></script>
  4. <!-- <link rel="stylesheet" href="/assets/css/common.css"> -->
  5. <link rel="stylesheet" href="/assets/css/element_ui.css">
  6. <div id="container" style="height:100%">
  7. <template>
  8. <div class="main w vh" >
  9. <div class="left">
  10. <div class="content_1">
  11. <div class="section_3">
  12. <div class="section_3_con">
  13. <div class="section_3_1"></div>
  14. <div class="section_3_2">
  15. <em>关注人数:[[pageData.users]]人</em>
  16. <span>注册时间:2023年09月28日</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="content_2">
  22. <div class="section h">
  23. <img src="assets/images/dashboard/left_1b.png" style="max-width: 100%;">
  24. </div>
  25. </div>
  26. </div>
  27. <!--右侧开始-->
  28. <div class="right">
  29. <div class="section_2">
  30. <div class="section_2_1">
  31. <div class="section_2_1_l">
  32. <div class="content">
  33. <div class="section_2_head">
  34. <div class="title">心理评估人次</div>
  35. <el-select class="select" size='mini' clearable v-model="cpColumnId" filterable placeholder="近7日" @change="cpChange($event)">
  36. <el-option v-for="item in columnList" :key="item.id" :label="item.name" :value="item.id">
  37. </el-option>
  38. </el-select>
  39. </div>
  40. <div class="data" style="height: 95%;">
  41. <div id="chart5" :options="chartOptions5" style="width: 100%; height: 100%; border-radius: 15px;">
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="section_2_1_r">
  47. <div class="li">
  48. <div class="li_content">
  49. <img src="/assets/images/dashboard/right_icon1.png" alt="" srcset="" class="img">
  50. <div class="name">评估总人次</div>
  51. <div class="number">[[pageData.cp]]<span>人</span></div>
  52. </div>
  53. </div>
  54. <div class="li">
  55. <div class="li_content">
  56. <img src="/assets/images/dashboard/right_icon2.png" alt="" srcset="" class="img">
  57. <div class="name">科普总人次</div>
  58. <div class="number">[[pageData.kp]]<span>人</span></div>
  59. </div>
  60. </div>
  61. <div class="li">
  62. <div class="li_content">
  63. <img src="/assets/images/dashboard/right_icon3.png" alt="" srcset="" class="img">
  64. <div class="name">疗愈总人次</div>
  65. <div class="number">[[pageData.xl]]<span>人</span></div>
  66. </div>
  67. </div>
  68. <div class="li">
  69. <div class="li_content">
  70. <img src="/assets/images/dashboard/right_icon4.png" alt="" srcset="" class="img">
  71. <div class="name">挂号总人次</div>
  72. <div class="number">[[pageData.gh]]<span>人</span></div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="section_2_2">
  78. <div class="section_2_2_l">
  79. <div class="content">
  80. <div class="section_2_head">
  81. <div class="title">心理科普人次</div>
  82. <el-select class="select" size='mini' clearable v-model="cpColumnId" filterable placeholder="近7日" @change="cpChange($event)">
  83. <el-option v-for="item in columnList" :key="item.id" :label="item.name" :value="item.id">
  84. </el-option>
  85. </el-select>
  86. </div>
  87. <div class="data" style="height: 95%;">
  88. <div id="chart3" :options="chartOptions3" style="width: 100%; height: 100%; border-radius: 15px;">
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="section_2_2_r">
  94. <div class="content">
  95. <div class="section_2_head">
  96. <div class="title">心理疗愈人次</div>
  97. <el-select class="select" size='mini' clearable v-model="cpColumnId" filterable placeholder="近7日" @change="cpChange($event)">
  98. <el-option v-for="item in columnList" :key="item.id" :label="item.name" :value="item.id">
  99. </el-option>
  100. </el-select>
  101. </div>
  102. <div class="data" style="height: 95%;">
  103. <div id="chart1" :options="chartOptions1" style="width: 100%; height: 100%; border-radius: 15px;">
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </template>
  113. </div>
  114. <script>
  115. // 创建 Vue 实例
  116. const app = new Vue({
  117. delimiters:['[[',']]'],
  118. el: '#container',
  119. data() {
  120. return {
  121. apiUrl: '{{config("app.url")}}', // 替换为实际 API URL
  122. successCode: '200', // 替换为实际成功代码
  123. chartOptions1: { accessibility: { enabled: false }},
  124. chartOptions3: { accessibility: { enabled: false }},
  125. chartOptions5: { accessibility: { enabled: false }},
  126. cpColumnId: 1,
  127. kpColumnId: 1,
  128. xlColumnId: 1,
  129. columnList: [{
  130. "id": 1,
  131. "name": "近7日"
  132. }, {
  133. "id": 2,
  134. "name": "2023年"
  135. }],
  136. pageData: {},
  137. };
  138. },
  139. mounted() {
  140. this.getPageData();
  141. },
  142. methods: {
  143. cpChange:function(value){
  144. let _this = this;
  145. _this.cpColumnId = value;
  146. _this.getPageData();
  147. },
  148. kpChange:function(value){
  149. let _this = this;
  150. _this.kpColumnId = value;
  151. _this.getPageData();
  152. },
  153. xlChange:function(value){
  154. let _this = this;
  155. _this.xlColumnId = value;
  156. _this.getPageData();
  157. },
  158. //获取页面数据
  159. getPageData: function() {
  160. let _this = this;
  161. // this.$http.get(this.apiUrl + 'statistics_api/index', {
  162. // params: {
  163. // cp_type:_this.cpColumnId,
  164. // kp_type:_this.kpColumnId,
  165. // xl_type:_this.xlColumnId,
  166. // },
  167. // }).then(
  168. // function(res) {
  169. // _this.pageData = res.body;
  170. // _this.columnList = _this.pageData.years;
  171. // this.tj1(_this.pageData.xl_tj.categories, _this.pageData.xl_tj.series);
  172. // this.tj3(_this.pageData.kp_tj.categories, _this.pageData.kp_tj.series);
  173. // this.tj5(_this.pageData.cp_tj.categories, _this.pageData.cp_tj.series);
  174. // },
  175. // function(res) {
  176. // console.log(res);
  177. // // 响应错误回调
  178. // }
  179. // );
  180. fetch(`${this.apiUrl}statistics_api/index?cp_type=${this.cpColumnId}&kp_type=${this.kpColumnId}&xl_type=${this.xlColumnId}`)
  181. .then(response => {
  182. if (!response.ok) {
  183. throw new Error(`HTTP error! status: ${response.status}`);
  184. }
  185. return response.json();
  186. })
  187. .then(data => {
  188. this.pageData = data;
  189. this.columnList = this.pageData.years;
  190. // this.updateCharts();
  191. // _this.pageData = data.body;
  192. // _this.columnList = _this.pageData.years;
  193. this.tj1(_this.pageData.xl_tj.categories, _this.pageData.xl_tj.series);
  194. this.tj3(_this.pageData.kp_tj.categories, _this.pageData.kp_tj.series);
  195. this.tj5(_this.pageData.cp_tj.categories, _this.pageData.cp_tj.series);
  196. console.log(data);
  197. })
  198. .catch(error => {
  199. console.error('Fetch error:', error);
  200. });
  201. },
  202. // 训练人次统计
  203. tj1: function(categories, series) {
  204. this.chartOptions1 = {
  205. exporting: {
  206. enabled: false //用来设置是否显示‘打印’,'导出'等
  207. },
  208. title: {
  209. text: '',
  210. align: 'left',
  211. style: {
  212. color: '#2AB1FE',
  213. fontSize: '15px',
  214. fontWeight: '900'
  215. }
  216. },
  217. credits: {
  218. enabled: false,
  219. },
  220. yAxis: {
  221. title: {
  222. text: ''
  223. }
  224. },
  225. xAxis: {
  226. categories: categories
  227. },
  228. legend: {
  229. layout: 'vertical',
  230. align: 'right',
  231. verticalAlign: 'middle',
  232. enabled: false
  233. },
  234. plotOptions: {
  235. // series: {
  236. // borderWidth: 0,
  237. // dataLabels: {
  238. // enabled: true,
  239. // format: '{point.y:.1f}%'
  240. // }
  241. // }
  242. },
  243. series: [{
  244. type: 'column',
  245. name: '人次',
  246. colorByPoint: true,
  247. data: series,
  248. colors: ['#2AB1FE ', '#2AB1FE', '#2AB1FE', '#2AB1FE', '#2AB1FE', ' #2AB1FE', ' #2AB1FE']
  249. }],
  250. responsive: {
  251. rules: [{
  252. condition: {
  253. // maxWidth: 500
  254. },
  255. chartOptions: {
  256. legend: {
  257. layout: 'horizontal',
  258. align: 'center',
  259. verticalAlign: 'bottom'
  260. }
  261. }
  262. }]
  263. }
  264. }
  265. $('#chart1').highcharts(this.chartOptions1)
  266. },
  267. // 科普人次统计
  268. tj3: function(categories, series) {
  269. this.chartOptions3 = {
  270. exporting: {
  271. enabled: false //用来设置是否显示‘打印’,'导出'等
  272. },
  273. title: {
  274. text: '',
  275. align: 'left',
  276. style: {
  277. color: '#2AB1FE',
  278. fontSize: '15px',
  279. fontWeight: '900'
  280. }
  281. },
  282. credits: {
  283. enabled: false,
  284. },
  285. yAxis: {
  286. title: {
  287. text: ''
  288. }
  289. },
  290. xAxis: {
  291. categories: categories
  292. },
  293. legend: {
  294. layout: 'vertical',
  295. align: 'right',
  296. verticalAlign: 'middle',
  297. enabled: false
  298. },
  299. plotOptions: {
  300. // series: {
  301. // borderWidth: 0,
  302. // dataLabels: {
  303. // enabled: true,
  304. // format: '{point.y:.1f}%'
  305. // }
  306. // }
  307. },
  308. series: [{
  309. type: 'column',
  310. name: '人次',
  311. colorByPoint: true,
  312. data: series,
  313. colors: ['#2AB1FE ', '#2AB1FE', '#2AB1FE', '#2AB1FE', '#2AB1FE', ' #2AB1FE', ' #2AB1FE']
  314. }],
  315. responsive: {
  316. rules: [{
  317. condition: {
  318. // maxWidth: 500
  319. },
  320. chartOptions: {
  321. legend: {
  322. layout: 'horizontal',
  323. align: 'center',
  324. verticalAlign: 'bottom'
  325. }
  326. }
  327. }]
  328. }
  329. }
  330. $('#chart3').highcharts(this.chartOptions3)
  331. },
  332. // 测评人次统计
  333. tj5: function(categories, series) {
  334. this.chartOptions5 = {
  335. exporting: {
  336. enabled: false //用来设置是否显示‘打印’,'导出'等
  337. },
  338. title: {
  339. text: '',
  340. align: 'left',
  341. style: {
  342. color: '#2AB1FE',
  343. fontSize: '15px',
  344. fontWeight: '900'
  345. }
  346. },
  347. credits: {
  348. enabled: false,
  349. },
  350. yAxis: {
  351. title: {
  352. text: ''
  353. }
  354. },
  355. xAxis: {
  356. categories: categories
  357. },
  358. legend: {
  359. layout: 'vertical',
  360. align: 'right',
  361. verticalAlign: 'middle',
  362. enabled: false
  363. },
  364. plotOptions: {
  365. series: {
  366. label: {
  367. connectorAllowed: true
  368. },
  369. }
  370. },
  371. series: [{
  372. name: '人次',
  373. data: series,
  374. color: '#2AB1FE',
  375. dataLabels: {
  376. enabled: true,
  377. },
  378. areaStyle: {}
  379. }],
  380. responsive: {
  381. rules: [{
  382. condition: {
  383. // maxWidth: 500
  384. },
  385. chartOptions: {
  386. legend: {
  387. layout: 'horizontal',
  388. align: 'center',
  389. verticalAlign: 'bottom'
  390. }
  391. }
  392. }]
  393. }
  394. }
  395. $('#chart5').highcharts(this.chartOptions5)
  396. },
  397. }
  398. });
  399. </script>
  400. <style>
  401. .el-input__inner,.el-select-dropdown__item.selected{
  402. color:#2AB1FE
  403. }
  404. .el-select .el-input.is-focus .el-input__inner {
  405. border-color: #2AB1FE;
  406. }
  407. </style>
  408. <style scoped="scoped" lang="scss">
  409. .main {
  410. display: flex;
  411. flex-direction: row;
  412. background-color: #f0f4f7;
  413. height:100%;
  414. .left {
  415. width: 24%;
  416. background: #E3E9ED;
  417. display: flex;
  418. flex-direction: column;
  419. .content_1 {
  420. padding: 26px 26px 0 26px;
  421. .section_1 {
  422. font-size: 18px;
  423. line-height: 18px;
  424. font-weight: bold;
  425. color: #181917;
  426. margin-bottom: 8px;
  427. }
  428. .section_2 {
  429. font-size: 12px;
  430. line-height: 12px;
  431. font-weight: 400;
  432. color: #565954;
  433. margin-bottom: 23px;
  434. }
  435. .section_3 {
  436. width: 100%;
  437. height: 88%;
  438. background: #FFFFFF;
  439. border-radius: 14px;
  440. margin-bottom: 18px;
  441. .section_3_con {
  442. padding: 0 18px;
  443. display: flex;
  444. flex-direction: row;
  445. .section_3_1 {
  446. width: 70px;
  447. height: 70px;
  448. background: url("/assets/images/dashboard/left_icon1.png") no-repeat;
  449. background-size: 100%;
  450. margin-right: 17px;
  451. }
  452. .section_3_2 {
  453. display: flex;
  454. flex-direction: column;
  455. align-items: center;
  456. justify-content: center;
  457. em {
  458. font-size: 16px;
  459. line-height: 16px;
  460. font-weight: bold;
  461. color: #565954;
  462. margin-bottom: 9px;
  463. }
  464. span {
  465. font-size: 12px;
  466. line-height: 12px;
  467. font-weight: 400;
  468. color: #939F8F;
  469. }
  470. }
  471. }
  472. }
  473. }
  474. .content_2 {
  475. padding: 0 20px 20px 20px;
  476. flex-grow: 1;
  477. .section {
  478. /* height: 100%; */
  479. display: flex;
  480. justify-content: center;
  481. background: url("/assets/images/dashboard/left_1b.png") no-repeat center;
  482. background-size: auto 100%;
  483. }
  484. }
  485. }
  486. .right {
  487. display: flex;
  488. flex-direction: column;
  489. width: 76%;
  490. .section_1 {
  491. display: flex;
  492. flex-direction: row;
  493. justify-content: space-between;
  494. align-items: center;
  495. padding: 0 26px;
  496. height: 70px;
  497. background: #2AB1FE;
  498. color: #FFFFFF;
  499. font-size: 12px;
  500. .logo {
  501. display: flex;
  502. width: 300px;
  503. height: 60px;
  504. background-image: url("./dashboard/images/logo2.png");
  505. background-repeat: no-repeat;
  506. background-size: 100%;
  507. background-position: 0 center;
  508. }
  509. .fn {
  510. display: flex;
  511. flex-direction: row;
  512. align-items: center;
  513. .head {
  514. display: flex;
  515. flex-direction: row;
  516. align-items: center;
  517. margin-right: 25px;
  518. .img {
  519. background: url("./dashboard/images/head.png") no-repeat;
  520. background-size: 26px;
  521. width: 26px;
  522. height: 26px;
  523. margin-right: 5px;
  524. }
  525. }
  526. .login_out {
  527. display: flex;
  528. flex-direction: row;
  529. align-items: center;
  530. .img {
  531. background: url("./dashboard/images/login_out.png") no-repeat;
  532. background-size: 14px;
  533. width: 14px;
  534. height: 14px;
  535. margin-right: 5px;
  536. }
  537. }
  538. }
  539. }
  540. .section_2 {
  541. padding: 26px;
  542. flex-grow: 1;
  543. display: flex;
  544. flex-direction: column;
  545. .section_2_head {
  546. display: flex;
  547. align-items: center;
  548. justify-content: space-between;
  549. height: 25px;
  550. margin-bottom: 10px;
  551. .title {
  552. font-size: 16px;
  553. font-weight: bold;
  554. color: #181917;
  555. }
  556. .select {
  557. display: flex;
  558. align-items: center;
  559. justify-content: center;
  560. width: 88px;
  561. height: 25px;
  562. font-weight: 400;
  563. }
  564. }
  565. .section_2_1 {
  566. display: flex;
  567. flex-direction: row;
  568. justify-content: space-between;
  569. margin-bottom: 26px;
  570. height: 403px;
  571. .section_2_1_l {
  572. display: flex;
  573. width: 67%;
  574. height: 403px;
  575. background: #FFFFFF;
  576. border-radius: 14px;
  577. margin-right: 26px;
  578. .content {
  579. width:100%;
  580. display: flex;
  581. flex-direction: column;
  582. flex: 1;
  583. padding: 26px;
  584. .data {
  585. flex-grow: 1;
  586. }
  587. }
  588. }
  589. .section_2_1_r {
  590. display: flex;
  591. width: 33%;
  592. flex-wrap: wrap;
  593. justify-content: space-between;
  594. align-items: center;
  595. .li {
  596. display: flex;
  597. width: 48%;
  598. height: 193px;
  599. border-radius: 14px;
  600. background: #FFFFFF;
  601. .li_content {
  602. padding: 26px;
  603. flex: 1;
  604. display: flex;
  605. flex-direction: column;
  606. justify-content: center;
  607. .img {
  608. width: 53px;
  609. height: 53px;
  610. margin-bottom: 10px;
  611. }
  612. .name {
  613. font-size: 14px;
  614. font-weight: 400;
  615. color: #565954;
  616. margin-bottom: 20px;
  617. }
  618. .number {
  619. font-size: 32px;
  620. font-family: Arial;
  621. font-weight: bold;
  622. color: #2AB1FE;
  623. span {
  624. font-size: 12px;
  625. font-family: Arial;
  626. color: #2AB1FE;
  627. }
  628. }
  629. }
  630. }
  631. }
  632. }
  633. .section_2_2 {
  634. display: flex;
  635. flex-direction: row;
  636. flex-grow: 1;
  637. justify-content: space-between;
  638. .section_2_2_l {
  639. display: flex;
  640. width: 49%;
  641. background: #FFFFFF;
  642. .content {
  643. width:100%;
  644. display: flex;
  645. flex-direction: column;
  646. flex: 1;
  647. padding: 26px;
  648. .data {
  649. flex-grow: 1;
  650. }
  651. }
  652. }
  653. .section_2_2_r {
  654. display: flex;
  655. width: 49%;
  656. background: #FFFFFF;
  657. .content {
  658. width:100%;
  659. display: flex;
  660. flex-direction: column;
  661. flex: 1;
  662. padding: 26px;
  663. .data {
  664. flex-grow: 1;
  665. }
  666. }
  667. }
  668. }
  669. }
  670. }
  671. }
  672. </style>