Просмотр исходного кода

新增合同统计,修改项目类型带输入建议

余思翰 6 месяцев назад
Родитель
Сommit
573bbfce72

+ 10
- 1
oa-ui/src/api/oa/project/project.js Просмотреть файл

@@ -2,7 +2,7 @@
2 2
  * @Author: wrh
3 3
  * @Date: 2024-01-30 16:37:46
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-11 15:26:43
5
+ * @LastEditTime: 2024-10-14 16:50:24
6 6
  */
7 7
 import request from '@/utils/request'
8 8
 
@@ -75,3 +75,12 @@ export function getProjectStatistic(query) {
75 75
     params: query
76 76
   })
77 77
 }
78
+
79
+
80
+// 项目统计信息
81
+export function getProjectType() {
82
+  return request({
83
+    url: '/oa/project/projectType',
84
+    method: 'get',
85
+  })
86
+}

+ 16
- 3
oa-ui/src/views/flowable/form/components/choosePartyA.vue Просмотреть файл

@@ -2,18 +2,21 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-06-18 17:38:50
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-09 11:31:52
5
+ * @LastEditTime: 2024-10-14 14:46:08
6 6
 -->
7 7
 <template>
8 8
   <div>
9 9
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
10 10
       <el-form-item label="单位名称" prop="partyAName">
11
-        <el-select v-model="queryParams.partyAName" clearable filterable remote reserve-keyword placeholder="请输入单位名称"
11
+        <!-- <el-select v-model="queryParams.partyAName" clearable filterable remote reserve-keyword placeholder="请输入单位名称"
12 12
           :remote-method="remoteMethod" :loading="queryLoading" style="width: 400px;" @change="handleQuery()">
13 13
           <el-option v-for="partyA in queryPartyAList" :key="partyA.partyAId" :label="partyA.partyAName"
14 14
             :value="partyA.partyAName">
15 15
           </el-option>
16
-        </el-select>
16
+        </el-select> -->
17
+        <el-autocomplete class="inline-input" clearable style="width: 400px;" v-model="queryParams.partyAName"
18
+          :fetch-suggestions="querySearch" value-key="partyAName" placeholder="请输入内容"
19
+          @select="handleQuery()"></el-autocomplete>
17 20
       </el-form-item>
18 21
       <el-form-item style="margin-bottom:0;display:none;"> <el-input></el-input> </el-form-item>
19 22
       <el-form-item>
@@ -160,6 +163,16 @@ export default {
160 163
         this.queryLoading = false;
161 164
       })
162 165
     },
166
+    querySearch(queryString, cb) {
167
+      let partyAList = this.partyAList;
168
+      let results = queryString ? partyAList.filter(this.createFilter(queryString)) : partyAList;
169
+      cb(results)
170
+    },
171
+    createFilter(queryString) {
172
+      return (partyA) => {
173
+        return (partyA.partyAName.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
174
+      };
175
+    },
163 176
     // 取消按钮
164 177
     cancel() {
165 178
       this.open = false;

+ 27
- 18
oa-ui/src/views/flowable/form/projectProcess/addproject.vue Просмотреть файл

@@ -2,7 +2,7 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-03-18 11:00:04
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-09 14:29:14
5
+ * @LastEditTime: 2024-10-14 17:02:05
6 6
 -->
7 7
 <template>
8 8
   <div class="project-wrapper">
@@ -21,7 +21,9 @@
21 21
         <el-input v-model="addForm.projectName"></el-input>
22 22
       </el-form-item>
23 23
       <el-form-item label="项目类型:" prop="projectType">
24
-        <el-input v-model="addForm.projectType"></el-input>
24
+        <!-- <el-input v-model="addForm.projectType"></el-input> -->
25
+        <el-autocomplete clearable style="width: 400px;" v-model="addForm.projectType"
26
+          :fetch-suggestions="querySearchProjectType" placeholder="请输入关键词"></el-autocomplete>
25 27
       </el-form-item>
26 28
       <el-form-item label="项目级别:" prop="projectLevel">
27 29
         <el-radio v-model="addForm.projectLevel" label="0" border>一般项目</el-radio>
@@ -93,7 +95,7 @@
93 95
         <el-col :span="6" :xs="24" :offset="12">
94 96
           <el-form-item label="项目登记人:" prop="registrantUser">
95 97
             <span class="auditor"> {{ addForm.projectRegistrantUser ? addForm.projectRegistrantUser.nickName :
96
-      registrantUser }} </span>
98
+              registrantUser }} </span>
97 99
           </el-form-item>
