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

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

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