CourseManagement.vue 10KB

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