DryWeight.vue 11KB

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