eight
2024-11-19 53aab22013a0092f5d3a8ad4758166fb355896c7
src/views/ecg/appointment/CheckItemPanel.vue
@@ -2,9 +2,10 @@
import {defineComponent, PropType} from "vue";
import {useCheckTypeStore} from "@/store/modules/checkType";
import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment";
import {dateFormatter2, formatDate} from "@/utils/formatTime";
import {formatTimeslot} from "@/utils/formatter";
import {isCurrentDay} from "@/utils/dateUtil";
import {QueueSequenceApi, QueueSequenceVO} from "@/api/ecg/queuesequence";
import {formatDate} from "../../../utils/formatTime";
defineComponent({
  name: 'CheckItemPanel'
@@ -19,14 +20,56 @@
const checkTypeStore = useCheckTypeStore();
const checkTypeTimeslotList = ref<QueueSequenceVO>()
const bookTimeSlotVip = ref<number>()
const _confirmAppointment = async () => {
  const data = await AppointmentApi.confirmAppointment(props.appointment)
  ElNotification({
    title: '温馨提示',
    message: data,
    type: 'warning'
  })
  if (!isCurrentDay(props.appointment.bookDate)) {
    ElMessageBox.confirm(
        '非当天预约项,确定要今天检查吗?',
        'Warning',
        {
          confirmButtonText: '好的',
          cancelButtonText: '不用',
          type: 'warning',
        }
    )
        .then(async () => {
          ElMessage({
            type: 'success',
            message: 'Delete completed',
          })
          const tempAppointment = cloneDeep(props.appointment)
          tempAppointment.bookTimeslot = bookTimeSlotVip
          const data = await AppointmentApi.confirmAppointmentVip(tempAppointment)
          ElNotification({
            title: '温馨提示',
            message: data,
            type: 'warning'
          })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: 'Delete canceled',
          })
        })
  } else {
    const data = await AppointmentApi.confirmAppointment(props.appointment)
    ElNotification({
      title: '温馨提示',
      message: data,
      type: 'warning'
    })
  }
}
onMounted( async () => {
  const data = await QueueSequenceApi.getTimeslotByCheckType(props.appointment.bookCheckType)
  console.info( data )
  checkTypeTimeslotList.value = data
})
</script>
@@ -34,7 +77,18 @@
  <el-card style="width: 200px" shadow="hover" >
    <template #header>{{checkTypeStore.getCheckTypeName(appointment.bookCheckType)}}</template>
    <div>{{formatDate(appointment.bookDate, 'YYYY-MM-DD')}}</div>
    <div>{{formatTimeslot(appointment.bookTimeslot)}}</div>
    <div v-if="isCurrentDay(appointment.bookDate)">{{formatTimeslot(appointment.bookTimeslot)}}</div>
    <el-select v-else v-model="bookTimeSlotVip" placeholder="请选择预约时间段">
      <el-option
          v-for="item in checkTypeTimeslotList"
          :key="item.id"
          :label="formatTimeslot(item.timeSlot)"
          :value="item.timeSlot"
          :disabled="item.queueVipNo === item.queueVipFull"
      />
    </el-select>
    <el-divider/>
    <el-button :type="isCurrentDay(appointment.bookDate)?'primary':'warning'" @click="_confirmAppointment"><Icon icon="ep:refresh" class="mr-5px" /> 排队 </el-button>
  </el-card>