|
@@ -41,7 +41,7 @@
|
|
|
</el-container>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
+<script setup>
|
|
|
import { computed, onActivated, onMounted, ref, watch } from 'vue'
|
|
|
import { useStore } from 'vuex'
|
|
|
import { selectSystemMessages } from '../../api/messages/index'
|
|
@@ -53,78 +53,60 @@ import { selectInpatientBriefs } from '../../api/dashboard/index'
|
|
|
import MyClock from '@/components/MyClock.vue'
|
|
|
import Inpatient from '@/components/dashboard/Inpatient.vue'
|
|
|
|
|
|
-export default {
|
|
|
- name: 'Dashboard',
|
|
|
- components: {
|
|
|
- MyClock,
|
|
|
- Inpatient,
|
|
|
- },
|
|
|
- setup() {
|
|
|
- const store = useStore()
|
|
|
- const token = computed(() => {
|
|
|
- return store.state.user.token
|
|
|
- })
|
|
|
- watch(
|
|
|
- () => token.value,
|
|
|
- () => {
|
|
|
- setTimeout(() => {
|
|
|
- location.reload()
|
|
|
- }, 100)
|
|
|
- }
|
|
|
- )
|
|
|
+const store = useStore()
|
|
|
+const token = computed(() => {
|
|
|
+ return store.state.user.token
|
|
|
+})
|
|
|
+watch(
|
|
|
+ () => token.value,
|
|
|
+ () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ location.reload()
|
|
|
+ }, 100)
|
|
|
+ }
|
|
|
+)
|
|
|
|
|
|
- const messages = ref([])
|
|
|
- const fetchMoreMessages = () => {
|
|
|
- let lastdate = 'latest'
|
|
|
- if (messages.value.length > 0) {
|
|
|
- lastdate = formatDate(messages.value[0].simpledate)
|
|
|
- }
|
|
|
- selectSystemMessages(lastdate).then((res) => {
|
|
|
- res.forEach((item) => {
|
|
|
- messages.value.unshift(item)
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
+const messages = ref([])
|
|
|
+const fetchMoreMessages = () => {
|
|
|
+ let lastdate = 'latest'
|
|
|
+ if (messages.value.length > 0) {
|
|
|
+ lastdate = formatDate(messages.value[0].simpledate)
|
|
|
+ }
|
|
|
+ selectSystemMessages(lastdate).then((res) => {
|
|
|
+ res.forEach((item) => {
|
|
|
+ messages.value.unshift(item)
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- const userInfo = ref({})
|
|
|
- const errorHandler = () => {
|
|
|
- return true
|
|
|
- }
|
|
|
- const makeTextPortrait = () => {
|
|
|
- return genTextPortrait(userInfo.value.name)
|
|
|
- }
|
|
|
+const userInfo = ref({})
|
|
|
+const errorHandler = () => {
|
|
|
+ return true
|
|
|
+}
|
|
|
+const makeTextPortrait = () => {
|
|
|
+ return genTextPortrait(userInfo.value.name)
|
|
|
+}
|
|
|
|
|
|
- onActivated(() => {
|
|
|
- setTimeout(() => {
|
|
|
- selectSystemMessages('latest').then((res) => {
|
|
|
- messages.value = res
|
|
|
- })
|
|
|
- }, 500)
|
|
|
+onActivated(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ selectSystemMessages('latest').then((res) => {
|
|
|
+ messages.value = res
|
|
|
})
|
|
|
+ }, 500)
|
|
|
+})
|
|
|
|
|
|
- const briefs = ref([])
|
|
|
+const briefs = ref([])
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- getUserInfo().then((res) => {
|
|
|
- userInfo.value = res
|
|
|
- if (isInpatientStaff()) {
|
|
|
- selectInpatientBriefs(res.deptCode).then((list) => {
|
|
|
- briefs.value = list
|
|
|
- })
|
|
|
- }
|
|
|
+onMounted(() => {
|
|
|
+ getUserInfo().then((res) => {
|
|
|
+ userInfo.value = res
|
|
|
+ if (isInpatientStaff()) {
|
|
|
+ selectInpatientBriefs(res.deptCode).then((list) => {
|
|
|
+ briefs.value = list
|
|
|
})
|
|
|
- })
|
|
|
-
|
|
|
- return {
|
|
|
- messages,
|
|
|
- userInfo,
|
|
|
- briefs,
|
|
|
- errorHandler,
|
|
|
- fetchMoreMessages,
|
|
|
- makeTextPortrait,
|
|
|
}
|
|
|
- },
|
|
|
-}
|
|
|
+ })
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|