8
0
ZaiZai 9 mēneši atpakaļ
vecāks
revīzija
c5f7f37117
2 mainītis faili ar 102 papildinājumiem un 6 dzēšanām
  1. 78 0
      src/views/project/detail/detail.vue
  2. 24 6
      src/views/project/list.vue

+ 78 - 0
src/views/project/detail/detail.vue

@@ -0,0 +1,78 @@
+<template>
+    <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
+            </hc-tab-card>
+        </div>
+    </hc-drawer>
+</template>
+
+<script setup>
+import { ref, watch } from 'vue'
+import mainApi from '~api/project/project'
+import { getObjValue, isNullES } from 'js-fast-way'
+
+const props = defineProps({
+    data: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//事件
+const emit = defineEmits(['close'])
+
+//双向绑定
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//监听数据
+const dataInfo = ref(props.data)
+watch(() => props.data, (data) => {
+    dataInfo.value = data
+}, { immediate: true, deep: true })
+
+//监听显示
+watch(isShow, (val) => {
+    if (val) getDataApi()
+})
+
+//处理相关数据
+const getDataApi = async () => {
+    const { pid, cid, type } = getObjValue(dataInfo.value)
+    if (isNullES(cid)) {
+        tabsData.value = [
+            { key: '1', name: '合同段信息' },
+            { key: '3', name: '分配项目人员' },
+        ]
+    } else {
+        tabsData.value = [
+            { key: '1', name: '合同段信息' },
+            { key: '2', name: '分配WBS' },
+            { key: '3', name: '分配项目人员' },
+        ]
+    }
+}
+
+//选项卡
+const tabsKey = ref('1')
+const tabsData = ref([])
+const tabsChange = ({ key }) => {
+    console.log(key)
+    //tabsKey.value = key
+}
+
+//关闭抽屉
+const drawerClose = () => {
+    isShow.value = false
+    emit('close')
+}
+</script>
+
+<style lang="scss">
+.hc-contract-info-drawer {
+
+}
+</style>

+ 24 - 6
src/views/project/list.vue

@@ -39,6 +39,9 @@
 
         <!-- 创建或编辑项目信息 -->
         <HcInfoDetail v-model="isProjectDrawer" :data="projectItem" />
+
+        <!-- 创建或编辑合同段信息 -->
+        <HcContractInfo v-model="isContractDrawer" :data="contractItem" />
     </hc-card>
 </template>
 
@@ -48,6 +51,7 @@ import { getArrValue, getObjValue } from 'js-fast-way'
 import InfoDialog from './list/info-dialog.vue'
 import HcWbsTree from './list/wbs-tree.vue'
 import HcInfoDetail from './info/detail.vue'
+import HcContractInfo from './detail/detail.vue'
 import mainApi from '~api/project/project'
 
 defineOptions({
@@ -142,7 +146,7 @@ const wbsTreeClose = () => {
 }
 
 //功能事件回调
-const projectInfoCheck = ({ type, info, item }) => {
+const projectInfoCheck = async ({ type, info, item }) => {
     //measure, lar, test, wbsTree, logTree, editProject, addContract, editContract, wbsContract
     //计量管理,征拆划分,实验划分,WBS树管理,日志树管理,编辑项目,创建合同段,编辑合同段信息,分配WBS
     const wbsArr = ['wbsTree', 'test', 'measure', 'logTree', 'lar']
@@ -153,13 +157,22 @@ const projectInfoCheck = ({ type, info, item }) => {
         isWbsTreeDrawer.value = true
     } else if (type === 'editProject') {
         projectItem.value = getObjValue(info)
-        nextTick(() => {
-            isProjectDrawer.value = true
-        })
+        await nextTick()
+        isProjectDrawer.value = true
     } else if (type === 'addContract') {
-        console.log('创建合同段')
+        const { id } = getObjValue(info)
+        contractItem.value = { pid: id }
+        await nextTick()
+        isContractDrawer.value = true
     } else if (type === 'editContract') {
-        console.log('创建合同段')
+        const { id } = getObjValue(info)
+        contractItem.value = {
+            pid: id,
+            cid: item.id,
+            type: item.contractType,
+        }
+        await nextTick()
+        isContractDrawer.value = true
     } else if (type === 'wbsContract') {
         console.log('分配WBS')
     }
@@ -178,10 +191,15 @@ const addProjectClick = () => {
     })
 }
 
+//创建合同段信息
+const isContractDrawer = ref(false)
+const contractItem = ref({})
+
 //离开了当前页面
 onDeactivated(() => {
     isWbsTreeDrawer.value = false
     isProjectDrawer.value = false
+    isContractDrawer.value = false
 })
 </script>