Browse Source

部门支出统计

duy 2 years ago
parent
commit
0deb91477c

+ 9 - 2
src/api/modules/static/actual.js

@@ -4,11 +4,18 @@ export default {
     //预算与实际统计-月度统计
     async budgetAndPracticalByMonth(form) {
         return httpApi({
-            url: '/api//blade-control/annualBudget/budgetAndPracticalByMonth',
+            url: '/api/blade-control/annualBudget/budgetAndPracticalByMonth',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+    //预算与实际统计-部门支出统计
+    async budgetAndPracticalByDept(form) {
+        return httpApi({
+            url: '/api/blade-control/annualBudget/budgetAndPracticalByDept',
             method: 'get',
             params: form,
         }, false)
     },
-
 
 }

+ 1 - 1
src/views/static/actual.vue

@@ -77,7 +77,7 @@
                 <TabMonth :cur="tabsKey" :checkyear="checkyear" />
             </template>
             <template #tab-decost>
-                <TabDecost />
+                <TabDecost :cur="tabsKey" :checkyear="checkyear" />
             </template>
             <template #tab-mannager>
                 <TabManager />

+ 51 - 29
src/views/static/components/tab-decost.vue

@@ -20,43 +20,65 @@
 
 <script setup>
 import { nextTick, ref, watch } from 'vue'
+import mainApi from '~api/static/actual.js'
+import { getArrValue } from 'js-fast-way'
 
 const props = defineProps({
 cur: {
   type: [String, Number],
   default: '',
 },
+checkyear:{
+  type: [String, Number],
+  default: '',
+},
 })
 
 const tabsKey = ref(props.cur)
-
+const year = ref('')
 //监听
 watch(() => [
 props.cur,
-], ([key]) => {
+props.checkyear,
+], ([key, checkyear]) => {
 tabsKey.value = key
-console.log(key)
+console.log(key, 'key')
+year.value = checkyear
+  if (key === 'decost') {
+    console.log('获部门计划')
+    budgetAndPracticalByDept()
+  }
 })
 
-
 const tableData = ref([
-{ time:'一月', beginremain:'2000' },
-{ time:'二月', market:'2000', precost:1000, realcost:2000 },
-{ time:'三月', beginremain:'2000' },
-{ time:'四月', beginremain:'2000' },
-{ time:'五月', beginremain:'2000' },
-{ time:'六月', beginremain:'2000' },  
-{ time:'七月', beginremain:'2000' },
-{ time:'八月', beginremain:'2000' },
-{ time:'九月', beginremain:'2000' },
-{ time:'十月', beginremain:'2000' },
-{ time:'十一月', beginremain:'2000' },
-{ time:'十二月', beginremain:'2000' },
-{ time:'总计', beginremain:'2000' },
-
-
+// { time:'一月', beginremain:'2000' },
+// { time:'二月', market:'2000', precost:1000, realcost:2000 },
+// { time:'三月', beginremain:'2000' },
+// { time:'四月', beginremain:'2000' },
+// { time:'五月', beginremain:'2000' },
+// { time:'六月', beginremain:'2000' },  
+// { time:'七月', beginremain:'2000' },
+// { time:'八月', beginremain:'2000' },
+// { time:'九月', beginremain:'2000' },
+// { time:'十月', beginremain:'2000' },
+// { time:'十一月', beginremain:'2000' },
+// { time:'十二月', beginremain:'2000' },
+// { time:'总计', beginremain:'2000' },
 
 ])
+//获取部门统计
+const budgetAndPracticalByDept = async () => {
+    const { error, code, data } = await mainApi.budgetAndPracticalByDept(
+     { year:year.value },
+    )
+    //判断状态
+    if (!error && code === 200) {
+      tableData.value = getArrValue(data)
+  
+    } else {
+      tableData.value = []
+    }
+}
 const tableColData = ref([
   {
     id:'time',
@@ -72,11 +94,11 @@ const tableColData = ref([
         name: '市场部',
         children:[
             {
-            id: 'precost',
+            id: 'budget1 ',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'practical1',
             name: '实际支出',
             },
     
@@ -87,11 +109,11 @@ const tableColData = ref([
         name: '研发部',
         children:[
             {
-            id: 'precost',
+            id: 'budget2',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'practical2',
             name: '实际支出',
             },
     
@@ -102,11 +124,11 @@ const tableColData = ref([
         name: '实施部',
         children:[
             {
-            id: 'precost',
+            id: 'budget3',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'practical3',
             name: '实际支出',
             },
     
@@ -117,11 +139,11 @@ const tableColData = ref([
         name: '维护部',
         children:[
             {
-            id: 'precost',
+            id: 'budget4',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'practical4',
             name: '实际支出',
             },
     
@@ -132,11 +154,11 @@ const tableColData = ref([
         name: '管理中心',
         children:[
             {
-            id: 'precost',
+            id: 'budget5',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'practical5',
             name: '实际支出',
             },