123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <template>
- <div>
- <div class="screening">
- <ul>
-
- <popover placement="bottom" >
- <div slot="content" class="popover-demo-content">
- <ul>
- <li v-for="(option, index) in zone_options" :key="index" @click="handleZoneChange(index)" :class="zone_selected == index ? 'tick' : ''">{{ option.text }}</li>
- </ul>
- </div>
- <li>{{ zone_options[zone_selected].text }}<span class="iconfont"></span></li>
- </popover>
- <li v-for="(item,i) in menuList" :class="select_index == i ? 'active' : ''" @click="menuTabClick(i)"
- :key="i">{{ item.label + (item.count > 0 ? '(' + item.count + ')' : '') }}</li>
- </ul>
- </div>
- <div class="stateBox ">
- <!-- <patient-box class="clearfix" :patients="filtedScheduals "></patient-box> -->
- <div v-for="(item, index) in filtedScheduals" :key="index">
- <h2 class="title" >{{item.zone_name}}</h2>
- <patient-box class="clearfix" :patients="item.scheduals"></patient-box>
- </div>
- <div class="NoData" v-show="filtedScheduals.length == 0"><img style="margin-top: 50px; margin-bottom: 50px" src="@/assets/login/data.jpg" alt=""></div>
-
- </div>
- </div>
- </template>
-
- <script>
- import PatientBox from "./PatientBox";
- import { getWaitingScheduals } from "@/api/dialysis";
- import { parseTime } from "@/utils";
- import { Popover } from "vux";
-
- export default {
- name: "WaitingArea",
- components: {
- PatientBox,
- Popover
- },
- data() {
- return {
- menuList: [
- { value: "2", label: "透前称量", count: 0 },
- { value: "3", label: "制定处方", count: 0 }
- ],
-
- select_index: -1,
- zone_selected: 0,
-
- scheduals: [],
-
- zone_options: [{ value: 0, text: "全部分区" }],
- zone_scheduals: []
- };
- },
- props: {
- search_keyword: {
- type: String
- }
- },
- computed: {
- filtedScheduals: function() {
- var search_keyword = this.search_keyword;
- if (this.search_keyword.length > 0) {
- var scheduals = [];
- for (let index = 0; index < this.scheduals.length; index++) {
- const schedual = this.scheduals[index];
- if (
- schedual.patient.name.indexOf(search_keyword) != -1 ||
- schedual.patient.dialysis_no.indexOf(search_keyword) != -1
- ) {
- scheduals.push(schedual);
- }
- }
- return this.processScheduals(scheduals);
- }
-
- if (this.zone_selected != 0) {
- var zone_name = this.zone_options[this.zone_selected].text;
- for (let index = 0; index < this.zone_scheduals.length; index++) {
- const zone_scheduals = this.zone_scheduals[index];
- if (zone_scheduals.zone_name == zone_name) {
- return [zone_scheduals];
- }
- }
- }
-
- if (this.select_index == 0) {
- // console.log("点击了第二个");
- var scheduals = [];
- for (let index = 0; index < this.scheduals.length; index++) {
- const schedual = this.scheduals[index];
- if (schedual.assessment_before_dislysis != null) {
- scheduals.push(schedual);
- }
- }
- return this.processScheduals(scheduals);
- // return scheduals;
- } else if (this.select_index == 1) {
- // console.log("点击了第三个");
- var scheduals = [];
- for (let index = 0; index < this.scheduals.length; index++) {
- const schedual = this.scheduals[index];
- if (
- schedual.assessment_before_dislysis == null &&
- schedual.prescription != null
- ) {
- scheduals.push(schedual);
- }
- }
- // return scheduals;
- return this.processScheduals(scheduals);
- } else {
- return this.zone_scheduals;
- }
- }
- },
- created() {
- this.requestScheduals();
- },
- methods: {
- menuTabClick: function(tabIndex) {
- this.select_index = tabIndex;
- this.zone_selected = 0;
- },
- handleZoneChange: function(index) {
- this.zone_selected = index;
- this.select_index = -1;
- },
-
- requestScheduals() {
- var date = parseTime(Date.parse(new Date()), "{y}-{m}-{d}");
- getWaitingScheduals({ date: date }).then(rs => {
- var resp = rs.data;
- // console.log(resp);
- if (resp.state == 1) {
- var scheduals = resp.data.scheduals;
- var totalCount = scheduals.length;
- var prescription_count = 0;
- var assessment_before_dislysis_count = 0;
- for (let index = 0; index < scheduals.length; index++) {
- const schedual = scheduals[index];
- if (schedual.assessment_before_dislysis != null) {
- assessment_before_dislysis_count += 1;
- } else if (schedual.prescription != null) {
- prescription_count += 1;
- }
- }
- this.menuList[0].count = assessment_before_dislysis_count;
- this.menuList[1].count = prescription_count;
- this.scheduals = scheduals;
-
- this.zone_options = this.makeZones(scheduals);
- this.zone_scheduals = this.processScheduals(scheduals);
- } else {
- this.$toast({
- message: resp.msg
- });
- }
- });
- },
- makeZones: function(scheduals) {
- var zoneMap = {};
- for (let index = 0; index < scheduals.length; index++) {
- const schedual = scheduals[index];
- if (zoneMap[schedual.device_number.zone.id] == null) {
- zoneMap[schedual.device_number.zone.id] = schedual.device_number.zone;
- }
- }
-
- var zones = [];
- zones.push({ value: 0, text: "全部分区" });
- for (var zoneId in zoneMap) {
- zones.push({ value: zoneMap[zoneId].id, text: zoneMap[zoneId].name });
- }
-
- zones = zones.sort(function(a, b) {
- return a.id > b.id;
- });
- return zones;
- },
- processScheduals: function(scheduals) {
- var zoneMap = {};
- var schedualMap = {};
- for (let index = 0; index < scheduals.length; index++) {
- const schedual = scheduals[index];
- if (schedualMap[schedual.device_number.zone.id] == null) {
- schedualMap[schedual.device_number.zone.id] = [];
- }
- schedualMap[schedual.device_number.zone.id].push(schedual);
- if (zoneMap[schedual.device_number.zone.id] == null) {
- zoneMap[schedual.device_number.zone.id] = schedual.device_number.zone;
- }
- }
-
- var zones = [];
- // zones.push({ value: 0, text: "全部分区" })
- for (var zoneId in zoneMap) {
- zones.push({ id: zoneMap[zoneId].id, name: zoneMap[zoneId].name });
- }
-
- zones = zones.sort(function(a, b) {
- return a.id > b.id;
- });
- // this.zones = zones
-
- var zone_scheduals = [];
- for (let index = 0; index < zones.length; index++) {
- const zone = zones[index];
- var scheduals = schedualMap[zone.id];
- zone_scheduals.push({
- zone_id: zone.id,
- zone_name: zone.name,
- scheduals: scheduals
- });
- }
- // this.zone_scheduals = zone_scheduals;
- return zone_scheduals;
- }
- }
- };
- </script>
-
- <style style="stylesheet/scss" lang="scss" scoped>
- .screening {
- border-bottom: 1px #e5e5e5 solid;
- position: fixed;
- top: 63px;
- right: 0;
- z-index: 66;
- left: 1.58rem;
- background: #fff;
- ul {
- @include display-flex;
- @include align-items-center;
- @include text-align;
- @include justify-content-between;
- width: 60%;
- margin: 0 auto;
- font-size: 0.32rem;
- color:$title-color;
- li {
- padding: 0.3rem 0;
- .iconfont {
- font-size: 0.32rem;
- margin-left: 0.1rem;
- }
- }
- .active {
- position: relative;
- &::before {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 2px;
- background: $main-color;
- // border-bottom: 0.04rem $main-color solid;
- content: "";
- }
- }
- }
- }
- .stateBox {
- // padding: 0.5rem 0 0 0.6rem;
- .title {
- font-size: 0.34rem;
- color: #34495e;
- font-weight: 600;
- height: 1rem;
- line-height: 1rem;
- display: inline-block;
- }
- }
- </style>
-
|