血透系统pad前端

index.vue 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div class="mainBox">
  3. <div class="newBox">
  4. <div class="mainContent">
  5. <record-page @refAdvice="refAdvice" :un_read_wait_num="unReadWaitNum" :un_read_dialysis_num="unReadDialysisNum" ></record-page>
  6. </div>
  7. <side-bar :active_index="0" :total_read_dot="readNum"></side-bar>
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. import RecordPage from './RecordPage'
  13. import SideBar from '@/pages/layout/SideBar'
  14. import { getDialysisScheduals, getWaitingScheduals } from '@/api/dialysis'
  15. import { parseTime } from '@/utils/index'
  16. export default {
  17. name: 'Main',
  18. data () {
  19. return {
  20. timer: null,
  21. scheduals: [],
  22. advice_groups: [],
  23. unReadWaitNum: 0,
  24. unReadDialysisNum: 0
  25. }
  26. },
  27. components: {
  28. RecordPage,
  29. SideBar
  30. },
  31. created () {
  32. // this.requestScheduals()
  33. // this.requestDialysisScheduals()
  34. },
  35. mounted () {
  36. // this.timer = window.setInterval(() => {
  37. // setTimeout(this.requestScheduals(), 0)
  38. // }, 10000)
  39. // this.timerDia = window.setInterval(() => {
  40. // setTimeout(this.requestDialysisScheduals(), 0)
  41. // }, 10000)
  42. },
  43. // beforeDestroy () {
  44. // clearInterval(this.timer)
  45. // this.timer = null
  46. // this.$once('hook:beforeDestroy', () => {
  47. // clearInterval(this.timer)
  48. // })
  49. // clearInterval(this.timerDia)
  50. // this.timerDia = null
  51. // this.$once('hook:beforeDestroy', () => {
  52. // clearInterval(this.timerDia)
  53. // })
  54. // },
  55. methods: {
  56. refAdvice () {
  57. this.requestScheduals()
  58. this.requestDialysisScheduals()
  59. },
  60. requestScheduals () {
  61. var storedata = this.$store.getters.waitscheduals
  62. var scheduals = storedata.waitscheduals
  63. if (Object.keys(storedata).length > 0) {
  64. this.scheduals = scheduals
  65. console.log(this.scheduals)
  66. let doctorAdvice = []
  67. for (let i = 0; i < this.scheduals.length; i++) {
  68. for (let y = 0; y < this.scheduals[i].doctor_advice.length; y++) {
  69. if (this.scheduals[i].dialysis_order == null) {
  70. if (this.scheduals[i].doctor_advice[y].execution_state == 2) {
  71. doctorAdvice.push(this.scheduals[i].doctor_advice[y])
  72. }
  73. }
  74. }
  75. }
  76. const sorted = this.groupBy(doctorAdvice, function (item) {
  77. return [item.groupno]
  78. })
  79. this.unReadWaitNum = sorted.length
  80. }
  81. // else {
  82. // var date = parseTime(Date.parse(new Date()), '{y}-{m}-{d}')
  83. // getWaitingScheduals({ date: date }).then(rs => {
  84. // var resp = rs.data
  85. // this.$store.dispatch('SetRequestScheduals', { resp })
  86. // // console.log(resp);
  87. // if (resp.state == 1) {
  88. // var scheduals = resp.data.scheduals
  89. // this.scheduals = scheduals
  90. // console.log(this.scheduals)
  91. // let doctorAdvice = []
  92. // for (let i = 0; i < this.scheduals.length; i++) {
  93. // for (let y = 0; y < this.scheduals[i].doctor_advice.length; y++) {
  94. // if (this.scheduals[i].dialysis_order == null) {
  95. // if (this.scheduals[i].doctor_advice[y].execution_state == 2) {
  96. // doctorAdvice.push(this.scheduals[i].doctor_advice[y])
  97. // }
  98. // }
  99. // }
  100. // }
  101. // const sorted = this.groupBy(doctorAdvice, function (item) {
  102. // return [item.groupno]
  103. // })
  104. // this.unReadWaitNum = sorted.length
  105. // } else {
  106. // this.$toast({
  107. // message: resp.msg
  108. // })
  109. // }
  110. // })
  111. // }
  112. },
  113. requestDialysisScheduals () {
  114. var storedata = this.$store.getters.scheduals
  115. var scheduals = storedata.scheduals
  116. if (Object.keys(storedata).length > 0) {
  117. let doctorAdvice = []
  118. for (let index = 0; index < scheduals.length; index++) {
  119. const schedual = scheduals[index]
  120. if (schedual.dialysis_order == null) {
  121. continue
  122. }
  123. for (let y = 0; y < schedual.doctor_advice.length; y++) {
  124. if (schedual.doctor_advice[y].execution_state == 2) {
  125. doctorAdvice.push(schedual.doctor_advice[y])
  126. }
  127. }
  128. }
  129. const sorted = this.groupBy(doctorAdvice, function (item) {
  130. return [item.groupno]
  131. })
  132. this.unReadDialysisNum = sorted.length
  133. }
  134. // else {
  135. // var date = this.$store.getters.app.dialysis_area.schedule_date
  136. // var type = 0
  137. // getDialysisScheduals({
  138. // type: type,
  139. // date: parseTime(date, '{y}-{m}-{d}')
  140. // })
  141. // .then(rs => {
  142. // var resp = rs.data
  143. // this.$store.dispatch('SetRequestDialysisScheduals', { resp })
  144. // if (resp.state == 1) {
  145. // var scheduals = resp.data.scheduals
  146. // let doctorAdvice = []
  147. // for (let index = 0; index < scheduals.length; index++) {
  148. // const schedual = scheduals[index]
  149. // if (schedual.dialysis_order == null) {
  150. // continue
  151. // }
  152. // for (let y = 0; y < schedual.doctor_advice.length; y++) {
  153. // if (schedual.doctor_advice[y].execution_state == 2) {
  154. // doctorAdvice.push(schedual.doctor_advice[y])
  155. // }
  156. // }
  157. // }
  158. // const sorted = this.groupBy(doctorAdvice, function (item) {
  159. // return [item.groupno]
  160. // })
  161. // this.unReadDialysisNum = sorted.length
  162. // } else {
  163. // this.$toast({
  164. // message: resp.msg
  165. // })
  166. // }
  167. // })
  168. // .catch(v => {})
  169. // }
  170. },
  171. groupBy (array, f) {
  172. const groups = {}
  173. array.forEach(function (o) {
  174. const group = JSON.stringify(f(o))
  175. groups[group] = groups[group] || []
  176. groups[group].push(o)
  177. })
  178. return Object.keys(groups).map(function (group) {
  179. return groups[group]
  180. })
  181. },
  182. getData () {
  183. console.log('111111')
  184. // this.requestScheduals()
  185. // this.requestDialysisScheduals()
  186. }
  187. },
  188. computed: {
  189. readNum: function () {
  190. return this.unReadWaitNum + this.unReadDialysisNum
  191. }
  192. }
  193. }
  194. </script>
  195. <style style="stylesheet/scss" lang="scss" scoped>
  196. html,
  197. body {
  198. height: 100%;
  199. }
  200. .mainBox {
  201. height: 100%;
  202. font-size: 0.3rem;
  203. .sideColumn {
  204. .column {
  205. .head {
  206. @include display-flex;
  207. @include align-items-center;
  208. @include flex-direction;
  209. @include text-align;
  210. @include justify-content-center;
  211. margin: 0.5rem 0 0.5rem 0;
  212. img {
  213. width: 100%;
  214. height: 100%;
  215. border-radius: 0.5rem;
  216. width: 0.7rem;
  217. height: 0.7rem;
  218. }
  219. }
  220. .sidebar {
  221. @include display-flex;
  222. @include align-items-center;
  223. @include flex-direction;
  224. @include text-align;
  225. padding: 0;
  226. li {
  227. padding: 0 0 0.8rem 0;
  228. a {
  229. color: #a8b3ba;
  230. display: inline-block;
  231. padding: 0;
  232. margin: 0;
  233. p {
  234. font-size: 0.24rem;
  235. margin-top: 0.2rem;
  236. }
  237. .iconfont {
  238. font-size: 0.5rem;
  239. display: inline-block;
  240. }
  241. }
  242. &.active {
  243. a {
  244. color: #409eff;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. .mainContent {
  253. // margin: 0 0 0 1.58rem;
  254. }
  255. .newBox {
  256. display: flex;
  257. flex-direction: column;
  258. height: 100%;
  259. overflow: hidden;
  260. > :first-child {
  261. flex: 1;
  262. overflow: auto;
  263. }
  264. }
  265. </style>