血透系统pad前端

WaitingArea.vue 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <div>
  3. <div class="screening">
  4. <ul>
  5. <el-popover
  6. v-model="zone_options_visible"
  7. placement="bottom"
  8. trigger="click">
  9. <li slot="reference">
  10. {{ zone_options[zone_selected].text }}<span class="iconfont">&#xe74a;</span>
  11. </li>
  12. <div class="popover-demo-content">
  13. <ul>
  14. <li v-for="(option, index) in zone_options" :key="index" @click="handleZoneChange(index)" :class="zone_selected == index ? 'tick' : ''">{{ option.text }}</li>
  15. </ul>
  16. </div>
  17. </el-popover>
  18. <li v-for="(item,i) in menuList" :class="select_index == i ? 'active' : ''" @click="menuTabClick(i)"
  19. :key="i">{{ item.label + (item.count > 0 ? '(' + item.count + ')' : '') }}</li>
  20. </ul>
  21. </div>
  22. <div class="stateBox ">
  23. <!-- <patient-box class="clearfix" :patients="filtedScheduals "></patient-box> -->
  24. <div v-for="(item, index) in filtedScheduals" :key="index">
  25. <h2 class="title" >{{item.zone_name}}</h2>
  26. <patient-box class="clearfix" :patients="item.scheduals"></patient-box>
  27. </div>
  28. <div class="NoData" v-show="filtedScheduals.length == 0"><img style="margin-top: 50px; margin-bottom: 50px" src="@/assets/login/data.jpg" alt=""></div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import PatientBox from "./PatientBox";
  34. import { getWaitingScheduals } from "@/api/dialysis";
  35. import { parseTime } from "@/utils";
  36. import { Popover } from "vux";
  37. export default {
  38. name: "WaitingArea",
  39. components: {
  40. PatientBox,
  41. Popover
  42. },
  43. data() {
  44. return {
  45. menuList: [
  46. { value: "2", label: "透前称量", count: 0 },
  47. { value: "3", label: "制定处方", count: 0 }
  48. ],
  49. select_index: -1,
  50. zone_selected: 0,
  51. scheduals: [],
  52. zone_options: [{ value: 0, text: "全部分区" }],
  53. zone_scheduals: [],
  54. zone_options_visible: false,
  55. };
  56. },
  57. props: {
  58. search_keyword: {
  59. type: String
  60. }
  61. },
  62. computed: {
  63. filtedScheduals: function() {
  64. var search_keyword = this.search_keyword;
  65. if (this.search_keyword.length > 0) {
  66. var scheduals = [];
  67. for (let index = 0; index < this.scheduals.length; index++) {
  68. const schedual = this.scheduals[index];
  69. if (
  70. schedual.patient.name.indexOf(search_keyword) != -1 ||
  71. schedual.patient.dialysis_no.indexOf(search_keyword) != -1
  72. ) {
  73. scheduals.push(schedual);
  74. }
  75. }
  76. return this.processScheduals(scheduals);
  77. }
  78. if (this.zone_selected != 0) {
  79. var zone_name = this.zone_options[this.zone_selected].text;
  80. for (let index = 0; index < this.zone_scheduals.length; index++) {
  81. const zone_scheduals = this.zone_scheduals[index];
  82. if (zone_scheduals.zone_name == zone_name) {
  83. return [zone_scheduals];
  84. }
  85. }
  86. }
  87. if (this.select_index == 0) {
  88. // console.log("点击了第二个");
  89. var scheduals = [];
  90. for (let index = 0; index < this.scheduals.length; index++) {
  91. const schedual = this.scheduals[index];
  92. if (schedual.assessment_before_dislysis != null) {
  93. scheduals.push(schedual);
  94. }
  95. }
  96. return this.processScheduals(scheduals);
  97. // return scheduals;
  98. } else if (this.select_index == 1) {
  99. // console.log("点击了第三个");
  100. var scheduals = [];
  101. for (let index = 0; index < this.scheduals.length; index++) {
  102. const schedual = this.scheduals[index];
  103. if (
  104. schedual.assessment_before_dislysis == null &&
  105. schedual.prescription != null
  106. ) {
  107. scheduals.push(schedual);
  108. }
  109. }
  110. // return scheduals;
  111. return this.processScheduals(scheduals);
  112. } else {
  113. return this.zone_scheduals;
  114. }
  115. }
  116. },
  117. created() {
  118. this.requestScheduals();
  119. },
  120. methods: {
  121. menuTabClick: function(tabIndex) {
  122. this.select_index = tabIndex;
  123. this.zone_selected = 0;
  124. },
  125. handleZoneChange: function(index) {
  126. this.zone_options_visible = false;
  127. this.zone_selected = index;
  128. this.select_index = -1;
  129. },
  130. requestScheduals() {
  131. var date = parseTime(Date.parse(new Date()), "{y}-{m}-{d}");
  132. getWaitingScheduals({ date: date }).then(rs => {
  133. var resp = rs.data;
  134. // console.log(resp);
  135. if (resp.state == 1) {
  136. var scheduals = resp.data.scheduals;
  137. var totalCount = scheduals.length;
  138. var prescription_count = 0;
  139. var assessment_before_dislysis_count = 0;
  140. for (let index = 0; index < scheduals.length; index++) {
  141. const schedual = scheduals[index];
  142. if (schedual.assessment_before_dislysis != null) {
  143. assessment_before_dislysis_count += 1;
  144. } else if (schedual.prescription != null) {
  145. prescription_count += 1;
  146. }
  147. }
  148. this.menuList[0].count = assessment_before_dislysis_count;
  149. this.menuList[1].count = prescription_count;
  150. this.scheduals = scheduals;
  151. this.zone_options = this.makeZones(scheduals);
  152. this.zone_scheduals = this.processScheduals(scheduals);
  153. } else {
  154. this.$toast({
  155. message: resp.msg
  156. });
  157. }
  158. });
  159. },
  160. makeZones: function(scheduals) {
  161. var zoneMap = {};
  162. for (let index = 0; index < scheduals.length; index++) {
  163. const schedual = scheduals[index];
  164. if (zoneMap[schedual.device_number.zone.id] == null) {
  165. zoneMap[schedual.device_number.zone.id] = schedual.device_number.zone;
  166. }
  167. }
  168. var zones = [];
  169. zones.push({ value: 0, text: "全部分区" });
  170. for (var zoneId in zoneMap) {
  171. zones.push({ value: zoneMap[zoneId].id, text: zoneMap[zoneId].name });
  172. }
  173. zones = zones.sort(function(a, b) {
  174. return a.id > b.id;
  175. });
  176. return zones;
  177. },
  178. processScheduals: function(scheduals) {
  179. var zoneMap = {};
  180. var schedualMap = {};
  181. for (let index = 0; index < scheduals.length; index++) {
  182. const schedual = scheduals[index];
  183. if (schedualMap[schedual.device_number.zone.id] == null) {
  184. schedualMap[schedual.device_number.zone.id] = [];
  185. }
  186. schedualMap[schedual.device_number.zone.id].push(schedual);
  187. if (zoneMap[schedual.device_number.zone.id] == null) {
  188. zoneMap[schedual.device_number.zone.id] = schedual.device_number.zone;
  189. }
  190. }
  191. var zones = [];
  192. // zones.push({ value: 0, text: "全部分区" })
  193. for (var zoneId in zoneMap) {
  194. zones.push({ id: zoneMap[zoneId].id, name: zoneMap[zoneId].name });
  195. }
  196. zones = zones.sort(function(a, b) {
  197. return a.id > b.id;
  198. });
  199. // this.zones = zones
  200. var zone_scheduals = [];
  201. for (let index = 0; index < zones.length; index++) {
  202. const zone = zones[index];
  203. var scheduals = schedualMap[zone.id];
  204. zone_scheduals.push({
  205. zone_id: zone.id,
  206. zone_name: zone.name,
  207. scheduals: scheduals
  208. });
  209. }
  210. // this.zone_scheduals = zone_scheduals;
  211. return zone_scheduals;
  212. }
  213. }
  214. };
  215. </script>
  216. <style style="stylesheet/scss" lang="scss" scoped>
  217. .screening {
  218. border-bottom: 1px #e5e5e5 solid;
  219. position: fixed;
  220. top: 63px;
  221. right: 0;
  222. z-index: 66;
  223. left: 1.58rem;
  224. background: #fff;
  225. ul {
  226. @include display-flex;
  227. @include align-items-center;
  228. @include text-align;
  229. @include justify-content-between;
  230. width: 60%;
  231. margin: 0 auto;
  232. font-size: 0.32rem;
  233. color:$title-color;
  234. li {
  235. padding: 0.3rem 0;
  236. .iconfont {
  237. font-size: 0.32rem;
  238. margin-left: 0.1rem;
  239. }
  240. }
  241. .active {
  242. position: relative;
  243. &::before {
  244. position: absolute;
  245. bottom: 0;
  246. left: 0;
  247. width: 100%;
  248. height: 2px;
  249. background: $main-color;
  250. // border-bottom: 0.04rem $main-color solid;
  251. content: "";
  252. }
  253. }
  254. }
  255. }
  256. .stateBox {
  257. // padding: 0.5rem 0 0 0.6rem;
  258. .title {
  259. font-size: 0.34rem;
  260. color: #34495e;
  261. font-weight: 600;
  262. height: 1rem;
  263. line-height: 1rem;
  264. display: inline-block;
  265. }
  266. }
  267. </style>