98 100
         </el-col>
99 101
         <el-col :span="6">
@@ -120,7 +122,7 @@
120 122
 <script>
121 123
 import { parseTime } from "@/utils/ruoyi";
122 124
 import { mapGetters } from "vuex";
123
-import { listProject, getProject, addProject, updateProject, delProject, getProjectNmuber, sendMessage } from "@/api/oa/project/project";
125
+import { listProject, getProject, addProject, updateProject, delProject, getProjectNmuber, sendMessage, getProjectType } from "@/api/oa/project/project";
124 126
 import { listDept } from '@/api/system/dept'
125 127
 import { getUser } from "@/api/system/user";
126 128
 import { getUsersDeptLeaderByDept } from "@/api/system/post";
@@ -218,7 +220,8 @@ export default {
218 220
         },
219 221
       ],
220 222
       restaurants: [{ value: "中国电建集团成都勘测设计研究院有限公司勘测设计分公司" }],
221
-      registrantUser: ''
223
+      registrantUser: '',
224
+      projectTypeList: []
222 225
     };
223 226
   },
224 227
   created() {
@@ -226,6 +229,7 @@ export default {
226 229
     this.initProjectForm();
227 230
     this.getPartyAList();
228 231
     this.getDeptList();
232
+    this.getProjectTypeList();
229 233
     this.getContractDataList();
230 234
     if (this.$cache.local.get('contractId')) {
231 235
       const contractId = this.$cache.local.get('contractId')
@@ -253,6 +257,24 @@ export default {
253 257
         this.loading = false;
254 258
       });
255 259
     },
260
+    getProjectTypeList() {
261
+      getProjectType().then(res => {
262
+        if (res) {
263
+          this.projectTypeList = res.data;
264
+        }
265
+      })
266
+    },
267
+    querySearchProjectType(queryString, cb) {
268
+      let projectTypeList = this.projectTypeList;
269
+      let res1 = queryString ? projectTypeList.filter(this.createFilter(queryString)) : projectTypeList;
270
+      let res2 = res1.map(item => ({ value: item }));
271
+      cb(res2)
272
+    },
273
+    createFilter(queryString) {
274
+      return (projectType) => {
275
+        return (projectType.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
276
+      };
277
+    },
256 278
     getDeptList() {
257 279
       listDept({
258 280
         deptName: undefined,
@@ -482,19 +504,6 @@ export default {
482 504
         arr.splice(index, 1);
483 505
       }
484 506
     },
485
-    querySearch(queryString, cb) {
486
-      var restaurants = this.restaurants;
487
-      var results = queryString
488
-        ? restaurants.filter(this.createFilter(queryString))
489
-        : restaurants;
490
-      // 调用 callback 返回建议列表的数据
491
-      cb(results);
492
-    },
493
-    createFilter(queryString) {
494
-      return restaurant => {
495
-        return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
496
-      };
497
-    },
498 507
     setProjectDocument(val) {
499 508
       let arr = val.split('/upload')
500 509
       this.addForm.taskDocument = arr[1]

+ 293
- 0
oa-ui/src/views/statistics/components/contractStatistics.vue Просмотреть файл

@@ -0,0 +1,293 @@
1
+<template>
2
+  <div style="width:100%;" v-loading="loading">
3
+    <div class="titles">合同统计</div>
4
+    <div class="warpper">
5
+      <div class="left">
6
+        <!-- 每年合同额柱状图 -->
7
+        <div class="left-top" id="amountBar"></div>
8
+        <div class="left-bottom">
9
+          <div class="pie1" id="cwamountPie"></div>
10
+          <div class="pie2" id="cwSourcePie"></div>
11
+        </div>
12
+      </div>
13
+      <div class="middle">
14
+
15
+      </div>
16
+      <div class="right">
17
+
18
+      </div>
19
+    </div>
20
+  </div>
21
+</template>
22
+
23
+<script>
24
+import { ehcartsInit } from '@/utils/echarts'
25
+let amountChart, cwAmountChart, cwSourceChart
26
+export default {
27
+  props: {
28
+    datas: {
29
+      type: Object,
30
+      require: true,
31
+    }
32
+  },
33
+  data() {
34
+    return {
35
+      loading: true,
36
+      dataLoading: true,
37
+      contractAmount: {},
38
+      contractCwAmount: {},
39
+      contractSource: {},
40
+      contractYear: {},
41
+      subYear: 0,
42
+      sumAomunt: 0
43
+    }
44
+  },
45
+  mounted() {
46
+    this.initDatas();
47
+    this.initAmountBar();
48
+    this.initChartCwAomunt('');
49
+    this.initChartCwSource('');
50
+  },
51
+  methods: {
52
+    async initDatas() {
53
+      console.log(this.datas);
54
+      if (Object.keys(this.datas).length !== 0) {
55
+        this.contractAmount = this.datas.amount[0];
56
+        this.contractCwAmount = this.datas.cwAmount[0]
57
+        this.contractSource = this.datas.source[0]
58
+        this.contractYear = this.datas.year[0]
59
+        this.loading = false
60
+        let sum = Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0)
61
+        this.sumAomunt = (sum / 100000000).toFixed(4) + '亿元';
62
+      }
63
+    },
64
+    initAmountBar() {
65
+      let option = {
66
+        title: {
67
+          text: '各年合同额统计',
68
+          subtext: '共计合同额:' + Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
69
+            + '(约: ' + this.sumAomunt + ')'
70
+        },
71
+        grid: {
72
+          left: '1%',
73
+          right: '1%',
74
+          bottom: '0%',
75
+          height: '60%',
76
+          containLabel: true
77
+        },
78
+        graphic: [
79
+          {
80
+            type: 'text',
81
+            name: '',
82
+            right: '0',
83
+            top: '20%',
84
+            style: {
85
+              text: '全部年份',
86
+              fill: '#000', // 文本颜色  
87
+              fontSize: 12, // 文本大小  
88
+              fontWeight: '' // 文本粗细  
89
+            }
90
+          }
91
+        ],
92
+        tooltip: {
93
+          trigger: 'axis',
94
+          axisPointer: {
95
+            type: 'none',
96
+            label: {
97
+              backgroundColor: '#6a7985'
98
+            }
99
+          }
100
+        },
101
+        xAxis: {
102
+          name: '年',
103
+          type: 'category',
104
+          data: Object.keys(this.contractAmount),
105
+        },
106
+        yAxis: {
107
+          type: 'value',
108
+          name: '单位:元'
109
+        },
110
+        series: [
111
+          {
112
+            data: Object.values(this.contractAmount),
113
+            type: 'bar',
114
+            smooth: true,
115
+            label: {
116
+              show: true,
117
+              position: 'top',
118
+              formatter: function (params) {
119
+                var value = params.value;
120
+                if (value >= 100000000) {
121
+                  // 亿  
122
+                  return (value / 100000000).toFixed(4) + '亿';
123
+                } else {
124
+                  // 千万元  
125
+                  return (value / 10000000).toFixed(4) + '千万元';
126
+                }
127
+              }
128
+            },
129
+            itemStyle: {
130
+              color: '#1C3F95'
131
+            }
132
+          },
133
+          {
134
+            type: 'line',
135
+            data: Object.values(this.contractAmount),
136
+            smooth: true,
137
+            itemStyle: {
138
+              color: '#F89B30'
139
+            }
140
+          }
141
+        ]
142
+      };
143
+      let charts = ehcartsInit(amountChart, 'amountBar', option);
144
+    },
145
+    initChartCwAomunt(year) {
146
+      let option = {
147
+        title: {
148
+          text: year + '合同额分布情况',
149
+        },
150
+        tooltip: {
151
+          trigger: 'item',
152
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
153
+        },
154
+        legend: {
155
+          top: 'bottom'
156
+        },
157
+        series: [
158
+          {
159
+            name: '占比',
160
+            type: 'pie',
161
+            radius: '40%',
162
+            avoidLabelOverlap: false,
163
+            data: Object.entries(this.contractCwAmount).map(([key, value]) => {
164
+              return { name: key, value: value }
165
+            }),
166
+            emphasis: {
167
+              itemStyle: {
168
+                shadowBlur: 10,
169
+                shadowOffsetX: 0,
170
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
171
+              }
172
+            },
173
+            label: {
174
+              alignTo: 'none',
175
+              formatter: '{name|{b}}\n{value|{c}元}',
176
+              minMargin: 5,
177
+              edgeDistance: 8,
178
+              lineHeight: 15,
179
+              rich: {
180
+                time: {
181
+                  fontSize: 10,
182
+                  color: '#999'
183
+                }
184
+              }
185
+            },
186
+          }
187
+        ]
188
+      };
189
+      ehcartsInit(cwAmountChart, 'cwamountPie', option);
190
+    },
191
+    initChartCwSource(year) {
192
+      let option = {
193
+        title: {
194
+          text: year + '合同来源分布',
195
+        },
196
+        tooltip: {
197
+          trigger: 'item',
198
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
199
+        },
200
+        legend: {
201
+          top: 'bottom'
202
+        },
203
+        series: [
204
+          {
205
+            name: '占比',
206
+            type: 'pie',
207
+            radius: '40%',
208
+            avoidLabelOverlap: false,
209
+            data: Object.entries(this.contractSource).map(([key, value]) => {
210
+              return { name: key, value: value }
211
+            }),
212
+            emphasis: {
213
+              itemStyle: {
214
+                shadowBlur: 10,
215
+                shadowOffsetX: 0,
216
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
217
+              }
218
+            },
219
+            label: {
220
+              alignTo: 'none',
221
+              formatter: '{name|{b}}\n{value|{c}个}',
222
+              minMargin: 5,
223
+              edgeDistance: 8,
224
+              lineHeight: 15,
225
+              rich: {
226
+                time: {
227
+                  fontSize: 10,
228
+                  color: '#999'
229
+                }
230
+              }
231
+            },
232
+          }
233
+        ]
234
+      };
235
+      ehcartsInit(cwSourceChart, 'cwSourcePie', option);
236
+    },
237
+  }
238
+}
239
+</script>
240
+
241
+<style lang="scss" scoped>
242
+.titles {
243
+  font-family: 'puhuiti';
244
+  font-size: 16px;
245
+  margin-bottom: 16px;
246
+}
247
+
248
+.warpper {
249
+  width: 100%;
250
+  height: 100%;
251
+  display: flex;
252
+
253
+  .left {
254
+    flex: 1.5;
255
+
256
+    .left-top {
257
+      width: 100%;
258
+      height: 300px;
259
+      padding: 10px;
260
+      border: 1px solid #ececec;
261
+    }
262
+
263
+    .left-bottom {
264
+      width: 100%;
265
+      height: 300px;
266
+      padding: 10px;
267
+      display: flex;
268
+
269
+      .pie1 {
270
+        flex: 1.5;
271
+        height: 300px;
272
+        padding: 10px;
273
+        border: 1px solid #ececec;
274
+      }
275
+
276
+      .pie2 {
277
+        flex: 1;
278
+        height: 300px;
279
+        padding: 10px;
280
+        border: 1px solid #ececec;
281
+      }
282
+    }
283
+  }
284
+
285
+  .middle {
286
+    flex: 1;
287
+  }
288
+
289
+  .right {
290
+    flex: 1;
291
+  }
292
+}
293
+</style>

+ 28
- 10
oa-ui/src/views/statistics/components/projectStatistics.vue Просмотреть файл

@@ -2,16 +2,19 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-10-11 16:41:17
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-12 17:00:05
5
+ * @LastEditTime: 2024-10-14 15:16:36
6 6
 -->
7 7
 <template>
8 8
   <div style="width:100%;" v-loading="loading">
9 9
     <div class="titles">项目统计</div>
10 10
     <div class="warpper">
11 11
       <div class="left">
12
+        <!-- 年份项目柱状图 -->
12 13
         <div class="bar" id="yearNumber"></div>
13 14
         <div class="pie-box" v-loading="dataLoading">
15
+          <!-- 院内院外饼图 -->
14 16
           <div class="sourcePie" id="sourceNumber"></div>
17
+          <!-- 部门饼图 -->
15 18
           <div class="deptPie" id="deptNumber"></div>
16 19
         </div>
17 20
       </div>
@@ -30,6 +33,12 @@ import { disposeCharts, echartsSetoption, ehcartsInit } from '@/utils/echarts'
30 33
 import { getProjectStatistic } from '@/api/oa/project/project'
31 34
 let barYearChart, sourceChart, deptChart, typeChart
32 35
 export default {
36
+  props: {
37
+    datas: {
38
+      type: Object,
39
+      require: true,
40
+    }
41
+  },
33 42
   data() {
34 43
     return {
35 44
       year: {},
@@ -53,6 +62,15 @@ export default {
53 62
     },
54 63
     type() {
55 64
       this.initTypeBar(this.activeYear);
65
+    },
66
+    datas: {
67
+      handler(newVal) {
68
+        if (newVal) {
69
+          this.initDatas();
70
+        }
71
+      },
72
+      immediate: true,  // 在绑定时立即执行一次  
73
+      deep: true       // 深度监听对象的变化  
56 74
     }
57 75
   },
58 76
   created() {
@@ -64,19 +82,19 @@ export default {
64 82
   methods: {
65 83
     async initDatas() {
66 84
       this.loading = true;
67
-      let res = await getProjectStatistic();
68
-      if (res.data) {
69
-        this.year = res.data.year[0];
70
-        this.type = res.data.type[0];
71
-        this.source = res.data.source[0];
72
-        this.dept = res.data.dept[0];
85
+      if (Object.keys(this.datas).length !== 0) {
86
+        this.year = this.datas.year[0];
87
+        this.type = this.datas.type[0];
88
+        this.source = this.datas.source[0];
89
+        this.dept = this.datas.dept[0];
73 90
         this.loading = false;
74 91
       }
92
+
75 93
     },
76 94
     initChartBar() {
77 95
       let option = {
78 96
         title: {
79
-          text: '年项目个数统计',
97
+          text: '年项目个数统计',
80 98
           subtext: '共计项目:' + Object.values(this.year).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个'
81 99
         },
82 100
         grid: {
@@ -223,7 +241,7 @@ export default {
223 241
         legend: {
224 242
           bottom: '0',
225 243
           textStyle: {
226
-            fontSize: 9
244
+            fontSize: 12
227 245
           }
228 246
         },
229 247
         series: [
@@ -316,7 +334,7 @@ export default {
316 334
           type: 'category',
317 335
           data: Object.keys(this.type),
318 336
           axisLabel: {
319
-            fontSize: 9,
337
+            fontSize: 12,
320 338
             width: 50,
321 339
             overflow: 'truncate',
322 340
           }

+ 120
- 30
oa-ui/src/views/statistics/components/topHead.vue Просмотреть файл

@@ -16,18 +16,19 @@
16 16
           <div id="thisYear"></div>
17 17
         </div>
18 18
       </div>
19
-      <div class="two item-box">
19
+      <div class="two item-box" @click="$emit('handleClick', 'contract')">
20 20
         <div class="data-left">
21
-          <div class="data-title">2024项目总数</div>
22
-          <div class="number">{{ projectNum.toLocaleString('en-US') }}</div>
21
+          <div class="data-title">{{ thisYear }}年合同总数</div>
22
+          <div class="number">{{ contractNum.toLocaleString('en-US') }}</div>
23 23
           <div>
24 24
             <span class="text-1">较去年</span>
25
-            <span class="text-2" :class="{ upColor: isProjectUp, dowColor: !isProjectUp }">206</span>
26
-            <img :src="isProjectUp ? upImg : downImg" alt="">
25
+            <span class="text-2" :class="{ upColor: isContractUp, dowColor: !isContractUp }">{{ contractSubYear
26
+              }}</span>
27
+            <img :src="isContractUp ? upImg : downImg" alt="">
27 28
           </div>
28 29
         </div>
29 30
         <div class="chart-box">
30
-          <div id=""></div>
31
+          <div id="thisContract"></div>
31 32
         </div>
32 33
       </div>
33 34
       <div class="three item-box">
@@ -67,53 +68,88 @@ import upSrc from '@/assets/icons/up.png'
67 68
 import downSrc from '@/assets/icons/down.png'
68 69
 import * as echarts from 'echarts'
69 70
 import { disposeCharts, echartsSetoption, ehcartsInit } from '@/utils/echarts'
70
-import { getProjectStatistic } from '@/api/oa/project/project'
71
-import { getContractStatistic } from '@/api/oa/contract/contract'
72
-let thisYearChart
71
+let thisYearChart, contractYearChart
73 72
 export default {
73
+  props: {
74
+    pDatas: {
75
+      type: Object,
76
+      require: true,
77
+    },
78
+    cDatas: {
79
+      type: Object,
80
+      require: true,
81
+    }
82
+  },
74 83
   data() {
75 84
     return {
76
-      projectNum: 12345,
85
+      projectNum: 0,
86
+      contractNum: 0,
77 87
       upImg: upSrc,
78 88
       downImg: downSrc,
79 89
       isProjectUp: false,
90
+      isContractUp: false,
80 91
       thisYear: new Date().getFullYear(),
81 92
       year: {},
82 93
       type: {},
83 94
       source: {},
84 95
       dept: {},
96
+      contractAmount: {},
97
+      contractCwAmount: {},
98
+      contractSource: {},
99
+      contractYear: {},
85 100
       subYear: 0,
101
+      contractSubYear: 0,
86 102
       loading: true
87 103
     }
88 104
   },
89 105
   watch: {
90 106
     year() {
91 107
       this.initChartOne();
108
+    },
109
+    contractYear() {
110
+      this.initChartTwo();
111
+    },
112
+    pDatas: {
113
+      handler(newVal) {
114
+        if (newVal) {
115
+          this.initDatas();
116
+        }
117
+      },
118
+      immediate: true,  // 在绑定时立即执行一次  
119
+      deep: true       // 深度监听对象的变化  
120
+    },
121
+    cDatas: {
122
+      handler(newVal) {
123
+        if (newVal) {
124
+          this.initDatas();
125
+        }
126
+      },
127
+      immediate: true,  // 在绑定时立即执行一次  
128
+      deep: true       // 深度监听对象的变化  
92 129
     }
93 130
   },
94 131
   created() {
95
-    this.initDatas();
96 132
   },
97 133
   mounted() {
98
-    // this.initChartOne();
99 134
   },
100 135
   methods: {
101 136
     async initDatas() {
102 137
       this.loading = true
103
-      let res1 = await getProjectStatistic();
104
-      if (res1.data) {
105
-        this.year = res1.data.year[0];
106
-        this.type = res1.data.type[0];
107
-        this.source = res1.data.source[0];
108
-        this.dept = res1.data.dept[0];
109
-        // this.initChartOne();
138
+      if (Object.keys(this.pDatas).length !== 0) {
139
+        this.year = this.pDatas.year[0];
140
+        this.type = this.pDatas.type[0];
141
+        this.source = this.pDatas.source[0];
142
+        this.dept = this.pDatas.dept[0];
110 143
         this.getProjectYearSub(this.year);
111 144
       }
112
-      let res2 = await getContractStatistic();
113
-      if(res2.data){
114
-        console.log(res2.data);
115
-        
145
+      if (Object.keys(this.cDatas).length !== 0) {
146
+        this.contractAmount = this.cDatas.amount[0];
147
+        this.contractCwAmount = this.cDatas.cwAmount[0]
148
+        this.contractSource = this.cDatas.source[0]
149
+        this.contractYear = this.cDatas.year[0]
150
+        this.getContractYearSub(this.contractYear)
116 151
       }
152
+
117 153
       this.loading = false
118 154
     },
119 155
     initChartOne() {
@@ -155,6 +191,50 @@ export default {
155 191
       };
156 192
       ehcartsInit(thisYearChart, 'thisYear', option);
157 193
     },
194
+    initChartTwo() {
195
+      let option = {
196
+        grid: {
197
+          left: '1%',
198
+          right: '1%',
199
+          bottom: '0%',
200
+          height: '60%',
201
+          containLabel: true
202
+        },
203
+        tooltip: {
204
+          trigger: 'axis',
205
+          axisPointer: {
206
+            type: 'none',
207
+            label: {
208
+              backgroundColor: '#6a7985'
209
+            }
210
+          }
211
+        },
212
+        xAxis: {
213
+          type: 'category',
214
+          data: Object.keys(this.contractYear).slice(-6),
215
+          show: false
216
+        },
217
+        yAxis: {
218
+          type: 'value',
219
+          axisLabel: { show: false },
220
+          splitLine: { show: false }
221
+        },
222
+        series: [
223
+          {
224
+            min: 0,
225
+            data: Object.values(this.contractYear).slice(-6),
226
+            type: 'line',
227
+            smooth: true,
228
+            itemStyle: {
229
+              color: '#00B42A'
230
+            }
231
+          }
232
+        ]
233
+      };
234
+      console.log(1);
235
+
236
+      ehcartsInit(contractYearChart, 'thisContract', option);
237
+    },
158 238
     getProjectYearSub(year) {
159 239
       let arr = Object.values(year).slice(-2);
160 240
       this.subYear = Number(arr[1]) - Number(arr[0]);
@@ -165,7 +245,18 @@ export default {
165 245
       } else {
166 246
         this.isProjectUp = true
167 247
       }
168
-    }
248
+    },
249
+    getContractYearSub(year) {
250
+      let arr = Object.values(year).slice(-2);
251
+      this.contractSubYear = Number(arr[1]) - Number(arr[0]);
252
+      this.contractNum = Number(arr[1])
253
+      if (this.contractSubYear < 0) {
254
+        this.contractSubYear = - this.contractSubYear;
255
+        this.isContractUp = false
256
+      } else {
257
+        this.isContractUp = true
258
+      }
259
+    },
169 260
   },
170 261
 }
171 262
 </script>
@@ -227,14 +318,13 @@ export default {
227 318
 
228 319
   .chart-box {
229 320
     flex: 2;
230
-  }
231
-
232
-}
233 321
 
322
+    div {
323
+      width: 100%;
324
+      height: 100%;
325
+    }
326
+  }
234 327
 
235
-#thisYear {
236
-  width: 100%;
237
-  height: 100%;
238 328
 }
239 329
 
240 330
 .one {

+ 31
- 10
oa-ui/src/views/statistics/index.vue Просмотреть файл

@@ -2,36 +2,58 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-10-11 09:23:15
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-12 09:38:18
5
+ * @LastEditTime: 2024-10-14 10:48:03
6 6
 -->
7 7
 <template>
8 8
   <div class="app-container bg">
9 9
     <div class="head">
10
-      <top-head @handleClick="changeClick"></top-head>
10
+      <top-head @handleClick="changeClick" :pDatas="projectInfo" :cDatas="contractInfo"></top-head>
11 11
     </div>
12 12
     <div class="content">
13
-      <project-statistics v-if="isActive = 'project'"></project-statistics>
13
+      <project-statistics v-if="isActive == 'project'" :datas="projectInfo"></project-statistics>
14
+      <contract-statistics v-else-if="isActive == 'contract'" :datas="contractInfo"></contract-statistics>
14 15
     </div>
15 16
   </div>
16 17
 </template>
17 18
 
18 19
 <script>
19
-import ProjectStatistics from './components/projectStatistics.vue'
20
-import topHead from './components/topHead.vue'
20
+import { getProjectStatistic } from '@/api/oa/project/project'
21
+import { getContractStatistic } from '@/api/oa/contract/contract';
22
+import ProjectStatistics from './components/projectStatistics.vue';
23
+import contractStatistics from './components/contractStatistics.vue';
24
+import topHead from './components/topHead.vue';
21 25
 export default {
22
-  components: { topHead, ProjectStatistics },
26
+  components: { topHead, ProjectStatistics, contractStatistics },
23 27
   data() {
24 28
     return {
25
-      isActive: 'project'
29
+      isActive: 'project',
30
+      contractInfo: {},
31
+      projectInfo: {},
26 32
     }
27 33
   },
34
+  created() {
35
+    this.getProjectInfo();
36
+    this.getContractInfo();
37
+  },
28 38
   mounted() {
39
+
29 40
   },
30 41
   methods: {
42
+    async getProjectInfo() {
43
+      let res1 = await getProjectStatistic();
44
+      if (res1.data) {
45
+        this.projectInfo = res1.data
46
+
47
+      }
48
+    },
49
+    async getContractInfo() {
50
+      let res2 = await getContractStatistic();
51
+      if (res2.data) {
52
+        this.contractInfo = res2.data;
53
+      }
54
+    },
31 55
     changeClick(val) {
32 56
       this.isActive = val
33
-      console.log(val);
34
-
35 57
     }
36 58
   },
37 59
 }
@@ -56,5 +78,4 @@ export default {
56 78
   border-radius: 4px;
57 79
   padding: 20px;
58 80
 }
59
-
60 81
 </style>

Загрузка…
Отмена
Сохранить