CourseManagement.vue 11KB

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