From c2d879c83d5d242d32b376193e1a4680067d169c Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期三, 31 五月 2023 15:14:38 +0800
Subject: [PATCH] 优化逻辑
---
src/views/paiban/index.vue | 162 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 117 insertions(+), 45 deletions(-)
diff --git a/src/views/paiban/index.vue b/src/views/paiban/index.vue
index 4699cca..1c18325 100644
--- a/src/views/paiban/index.vue
+++ b/src/views/paiban/index.vue
@@ -1,64 +1,54 @@
<template>
<div class="paiban">
+ <van-nav-bar
+ title=""
+ left-text="返回"
+ left-arrow
+ @click="fanhui"
+ />
<div>
<van-calendar
- title="透析排班"
color="#769AFF"
+ :min-date="minDate"
+ @month-show="monthShow"
:poppable="false"
:show-confirm="false"
@select="selectData"
:formatter="formatter"
+ :show-title="false"
:style="{ height: '400px' }"
/>
</div>
- <div class="listdiv">
- <div class="listrow">
+ <div class="listdiv" v-for="(item,index) in selectDate" :key="index">
+ <div class="listrow" v-if="item.code !== ''">
<van-row class="rowhand">
<van-col span="18">
<van-icon style="color: blue;" name="bell" />
- 2022年5月24日(周四) 上午</van-col>
+ {{item.y}}年{{item.m}}月{{item.d}}日
+ </van-col>
<van-col span="6">
<div>
- <div class="sqtb">
- 申请调班
+ <div class="sqtb" v-if="item.timeSlot === 0">
+ 上午
+ </div>
+ <div class="sqtb" v-if="item.timeSlot === 1">
+ 下午
+ </div>
+ <div class="sqtb" v-if="item.timeSlot === 2">
+ 晚上
</div>
</div>
</van-col>
</van-row>
- <van-row>
+ <van-row v-if="item.code !== ''">
<div class="info"></div>
<van-row class="lable">
<van-col span="12">机号</van-col>
<van-col span="12">透析模式</van-col>
</van-row>
<van-row class="value">
- <van-col span="12">1区 2号机</van-col>
- <van-col span="12">HD</van-col>
- </van-row>
- </van-row>
- </div>
- <div class="listrow">
- <van-row class="rowhand">
- <van-col span="18">
- <van-icon style="color: blue;" name="bell" />
- 2022年5月24日(周四) 上午</van-col>
- <van-col span="6">
- <div>
- <div class="sqtb">
- 申请调班
- </div>
- </div>
- </van-col>
- </van-row>
- <van-row>
- <div class="info"></div>
- <van-row class="lable">
- <van-col span="12">机号</van-col>
- <van-col span="12">透析模式</van-col>
- </van-row>
- <van-row class="value">
- <van-col span="12">1区 2号机</van-col>
- <van-col span="12">HD</van-col>
+ <van-col span="12">{{item.deviceGroupName}} {{item.deviceName}}</van-col>
+ <van-col span="12">{{item.type}}</van-col>
</van-row>
</van-row>
</div>
@@ -66,30 +56,99 @@
</div>
</template>
<script lang="ts" setup>
- import {ref,reactive,watchEffect,watch} from 'vue'
import { Calendar as vanCalendar } from 'vant'
+ import { ref,onMounted } from 'vue'
+ import {useRouter} from 'vue-router'
+ import {ajaxPost} from '@/utils/axios'
+ import { userInfoStore } from '@/stores/userInfo'
+ const router=useRouter()
+ const userInfo = userInfoStore()
+ const day=new Date()
+ const Year = day.getFullYear()
+ const minDate=ref( new Date(Date.parse(Year+'-01-01'.replace(/-/g, '/'))))
+ const selectDate=ref([{y:2000,m:1,d:1,type:'',code:'',id:0,deviceGroupName:'',deviceName:'',timeSlot:1}])
+ const fanhui=()=>{
+ router.go(-1)
+ }
const selectData=(data:any)=>{
console.log(data)
}
+ const getPaiban=(date:Date)=>{
+ console.log(date)
+ const y=date.getFullYear()
+ const m= date.getMonth()+1
+ console.log('年='+y+'月='+m)
+ const pagedata={
+ patientCode:userInfo.patient.patientInfo.code,
+ year:y,
+ month:m,
+ }
+ ajaxPost('/hemo/med/schedule/listMonthSchedulesByPat',pagedata).then((re:any)=>{
+ console.log(re)
+ re.forEach((element:any) => {
+ const dey=element.scheduleDay.split('-')
+ // 不能添加重复的
+ const x=selectDate.value.findIndex(e=>{return e.code===element.code})
+ if (x===-1){
+ selectDate.value.push({
+ y:Number(dey[0]),
+ m:Number(dey[1]),
+ d:Number(dey[2].substring(0,2)),
+ type:element.patientVsHemoMedSchemeName,
+ deviceGroupName:element.deviceGroupName,
+ deviceName:element.deviceName,
+ timeSlot:element.timeSlot,
+ code:element.code,
+ id:element.id
+
+ })
+ }
+
+ })
+ selectDate.value= selectDate.value.sort((a,b)=>{
+ return a.id-b.id
+ })
+ console.log(selectDate.value)
+ })
+ }
+ const monthShow=(month:any)=>{
+ console.log(month)
+ getPaiban(month.date)
+ }
const formatter=(day:any)=>{
+ const year=day.date.getFullYear()
const month = day.date.getMonth() + 1
const date = day.date.getDate()
- if (month === 9) {
- if (date === 24) {
- day.bottomInfo='8:30'
- day.className='paibanclass'
- } else if (date === 27) {
- day.bottomInfo='13:00'
- day.className='paibanclass'
+ const index= selectDate.value.findIndex(el=>{return el.y===year&&el.m===month&&el.d===date})
+ if (index>0){
+ console.log(day)
+ day.type='start'
+ day.text=selectDate.value[index].type
+ if (selectDate.value[index].timeSlot===0){
+ day.bottomInfo='上午'
+ }
+ else if (selectDate.value[index].timeSlot===1){
+ day.bottomInfo='上午'
+ }
+ else {
+ day.bottomInfo='晚上'
}
}
return day
}
+ onMounted(()=>{
+ console.log('页面初始化')
+ const day=new Date()
+ const Year = day.getFullYear()
+ console.log(Year)
+ // 只能选取当年的
+ minDate.value=new Date(Date.parse(`${Year}-01-01`.replace(/-/g, '/')))
+ })
</script>
-<style lang="scss">
+<style scoped lang="scss">
.paibanclass{
- // background: rgb(228, 231, 225);
- color: blue;
+ background: rgb(201, 110, 19);
+ color: rgb(41, 41, 200);
}
.paiban{
background-color: #F6FAFF;
@@ -118,8 +177,11 @@
.sqtb{
color: #4696F9;
// background: #4696F9;
+ height:18px;
+ line-height:18px;
border: #4696F9 1px solid;
width: 60px;
+ text-align: center;
border-radius: 4px;
font-size: 12px;
}
@@ -155,4 +217,14 @@
}
}
}
+ .fanhui{
+ // padding-top: 20px;
+ width: 100%;
+ background: #4696F9;
+ text-align: center;
+ border-radius: 5px;
+ color:#FFFFFF;
+ height: 36px;
+ line-height: 36px;
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0