duy 1 年之前
父节点
当前提交
59dc8626e1
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 14 2
      src/views/project/debit/project/unit.vue

+ 14 - 2
src/views/project/debit/project/unit.vue

@@ -81,7 +81,7 @@
 </template>
 
 <script setup>
-import { nextTick, onMounted, ref } from 'vue'
+import { nextTick, onMounted, ref, watch } from 'vue'
 import { arrToId, getArrValue, getObjValue, getRandom } from 'js-fast-way'
 import unitApi from '~api/project/debit/project/unit.js'
 import { useAppStore } from '~src/store'
@@ -89,7 +89,19 @@ import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { getDictionary } from '~api/other'
 import { delMessageV2 } from '~com/message/index.js'
 const useAppState = useAppStore()
-const projectId = ref(useAppState.getProjectId)
+const projectId = ref(useAppState.getProjectId || '')
+//监听
+watch(() => [
+useAppState.getProjectId,
+], ([pid]) => {
+ if (pid) {
+    projectId.value = pid
+    ishowTree.value = false
+    setTimeout(() => {
+        ishowTree.value = true
+    }, 100)
+ }
+})
 defineOptions({
     name: 'ProjectDebitProjectUnit',
 })