Browse Source

资料查询、资料进度,增加施工数据、监理数据的切换

iZaiZaiA 2 years ago
parent
commit
07df6c6712

+ 28 - 0
src/global/components/hc-page-header/index.vue

@@ -0,0 +1,28 @@
+<template>
+    <Suspense v-if="isBody">
+        <Teleport to="#hc-header-page-name">
+            <div class="hc-header-page-extra">
+                <slot></slot>
+            </div>
+        </Teleport>
+    </Suspense>
+</template>
+
+<script setup>
+import {nextTick, ref} from "vue";
+const isBody = ref(false)
+
+//渲染完成
+nextTick(()=> {
+    //页面渲染完成后,再让 vue3 的 Teleport,挂载到指定节点
+    isBody.value = true
+})
+
+</script>
+
+<style lang="scss">
+.hc-header-page-extra {
+    position: relative;
+    margin-left: 24px;
+}
+</style>

+ 2 - 0
src/global/components/index.js

@@ -18,6 +18,7 @@ import HcTasksUser from './hc-tasks-user/index.vue'
 import HcContextMenu from './hc-context-menu/index.vue'
 import HcTabsSimple from './hc-tabs-simple/index.vue'
 import HcStatus from './hc-status/index.vue'
+import HcPageHeader from './hc-page-header/index.vue'
 
 //注册全局组件
 export const setupComponents = (App) => {
@@ -41,4 +42,5 @@ export const setupComponents = (App) => {
     App.component('HcContextMenu', HcContextMenu)
     App.component('HcTabsSimple', HcTabsSimple)
     App.component('HcStatus', HcStatus)
+    App.component('HcPageHeader', HcPageHeader)
 }

+ 1 - 1
src/layout/index.vue

@@ -24,7 +24,7 @@
         </el-aside>
         <el-container class="hc-container-view" :class="MenuBarKey === 'home-index'?'home':''">
             <el-header class="hc-header-view">
-                <div class="hc-header-page-name">
+                <div class="hc-header-page-name" id="hc-header-page-name">
                     {{RoutesTitle}}
                     <input multiple type="file" id="file" @change="handleChange" v-if="userInfo?.user_id == '1541381503819694081'">
                 </div>

+ 2 - 0
src/layout/layout.scss

@@ -123,6 +123,8 @@
                 position: relative;
                 color: #cccccc;
                 font-size: 22px;
+                display: flex;
+                align-items: center;
             }
             .hc-header-content {
                 flex: auto;

+ 32 - 1
src/views/data-fill/query.vue

@@ -116,6 +116,11 @@
                         </div>
                     </div>
                 </template>
+                <template #extra>
+                    <template v-if="contractInfo?.contractType === 2 || contractInfo?.contractType === 3">
+                        <HcNewSwitch :datas="contractTypeTab" :keys="contractTypeTabKey" @change="contractTypeTabChange"/>
+                    </template>
+                </template>
                 <HcTable ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading" isCheck @selection-change="tableSelectionChange">
                     <template #name="{row}">
                         <span class="text-link" @click="tableRowName(row)">{{row?.name}}</span>
@@ -177,6 +182,7 @@ const {getObjValue, getArrValue, isObjNull} = isType()
 const projectId = ref(useAppState.getProjectId);
 const contractId = ref(useAppState.getContractId);
 const projectInfo = ref(useAppState.getProjectInfo);
+const contractInfo = ref(useAppState.getContractInfo);
 const isCollapse = ref(useAppState.getCollapse)
 
 //监听
@@ -317,6 +323,29 @@ const searchForm = ref({
     queryValue: null, contractIdRelation: null, wbsId: null, current: 1, size: 20, total: 0
 })
 
+
+//结构类型tab数据和相关处理
+const contractTypeTabKey = ref(1)
+const contractTypeTab = ref([
+    {key:'1',  name: '施工数据'},
+    {key:'2', name: '监理数据'}
+]);
+const contractTypeTabChange = (item) => {
+    contractTypeTabKey.value = item?.key;
+    searchClick()
+}
+
+//获取合同段类型
+const getContractTypeKey = () => {
+    const { contractType } = contractInfo.value;
+    if (contractType === 2 || contractType === 3) {
+        return contractTypeTabKey.value ?? '1'
+    } else {
+        return null
+    }
+}
+
+
 //日期时间被选择
 const betweenTime = ref(null)
 const betweenTimeUpdate = ({arr,query}) => {
@@ -363,10 +392,12 @@ const getTableData = async () => {
         tableListRef.value?.clearSelection()
         tableCheckedKeys.value = []
         tableLoading.value = true
+        const classifyType = getContractTypeKey();
         const { error, code, data } = await queryApi.getPageData({
             projectId: projectId.value,
             contractId: contractId.value,
-            ...searchForm.value
+            ...searchForm.value,
+            classifyType: classifyType
         })
         //处理数据
         tableLoading.value = false

+ 36 - 3
src/views/schedule/hc-data.vue

@@ -1,5 +1,8 @@
 <template>
     <div class="hc-layout-box">
+        <HcPageHeader v-if="contractInfo?.contractType === 2 || contractInfo?.contractType === 3">
+            <HcNewSwitch :datas="contractTypeTab" :keys="contractTypeTabKey" @change="contractTypeTabChange"/>
+        </HcPageHeader>
         <div class="hc-round-chart">
             <el-row :gutter="30">
                 <el-col :span="6" v-for="item in processMaterialList">
@@ -94,6 +97,7 @@ const router = useRouter()
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId);
 const contractId = ref(useAppState.getContractId);
+const contractInfo = ref(useAppState.getContractInfo);
 const isCollapse = ref(useAppState.getCollapse)
 
 //渲染完成
@@ -104,14 +108,39 @@ onMounted(() => {
 })
 
 
+//结构类型tab数据和相关处理
+const contractTypeTabKey = ref(2)
+const contractTypeTab = ref([
+    {key:'1',  name: '施工数据'},
+    {key:'2', name: '监理数据'}
+]);
+const contractTypeTabChange = (item) => {
+    contractTypeTabKey.value = item?.key;
+    queryMaterialProgress()
+    queryMaterialProgressStatus()
+    queryImageClassification()
+}
+
+//获取合同段类型
+const getContractTypeKey = () => {
+    const { contractType } = contractInfo.value;
+    if (contractType === 2 || contractType === 3) {
+        return contractTypeTabKey.value ?? '1'
+    } else {
+        return null
+    }
+}
+
 //查询内业资料进度
 const isProcessLoading = ref(false)
 const processMaterialList = ref([])
 const queryMaterialProgress = async () => {
     isProcessLoading.value = true
+    const classifyType = getContractTypeKey();
     const { error, code, data } = await DataApi.queryMaterialProgress({
         projectId: projectId.value,
-        contractId: contractId.value
+        contractId: contractId.value,
+        classifyType: classifyType
     });
     //处理数据
     isProcessLoading.value = false
@@ -129,9 +158,11 @@ const isMaterialLoading = ref(false)
 const processMaterialStatusList = ref([])
 const queryMaterialProgressStatus = async () => {
     isMaterialLoading.value = true
+    const classifyType = getContractTypeKey();
     const { error, code, data } = await DataApi.queryMaterialProgressStatus({
         projectId: projectId.value,
-        contractId: contractId.value
+        contractId: contractId.value,
+        classifyType: classifyType
     });
     //处理数据
     isMaterialLoading.value = false
@@ -156,9 +187,11 @@ const contractImageClassificationList = ref([])
 const imageClassInfo = ref({amount: 0, image: 0, video: 0})
 const queryImageClassification = async () => {
     isImageClassLoading.value = true
+    const classifyType = getContractTypeKey();
     const { error, code, data } = await DataApi.queryImageClassification({
         projectId: projectId.value,
-        contractId: contractId.value
+        contractId: contractId.value,
+        classifyType: classifyType
     });
     //处理数据
     isImageClassLoading.value = false