8
0
ZaiZai há 9 meses atrás
pai
commit
e2e88719a3
2 ficheiros alterados com 114 adições e 75 exclusões
  1. 3 75
      src/views/project/detail/detail.vue
  2. 111 0
      src/views/project/detail/info.vue

+ 3 - 75
src/views/project/detail/detail.vue

@@ -2,7 +2,7 @@
     <hc-drawer v-model="isShow" to-id="hc-project-list" is-close @close="drawerClose">
         <div class="hc-contract-info-drawer relative h-full">
             <hc-tab-card :scrollbar="tabsKey === '1'" :tabs="tabsData" :tab-key="tabsKey" is-action-btn @change="tabsChange">
-                111111
+                <HcInfo v-if="tabsKey === '1'" :data="dataInfo" />
             </hc-tab-card>
         </div>
     </hc-drawer>
@@ -11,9 +11,7 @@
 <script setup>
 import { ref, watch } from 'vue'
 import { getObjValue, isNullES } from 'js-fast-way'
-import { getDictionaryData } from '~uti/tools'
-import mainApi from '~api/project/contract'
-import projectApi from '~api/project/project'
+import HcInfo from './info.vue'
 
 const props = defineProps({
     data: {
@@ -45,85 +43,15 @@ watch(isShow, (val) => {
 const tabsKey = ref('1')
 const tabsData = ref([])
 const getDataApi = async () => {
-    const { cid, type, tab } = getObjValue(dataInfo.value)
+    const { cid, tab } = getObjValue(dataInfo.value)
     if (isNullES(cid)) {
         tabsData.value = [{ key: '1', name: '合同段信息' }]
     } else {
         tabsData.value = [{ key: '1', name: '合同段信息' }, { key: '2', name: '分配WBS' }, { key: '3', name: '分配项目人员' }]
     }
-    await getContractTypeList()
-    if (!isNullES(cid)) {
-        if ([1, 4, 8].includes(type)) {
-            await getContractInfo()
-        } else if ([2, 3].includes(type)) {
-            await getContractInfo2()
-            await getContractRelation()
-        }
-    }
-    await getProjectDeatil()
     if (!isNullES(tab)) {
         tabsKey.value = tab
     }
-    getStoragePeriodList().then()
-    getSecurityLevelList().then()
-}
-
-//获取项目详情
-const projectInfo = ref({})
-const getProjectDeatil = async () => {
-    const { pid } = getObjValue(dataInfo.value)
-    contractForm.value = {}
-    if (isNullES(pid)) return
-    const { data } = await projectApi.detail(pid)
-    projectInfo.value = getObjValue(data)
-}
-
-//获取合同类型
-const contractTypeList = ref([])
-const getContractTypeList = async () => {
-    contractTypeList.value = await getDictionaryData('contract_type')
-}
-
-//获取合同段基本信息
-const contractForm = ref({})
-const getContractInfo = async () => {
-    const { cid } = getObjValue(dataInfo.value)
-    contractForm.value = {}
-    if (isNullES(cid)) return
-    const { data } = await mainApi.detail(cid)
-    contractForm.value = getObjValue(data)
-}
-
-//获取合同段基本信息
-const getContractInfo2 = async () => {
-    const { cid, type } = getObjValue(dataInfo.value)
-    contractForm.value = {}
-    if (isNullES(cid)) return
-    const { data } = await mainApi.detail2({
-        id: cid,
-        contractType: type,
-    })
-    contractForm.value = getObjValue(data)
-}
-
-//监理、业主关联施工
-const getContractRelation = async () => {
-    const { cid } = getObjValue(dataInfo.value)
-    if (isNullES(cid)) return
-    const { data } = await projectApi.getContractRelation(cid)
-    console.log(data)
-}
-
-//获取业务字典
-const storagePeriods = ref([])
-const getStoragePeriodList = async () => {
-    storagePeriods.value = await getDictionaryData('storage_period', true)
-}
-
-//获取安全等级
-const securityLevels = ref([])
-const getSecurityLevelList = async () => {
-    securityLevels.value = await getDictionaryData('security_level', true)
 }
 
 //选项卡

+ 111 - 0
src/views/project/detail/info.vue

@@ -0,0 +1,111 @@
+<template>
+    <div>
+        111
+    </div>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+import { getObjValue, isNullES } from 'js-fast-way'
+import { getDictionaryData } from '~uti/tools'
+
+//请求接口
+import mainApi from '~api/project/contract'
+import projectApi from '~api/project/project'
+
+const props = defineProps({
+    data: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//监听数据
+const dataInfo = ref(props.data)
+watch(() => props.data, (data) => {
+    dataInfo.value = data
+}, { immediate: true, deep: true })
+
+//渲染完成
+onMounted(() => {
+    getDataApi()
+})
+
+const getDataApi = async () => {
+    const { cid, type } = getObjValue(dataInfo.value)
+    await getContractTypeList()
+    if (!isNullES(cid)) {
+        if ([1, 4, 8].includes(type)) {
+            await getContractInfo()
+        } else if ([2, 3].includes(type)) {
+            await getContractInfo2()
+            await getContractRelation()
+        }
+    }
+    await getProjectDeatil()
+    getStoragePeriodList().then()
+    getSecurityLevelList().then()
+}
+
+//获取项目详情
+const projectInfo = ref({})
+const getProjectDeatil = async () => {
+    const { pid } = getObjValue(dataInfo.value)
+    contractForm.value = {}
+    if (isNullES(pid)) return
+    const { data } = await projectApi.detail(pid)
+    projectInfo.value = getObjValue(data)
+}
+
+//获取合同类型
+const contractTypeList = ref([])
+const getContractTypeList = async () => {
+    contractTypeList.value = await getDictionaryData('contract_type')
+}
+
+//获取合同段基本信息
+const contractForm = ref({})
+const getContractInfo = async () => {
+    const { cid } = getObjValue(dataInfo.value)
+    contractForm.value = {}
+    if (isNullES(cid)) return
+    const { data } = await mainApi.detail(cid)
+    contractForm.value = getObjValue(data)
+}
+
+//获取合同段基本信息
+const getContractInfo2 = async () => {
+    const { cid, type } = getObjValue(dataInfo.value)
+    contractForm.value = {}
+    if (isNullES(cid)) return
+    const { data } = await mainApi.detail2({
+        id: cid,
+        contractType: type,
+    })
+    contractForm.value = getObjValue(data)
+}
+
+//监理、业主关联施工
+const getContractRelation = async () => {
+    const { cid } = getObjValue(dataInfo.value)
+    if (isNullES(cid)) return
+    const { data } = await projectApi.getContractRelation(cid)
+    console.log(data)
+}
+
+//获取业务字典
+const storagePeriods = ref([])
+const getStoragePeriodList = async () => {
+    storagePeriods.value = await getDictionaryData('storage_period', true)
+}
+
+//获取安全等级
+const securityLevels = ref([])
+const getSecurityLevelList = async () => {
+    securityLevels.value = await getDictionaryData('security_level', true)
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>