duy 2 роки тому
батько
коміт
cb06ee9308

+ 21 - 0
src/api/modules/static/plan.js

@@ -0,0 +1,21 @@
+import {httpApi} from "../../request/httpApi";
+
+export default {
+    //任务统计-计划统计图-风险暂停计划
+    async MonthOfYearPlanOverview2(form) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudget/MonthOfYearPlanOverview2',
+            method: 'get',
+            params: form
+        }, false);
+    },
+    //任务统计完成率
+    async planFinishedRatio(form) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudget/planFinishedRatio',
+            method: 'get',
+            params: form
+        }, false);
+    },
+
+}

+ 9 - 2
src/components/echarts/BarLabelRotation.vue

@@ -31,6 +31,10 @@ const props = defineProps({
         type: Object,
         default:  () => ({})
     },
+    xdata:{
+        type: Array,
+         default: () => ([])
+    }
 })
 
 //初始变量
@@ -41,6 +45,7 @@ const datas = ref(props.datas)
 const isMonths = ref(props.isMonth)
 const xAxis = ref(props.lables)
 const legendval=ref(props.legend)
+const xdatas = ref(props.xdata)
 
 
 watch(() => [
@@ -49,12 +54,14 @@ watch(() => [
     props.isMonth,
     props.lables,
     props.legend,
-], ([color, unit, isMonth, lables,legend]) => {
+    props.xdata,
+], ([color, unit, isMonth, lables,legend,xdata]) => {
     colors.value = color
     units.value = unit
     isMonths.value = isMonth
     xAxis.value = lables
     legendval.value=legend
+    xdatas.value=xdata
     setOptions()
 })
 
@@ -78,7 +85,7 @@ const setDataFormat = () => {
             lables = [...lables, i + '月']
         }
     } else {
-        lables = xAxis.value
+        lables = xdatas.value
     }
     let isLables = lables.length > 0
     //处理数据

+ 79 - 39
src/views/static/plan.vue

@@ -2,21 +2,21 @@
     <HcCard scrollbar>
         <template #header>
             <div class="w-36">
-                <el-select v-model="searchForm.department" block clearable placeholder="选择部门" size="large">
-                    <el-option v-for="item in departmentType" :label="item.name" :value="item.key"/>
+                <el-select v-model="searchForm.deptId" block clearable placeholder="选择部门" size="large" @change="changeDpet">
+                    <el-option v-for="item in department" :label="item.deptName" :value="item.id"/>
                 </el-select>
             </div>
             <div class="w-40 ml-2">
-                <el-select v-model="searchForm.person" block clearable placeholder="任务人员" size="large">
-                    <el-option v-for="item in personType" :label="item.name" :value="item.key"/>
+                <el-select v-model="searchForm.userId" block clearable placeholder="任务人员" size="large">
+                    <el-option v-for="item in departmentPeople" :label="item.name" :value="item.id"/>
                 </el-select>
             </div>
             <div class="w-36 ml-4">
-                <el-date-picker class="block" v-model="searchForm.startTime" type="month" value-format="YYYY-MM" placeholder="开始日期" clearable size="large"/>
+                <el-date-picker class="block" v-model="searchForm.start" type="month" value-format="YYYY-MM" placeholder="开始日期" clearable size="large"/>
             </div>
             <div class="mx-2">~</div>
             <div class="w-36">
-                <el-date-picker class="block" v-model="searchForm.endTime" type="month" value-format="YYYY-MM" placeholder="结束日期" clearable size="large"/>
+                <el-date-picker class="block" v-model="searchForm.end" type="month" value-format="YYYY-MM" placeholder="结束日期" clearable size="large"/>
             </div>
             <div class="ml-4">
                 <el-button type="primary" @click="searchClick" size="large">
@@ -34,7 +34,7 @@
 
         <HcCardItem ui="hac-bg-grey">
             <div class="h-72">
-                <BarLabelRotation isMonth :datas="planDatas" :legend="legend"/>
+                <BarLabelRotation  :datas="planDatas" :legend="legend" :xdata="sxdata"/>
             </div>
         </HcCardItem>
 
@@ -61,13 +61,21 @@
 </template>
 
  <script setup>
- import {ref, watch} from "vue";
+ import {ref, watch,onMounted} from "vue";
  import BarLabelRotation from "~com/echarts/BarLabelRotation.vue";
  import StackedLine from "~com/echarts/StackedLine.vue";
  import WordPopulation from "~com/echarts/WordPopulation.vue";
+ import mainApi from '~api/static/plan.js'
+ import {getObjValue,getArrValue} from "js-fast-way"
+ import { getdepartmentList,getuserList} from "~api/other";
 
+ onMounted(()=>{
+    getDepartmentDict()
+    getImageData()
+    planFinishedRatio()
+ })
  const searchForm=ref({
-    department:'',person:''
+    deptId:'',userId:''
  })
  const departmentType=ref([
     {name:'研发部门',key:1},
@@ -83,30 +91,20 @@
 const searchClick = () => {
     searchForm.value.current = 1;
     console.log(searchForm.value)
+
+    let start=searchForm.value.start
+    let end=searchForm.value.end
+    console.log(end-start);
 }
 
 //重置
 const resetClick = () => {
     searchForm.value = {
-        reportType: null, startTime: null, endTime: null,
-        current: 1, size: 20, total: 0
+        deptId:null,userId:null
     }
 }
 //计划统计图
-const planDatas = ref([
-    {
-        name: '任务总量',
-        value: [120, 132, 101, 134, 90, 230, 210, 210, 210, 210, 132, 101]
-    },
-    {
-        name: '已完成',
-        value: [120, 132, 101, 134, 90, 230, 210, 210, 210, 210, 132, 101]
-    },
-    {
-        name: '未完成',
-        value: [120, 132, 101, 134, 90, 230, 210, 210, 210, 210, 132, 101]
-    },
-])
+const planDatas = ref([])
 const ydata=ref( ['张三', '李四', '王五', '赵六', '陈琦', '五把'])
 const xdata=ref( [10, 20, 40, 60, 80, 99])
 const planDatas1=ref([])
@@ -120,22 +118,64 @@ const legend=ref(
         }
    	},
 )
-const sydata=ref( [
-    {
-      name: '风险暂停计划',
-      type: 'line',
-      stack: 'Total',
-      data: [120, 132, 101, 134, 90, 230, 210]
-    },
-    {
-      name: '正常计划',
-      type: 'line',
-      stack: 'Total',
-      data: [220, 182, 191, 234, 290, 330, 310]
-    },
-  ])
+const sydata=ref( [])
 const sxdata=ref(['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'])
 const slegend=ref( ['风险暂停计划', '正常计划',])
+
+//项目图表数据
+const getImageData = async () => {
+    const {error, code, data} = await mainApi.MonthOfYearPlanOverview2()
+    //判断状态
+    if (!error && code === 200) {
+       planDatas.value=data['dataList']
+       sydata.value=data['riskPlans']
+       sxdata.value=data['dateList']
+    } else {
+        planDatas.value=[]
+        sydata.value=[]
+        sxdata.value=[]
+    }
+}
+//任务完成率
+const planFinishedRatio = async () => {
+    const {error, code, data} = await mainApi.planFinishedRatio()
+    //判断状态
+    if (!error && code === 200) {
+       let image=getObjValue(data)
+        xdata.value=image['ratioList']
+        ydata.value=image['userList']
+    } else {
+     
+    }
+}
+const department=ref([])
+//获取部门列表
+const getDepartmentDict=async()=>{
+    const {error, code, data} = await getdepartmentList({deptType:2})
+    if (!error && code === 200) {
+        department.value = getArrValue(data)
+
+    } else {
+        department.value = []
+
+    }
+}
+//改变部门
+const changeDpet=(val)=>{
+    getDepartmentuserDict(val)
+}
+const departmentPeople=ref([])
+//获取部门人员列表
+const getDepartmentuserDict=async(id)=>{
+    const {error, code, data} = await getuserList({deptId:id})
+    if (!error && code === 200) {
+        departmentPeople.value = getArrValue(data)
+
+    } else {
+        departmentPeople.value = []
+
+    }
+}
 </script>
 <style lang="scss" scoped>
 @import "~src/styles/home/index.scss";