|
@@ -25,13 +25,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Cookies from 'js-cookie'
|
|
|
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 } from '../../../utils/date'
|
|
|
+import { formatDate, getOneMonthOffset } from '../../../utils/date'
|
|
|
export default {
|
|
|
name: 'CheckExamIndex',
|
|
|
setup() {
|
|
@@ -51,8 +50,7 @@ export default {
|
|
|
showDateRange.value = false
|
|
|
const start = formatDate(values[0])
|
|
|
const end = formatDate(values[1])
|
|
|
- Cookies.set('inspection-start-date', start)
|
|
|
- Cookies.set('inspection-end-date', end)
|
|
|
+ store.commit('SET_EXAMDATERANGE', [start, end])
|
|
|
date.value = `${start} - ${end}`
|
|
|
const param = {
|
|
|
patientId,
|
|
@@ -65,18 +63,23 @@ export default {
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- if (Cookies.get('inspection-start-date')) {
|
|
|
- date.value = Cookies.get('inspection-start-date') + ' - ' + Cookies.get('inspection-end-date')
|
|
|
- if (examIndex.value.length === 0) {
|
|
|
- const param = {
|
|
|
- patientId,
|
|
|
- start: Cookies.get('inspection-start-date'),
|
|
|
- end: Cookies.get('inspection-end-date'),
|
|
|
- }
|
|
|
- checkExamIndex(param).then((res) => {
|
|
|
- store.commit('SET_EXAMINDEXARRAY', res)
|
|
|
- })
|
|
|
+ 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],
|
|
|
}
|
|
|
+ checkExamIndex(param).then((res) => {
|
|
|
+ store.commit('SET_EXAMINDEXARRAY', res)
|
|
|
+ })
|
|
|
}
|
|
|
showDateRange.value = false
|
|
|
})
|