ZaiZai 6 maanden geleden
bovenliggende
commit
fd32f2b689
2 gewijzigde bestanden met toevoegingen van 17 en 28 verwijderingen
  1. 11 10
      src/layout/index.vue
  2. 6 18
      src/views/using/query.vue

+ 11 - 10
src/layout/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-container v-loading="isLoading" class="hc-layout-box" :class="[!isNullES(isLayout) && isLayout === 'no' ? 'is-no-layout' : '']">
+    <el-container v-loading="!isAppLoading" class="hc-layout-box" :class="[!isNullES(isLayout) && isLayout === 'no' ? 'is-no-layout' : '']">
         <div v-if="appTheme === 'dark'" class="hc-app-bg-box">
             <img :src="appViewBg" alt="">
         </div>
@@ -52,12 +52,13 @@
 </template>
 
 <script setup>
-import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
+import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRoute, useRouter } from 'vue-router'
 import { initButtons } from '~sto/app'
 import { HcSocket } from '~src/plugins/HcSocket'
 import { isNullES, useClick } from 'js-fast-way'
+import { useProject } from '~sto/useProject'
 import website from '~src/config'
 
 //初始组合式
@@ -65,7 +66,7 @@ const router = useRouter()
 const useRoutes = useRoute()
 const store = useAppStore()
 
-const reloadRouter = ref(!website.localModel)
+const reloadRouter = ref(false)
 const userRoleId = ref(store.getRoleId)
 const projectInfoData = ref(store.getProjectInfo)
 
@@ -88,13 +89,8 @@ const menuBarKey = ref('')
 const menuBarData = ref([])
 const isLayout = ref('')
 
-const isLoading = computed(() => {
-    if (website.localModel) {
-        return !reloadRouter.value
-    } else {
-        return false
-    }
-})
+//获取项目信息
+const { isAppLoading } = useProject()
 
 //渲染完成
 onMounted(() => {
@@ -116,6 +112,11 @@ watch(() => store.getTheme, (theme) => {
     appTheme.value = theme
 })
 
+//监听项目信息变化
+watch(() => isAppLoading.value, (res) => {
+    reloadRouter.value = res
+}, { immediate:true })
+
 //路由信息
 const routerMenuLoad = ({ key }) => {
     menuBarKey.value = key

+ 6 - 18
src/views/using/query.vue

@@ -1,5 +1,5 @@
 <template>
-    <div id="carry-spot-checks-layout-target" v-loading="!isAppLoading" class="hc-using-query-page">
+    <div id="carry-spot-checks-layout-target" class="hc-using-query-page">
         <div v-show="!isCarrySpotChecksDrawer" class="hc-query-card-box">
             <div v-if="isShowheader" class="hc-tag-flex-box">
                 <div class="hc-arrow-icon">
@@ -537,7 +537,6 @@ import { useAppStore } from '~src/store'
 import { arrIndex, arrToId, downloadBlob, getArrValue, getObjValue, isArrIndex, isNullES } from 'js-fast-way'
 import MetaTable from '../transfer/components/meta-table.vue'
 import HcMediaMic from './components/media-mic/index.vue'
-import { useProject } from '~sto/useProject'
 import archiveQueryApi from '~api/using/query.js'
 import tuningApi from '~api/archiveConfig/tuning.js'
 import imageViewGui from '~src/assets/view/gui.png'
@@ -547,6 +546,9 @@ import { setTimeString } from '~src/utils/tools'
 
 //变量
 const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
+const contractId = ref(useAppState.getContractId)
+const contractInfo = ref(useAppState.getContractInfo)
 const isBubble = ref(useAppState.getBubble)
 const isShowheader = ref(false)
 const tags = ref([])
@@ -555,9 +557,6 @@ const userAgent = navigator.userAgent
 const isMac = userAgent.indexOf('Mac') !== -1
 const AppTheme = ref(useAppState.getTheme)
 
-//获取项目信息
-const { projectId, contractId, contractInfo, isAppLoading } = useProject()
-
 //监听
 watch(() => [useAppState.getBubble, tags.value, useAppState.getTheme], ([bubble, Tags, theme]) => {
     isBubble.value = bubble
@@ -565,25 +564,14 @@ watch(() => [useAppState.getBubble, tags.value, useAppState.getTheme], ([bubble,
     isShowheader.value = Tags.length !== 0
 })
 
-//监听变化
-watch(() => isAppLoading.value, (res) => {
-    if (!res) return
+//渲染完成
+onMounted(() => {
     getCarrierTypeByDictdata()
     setAnnuals()
     setMonths()
     getTableData()
 })
 
-//渲染完成
-onMounted(() => {
-    if (isAppLoading.value) {
-        getCarrierTypeByDictdata()
-        setAnnuals()
-        setMonths()
-        getTableData()
-    }
-})
-
 //截取日期
 const splitDate = (val) => {
     if (val) {