index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <div class="page-container">
  3. <el-row class="top-panel">
  4. <el-col :span="16">
  5. <div class="group-box-head-container year">
  6. <el-select v-model="year" placeholder="请选择年份" class="el-select-text" @change="changeYear">
  7. <el-option
  8. v-for="item in yearList"
  9. :key="item"
  10. :label="item+'年'"
  11. :value="item"
  12. />
  13. </el-select>
  14. <el-select v-model="month" placeholder="请选择月份" class="el-select-text" @change="changeMonth">
  15. <el-option
  16. v-for="item in 12"
  17. :key="item"
  18. :label="item+'月'"
  19. :value="item"
  20. />
  21. </el-select>
  22. <div class="group-box-head">年满意度评价</div>
  23. </div>
  24. <el-row>
  25. <el-col :span="24">
  26. <div class="group-box border">
  27. <div class="group-content">
  28. <div class="group-content-item">
  29. <div class="panorama-scoreIcon-container">
  30. <div class="item">
  31. <p class="score small">{{ yearOverview.score }}</p>
  32. <p class="name">总评分</p>
  33. </div>
  34. </div>
  35. <div class="chart-container">
  36. <FullYearChart :values="showYearScore(yearOverview.monthScoreCounter)" />
  37. </div>
  38. <div class="panorama-scoreIcon-container">
  39. <div class="item">
  40. <p class="score small">{{ yearOverview.recordQty }}</p>
  41. <p class="name">评价次数</p>
  42. </div>
  43. <div class="item">
  44. <p class="score small">{{ yearOverview.groupQty }}</p>
  45. <p class="name">科室</p>
  46. </div>
  47. <div class="item">
  48. <p class="score small">{{ yearOverview.doctorQty }}</p>
  49. <p class="name">医务人员</p>
  50. </div>
  51. <div class="item">
  52. <p class="score small">{{ yearOverview.gridQty }}</p>
  53. <p class="name">场所</p>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </el-col>
  60. </el-row>
  61. <el-row style="margin-top:10px">
  62. <el-col :span="18" class="group-box-month">
  63. <div class="group-box-head-container"><div class="group-box-head">月满意度评价</div></div>
  64. <div class="monthOverview-container">
  65. <div v-for="(monthItem,mIndex) in monthOverview" :key="mIndex" class="group-box border">
  66. <div class="group-title">
  67. <div>{{ monthItem.score }}</div>
  68. <div>{{ monthItem.groupName }}</div>
  69. </div>
  70. <div class="group-content">
  71. <div v-for="(checklist,cklIndex) in monthItem.checklistList" :key="cklIndex" class="group-content-item block">
  72. <div class="checklist-title">{{ checklist.checklistTitle }}</div>
  73. <div class="checklist-content flex-start">
  74. <div class="chart-container">
  75. <monthChart :id="'monthChart-'+cklIndex" :key="'checklist-'+cklIndex" :keys="monthScoreKeys" :values="formatCheckListValues(checklist.dayScoreList)" :axis-label="false" />
  76. </div>
  77. <div class="panorama-scoreIcon-container">
  78. <div class="item">
  79. <p class="score small">{{ checklist.score }}</p>
  80. <p class="name">得分</p>
  81. </div>
  82. <div class="item">
  83. <p class="score small">{{ checklist.targetQty }}</p>
  84. <p class="name">总人次</p>
  85. </div>
  86. <div class="item">
  87. <p class="score small">{{ checklist.recordQty }}</p>
  88. <p class="name">评价数</p>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </el-col>
  97. <el-col :span="6">
  98. <div class="group-box">
  99. <div class="group-title">
  100. <span>科室-英雄榜</span>
  101. <el-link @click="handleMoreAssess()">详情</el-link>
  102. </div>
  103. <el-row>
  104. <vuescroll :ops="ops" style="height: 188px">
  105. <GroupScoreRank :data="groupDataList" />
  106. </vuescroll>
  107. </el-row>
  108. </div>
  109. <div class="group-box" style="margin:5px 0">
  110. <div class="group-title">
  111. <span>医生-英雄榜</span>
  112. <el-link @click="handleMoreAssess()">详情</el-link>
  113. </div>
  114. <el-row>
  115. <vuescroll :ops="ops" style="height:188px">
  116. <DoctorScoreRank :data="doctorDataList" />
  117. </vuescroll>
  118. </el-row>
  119. </div>
  120. <div class="group-box">
  121. <div class="group-title">
  122. <span>场所-英雄榜</span>
  123. <el-link @click="handleMoreAssess()">详情</el-link>
  124. </div>
  125. <el-row>
  126. <vuescroll :ops="ops" style="height: 188px">
  127. <GridScoreRank ref="GridScoreRank" :data="gridDataList" />
  128. </vuescroll>
  129. </el-row>
  130. </div>
  131. </el-col>
  132. </el-row>
  133. </el-col>
  134. <el-col :span="8">
  135. <div class="group-box-head" style="padding:10px 0">今日评价次数</div>
  136. <div class="group-box max">
  137. <div class="group-content">
  138. <div class="panorama-scoreIcon-container">
  139. <div class="item">
  140. <p class="score">{{ parseFloat(todayOverview.score)!==0?parseFloat(todayOverview.score).toFixed(1):0 }}</p>
  141. <p class="name">总评分</p>
  142. </div>
  143. <div class="item">
  144. <p class="score">{{ parseFloat(todayOverview.recordQty)!==0?parseFloat(todayOverview.recordQty).toFixed(1):0 }}</p>
  145. <p class="name">评价次数</p>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <el-row style="margin-top:5px">
  151. <el-col :span="12">
  152. <div class="group-box">
  153. <div class="group-title">
  154. <span>科室-今日排行</span>
  155. <el-link @click="handleMoreAssess()">详情</el-link>
  156. </div>
  157. <el-row>
  158. <vuescroll :ops="ops" style="height: 188px">
  159. <GroupScoreRank ref="GroupScoreRank" :data="todayOverview.groupRank" http />
  160. </vuescroll>
  161. </el-row>
  162. </div>
  163. </el-col>
  164. <el-col :span="12">
  165. <div class="group-box max">
  166. <div class="group-title">
  167. <span>医生-今日排行</span>
  168. <el-link @click="handleMoreAssess()">详情</el-link>
  169. </div>
  170. <el-row>
  171. <vuescroll :ops="ops" style="height:188px">
  172. <DoctorScoreRank :data="todayOverview.doctorRank" http />
  173. </vuescroll>
  174. </el-row>
  175. </div>
  176. </el-col>
  177. </el-row>
  178. <el-row style="margin-top:10px">
  179. <el-col :span="12">
  180. <div class="group-box">
  181. <div class="group-title">
  182. <span>场所-今日排行</span>
  183. <el-link @click="handleMoreAssess()">详情</el-link>
  184. </div>
  185. <vuescroll :ops="ops" style="height: calc(100vh - 495px)">
  186. <GridScoreRank :data="todayOverview.gridRank" http />
  187. </vuescroll>
  188. </div>
  189. </el-col>
  190. <el-col :span="12">
  191. <RecentRecord more="/hos/satisfy/news/index" height="calc(100vh - 452px)" :data="todayOverview.data" />
  192. </el-col>
  193. </el-row>
  194. </el-col>
  195. </el-row>
  196. </div>
  197. </template>
  198. <script>
  199. import { gridScoreByList, groupScoreByList, doctorScoreByList } from '@/api/hos/satisfyStatisApi'
  200. import { yearOverview, monthOverview, todayOverview } from '@/api/hos/satisfyPanoramaApi'
  201. import monthChart from './components/monthChart'
  202. import FullYearChart from './components/FullYearChart'
  203. import RecentRecord from './components/RecentRecord'
  204. import DoctorScoreRank from '@/views/hos/panorama/components/DoctorScoreRank'
  205. import GridScoreRank from '@/views/hos/panorama/components/GridScoreRank'
  206. import GroupScoreRank from '@/views/hos/panorama/components/GroupScoreRank'
  207. import vuescroll from 'vuescroll'
  208. import mqtt from 'mqtt'
  209. import { mqttUrl } from '@/settings'
  210. export default {
  211. name: 'SatisfyIndex',
  212. components: {
  213. monthChart,
  214. FullYearChart,
  215. RecentRecord,
  216. DoctorScoreRank,
  217. GridScoreRank,
  218. GroupScoreRank,
  219. vuescroll
  220. },
  221. data() {
  222. return {
  223. ops: {
  224. bar: {
  225. keepShow: false,
  226. background: 'rgba(144, 147, 153, 0.4)',
  227. onlyShowBarOnScroll: false
  228. }
  229. },
  230. year: '',
  231. month: '',
  232. yearList: [],
  233. yearScoreValues: [10, 20, 30, 40, 50, 60, 50, 30, 35, 20, 55],
  234. monthScoreKeys: [],
  235. monthScoreValues: [],
  236. conditions: {},
  237. todayOverview: {
  238. data: [],
  239. doctorRank: [],
  240. gridRank: [],
  241. groupName: '',
  242. groupRank: [],
  243. recordQty: 0,
  244. score: 0
  245. },
  246. yearOverview: {
  247. doctorQty: 0,
  248. gridQty: 0,
  249. groupName: '',
  250. groupQty: 0,
  251. monthScoreCounter: {},
  252. recordQty: 0,
  253. score: 0
  254. },
  255. monthOverview: [],
  256. doctorDataList: [],
  257. groupDataList: [],
  258. gridDataList: []
  259. }
  260. },
  261. mounted() {
  262. this.init()
  263. },
  264. destroyed() {
  265. if (this.client.connected) {
  266. try {
  267. this.client.end(false, () => {
  268. console.log('Successfully disconnected!')
  269. })
  270. } catch (error) {
  271. console.log('Disconnect failed', error.toString())
  272. }
  273. }
  274. },
  275. methods: {
  276. init() {
  277. const d = new Date()
  278. this.year = d.getFullYear()
  279. this.month = d.getMonth() + 1
  280. this.initYearList()
  281. this.monthScoreKeys = this.getmonthScoreKeys()
  282. this.getData()
  283. this.initMqtt()
  284. },
  285. initYearList() {
  286. const d = new Date()
  287. const yearList = []
  288. for (let i = -5; i < 1; i++) {
  289. yearList.push(d.getFullYear() + i)
  290. }
  291. this.yearList = yearList
  292. },
  293. initMqtt() {
  294. const self = this
  295. const options = {
  296. clean: true,
  297. connectTimeout: 4000,
  298. clientId: 'emqx_test',
  299. username: 'emqx_test',
  300. password: 'emqx_test'
  301. }
  302. const client = mqtt.connect(mqttUrl, options)
  303. client.on('connect', function() {
  304. console.log('Connected')
  305. client.subscribe('topic/#', function(err) {
  306. if (!err) {
  307. // client.publish('topic/1', 'Hello mqtt')
  308. }
  309. })
  310. })
  311. client.on('message', function(topic, message) {
  312. self.mqttResponse(message)
  313. })
  314. this.client = client
  315. },
  316. handleAssessDetail(row) {},
  317. viewIndexScoreDetail(data) {},
  318. // Get Data
  319. getData() {
  320. this.getyearOverview()
  321. this.getMonthOverview()
  322. this.getTodayOverview()
  323. this.getGridScoreByList()
  324. this.getDoctorScoreByList()
  325. this.getGroupScoreByList()
  326. },
  327. getTodayOverview() {
  328. todayOverview().then((resp) => {
  329. const { data } = resp
  330. if (data) {
  331. this.todayOverview = data
  332. } else {
  333. this.$set(this.todayOverview, { data: [], doctorRank: [], gridRank: [], groupName: '', groupRank: [], recordQty: 0, score: 0 })
  334. }
  335. })
  336. },
  337. getyearOverview() {
  338. yearOverview(this.year).then((resp) => {
  339. const { data } = resp
  340. if (data) {
  341. this.yearOverview = data
  342. } else {
  343. this.$set(this.yearOverview, { doctorQty: 0, gridQty: 0, groupName: '', groupQty: 0, monthScoreCounter: {}, recordQty: 0, score: 0 })
  344. }
  345. })
  346. },
  347. getMonthOverview() {
  348. monthOverview(this.year, this.month).then((resp) => {
  349. const { data } = resp
  350. if (data) {
  351. this.monthOverview = data.data
  352. } else {
  353. this.monthOverview = []
  354. }
  355. })
  356. },
  357. getGridScoreByList() {
  358. gridScoreByList(this.conditions).then((resp) => {
  359. const { code, msg, data } = resp
  360. if (code === 0) {
  361. this.gridDataList = data
  362. } else {
  363. this.$message.error(msg)
  364. }
  365. })
  366. },
  367. getGroupScoreByList() {
  368. groupScoreByList(this.conditions).then((resp) => {
  369. const { code, msg, data } = resp
  370. if (code === 0) {
  371. this.groupDataList = data
  372. } else {
  373. this.$message.error(msg)
  374. }
  375. })
  376. },
  377. getDoctorScoreByList() {
  378. doctorScoreByList(this.conditions).then((resp) => {
  379. const { code, msg, data } = resp
  380. if (code === 0) {
  381. this.doctorDataList = data
  382. } else {
  383. this.$message.error(msg)
  384. }
  385. })
  386. },
  387. getmonthScoreKeys(date = (new Date()), unit = '') {
  388. var days = []
  389. if (typeof (date) === 'string') { // 2022/09
  390. date = new Date(date)
  391. }
  392. const y = date.getFullYear()
  393. const m = date.getMonth()
  394. const lastDay = new Date(y, m + 1, 0).getDate()
  395. for (let i = 1; i <= lastDay; i++) {
  396. days.push(i)
  397. }
  398. return days
  399. },
  400. showYearScore(data) {
  401. if (Array.isArray(data)) return data
  402. var arr = []
  403. for (let i = 1; i <= 12; i++) {
  404. arr.push(data[`m${i}`] ? data[`m${i}`] : 0)
  405. }
  406. return arr
  407. },
  408. handleMoreAssess() {
  409. this.$router.push({
  410. path: '/hos/satisfy/assess/index'
  411. })
  412. },
  413. formatCheckListValues(data) {
  414. if (!data) return []
  415. const enums = {}
  416. const len = (this.getmonthScoreKeys(`${this.year}/${this.month}`)).length
  417. const months = []
  418. data.forEach(item => { enums[item.day] = item })
  419. for (let i = 1; i <= len; i++) {
  420. months[i - 1] = enums[i] ? enums[i].score : 0
  421. }
  422. return months
  423. },
  424. mqttResponse(message) {
  425. // console.log('message', message.toString())
  426. this.getData()
  427. },
  428. changeYear(params) {
  429. this.getyearOverview()
  430. },
  431. changeMonth() {
  432. this.monthScoreKeys = this.getmonthScoreKeys(`${this.year}/${this.month}`)
  433. this.getMonthOverview()
  434. }
  435. }
  436. }
  437. </script>
  438. <style lang="scss" scoped>
  439. .page-container {
  440. padding: 15px;
  441. color: #FFF;
  442. position: relative;
  443. .group-box-head-container{
  444. padding-right:15px;
  445. .group-box-head{
  446. background-color: #0C3242;
  447. padding:8px 5px;
  448. font-weight: bold;
  449. font-size: 18px;
  450. }
  451. &.year{
  452. .group-box-head{
  453. padding:5px 10px;
  454. }
  455. }
  456. }
  457. .monthOverview-container{
  458. width: calc(100% - 15px);
  459. min-height: calc(100vh - 300px);
  460. background-color: #0C3242;
  461. .group-box{
  462. width: auto;
  463. box-sizing: border-box;
  464. }
  465. }
  466. .page-title {
  467. font-size: 18px;
  468. font-weight: bold;
  469. color: #FFFFFF;
  470. }
  471. .top-panel{
  472. margin-bottom:0;
  473. .group-box{
  474. border-radius: 0;
  475. padding: 5px 15px;
  476. border-top: 0;
  477. }
  478. }
  479. .group-box {
  480. width: calc(100% - 15px);
  481. background-color: #0C3242;
  482. border-top: 4px solid #1F3C51;
  483. border-radius: 5px 5px 0 0;
  484. padding: 15px;
  485. &.max{
  486. width: 100%;
  487. }
  488. &-bg {
  489. background-repeat: no-repeat;
  490. background-position: right top;
  491. }
  492. &.border{
  493. border:1px solid #163e5e;
  494. }
  495. .group-title {
  496. font-size: 16px;
  497. color: #FFF;
  498. margin-bottom: 15px;
  499. font-weight: bold;
  500. span{
  501. color: #aa9f9f;
  502. }
  503. .el-link {
  504. float: right;
  505. font-size: 14px;
  506. color: #C1C6C8;
  507. -webkit-text-fill-color: #C1C6C8;
  508. }
  509. span{
  510. font-size: 12px;
  511. font-family: Microsoft YaHei,serif;
  512. font-weight: 400;
  513. color: #7C878E;
  514. }
  515. }
  516. .group-content {
  517. height: 80%;
  518. .group-content-item{
  519. display: flex;
  520. justify-content: flex-start;
  521. align-items:center;
  522. &.block{
  523. display: block;
  524. }
  525. .checklist-title{
  526. font-size: 10px;
  527. color: #d7d1d1;
  528. }
  529. .checklist-content{
  530. align-items: center;
  531. }
  532. .chart-container{
  533. width: 65%;
  534. height: 100px;
  535. min-width:300px ;
  536. flex: 1;
  537. }
  538. .panorama-scoreIcon-container{
  539. height: 100%;
  540. padding: 0 10px;
  541. }
  542. }
  543. }
  544. }
  545. .group-box-month{
  546. .group-box{
  547. border-top: 0;
  548. border-bottom: 0;
  549. &{
  550. display: flex;
  551. justify-content: flex-start;
  552. align-items: center;
  553. padding: 6px 10px;
  554. }
  555. &:first-child{
  556. border-top:1px solid #163e5e;
  557. }
  558. &:last-child{
  559. border-top:1px solid #163e5e;
  560. border-bottom:1px solid #163e5e;
  561. }
  562. .group-content{
  563. flex: 1;
  564. .checklist-title{
  565. padding-left:15px;
  566. }
  567. .group-content-item{
  568. .chart-container{
  569. width: 75%;
  570. height: 108px;
  571. }
  572. }
  573. }
  574. }
  575. }
  576. .score-group{
  577. overflow: hidden;
  578. &-title{
  579. font-size: 14px;
  580. font-family: Microsoft YaHei,serif;
  581. font-weight: 400;
  582. color: #C1C6C8;
  583. text-align: center;
  584. overflow: hidden;
  585. p{
  586. position: relative;
  587. display: inline-block;
  588. &:before{
  589. position: absolute;
  590. left: -353px;
  591. top: 50%;
  592. content: "";
  593. width: 343px;
  594. height: 2px;
  595. background: linear-gradient(-90deg, #233E4F 0%, #193142 100%);
  596. }
  597. &:after{
  598. position: absolute;
  599. right: -353px;
  600. top: 50%;
  601. content: "";
  602. width: 343px;
  603. height: 2px;
  604. background: linear-gradient(90deg, #233E4F 0%, #193142 100%);
  605. }
  606. }
  607. }
  608. }
  609. .chart-score-group {
  610. margin-bottom: 15px;
  611. }
  612. }
  613. .panorama-scoreIcon-container{
  614. &{
  615. display: flex;
  616. justify-content: space-between;
  617. align-items: center;
  618. height: 80px;
  619. }
  620. .item{
  621. display: flex;
  622. justify-content: center;
  623. align-items: center;
  624. flex-direction: column;
  625. padding: 0 10px;
  626. &.total{
  627. border-right: 5px solid #d96c1b;
  628. padding-right: 20px;
  629. box-sizing: border-box;
  630. }
  631. p{
  632. line-height: 1;
  633. margin: 0;
  634. padding: 0;
  635. }
  636. .score{
  637. font-size: 40px;
  638. line-height: 1;
  639. font-weight: 800;
  640. text-shadow: 2px 2px #bdaaa3;
  641. &.small{
  642. font-size: 24px;
  643. }
  644. }
  645. .name{
  646. font-size: 12px;
  647. border-top: 1px solid #888686;
  648. color: #d7d1d1;
  649. margin-top: 5px;
  650. padding: 5px 6px 0 6px;
  651. }
  652. }
  653. }
  654. </style>