See999 5 年前
父节点
当前提交
4b3218865a
共有 2 个文件被更改,包括 90 次插入102 次删除
  1. 27 10
      src/xt_pages/qcd/components/LineChart.vue
  2. 63 92
      src/xt_pages/qcd/treatmentControlAnalysis/components/TimeAll.vue

+ 27 - 10
src/xt_pages/qcd/components/LineChart.vue 查看文件

79
     this.chart = null;
79
     this.chart = null;
80
   },
80
   },
81
   watch: {
81
   watch: {
82
-    options: function() {
83
-      this.chartOptions = this.options;
84
-      this.initChart();
85
-      this.__resizeHanlder = debounce(() => {
86
-        if (this.chart) {
87
-          this.chart.resize();
88
-        }
89
-      }, 100);
90
-      window.addEventListener("resize", this.__resizeHanlder);
82
+    // options: function(a) {
83
+    //   console.log(a)
84
+    //   this.chartOptions = this.options;
85
+    //   this.initChart();
86
+    //   this.__resizeHanlder = debounce(() => {
87
+    //     if (this.chart) {
88
+    //       this.chart.resize();
89
+    //     }
90
+    //   }, 100);
91
+    //   window.addEventListener("resize", this.__resizeHanlder);
92
+    // },
93
+    options:{
94
+      handler(newValue,oldValue){
95
+        this.getInitChart();
96
+      },
97
+      deep:true
91
     },
98
     },
92
 
99
 
93
     chartData: {
100
     chartData: {
99
   },
106
   },
100
   created() {
107
   created() {
101
     this.chartOptions = this.options;
108
     this.chartOptions = this.options;
102
-    console.log("this.chartOptions", this.chartOptions, this.options);
109
+    // console.log("this.chartOptions", this.chartOptions, this.options);
103
   },
110
   },
104
   methods: {
111
   methods: {
112
+    getInitChart() {
113
+      this.chartOptions = this.options;
114
+      this.initChart();
115
+      this.__resizeHanlder = debounce(() => {
116
+        if (this.chart) {
117
+          this.chart.resize();
118
+        }
119
+      }, 100);
120
+      window.addEventListener("resize", this.__resizeHanlder);
121
+    },
105
     // setOptions({ expectedData, actualData } = {}) {
122
     // setOptions({ expectedData, actualData } = {}) {
106
     //   this.chart.setOption({
123
     //   this.chart.setOption({
107
     //     title: {
124
     //     title: {

+ 63 - 92
src/xt_pages/qcd/treatmentControlAnalysis/components/TimeAll.vue 查看文件

28
         align="right"
28
         align="right"
29
         format="yyyy-MM-dd"
29
         format="yyyy-MM-dd"
30
         value-format="yyyy-MM-dd"
30
         value-format="yyyy-MM-dd"
31
+        :picker-options="pickerOptions"
31
       ></el-date-picker>
32
       ></el-date-picker>
32
       <span class>-</span>
33
       <span class>-</span>
33
       <el-date-picker
34
       <el-date-picker
41
         align="right"
42
         align="right"
42
         format="yyyy-MM-dd"
43
         format="yyyy-MM-dd"
43
         value-format="yyyy-MM-dd"
44
         value-format="yyyy-MM-dd"
45
+        :picker-options="pickerOptions"
44
       ></el-date-picker>
46
       ></el-date-picker>
45
     </div>
47
     </div>
46
     <div class="tableTitle">统计图</div>
48
     <div class="tableTitle">统计图</div>
66
           :key="index"
68
           :key="index"
67
         >
69
         >
68
           <template slot-scope="scope">
70
           <template slot-scope="scope">
69
-            {{
70
-              scope.row.data[modeItem.id].number
71
-                ? scope.row.data[modeItem.id].number
72
-                : ""
73
-            }}
71
+            {{ scope.row.data[modeItem.id].number ? scope.row.data[modeItem.id].number : "" }}
74
           </template>
72
           </template>
75
         </el-table-column>
73
         </el-table-column>
76
 
74
 
77
         <el-table-column
75
         <el-table-column
78
           fixed="right"
76
           fixed="right"
79
-          label="总数"
77
+          label="总数"
80
           width="80"
78
           width="80"
81
           property="total"
79
           property="total"
82
           align="center"
80
           align="center"
89
         @current-change="handleCurrentChange"
87
         @current-change="handleCurrentChange"
90
         :current-page="listQuery.page"
88
         :current-page="listQuery.page"
91
         :page-sizes="[20, 40, 60, 80,100]"
89
         :page-sizes="[20, 40, 60, 80,100]"
92
-        :page-size="20"
90
+        :page-size="10"
93
         background
91
         background
94
         style="margin-top:20px;"
92
         style="margin-top:20px;"
95
         layout="total, sizes, prev, pager, next, jumper"
93
         layout="total, sizes, prev, pager, next, jumper"
124
         },
122
         },
125
       ],
123
       ],
