Explorar el Código

项目统计接口调用

duy hace 7 meses
padre
commit
6c97bc4fcd
Se han modificado 2 ficheros con 102 adiciones y 21 borrados
  1. 21 0
      src/api/modules/datav/projectdata.js
  2. 81 21
      src/views/home/datav.vue

+ 21 - 0
src/api/modules/datav/projectdata.js

@@ -0,0 +1,21 @@
+import { HcApi } from '../../request/index'
+
+export default {
+    //数据看板-项目统计
+    async dataProjectStat(form) {
+        return HcApi({
+            url: '/api/blade-attach/project/data-project-stat',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+    //数据看板-投资数据
+    async dataInvestStat(form) {
+        return HcApi({
+            url: '/api/blade-attach/project/data-invest-stat',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+
+}

+ 81 - 21
src/views/home/datav.vue

@@ -16,8 +16,8 @@
                         <HcDatavSelect v-model="pageType" :datas="pageTypeArr" :clearable="false" @change="pageTypeChange" />
                         <template v-if="pageType === '1'">
                             <HcDatavSelect v-model="searchForm.month" :datas="monthArr" placeholder="选择月份" />
-                            <HcDatavSelect v-model="searchForm.lag" :datas="lagArr" />
-                            <HcDatavSelect v-if="searchForm.lag === '3'" v-model="searchForm.level" :datas="levelArr" placeholder="滞后等级" />
+                            <HcDatavSelect v-model="searchForm.projectScheduleType" :datas="lagArr" />
+                            <HcDatavSelect v-if="searchForm.projectScheduleType === '3'" v-model="searchForm.scale" :datas="levelArr" placeholder="滞后等级" />
                         </template>
                         <HcDatavSelect v-model="searchForm.projectStage" :datas="stageArr" placeholder="项目阶段" />
                         <HcDatavSelect v-if="pageType === '1'" v-model="searchForm.type" :datas="typeArr" placeholder="项目类型" />
@@ -29,13 +29,13 @@
             <div class="hc-datav-total relative p-[14px]">
                 <el-row v-if="pageType === '1'" :gutter="24">
                     <el-col :span="6">
-                        <HcDatavCard title="项目总量" num="860" unit="" color="#D5DEFF" />
+                        <HcDatavCard title="项目总量" :num="projectStat.projectTotal" unit="" color="#D5DEFF" />
                     </el-col>
                     <el-col :span="6">
-                        <HcDatavCard title="计划总投资额" num="1590" unit="亿" color="#EEB500" />
+                        <HcDatavCard title="计划总投资额" :num="projectStat.planAllMoney" unit="亿" color="#EEB500" />
                     </el-col>
                     <el-col :span="6">
-                        <HcDatavCard num="590" unit="亿" color="#0DD70C">
+                        <HcDatavCard :num="projectStat.currentMoney" unit="亿" color="#0DD70C">
                             <template #title>
                                 <span style="color: #FE0301;">目前</span>
                                 <span>实际完成投资额</span>
@@ -43,7 +43,7 @@
                         </HcDatavCard>
                     </el-col>
                     <el-col :span="6">
-                        <HcDatavCard title="投资完成比例" num="58" unit="%" color="#1DC98B" />
+                        <HcDatavCard title="投资完成比例" :num="projectStat.investRatio" unit="%" color="#1DC98B" />
                     </el-col>
                 </el-row>
                 <el-row v-else :gutter="24">
@@ -87,9 +87,9 @@
                                         <div class="content relative ml-[12px] h-[52px] flex-1">
                                             <div class="name mb-[10px] text-center text-[16px]">一季度</div>
                                             <div class="data text-center text-[24px]">
-                                                <span class="num font-bold">130</span>
+                                                <span class="num font-bold">{{ investStat?.oneFinished || 0 }}</span>
                                                 <span class="line">/</span>
-                                                <span class="red font-bold">60</span>
+                                                <span class="red font-bold">{{ investStat?.oneUnFinished || 0 }}</span>
                                                 <span class="unit ml-[5px] text-[14px]">(亿)</span>
                                             </div>
                                         </div>
@@ -101,9 +101,9 @@
                                         <div class="content relative ml-[12px] h-[52px] flex-1">
                                             <div class="name mb-[10px] text-center text-[16px]">二季度</div>
                                             <div class="data text-center text-[24px]">
-                                                <span class="num font-bold">130</span>
+                                                <span class="num font-bold">{{ investStat?.twoFinished || 0 }}</span>
                                                 <span class="line">/</span>
-                                                <span class="red font-bold">60</span>
+                                                <span class="red font-bold">{{ investStat?.twoUnFinished || 0 }}</span>
                                                 <span class="unit ml-[5px] text-[14px]">(亿)</span>
                                             </div>
                                         </div>
@@ -115,9 +115,9 @@
                                         <div class="content relative ml-[12px] h-[52px] flex-1">
                                             <div class="name mb-[10px] text-center text-[16px]">三季度</div>
                                             <div class="data text-center text-[24px]">
-                                                <span class="num font-bold">130</span>
+                                                <span class="num font-bold">{{ investStat?.threeFinished || 0 }}</span>
                                                 <span class="line">/</span>
-                                                <span class="red font-bold">60</span>
+                                                <span class="red font-bold">{{ investStat?.threeUnFinished || 0 }}</span>
                                                 <span class="unit ml-[5px] text-[14px]">(亿)</span>
                                             </div>
                                         </div>
@@ -129,9 +129,9 @@
                                         <div class="content relative ml-[12px] h-[52px] flex-1">
                                             <div class="name mb-[10px] text-center text-[16px]">四季度</div>
                                             <div class="data text-center text-[24px]">
-                                                <span class="num font-bold">130</span>
+                                                <span class="num font-bold">{{ investStat?.fourFinished || 0 }}</span>
                                                 <span class="line">/</span>
-                                                <span class="red font-bold">60</span>
+                                                <span class="red font-bold">{{ investStat?.fourUnFinished || 0 }}</span>
                                                 <span class="unit ml-[5px] text-[14px]">(亿)</span>
                                             </div>
                                         </div>
@@ -140,7 +140,7 @@
                             </hc-row>
                         </div>
                         <div class="hc-datav-divider" />
-                        <div v-if="searchForm.lag !== '3'" class="hc-datav-table relative">
+                        <div v-if="searchForm.projectScheduleType !== '3'" class="hc-datav-table relative">
                             <HcDatavTable :column="tableColumn1" :datas="tableData1" is-current @row-click="tableRowClick">
                                 <template #key3="{ row }">
                                     <span style="color: #06A3FF;" class="font-bold">{{ row.key3 }}</span>
@@ -173,15 +173,15 @@
                         <div class="row-charts relative inline-block h-[335px] w-[520px]">
                             <div class="title-box a1">
                                 <span>常规项目</span>
-                                <span class="num">122</span>
+                                <span class="num">{{ projectStat.total1 }}</span>
                             </div>
                             <div class="title-box a2">
                                 <span>超进度项目</span>
-                                <span class="num">333</span>
+                                <span class="num">{{ projectStat.total2 }}</span>
                             </div>
                             <div class="title-box a3">
                                 <span>滞后项目</span>
-                                <span class="num">21</span>
+                                <span class="num">{{ projectStat.total3 }}</span>
                             </div>
                         </div>
                     </div>
@@ -257,7 +257,7 @@
                             </hc-row>
                         </div>
                         <div class="hc-datav-divider" />
-                        <div v-if="searchForm.lag !== '3'" class="hc-datav-table relative">
+                        <div v-if="searchForm.projectScheduleType !== '3'" class="hc-datav-table relative">
                             <HcDatavTable :column="tableColumn2" :datas="tableData2">
                                 <template #key3="{ row }">
                                     <span style="color: #D8A70F;" class="font-bold">{{ row.key3 }}</span>
@@ -311,8 +311,9 @@ import HcDatavSelect from './modules/select.vue'
 import HcDatavCard from './modules/card.vue'
 import HcDatavTable from './modules/table.vue'
 import HcDatavCharts from './modules/charts.vue'
-import { isNullES } from 'js-fast-way'
+import { getObjValue, isNullES } from 'js-fast-way'
 import { getDictionaryData } from '~src/utils/tools'
+import projectApi from '~api/datav/projectdata'
 
 const store = useAppStore()
 
@@ -342,6 +343,8 @@ onMounted(() => {
     monthArr.value = newMonthArr
     getProType()
     getProStation()
+    getDataProjectStat()
+    // getDataInvestStat()
 })
 
 //关闭引导提示
@@ -352,7 +355,7 @@ const tourFinishClose = () => {
 
 //搜索表单
 const pageType = ref('1')
-const searchForm = ref({ year: '2024', month: 0, level: '0', projectStage: null, projectType: null })
+const searchForm = ref({ year: '2024', month: 0, scale: null, projectStage: null, projectType: null, projectScheduleType:null })
 const yearArr = [{ id: '2024', name: '2024年' }, { id: '2023', name: '2023年' }, { id: '2022', name: '2022年' }]
 const pageTypeArr = [{ id: '1', name: '项目数据看板' }, { id: '2', name: '工作要点' }]
 const monthArr = ref([])
@@ -387,7 +390,64 @@ const getProStation = async () => {
 const pageTypeChange = () => {
 
 }
+//获取项目统计
+const projectStat = ref({
+    projectTotal:0,
+    planAllMoney:0,
+    currentMoney:0,
+    investRatio:0,
+    total1:0,
+    total2:0,
+    total3:0,
 
+})
+//获取项目统计
+const getDataProjectStat = async ()=>{
+    const { error, code, data } = await projectApi.dataProjectStat(searchForm.value)
+    //处理数据
+    if (!error && code === 200) {
+        projectStat.value = getObjValue(data)
+    } else {
+        projectStat.value = {
+            projectTotal:0,
+            planAllMoney:0,
+            currentMoney:0,
+            investRatio:0,
+            total1:0,
+            total2:0,
+            total3:0,
+        }
+    }
+}
+//获取投资数据
+const investStat = ref({
+    oneFinished:0,
+    oneUnFinished:0,
+    twoFinished:0,
+    twoUnFinished:0,
+    threeFinished:0,
+    threeUnFinished:0,
+    fourFinished:0,
+    fourUnFinished:0,
+})
+const getDataInvestStat = async ()=>{
+    const { error, code, data } = await projectApi.dataInvestStat(searchForm.value)
+    //处理数据
+    if (!error && code === 200) {
+        investStat.value = getObjValue(data)
+    } else {
+        investStat.value = {
+            oneFinished:0,
+            oneUnFinished:0,
+            twoFinished:0,
+            twoUnFinished:0,
+            threeFinished:0,
+            threeUnFinished:0,
+            fourFinished:0,
+            fourUnFinished:0,
+        }
+    }
+}
 //表格1
 const tableColumn1 = [
     { key: 'key1', name: '项目阶段' }, { key: 'key2', name: '项目类型' },