wangting
2023-07-28 0ab2314356c648ba6595e5c10e346dcc6398fa13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
  <div>
    <el-row :gutter="20">
      <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="4" v-for="item in listMyTask">
        <div class="box" :style="item.style" @click="goto(item)">
          {{item.name}}
          <div><avue-count-up class="value" :end="item.count"></avue-count-up></div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
 
<script>
import {validatenull} from "@/util/validate";
import {getList} from "@/api/system/statistic";
import {flowRoute} from "@/util/flow";
 
export default {
name: "Statistic",
  data(){
  return {
    countByServer:true,
    listMyTask:[]
  }
  },
  created() {
  this.getList();
  },
  computed(){
 
  },
  methods: {
    getList() {
      let data = [{
        "backgroundColor": "#FF5722",
        "btmname": "hometask",
        "countUrl": "priceIndexController/countNeedConfirmPlan",
        "name": "物品主数据",
        "nameOid": "",
        "oid": "34aebfde-eb11-4555-87eb-0a779be9aad0",
        "uiUrl": "/MasterData/items?id=wupin@name=物品主数据",
      }, {
        "backgroundColor": "#5FB878",
        "btmname": "hometask",
        "countUrl": "priceIndexController/countPricingPlan",
        "name": "人员主数据",
        "nameOid": "2C72EA23-8AA5-E5FC-9BC1-DE4AD182EF7B",
        "oid": "6256ae79-7765-4c66-afc7-f12fad350065",
        "uiUrl": "/MasterData/items?id=renyuan@@name=人员主数据",
      },{
          "backgroundColor": "#1E9FFF",
          "btmname": "hometask",
          "countUrl": "priceIndexController/countNeedFeedbackPlan",
          "name": "主题库定义",
          "nameOid": "2536978C-CD1B-5B56-6529-A8C3456B5260",
          "oid": "3043cdf1-8479-4c2a-9eab-fc35e9f9d5a7",
          "uiUrl": "/modeling/classifyTree",
        },
        {
          "backgroundColor": "#FF5722",
          "btmname": "hometask",
          "countUrl": "priceIndexController/countMyUnCreatePricePlan",
          "name": "供应商主数据",
          "nameOid": "",
          "oid": "529634e7-1854-4f61-b911-a91e3c406757",
          "uiUrl": "/MasterData/items?id=gongyingshang@@name=供应商主数据",
        }]
      this.listMyTask = data.map(record => {
        record.style=record.style || ''
        if(record.backgroundColor!=''){
          record.style = 'background-color:'+record.backgroundColor;
        }
        record.count=record.count || 0;
        if(!this.countByServer){
          //是前端查询
          getList(record.countUrl,{}).then(res=>{
            if(res.data.data.success){
              record.count=res.data.data.obj;
            }else{
              record.count=0
            }
          })
 
        }
        return {
          ...record
        }
      })
    },
    goto(item){
      this.$router.push({ path: item.uiUrl });
    }
  }
}
</script>
 
<style scoped>
.el-col{margin-bottom: 0}
.box{
  text-align: center;
  background: rgb(235, 238, 245);
  color: #303133;
  height: 70px;
  margin: 10px 0!important;
  padding: 15px 10px;
  position: relative;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
}
.value{
  font-size: 12px;
  opacity: .69;
  line-height: 20px;
  margin-top: 5px;
  display: block;
}
</style>