|
@@ -1,7 +1,24 @@
|
|
|
<template>
|
|
|
<window-size>
|
|
|
- <van-cell title="选择日期区间" :value="date" @click="showDateRange = true" />
|
|
|
- <van-calendar v-model:show="showDateRange" :min-date="minDate" type="range" @confirm="onConfirm" />
|
|
|
+ <van-cell title="选择日期区间" :value="date" @click="showDateShortcuts = true" />
|
|
|
+
|
|
|
+ <van-dialog v-model:show="showDateShortcuts" @confirm="onConfirmShortcuts">
|
|
|
+ <div style="display:flex; justify-content: center; padding: 30px 0 20px 0">
|
|
|
+ <van-radio-group v-model="chosenShortcut">
|
|
|
+ <van-radio name="oneWeek" style="margin-bottom: 12px">近一周</van-radio>
|
|
|
+ <van-radio name="threeMonths" style="margin-bottom: 12px">近三月</van-radio>
|
|
|
+ <van-radio name="halfYear" style="margin-bottom: 12px">近半年</van-radio>
|
|
|
+ <van-radio name="oneYear" style="margin-bottom: 12px">近一年</van-radio>
|
|
|
+ <van-radio name="diy">自定义</van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </div>
|
|
|
+ </van-dialog>
|
|
|
+
|
|
|
+ <van-calendar v-model:show="showDateRange"
|
|
|
+ :min-date="minDate"
|
|
|
+ :max-date="maxDate"
|
|
|
+ type="range"
|
|
|
+ @confirm="onConfirm" />
|
|
|
<div v-show="examIndex.length > 0">
|
|
|
<div style="height: 5px"></div>
|
|
|
<van-tag type="success" size="large" round plain>已发布报告</van-tag>
|
|
@@ -24,77 +41,95 @@
|
|
|
</window-size>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
+<script setup>
|
|
|
import store from '../../../store'
|
|
|
import empty from '../../../assets/empty.png'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { computed, onMounted, ref } from 'vue'
|
|
|
import { checkExamIndex } from '../../../api/check-exam'
|
|
|
-import { formatDate, getOneMonthOffset } from '../../../utils/date'
|
|
|
-export default {
|
|
|
- name: 'CheckExamIndex',
|
|
|
- setup() {
|
|
|
- const router = useRouter()
|
|
|
- const patientId = router.currentRoute.value.params.patientId
|
|
|
- const scrollStyle = {
|
|
|
- height: store.state.screenSize.h - 125 + 'px',
|
|
|
- overflowY: 'auto',
|
|
|
- }
|
|
|
- const date = ref('')
|
|
|
- const showDateRange = ref(false)
|
|
|
- const examIndex = computed(() => {
|
|
|
- return store.state.examIndexArray
|
|
|
- })
|
|
|
+import {formatDate, getDateRangeByOffsetDays} from '../../../utils/date'
|
|
|
|
|
|
- const onConfirm = (values) => {
|
|
|
- showDateRange.value = false
|
|
|
- const start = formatDate(values[0])
|
|
|
- const end = formatDate(values[1])
|
|
|
- store.commit('SET_EXAMDATERANGE', [start, end])
|
|
|
- date.value = `${start} - ${end}`
|
|
|
- const param = {
|
|
|
- patientId,
|
|
|
- start,
|
|
|
- end,
|
|
|
- openId: localStorage.getItem('openId')
|
|
|
- }
|
|
|
- checkExamIndex(param).then((res) => {
|
|
|
- store.commit('SET_EXAMINDEXARRAY', res)
|
|
|
- })
|
|
|
- }
|
|
|
+const router = useRouter()
|
|
|
+const patientId = router.currentRoute.value.params.patientId
|
|
|
+const scrollStyle = {
|
|
|
+ height: store.state.screenSize.h - 125 + 'px',
|
|
|
+ overflowY: 'auto',
|
|
|
+}
|
|
|
+const date = ref('')
|
|
|
+const minDate = ref(new Date(2012, 0, 1))
|
|
|
+const maxDate = ref(new Date())
|
|
|
+
|
|
|
+const showDateShortcuts = ref(false)
|
|
|
+const chosenShortcut = ref('oneWeek')
|
|
|
+
|
|
|
+const onConfirmShortcuts = () => {
|
|
|
+ switch (chosenShortcut.value) {
|
|
|
+ case 'oneWeek':
|
|
|
+ makeOffset(7)
|
|
|
+ queryInspectionIndex(date.value[0], date.value[1])
|
|
|
+ return
|
|
|
+ case 'threeMonths':
|
|
|
+ makeOffset(90)
|
|
|
+ queryInspectionIndex(date.value[0], date.value[1])
|
|
|
+ return;
|
|
|
+ case 'halfYear':
|
|
|
+ makeOffset(183)
|
|
|
+ queryInspectionIndex(date.value[0], date.value[1])
|
|
|
+ return
|
|
|
+ case 'oneYear':
|
|
|
+ makeOffset(365)
|
|
|
+ queryInspectionIndex(date.value[0], date.value[1])
|
|
|
+ return;
|
|
|
+ default:
|
|
|
+ showDateRange.value = true
|
|
|
+ return;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- const range = store.state.examDateRange
|
|
|
- if (range.length === 0) {
|
|
|
- const temp = getOneMonthOffset()
|
|
|
- range[0] = temp.start
|
|
|
- range[1] = temp.end
|
|
|
- store.commit('SET_EXAMDATERANGE', range)
|
|
|
- }
|
|
|
- date.value = range[0] + ' - ' + range[1]
|
|
|
- if (examIndex.value.length === 0) {
|
|
|
- const param = {
|
|
|
- patientId,
|
|
|
- start: range[0],
|
|
|
- end: range[1],
|
|
|
- openId: localStorage.getItem('openId')
|
|
|
- }
|
|
|
- checkExamIndex(param).then((res) => {
|
|
|
- store.commit('SET_EXAMINDEXARRAY', res)
|
|
|
- })
|
|
|
- }
|
|
|
- showDateRange.value = false
|
|
|
- })
|
|
|
- return {
|
|
|
- patientId,
|
|
|
- scrollStyle,
|
|
|
- empty,
|
|
|
- minDate: new Date(2010, 0, 1),
|
|
|
- date,
|
|
|
- examIndex,
|
|
|
- onConfirm,
|
|
|
- showDateRange,
|
|
|
- }
|
|
|
- },
|
|
|
+const makeOffset = (offsetDays) => {
|
|
|
+ const range = ['', '']
|
|
|
+ const temp = getDateRangeByOffsetDays(offsetDays)
|
|
|
+ range[0] = temp.start
|
|
|
+ range[1] = temp.end
|
|
|
+ store.commit('SET_EXAMDATERANGE', range)
|
|
|
+ date.value = range[0] + ' - ' + range[1]
|
|
|
}
|
|
|
+
|
|
|
+const showDateRange = ref(false)
|
|
|
+const examIndex = computed(() => {
|
|
|
+ return store.state.examIndexArray
|
|
|
+})
|
|
|
+
|
|
|
+const onConfirm = (values) => {
|
|
|
+ showDateRange.value = false
|
|
|
+ const start = formatDate(values[0])
|
|
|
+ const end = formatDate(values[1])
|
|
|
+ store.commit('SET_EXAMDATERANGE', [start, end])
|
|
|
+ date.value = `${start} - ${end}`
|
|
|
+ queryInspectionIndex(start, end)
|
|
|
+}
|
|
|
+
|
|
|
+const queryInspectionIndex = (start, end) => {
|
|
|
+ const param = {
|
|
|
+ patientId,
|
|
|
+ start: start,
|
|
|
+ end: end,
|
|
|
+ openId: localStorage.getItem('openId')
|
|
|
+ }
|
|
|
+ checkExamIndex(param).then((res) => {
|
|
|
+ store.commit('SET_EXAMINDEXARRAY', res)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ const range = store.state.examDateRange
|
|
|
+ if (range.length === 0) {
|
|
|
+ makeOffset(30)
|
|
|
+ } else {
|
|
|
+ date.value = range[0] + ' - ' + range[1]
|
|
|
+ }
|
|
|
+ if (examIndex.value.length === 0) {
|
|
|
+ queryInspectionIndex(range[0], range[1])
|
|
|
+ }
|
|
|
+})
|
|
|
</script>
|