ZaiZai 6 months ago
parent
commit
9f860a9a04

+ 20 - 4
src/views/project/debit/contract/check-list.vue

@@ -317,7 +317,7 @@
 </template>
 
 <script setup>
-import { nextTick, onActivated, onMounted, ref } from 'vue'
+import { computed, nextTick, onActivated, onMounted, ref, watch } from 'vue'
 import { arrToId, formValidate, getArrValue, getObjValue, getRandom, isNullES } from 'js-fast-way'
 import { getHeader } from 'hc-vue3-ui'
 import { useAppStore } from '~src/store'
@@ -333,8 +333,23 @@ import { toPdfPage } from '~uti/btn-auth'
 
 //变量
 const useAppState = useAppStore()
-const projectId = ref(useAppState.getProjectId)
-const contractId = ref(useAppState.getContractId)
+
+const projectId = computed(() => useAppState.getProjectId || '')
+const contractId = computed(() => useAppState.getContractId || '')
+
+//监听
+watch(() => projectId.value, (pid) => {
+    if (isNullES(pid)) {
+        ishowTree.value = false
+        return
+    }
+    projectId.value = pid
+    ishowTree.value = false
+    setTimeout(() => {
+        ishowTree.value = true
+    }, 100)
+})
+
 defineOptions({
     name: 'ProjectDebitContractList',
 })
@@ -343,6 +358,7 @@ const uuid = getRandom(4)
 
 //渲染完成
 onMounted(() => {
+    ishowTree.value = !isNullES(projectId.value)
     setSplitRef()
 })
 
@@ -383,7 +399,7 @@ const treeProps = {
           return !data.hasChild
     },
 }
-const ishowTree = ref(true)
+const ishowTree = ref(false)
 
 //自动展开缓存
 const autoExpandKeys = ref(getStoreValue('autoExpandKeys') || [])

+ 20 - 5
src/views/project/debit/contract/unit.vue

@@ -200,8 +200,8 @@
 </template>
 
 <script setup>
-import { nextTick, onMounted, ref } from 'vue'
-import { arrToId, arrToKey, getArrValue, getObjValue, getRandom } from 'js-fast-way'
+import { computed, nextTick, onMounted, ref, watch } from 'vue'
+import { arrToId, arrToKey, getArrValue, getObjValue, getRandom, isNullES } from 'js-fast-way'
 import infoTable from './components/unit/info-table.vue'
 import treeForm from './components/unit/tree-form.vue'
 import rowData from './components/unit/row-data.vue'
@@ -216,8 +216,22 @@ import { getHeader } from 'hc-vue3-ui'
 
 import { getDictionaryBiz } from '~api/other'
 const useAppState = useAppStore()
-const projectId = ref(useAppState.getProjectId || '')
-const contractId = ref(useAppState.getContractId || '')
+const projectId = computed(() => useAppState.getProjectId || '')
+const contractId = computed(() => useAppState.getContractId || '')
+
+//监听
+watch(() => projectId.value, (pid) => {
+    if (isNullES(pid)) {
+        ishowTree.value = false
+        return
+    }
+    projectId.value = pid
+    ishowTree.value = false
+    setTimeout(() => {
+        ishowTree.value = true
+    }, 100)
+})
+
 defineOptions({
     name: 'ProjectDebitContractUnit',
 })
@@ -226,6 +240,7 @@ const uuid = getRandom(4)
 
 //渲染完成
 onMounted(() => {
+    ishowTree.value = !isNullES(projectId.value)
     setSplitRef()
     // getNodeType()
 })
@@ -268,7 +283,7 @@ const treeProps = {
     children: 'children',
     isLeaf: 'notExsitChild',
 }
-const ishowTree = ref(true)
+const ishowTree = ref(false)
 //重新设置树
 const setLoading = ref(false)
 const setTree = async () => {

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

@@ -82,29 +82,30 @@
 </template>
 
 <script setup>
-import { nextTick, onMounted, ref, watch } from 'vue'
-import { arrToId, formValidate, getArrValue, getObjValue, getRandom } from 'js-fast-way'
-import unitApi from '~api/project/debit/project/unit.js'
-import { useAppStore } from '~src/store'
+import { computed, nextTick, onMounted, ref, watch } from 'vue'
+import { arrToId, formValidate, getArrValue, getObjValue, getRandom, isNullES } from 'js-fast-way'
+import unitApi from '~api/project/debit/project/unit'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { getDictionaryBiz } from '~api/other'
-
+import { useAppStore } from '~src/store'
 
 import { HcDelMsg } from 'hc-vue3-ui'
 const useAppState = useAppStore()
-const projectId = ref(useAppState.getProjectId || '')
+const projectId = computed(() => useAppState.getProjectId || '')
+
 //监听
-watch(() => [
-useAppState.getProjectId,
-], ([pid]) => {
- if (pid) {
+watch(() => projectId.value, (pid) => {
+    if (isNullES(pid)) {
+        ishowTree.value = false
+        return
+    }
     projectId.value = pid
     ishowTree.value = false
     setTimeout(() => {
         ishowTree.value = true
     }, 100)
- }
 })
+
 defineOptions({
     name: 'ProjectDebitProjectUnit',
 })
@@ -113,6 +114,7 @@ const uuid = getRandom(4)
 
 //渲染完成
 onMounted(() => {
+    ishowTree.value = !isNullES(projectId.value)
     setSplitRef()
     // getNodeType()
 })
@@ -165,7 +167,7 @@ const treeLoadNode = async ({ item, level }, resolve) => {
     resolve(getArrValue(data))
 }
 
-const ishowTree = ref(true)
+const ishowTree = ref(false)
 //重新设置树
 const setLoading = ref(false)
 const setTree = async ()=>{

+ 19 - 18
src/views/user/auth.vue

@@ -66,19 +66,29 @@ const queryCurrentUserData = async (tenant_id) => {
     await getTenantIdApi()
     const tenantIds = await getTenantIdApi()
     const tenantId = tenant_id ? tenant_id : tenantIds
-    const { error, code, data } = await userApi.queryCurrentUserData()
-    if (!error && code === 200) {
-        await useAppLoginApi({
-            tenantId: tenantId,
-            username: data.account,
-            password: data.plaintextPassword,
-            type: 'account',
-        })
-    } else {
+    const { isRes, data } = await userApi.queryCurrentUserData()
+    if (!isRes) {
         window.$message?.error('授权信息异常')
         isErrorShow.value = true
         loading.value = false
+        return
     }
+    const isLogin = await useAppLoginApi({
+        tenantId: tenantId,
+        username: data.account,
+        password: data.plaintextPassword,
+        type: 'account',
+    })
+    if (!isLogin) return
+    //授权登录成功
+    setTimeout(() => {
+        loading.value = false
+        isErrorShow.value = false
+        window?.$message?.success('授权登录成功')
+        router.push({
+            name: store.homeUrl ?? 'home',
+        })
+    }, 1500)
 }
 
 //请求授权登录
@@ -91,15 +101,6 @@ const useAppLoginApi = async (form) => {
         loading.value = false
         return false
     }
-    //授权登录成功
-    setTimeout(() => {
-        loading.value = false
-        isErrorShow.value = false
-        window?.$message?.success('授权登录成功')
-        router.push({
-            name: store.homeUrl ?? 'home',
-        })
-    }, 1500)
 }
 
 //跳转登陆