Commit f1b83ea3 authored by 郭铭瑶's avatar 郭铭瑶 🤘

调整页面中基于权限编码请求数据时机

parent f88f1b66
...@@ -39,7 +39,6 @@ import { ...@@ -39,7 +39,6 @@ import {
NMenu, NMenu,
NPopover, NPopover,
} from 'naive-ui' } from 'naive-ui'
import { normalizeHue } from 'naive-ui/lib/color-picker/src/utils'
const naive = create({ const naive = create({
components: [ components: [
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import store from '@/store' import store from '@/store'
import { computed, onMounted, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import { Checkmark, Close } from '@vicons/ionicons5' import { Checkmark, Close } from '@vicons/ionicons5'
import ActivityListModal from './activity-list-modal.vue' import ActivityListModal from './activity-list-modal.vue'
import { useFetchActivity } from '@/hooks/useFetch' import { useFetchActivity } from '@/hooks/useFetch'
...@@ -149,9 +149,14 @@ const list = ref([ ...@@ -149,9 +149,14 @@ const list = ref([
}, },
]) ])
onMounted(() => { watch(
() => store.state.auth.code,
(code) => {
if (!code) return
getList() getList()
}) },
{ immediate: true },
)
async function getList(query?: string) { async function getList(query?: string) {
const result = [...list.value] const result = [...list.value]
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import store from '@/store' import store from '@/store'
import { computed, ref, h, onMounted, watch } from 'vue' import { computed, ref, h, watch } from 'vue'
import NewActivityDrawer from './new-activity-drawer.vue' import NewActivityDrawer from './new-activity-drawer.vue'
import { Add } from '@vicons/ionicons5' import { Add } from '@vicons/ionicons5'
import dayjs from '@/util/dayjs' import dayjs from '@/util/dayjs'
...@@ -131,6 +131,14 @@ const fetchList = useDebounce(async (query?: string) => { ...@@ -131,6 +131,14 @@ const fetchList = useDebounce(async (query?: string) => {
...item.extra, ...item.extra,
})) || [] })) || []
}) })
watch(
() => store.state.auth.code,
(code) => {
if (!code) return
fetchList()
},
{ immediate: true },
)
function clearData() { function clearData() {
model.value = { model.value = {
...@@ -145,9 +153,6 @@ const reFetchList = () => { ...@@ -145,9 +153,6 @@ const reFetchList = () => {
clearData() clearData()
fetchList() fetchList()
} }
onMounted(() => {
fetchList()
})
const show = computed(() => store.state.showActivityListModal) const show = computed(() => store.state.showActivityListModal)
const close = (val: boolean) => { const close = (val: boolean) => {
store.commit('SET_ACTIVITY_LIST_MODAL', val) store.commit('SET_ACTIVITY_LIST_MODAL', val)
......
...@@ -30,6 +30,7 @@ onMounted(async () => { ...@@ -30,6 +30,7 @@ onMounted(async () => {
/** 重置地图 */ /** 重置地图 */
function resetMap() { function resetMap() {
if (!window.graphiclayer || !window.sceneView) return
window.graphiclayer.removeAll() window.graphiclayer.removeAll()
window.sceneView.popup.close() window.sceneView.popup.close()
if (window.modelHighlight) { if (window.modelHighlight) {
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import store from '@/store' import store from '@/store'
import { useFetchOrg, useFetchMember } from '@/hooks/useFetch' import { useFetchOrg, useFetchMember } from '@/hooks/useFetch'
import useDebounce from '@/hooks/useDebounce' import useDebounce from '@/hooks/useDebounce'
......
...@@ -327,7 +327,7 @@ const props = defineProps({ ...@@ -327,7 +327,7 @@ const props = defineProps({
const mode = ref<string | null>(null) const mode = ref<string | null>(null)
const orgOptions = ref<any[]>([]) const orgOptions = ref<any[]>([])
onMounted(async () => { async function getOrgOptions() {
orgOptions.value = ( orgOptions.value = (
await useFetchOrg({ await useFetchOrg({
a: 'id,count', a: 'id,count',
...@@ -340,7 +340,15 @@ onMounted(async () => { ...@@ -340,7 +340,15 @@ onMounted(async () => {
label: item['党组织名称'], label: item['党组织名称'],
value: item['党组织名称'], value: item['党组织名称'],
})) }))
}) }
watch(
() => store.state.auth.code,
(code) => {
if (!code) return
getOrgOptions()
},
{ immediate: true },
)
const show = computed(() => store.state.showNewActivityDrawer) const show = computed(() => store.state.showNewActivityDrawer)
const closeDrawer = () => { const closeDrawer = () => {
......
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import store from '@/store' import store from '@/store'
import { computed, h, onMounted, ref, watch } from 'vue' import { computed, h, ref, watch } from 'vue'
import PartyIcon from './party-icon.vue' import PartyIcon from './party-icon.vue'
import exportIcon from '@images/export.svg' import exportIcon from '@images/export.svg'
import { CloseOutline } from '@vicons/ionicons5' import { CloseOutline } from '@vicons/ionicons5'
...@@ -441,7 +441,15 @@ const belongToCommunityParty = ref<any[]>([]) ...@@ -441,7 +441,15 @@ const belongToCommunityParty = ref<any[]>([])
const onlyOne = ref(false) const onlyOne = ref(false)
onMounted(async () => { watch(
() => code.value,
(code) => {
if (!code) return
init()
},
{ immediate: true },
)
async function init() {
const orgList = await useFetchOrg({ const orgList = await useFetchOrg({
q: `paths @ "党组织编号" && string @ "${code.value}"`, q: `paths @ "党组织编号" && string @ "${code.value}"`,
}) })
...@@ -563,7 +571,7 @@ onMounted(async () => { ...@@ -563,7 +571,7 @@ onMounted(async () => {
}, },
] ]
initCurMenu() initCurMenu()
}) }
async function checkHasChildren(data: any) { async function checkHasChildren(data: any) {
if (!data) return [] if (!data) return []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment