DryWeight.vue 11KB

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