Education.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div class="education">
  3. <div>
  4. <div class="toolBox">
  5. <div class="toolOne" @click="startShow = true">
  6. <div style="display: flex;align-items: center;">
  7. {{ startTime }}
  8. <van-icon name="arrow-down" />
  9. </div>
  10. </div>
  11. <div class="toolOne" @click="endShow = true">
  12. <div style="display: flex;align-items: center;">
  13. {{ endTime }}
  14. <van-icon name="arrow-down" />
  15. </div>
  16. </div>
  17. </div>
  18. <div class="adviceBox" v-if="Education.length > 0">
  19. <van-list
  20. v-model="loading"
  21. :finished="finished"
  22. finished-text="没有更多了"
  23. @load="onLoad"
  24. >
  25. <div class="adviceMain">
  26. <div
  27. class="adviceOne"
  28. v-for="(item, index) in Education"
  29. :key="index"
  30. >
  31. <div class="adviceTitle">
  32. <p>{{ getTime(item.assessment_date) }}</p>
  33. <van-icon
  34. class="ellipsis"
  35. name="ellipsis"
  36. @click="toDeleteEducation(item.id, item.index)"
  37. />
  38. </div>
  39. <div class="statOrder" @click="toEducationDetail(item.id)">
  40. <div class="orderContent">
  41. <p>{{ item.mission }}</p>
  42. </div>
  43. </div>
  44. <div class="all" @click="toEducationDetail(item.id)">全部</div>
  45. </div>
  46. </div>
  47. </van-list>
  48. </div>
  49. <div class="noimgBox" v-else>
  50. <img src="../../../assets/images/none.png" alt />
  51. </div>
  52. </div>
  53. <!-- <div class="add">
  54. <div style="display: flex;align-items: center;">
  55. <van-icon class="addIcon" name="add" />新增
  56. </div>
  57. </div>-->
  58. <!-- 弹出层 -->
  59. <div>
  60. <van-popup
  61. v-model="startShow"
  62. position="bottom"
  63. :style="{ height: '40%' }"
  64. >
  65. <van-datetime-picker
  66. v-model="currentDate"
  67. type="date"
  68. :min-date="minDate"
  69. :max-date="maxDate"
  70. @confirm="getstartTime"
  71. @cancel="startShow = false"
  72. />
  73. </van-popup>
  74. <van-popup v-model="endShow" position="bottom" :style="{ height: '40%' }">
  75. <van-datetime-picker
  76. v-model="currentDate"
  77. type="date"
  78. :min-date="minDate"
  79. :max-date="maxDate"
  80. @confirm="getstartTime2"
  81. @cancel="endShow = false"
  82. />
  83. </van-popup>
  84. <van-action-sheet
  85. v-model="newShow"
  86. :actions="actions"
  87. cancel-text="取消"
  88. @select="DeleteEducation"
  89. />
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import {
  95. getPatientDetail,
  96. getEducation,
  97. DeleteEducationOne
  98. } from '@/api/patient/patient'
  99. import { uParseTime } from '@/utils/tools'
  100. import Vue from 'vue'
  101. import { Dialog } from 'vant'
  102. const moment = require('moment')
  103. export default {
  104. props: {
  105. active: Number
  106. },
  107. data () {
  108. return {
  109. newShow: false,
  110. startShow: false,
  111. endShow: false,
  112. startTime: '请选择',
  113. endTime: '请选择',
  114. minDate: new Date(1970, 0, 1),
  115. maxDate: new Date(2025, 10, 1),
  116. currentDate: new Date(),
  117. actions: [{ name: '查看全部' }, { name: '全部删除' }],
  118. showOne: true,
  119. showTwo: false,
  120. limit: 10,
  121. page: 1,
  122. total: 0,
  123. loading: false,
  124. finished: false,
  125. list: [],
  126. Education: [],
  127. patient_id: '',
  128. id: 0,
  129. index: 0
  130. }
  131. },
  132. methods: {
  133. onCancel () {
  134. this.typeShow = false
  135. },
  136. onConfirm (value) {
  137. this.type = value
  138. this.typeShow = false
  139. },
  140. getstartTime (value) {
  141. this.page = 1
  142. let year = value.getFullYear()
  143. let month = value.getMonth() + 1
  144. let day = value.getDate()
  145. if (month >= 1 && month <= 9) {
  146. month = `0${month}`
  147. }
  148. if (day >= 1 && day <= 9) {
  149. day = `0${day}`
  150. }
  151. this.startTime = `${year}-${month}-${day}`
  152. this.Education = []
  153. this.getEducation(
  154. this.patient_id,
  155. this.limit,
  156. this.page,
  157. this.startTime,
  158. this.endTime
  159. )
  160. this.startShow = false
  161. },
  162. getstartTime2 (value) {
  163. this.page = 1
  164. let year = value.getFullYear()
  165. let month = value.getMonth() + 1
  166. let day = value.getDate()
  167. if (month >= 1 && month <= 9) {
  168. month = `0${month}`
  169. }
  170. if (day >= 1 && day <= 9) {
  171. day = `0${day}`
  172. }
  173. this.endTime = `${year}-${month}-${day}`
  174. this.Education = []
  175. this.getEducation(
  176. this.patient_id,
  177. this.limit,
  178. this.page,
  179. this.startTime,
  180. this.endTime
  181. )
  182. this.endShow = false
  183. },
  184. getEducation (id) {
  185. getEducation(
  186. id,
  187. this.limit,
  188. this.page,
  189. this.startTime,
  190. this.endTime
  191. ).then(response => {
  192. if (response.data.state === 1) {
  193. var education = response.data.data.education
  194. let arr = this.Education
  195. arr.push(...education)
  196. this.Education = arr
  197. var total = response.data.data.total
  198. this.total = total
  199. this.loading = false
  200. }
  201. })
  202. },
  203. onLoad () {
  204. setTimeout(() => {
  205. this.page++
  206. if (this.page <= Math.ceil(this.total / 10)) {
  207. this.getEducation(
  208. this.patient_id,
  209. this.limit,
  210. this.page,
  211. this.startTime,
  212. this.endTime
  213. )
  214. } else {
  215. this.loading = false
  216. this.finished = true
  217. }
  218. }, 3000)
  219. },
  220. getPatientDetail (patientid) {
  221. getPatientDetail(patientid).then(response => {
  222. if (response.data.state === 1) {
  223. var patientDetail = response.data.data.patientDetail
  224. if (patientDetail.blood_patients == 0) {
  225. this.Education = []
  226. this.showOne = false
  227. this.showTwo = true
  228. }
  229. if (patientDetail.blood_patients == 1) {
  230. this.showOne = true
  231. this.showTwo = false
  232. }
  233. this.patientName = patientDetail.name
  234. }
  235. })
  236. },
  237. getTime (time) {
  238. // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
  239. return uParseTime(time, '{y}-{m}-{d}')
  240. },
  241. toEducationDetail (id) {
  242. var patientid = this.$route.query.patientid
  243. this.$router.push(
  244. '/editEducation?id=' +
  245. id +
  246. '&patientid=' +
  247. patientid +
  248. '&active=' +
  249. this.active
  250. )
  251. },
  252. toDeleteEducation (id, index) {
  253. this.id = id
  254. this.index = index
  255. this.newShow = true
  256. },
  257. DeleteEducation (value) {
  258. // console.log("value", value);
  259. if (value.name == '查看全部') {
  260. var patientid = this.$route.query.patientid
  261. this.$router.push(
  262. '/editEducation?id=' +
  263. this.id +
  264. '&patientid=' +
  265. patientid +
  266. '&active=' +
  267. this.active
  268. )
  269. }
  270. if (value.name == '全部删除') {
  271. this.DeleteEducationOne(this.id, this.index)
  272. }
  273. },
  274. DeleteEducationOne (id, index) {
  275. Dialog.confirm({
  276. title: '删除提示!',
  277. message: '确认删除该条信息吗?,删除后将无法恢复!'
  278. }).then(() => {
  279. DeleteEducationOne(id).then(response => {
  280. if (response.data.state === 1) {
  281. var msg = response.data.data.msg
  282. // console.log("msg", msg);
  283. this.Education.splice(index, 1)
  284. this.newShow = false
  285. }
  286. })
  287. })
  288. }
  289. },
  290. created () {
  291. var patientid = this.$route.query.patientid
  292. this.getPatientDetail(patientid)
  293. this.getEducation(patientid)
  294. this.patient_id = patientid
  295. }
  296. }
  297. </script>
  298. <style lang="scss" scoped>
  299. .education {
  300. height: 100%;
  301. overflow-y: auto;
  302. .toolBox {
  303. display: flex;
  304. height: 3.125rem;
  305. align-items: center;
  306. .toolOne {
  307. width: 6.25rem;
  308. height: 1.875rem;
  309. background: rgba(246, 246, 246, 1);
  310. border-radius: 5px;
  311. text-align: center;
  312. font-size: 0.8125rem;
  313. color: #8d8d8d;
  314. display: flex;
  315. align-items: center;
  316. justify-content: space-around;
  317. margin-left: 0.8125rem;
  318. }
  319. }
  320. .adviceBox {
  321. padding: 0 1.125rem;
  322. margin-bottom: 3.125rem;
  323. }
  324. .adviceMain {
  325. > div:last-child {
  326. border: none;
  327. }
  328. }
  329. .adviceOne {
  330. // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  331. border-bottom: 1px solid #e5e5e5;
  332. padding-bottom: 0.625rem;
  333. }
  334. .adviceTitle {
  335. padding-top: 0.625rem;
  336. display: flex;
  337. align-items: center;
  338. justify-content: space-between;
  339. p {
  340. color: #000000;
  341. font-weight: bold;
  342. font-size: 0.9375rem;
  343. }
  344. .ellipsis {
  345. font-size: 1.25rem;
  346. color: #cccccc;
  347. }
  348. }
  349. .statOrderTitle {
  350. color: #5b98ff;
  351. font-size: 0.8125rem;
  352. font-weight: bold;
  353. margin: 0.625rem 0;
  354. }
  355. .longOrderTitle {
  356. color: #ff964a;
  357. font-size: 0.8125rem;
  358. font-weight: bold;
  359. margin: 0.625rem 0;
  360. }
  361. .orderContent {
  362. font-size: 0.875rem;
  363. color: rgba(49, 50, 52, 1);
  364. p {
  365. line-height: 1.125rem;
  366. }
  367. }
  368. .doctorBox {
  369. font-size: 0.75rem;
  370. color: rgba(152, 152, 152, 1);
  371. line-height: 1.125rem;
  372. display: flex;
  373. align-items: center;
  374. justify-content: space-between;
  375. margin-top: 0.625rem;
  376. }
  377. .all {
  378. font-size: 0.8125rem;
  379. color: #5b98ff;
  380. margin-top: 0.625rem;
  381. }
  382. .noimgBox {
  383. margin-top: 40%;
  384. img {
  385. width: 9.375rem;
  386. height: 9.375rem;
  387. margin: 0 auto;
  388. display: block;
  389. }
  390. }
  391. .add {
  392. position: fixed;
  393. bottom: 0;
  394. left: 0;
  395. width: 100%;
  396. height: 2.75rem;
  397. background: rgba(255, 255, 255, 1);
  398. box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  399. display: flex;
  400. align-items: center;
  401. justify-content: space-around;
  402. font-size: 0.9375rem;
  403. color: #979798;
  404. .addIcon {
  405. color: #5b98ff;
  406. font-size: 1.25rem;
  407. margin-right: 0.25rem;
  408. }
  409. }
  410. }
  411. ::-webkit-scrollbar {
  412. width: 0;
  413. }
  414. </style>