126
       chart: {
124
       chart: {
127
-        title: {
128
-          text: "ECharts 入门示例"
129
-        },
130
         tooltip: {},
125
         tooltip: {},
131
         legend: {
126
         legend: {
132
-          data: ["次"],
127
+          data: ["次"],
133
           left: 0
128
           left: 0
134
         },
129
         },
135
         xAxis: {
130
         xAxis: {
136
-          data: ["达标", "未达标"]
131
+          data: []
137
         },
132
         },
138
         yAxis: {
133
         yAxis: {
139
           axisLabel: {
134
           axisLabel: {
143
         },
138
         },
144
         series: [
139
         series: [
145
           {
140
           {
146
-            name: "次",
141
+            name: "次",
147
             type: "bar",
142
             type: "bar",
148
-            data: ["78.57", "50"],
143
+            data: [],
149
             barWidth: 30,
144
             barWidth: 30,
150
             label: {
145
             label: {
151
               normal: {
146
               normal: {
164
                   //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
159
                   //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
165
                   var colorList = [
160
                   var colorList = [
166
                     ["#A9E0F3", "#9FBDFC"],
161
                     ["#A9E0F3", "#9FBDFC"],
167
-
168
-                    ["#FFD7C0", "#FF9994"]
162
+                    ["#A9E0F3", "#9FBDFC"],
163
+                    ["#A9E0F3", "#9FBDFC"],
164
+                    ["#FFD7C0", "#FF9994"],
165
+                    ["#FFD7C0", "#FF9994"],
166
+                    ["#FFD7C0", "#FF9994"],
167
+                    ["#D7C3FD", "#B3A8F7"],
168
+                    ["#D7C3FD", "#B3A8F7"],
169
+                    ["#D7C3FD", "#B3A8F7"]
169
                   ];
170
                   ];
170
 
171
 
171
                   var index = params.dataIndex;
172
                   var index = params.dataIndex;
183
               },
184
               },
184
 
185
 
185
               //鼠标悬停时:
186
               //鼠标悬停时:
186
-              emphasis: {
187
-                shadowBlur: 10,
188
-                shadowOffsetX: 0,
189
-                shadowColor: "rgba(0, 0, 0, 0.5)"
190
-              }
187
+              // emphasis: {
188
+              //   shadowBlur: 10,
189
+              //   shadowOffsetX: 0,
190
+              //   shadowColor: "rgba(0, 0, 0, 0.5)"
191
+              // }
191
             }
192
             }
192
           }
193
           }
193
         ]
194
         ]
207
         xAxis: [],
208
         xAxis: [],
208
         series: []
209
         series: []
209
       },
210
       },
211
+      pickerOptions: {
212
+        disabledDate(time) {
213
+          let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
214
+          return time.getTime() > Date.now() || time.getTime() < threeMonths;;
215
+        }
216
+      }, 
210
     };
217
     };
211
   },
218
   },
