ZaiZai 6 months ago
parent
commit
3abb9ed714
1 changed files with 12 additions and 26 deletions
  1. 12 26
      src/views/using/query.vue

+ 12 - 26
src/views/using/query.vue

@@ -532,11 +532,12 @@
 </template>
 
 <script setup>
-import { computed, onMounted, ref, watch } from 'vue'
+import { onMounted, ref, watch } from 'vue'
 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 { arrIndex, arrToId, downloadBlob, getArrValue, getObjValue, isArrIndex, isNullES } from 'js-fast-way'
+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'
@@ -554,6 +555,9 @@ 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
@@ -561,31 +565,13 @@ watch(() => [useAppState.getBubble, tags.value, useAppState.getTheme], ([bubble,
     isShowheader.value = Tags.length !== 0
 })
 
-//获取项目信息
-const projectId = ref(useAppState.getProjectId)
-const contractId = ref(useAppState.getContractId)
-const contractInfo = ref(useAppState.getContractInfo)
-
-//监听
-watch(() => [useAppState.getProjectId, useAppState.getContractId, useAppState.getContractInfo], ([pid, cid, info]) => {
-    projectId.value = pid
-    contractId.value = cid
-    contractInfo.value = info
-}, { deep: true })
-
-//加载中
-const isAppLoading = computed(() => {
-    return !isNullES(projectId.value) && !isNullES(contractId.value)
-})
-
 //监听变化
-watch(() => isAppLoading.value, (val) => {
-    if (val) {
-        getCarrierTypeByDictdata()
-        setAnnuals()
-        setMonths()
-        getTableData()
-    }
+watch(() => isAppLoading.value, (res) => {
+    if (!res) return
+    getCarrierTypeByDictdata()
+    setAnnuals()
+    setMonths()
+    getTableData()
 })
 
 //渲染完成