CourseManagement.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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">
  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: "删除" }],
  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. this.DeleteCouseManage(this.patient_id);
  250. }
  251. },
  252. DeleteCouseManage(id, index) {
  253. Dialog.confirm({
  254. title: "删除提示!",
  255. message: "确认删除该条信息吗?,删除后将无法恢复!"
  256. }).then(() => {
  257. DeleteCouseManage(id).then(response => {
  258. if (response.data.state === 1) {
  259. var msg = response.data.data.msg;
  260. console.log("msg", msg);
  261. this.courseManagement.splice(index, 1);
  262. this.newShow = false;
  263. }
  264. });
  265. });
  266. },
  267. toCourseDetail(id) {
  268. var patientid = this.$route.query.patientid;
  269. this.$router.push(
  270. "/coursedetail?id=" +
  271. id +
  272. "&patientid=" +
  273. patientid +
  274. "&active=" +
  275. this.active
  276. );
  277. },
  278. getPatientDetail(patientid) {
  279. getPatientDetail(patientid).then(response => {
  280. if (response.data.state === 1) {
  281. var patientDetail = response.data.data.patientDetail;
  282. if (patientDetail.blood_patients == 0) {
  283. this.showOne = false;
  284. this.showTwo = true;
  285. }
  286. if (patientDetail.blood_patients == 1) {
  287. this.showOne = true;
  288. this.showTwo = false;
  289. }
  290. this.patientName = patientDetail.name;
  291. }
  292. });
  293. }
  294. },
  295. created() {
  296. var patientid = this.$route.query.patientid;
  297. this.patientid = patientid;
  298. // console.log("干体重id", patientid);
  299. this.getCourseManagement(patientid);
  300. this.getPatientDetail(patientid);
  301. }
  302. };
  303. </script>
  304. <style lang="scss" scoped>
  305. .courseManagement {
  306. height: 100%;
  307. overflow-y: auto;
  308. .toolBox {
  309. display: flex;
  310. height: 3.125rem;
  311. align-items: center;
  312. .toolOne {
  313. width: 6.25rem;
  314. height: 1.875rem;
  315. background: rgba(246, 246, 246, 1);
  316. border-radius: 5px;
  317. text-align: center;
  318. font-size: 0.8125rem;
  319. color: #8d8d8d;
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-around;
  323. margin-left: 0.8125rem;
  324. }
  325. }
  326. .adviceBox {
  327. padding: 0 1.125rem;
  328. margin-bottom: 3.125rem;
  329. }
  330. .adviceMain{
  331. >div:last-child{
  332. border: none;
  333. }
  334. }
  335. .adviceOne {
  336. // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  337. border-bottom: 1px solid #e5e5e5;
  338. padding-bottom: 0.625rem;
  339. }
  340. .adviceTitle {
  341. padding-top: 0.625rem;
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-between;
  345. p {
  346. color: #000000;
  347. font-weight: bold;
  348. font-size: 0.9375rem;
  349. }
  350. .ellipsis {
  351. font-size: 1.25rem;
  352. color: #cccccc;
  353. }
  354. }
  355. .statOrderTitle {
  356. color: #5b98ff;
  357. font-size: 0.8125rem;
  358. font-weight: bold;
  359. margin: 0.625rem 0;
  360. }
  361. .longOrderTitle {
  362. color: #ff964a;
  363. font-size: 0.8125rem;
  364. font-weight: bold;
  365. margin: 0.625rem 0;
  366. }
  367. .orderContent {
  368. font-size: 0.875rem;
  369. color: rgba(49, 50, 52, 1);
  370. p {
  371. line-height: 1.125rem;
  372. }
  373. }
  374. .doctorBox {
  375. font-size: 0.75rem;
  376. color: rgba(152, 152, 152, 1);
  377. line-height: 1.125rem;
  378. display: flex;
  379. align-items: center;
  380. justify-content: space-between;
  381. margin-top: 0.625rem;
  382. }
  383. .all {
  384. font-size: 0.8125rem;
  385. color: #5b98ff;
  386. margin-top: 0.625rem;
  387. }
  388. .noimgBox {
  389. margin-top: 40%;
  390. img {
  391. width: 9.375rem;
  392. height: 9.375rem;
  393. margin: 0 auto;
  394. display: block;
  395. }
  396. }
  397. .add {
  398. position: fixed;
  399. bottom: 0;
  400. left: 0;
  401. width: 100%;
  402. height: 2.75rem;
  403. background: rgba(255, 255, 255, 1);
  404. box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  405. display: flex;
  406. align-items: center;
  407. justify-content: space-around;
  408. font-size: 0.9375rem;
  409. color: #979798;
  410. .addIcon {
  411. color: #5b98ff;
  412. font-size: 1.25rem;
  413. margin-right: 0.25rem;
  414. }
  415. }
  416. }
  417. ::-webkit-scrollbar {
  418. width: 0;
  419. }
  420. </style>