| | |
| | | |
| | | <script setup> |
| | | import st7 from '@/assets/images/workbench/st7.png'; |
| | | |
| | | import { getdaiban } from '@/api/home/index'; |
| | | import { onMounted } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | |
| | | const permission = computed(() => store.getters.permission); |
| | | const userInfo = computed(() => store.getters.userInfo) |
| | | const todos = ref([]); |
| | | |
| | | const loading = ref(false); |
| | | const statusMap = { |
| | | 0: '待处理', |
| | | 2: '待审核', |
| | |
| | | return statusMapColor[statusIndex]?.color || '#999'; |
| | | } |
| | | }; |
| | | const getListMatter = async () => { |
| | | // console.log('permission.value.o_and_m_p_jump', permission.value.o_and_m_p_jump); |
| | | |
| | | if (permission.value.o_and_m_p_jump === true) { |
| | | const res = await getdaiban(0,userInfo.value.detail.areaCode); |
| | | todos.value = res.data.data?.slice(0, 5); |
| | | |
| | | } else { |
| | | const res = await getdaiban(1,userInfo.value.detail.areaCode); |
| | | todos.value = res.data.data?.slice(0, 5); |
| | | |
| | | const isDataReady = computed(() => { |
| | | return userInfo.value.detail?.areaCode && permission.value.o_and_m_p_jump; |
| | | }); |
| | | const autoFetchData = () => { |
| | | if (isDataReady.value) { |
| | | getListMatter(); |
| | | } |
| | | |
| | | }; |
| | | watch( |
| | | () => [userInfo.value.detail?.areaCode, permission.value.o_and_m_p_jump], |
| | | () => autoFetchData(), |
| | | { immediate: true } |
| | | ); |
| | | const getListMatter = async () => { |
| | | loading.value = true; |
| | | try { |
| | | if (permission.value.o_and_m_p_jump === true) { |
| | | const res = await getdaiban(0, userInfo.value.detail.areaCode); |
| | | todos.value = res.data.data?.slice(0, 5) || []; |
| | | loading.value = false; |
| | | } else { |
| | | const res = await getdaiban(1, userInfo.value.detail.areaCode); |
| | | todos.value = res.data.data?.slice(0, 5) || []; |
| | | loading.value = false; |
| | | } |
| | | } catch (error) {} |
| | | }; |
| | | const jumporder = val => { |
| | | if (permission.value.o_and_m_p_jump === true) { |
| | |
| | | } |
| | | }; |
| | | onMounted(() => { |
| | | getListMatter(); |
| | | autoFetchData(); |
| | | }); |
| | | </script> |
| | | |