212
   methods: {
219
   methods: {
250
       geStatistics(this.listQuery).then(response=>{
257
       geStatistics(this.listQuery).then(response=>{
251
         if(response.data.state === 1){
258
         if(response.data.state === 1){
252
           var dtd =  response.data.data.statistics
259
           var dtd =  response.data.data.statistics
253
-         console.log("dtd",dtd)
254
-            var dd = {};
260
+          console.log("dtd",dtd)
261
+          var dd = {};
255
           for (const index in dtd) {
262
           for (const index in dtd) {
256
             if (!(dtd[index].date in dd)) {
263
             if (!(dtd[index].date in dd)) {
257
-              dd[dtd[index].date] = {};
264
+               dd[dtd[index].date] = {};
258
             }
265
             }
259
-            if (
260
-              !(dtd[index].mode_id in dd[dtd[index].date]) &&
261
-              dtd[index].mode_id != "0"
262
-            ) {
266
+            if (!(dtd[index].mode_id in dd[dtd[index].date]) && dtd[index].mode_id != "0") {
263
               dd[dtd[index].date][dtd[index].mode_id] = dtd[index];
267
               dd[dtd[index].date][dtd[index].mode_id] = dtd[index];
264
             }
268
             }
265
           }
269
           }
278
                 dd[key][mkey] = {
282
                 dd[key][mkey] = {
279
                   mode: this.modeOptions[mkey].name,
283
                   mode: this.modeOptions[mkey].name,
280
                   mode_id: mkey,
284
                   mode_id: mkey,
281
-                  number: 0,
282
-                  date: key
285
+                  number: 0
283
                 };
286
                 };
284
               }
287
               }
285
             }
288
             }
286
             this.tableData.push({ date: key, data: dd[key], total: total });
289
             this.tableData.push({ date: key, data: dd[key], total: total });
287
           }
290
           }
288
           var ttd = response.data.data.ttd
291
           var ttd = response.data.data.ttd
289
-         console.log("ttd",ttd)
290
-         // for(let i=0;i<ttd.length;i++){
291
-         //    if(ttd[i].mode_id == "1"){
292
-         //       ttd[i].mode_id == "HD"
293
-         //    }
294
-         //     if(ttd[i].mode_id == "2"){
295
-         //       ttd[i].mode_id == "HDF"
296
-         //    }
297
-         //     if(ttd[i].mode_id == "3"){
298
-         //       ttd[i].mode_id == "HD+HP"
299
-         //    }
300
-         //     if(ttd[i].mode_id == "4"){
301
-         //       ttd[i].mode_id == "HP"
302
-         //    }
303
-         //     if(ttd[i].mode_id == "5"){
304
-         //       ttd[i].mode_id == "HF"
305
-         //    }
306
-         //     if(ttd[i].mode_id == "6"){
307
-         //       ttd[i].mode_id == "SCUF"
308
-         //    }
309
-         //     if(ttd[i].mode_id == "7"){
310
-         //       ttd[i].mode_id == "IUF"
311
-         //    }
312
-         //     if(ttd[i].mode_id == "8"){
313
-         //       ttd[i].mode_id == "HFHD"
314
-         //    }
315
-         //     if(ttd[i].mode_id == "9"){
316
-         //       ttd[i].mode_id == "HFHD+HP"
317
-         //    }
318
-         //     if(ttd[i].mode_id == "10"){
319
-         //       ttd[i].mode_id == "PHF"
320
-         //    }
321
-         //     if(ttd[i].mode_id == "11"){
322
-         //       ttd[i].mode_id == "HFR"
323
-         //    }
324
-         //     if(ttd[i].mode_id == "12"){
325
-         //       ttd[i].mode_id == "HDF+HP"
326
-         //    }
327
-         //    if(ttd[i].mode_id == "13"){
328
-         //       ttd[i].mode_id == "CRRT"
329
-         //    }
330
-         //      if(ttd[i].mode_id == "14"){
331
-         //       ttd[i].mode_id == "腹水回输"
332
-         //    }
333
-         //      if(ttd[i].mode_id == "15"){
334
-         //       ttd[i].mode_id == "HD前置换"
335
-         //    }
336
-         //      if(ttd[i].mode_id == "16"){
337
-         //       ttd[i].mode_id == "HD后置换"
338
-         //    }
339
-         //      if(ttd[i].mode_id == "17"){
340
-         //       ttd[i].mode_id == "HDF前置换"
341
-         //    }
342
-         //      if(ttd[i].mode_id == "18"){
343
-         //       ttd[i].mode_id == "HDF后置换"
344
-         //    }
345
-         //
346
-         //      if(ttd[i].mode_id == "19"){
347
-         //       ttd[i].mode_id == IUF+HD
348
-         //    }
349
-        // }
292
+          console.log("ttd",ttd)
293
+          var modeMap = {};
294
+          var batotal = 0;
295
+          for (const index in ttd) {
296
+            if (ttd[index].mode_id == "0") {
297
+              continue;
298
+            }
299
+            modeMap[ttd[index].mode_id] = ttd[index];
300
+          }
301
+          console.log(111,modeMap)
302
+          for (const key in this.modeOptions) {
303
+            this.modesData.xAxis.push(this.modeOptions[key].name);
304
+            if (key in modeMap) {
305
+              this.modesData.series.push(parseInt(modeMap[key].number));
306
+              batotal += parseInt(modeMap[key].number);
307
+            } else {
308
+              this.modesData.series.push(0);
309
+            }
310
+          }
311
+          
312
+          this.chart.series[0].data = this.modesData.series
313
+          this.chart.xAxis.data = this.modesData.xAxis
314
+          console.log(this.chart.series[0].data)
315
+          console.log(this.chart.xAxis.data)
350
 
316
 
351
           this.total =  response.data.data.total
317
           this.total =  response.data.data.total
352
-           console.log("total",this.total)
318
+          console.log("total",this.total)
353
 
319
 
354
         }
320
         }
355
       })
321
       })
409
   .cell {
375
   .cell {
410
     text-align: center;
376
     text-align: center;
411
   }
377
   }
378
+  .el-table{
379
+    ::-webkit-scrollbar{
380
+      height: 15px;
381
+    }
382
+  }
412
 }
383
 }
413
 </style>
384
 </style>