Bladeren bron

总经营预算修改

duy 2 jaren geleden
bovenliggende
commit
925674900d

+ 16 - 0
src/api/modules/static/actual.js

@@ -17,5 +17,21 @@ export default {
             params: form,
         }, false)
     },
+    //预算与实际统计-人工和管理统计
+    async budgetAndPracticalByManage(form) {
+        return httpApi({
+            url: '/api/blade-control/annualBudget/budgetAndPracticalByManage',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+    //预算与实际统计-总经营
+    async budgetAndPracticalByBusiness(form) {
+        return httpApi({
+            url: '/api/blade-control/annualBudget/budgetAndPracticalByBusiness',
+            method: 'get',
+            params: form,
+        }, false)
+    },
 
 }

+ 33 - 14
src/views/static/actual.vue

@@ -9,8 +9,8 @@
                     </el-button>
                 </div>
                 <div class="w-36 ml-4">
-                    <el-select v-model="checkyear" block clearable placeholder="选择年份" size="large">
-                        <el-option v-for="item in yearoptions" :key="item" :label="item" :value="item" />
+                    <el-select v-model="checkyear" block clearable placeholder="选择年份" size="large" @change="selectYear">
+                        <el-option v-for="(item, index) in yearoptions" :key="index" :label="item" :value="item" />
                     </el-select>
                 </div>
             </el-row>
@@ -22,7 +22,7 @@
                                 总经营收入预算
                             </div>
                             <div class="item-sub-num">
-                                <span class="num">120000</span>
+                                <span class="num">{{ totalObj?.budgetInput }}</span>
                                 <span class="text">元</span>
                             </div>
                         </div>
@@ -35,7 +35,7 @@
                                 总经营支出预算
                             </div>
                             <div class="item-sub-num">
-                                <span class="num">560</span>
+                                <span class="num">{{ totalObj?.budgetOutput }}</span>
                                 <span class="text">元</span>
                             </div>
                         </div>
@@ -48,7 +48,7 @@
                                 总经营实际收入
                             </div>
                             <div class="item-sub-num">
-                                <span class="num">90</span>
+                                <span class="num">{{ totalObj?.practicalInput }}</span>
                                 <span class="text">元</span>
                             </div>
                         </div>
@@ -61,7 +61,7 @@
                                 总经营实际支出
                             </div>
                             <div class="item-sub-num">
-                                <span class="num">125</span>
+                                <span class="num">{{ totalObj?.practicalOutput }}</span>
                                 <span class="text">元</span>
                             </div>
                         </div>
@@ -80,7 +80,7 @@
                 <TabDecost :cur="tabsKey" :checkyear="checkyear" />
             </template>
             <template #tab-mannager>
-                <TabManager />
+                <TabManager :cur="tabsKey" :checkyear="checkyear" />
             </template>
         </HcTabsSimple>
     </el-scrollbar>
@@ -93,32 +93,51 @@
  import TabDecost from './components/tab-decost.vue'
  import TabManager from './components/tab-mannager.vue'
  import mainApi from '~api/home/index'
- import { getArrValue } from 'js-fast-way'
-onActivated(()=>{
-    getYearList()
+ import mainApi1 from '~api/static/actual.js'
+ import { getArrValue, getObjValue } from 'js-fast-way'
+onActivated(async ()=>{
+   await getYearList()
+    budgetAndPracticalByBusiness()
 })
 const importModalClick = ()=>{
 
 }
 const checkyear = ref('')
 const yearoptions = ref([
-    { name:'2021年', key:2021 },
-    { name:'2022年', key:2022 },
-    { name:'2023年', key:2023 },
+    
 ])
+const selectYear = ()=>{
+    budgetAndPracticalByBusiness()
+}
 //获取年度列表
-
 const getYearList = async () => {
     const { error, code, data } = await mainApi.yearList()
     //判断状态
     if (!error && code === 200) {
         const arr = getArrValue(data)
         yearoptions.value = arr
+        if ( yearoptions.value.length > 0) {
+            checkyear.value = yearoptions.value[0]
+        }
     } else {
         yearoptions.value = []
      
     }
 }
+//获取总经营数据
+const totalObj = ref({})
+const budgetAndPracticalByBusiness = async () => {
+    const { error, code, data } = await mainApi1.budgetAndPracticalByBusiness(
+     { year:checkyear.value },
+    )
+    //判断状态
+    if (!error && code === 200) {
+    console.log(data, 'data')
+    totalObj.value = getObjValue(data)
+    } else {
+        totalObj.value = {}
+    }
+}
 const tabsKey = ref('all')
 const tabsData = ref([
     { icon: 'bar-chart-box', label: '汇总统计', key: 'all' },

+ 1 - 16
src/views/static/components/tab-decost.vue

@@ -50,22 +50,7 @@ year.value = checkyear
   }
 })
 
-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' },
-
-])
+const tableData = ref([])
 //获取部门统计
 const budgetAndPracticalByDept = async () => {
     const { error, code, data } = await mainApi.budgetAndPracticalByDept(

+ 33 - 26
src/views/static/components/tab-mannager.vue

@@ -20,6 +20,8 @@
 
 <script setup>
 import { nextTick, ref, watch } from 'vue'
+import mainApi from '~api/static/actual.js'
+import { getArrValue } from 'js-fast-way'
 
 
 const props = defineProps({
@@ -27,38 +29,43 @@ 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 === 'mannager') {
+    console.log('获部门计划')
+    budgetAndPracticalByManage()
+  }
 })
 
 
-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' },
-
-
-
-])
+const tableData = ref([])
+//获取部门统计
+const budgetAndPracticalByManage = async () => {
+    const { error, code, data } = await mainApi.budgetAndPracticalByManage(
+     { year:year.value },
+    )
+    //判断状态
+    if (!error && code === 200) {
+      tableData.value = getArrValue(data)
+  
+    } else {
+      tableData.value = []
+    }
+}
 const tableColData = ref([
   {
     id:'time',
@@ -77,11 +84,11 @@ const tableColData = ref([
         name: '人工成本',
         children:[
             {
-            id: 'precost',
+            id: 'disburse1',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'disburse2',
             name: '实际支出',
             },
     
@@ -92,11 +99,11 @@ const tableColData = ref([
         name: '管理成本',
         children:[
             {
-            id: 'precost',
+            id: 'disburse3',
             name: '预算支出',
             },
             {
-            id: 'realcost',
+            id: 'disburse4',
             name: '实际支出',
             },