See999 4 years ago
parent
commit
4b3218865a

+ 27 - 10
src/xt_pages/qcd/components/LineChart.vue View File

@@ -79,15 +79,22 @@ export default {
79 79
     this.chart = null;
80 80
   },
81 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 100
     chartData: {
@@ -99,9 +106,19 @@ export default {
99 106
   },
100 107
   created() {
101 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 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 122
     // setOptions({ expectedData, actualData } = {}) {
106 123
     //   this.chart.setOption({
107 124
     //     title: {

+ 63 - 92
src/xt_pages/qcd/treatmentControlAnalysis/components/TimeAll.vue View File

@@ -28,6 +28,7 @@
28 28
         align="right"
29 29
         format="yyyy-MM-dd"
30 30
         value-format="yyyy-MM-dd"
31
+        :picker-options="pickerOptions"
31 32
       ></el-date-picker>
32 33
       <span class>-</span>
33 34
       <el-date-picker
@@ -41,6 +42,7 @@
41 42
         align="right"
42 43
         format="yyyy-MM-dd"
43 44
         value-format="yyyy-MM-dd"
45
+        :picker-options="pickerOptions"
44 46
       ></el-date-picker>
45 47
     </div>
46 48
     <div class="tableTitle">统计图</div>
@@ -66,17 +68,13 @@
66 68
           :key="index"
67 69
         >
68 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 72
           </template>
75 73
         </el-table-column>
76 74
 
77 75
         <el-table-column
78 76
           fixed="right"
79
-          label="总数"
77
+          label="总数"
80 78
           width="80"
81 79
           property="total"
82 80
           align="center"
@@ -89,7 +87,7 @@
89 87
         @current-change="handleCurrentChange"
90 88
         :current-page="listQuery.page"
91 89
         :page-sizes="[20, 40, 60, 80,100]"
92
-        :page-size="20"
90
+        :page-size="10"
93 91
         background
94 92
         style="margin-top:20px;"
95 93
         layout="total, sizes, prev, pager, next, jumper"
@@ -124,16 +122,13 @@ export default {
124 122
         },
125 123
       ],
126 124
       chart: {
127
-        title: {
128
-          text: "ECharts 入门示例"
129
-        },
130 125
         tooltip: {},
131 126
         legend: {
132
-          data: ["次"],
127
+          data: ["次"],
133 128
           left: 0
134 129
         },
135 130
         xAxis: {
136
-          data: ["达标", "未达标"]
131
+          data: []
137 132
         },
138 133
         yAxis: {
139 134
           axisLabel: {
@@ -143,9 +138,9 @@ export default {
143 138
         },
144 139
         series: [
145 140
           {
146
-            name: "次",
141
+            name: "次",
147 142
             type: "bar",
148
-            data: ["78.57", "50"],
143
+            data: [],
149 144
             barWidth: 30,
150 145
             label: {
151 146
               normal: {
@@ -164,8 +159,14 @@ export default {
164 159
                   //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
165 160
                   var colorList = [
166 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 172
                   var index = params.dataIndex;
@@ -183,11 +184,11 @@ export default {
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,6 +208,12 @@ export default {
207 208
         xAxis: [],
208 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 219
   methods: {
@@ -250,16 +257,13 @@ export default {
250 257
       geStatistics(this.listQuery).then(response=>{
251 258
         if(response.data.state === 1){
252 259
           var dtd =  response.data.data.statistics
253
-         console.log("dtd",dtd)
254
-            var dd = {};
260
+          console.log("dtd",dtd)
261
+          var dd = {};
255 262
           for (const index in dtd) {
256 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 267
               dd[dtd[index].date][dtd[index].mode_id] = dtd[index];
264 268
             }
265 269
           }
@@ -278,78 +282,40 @@ export default {
278 282
                 dd[key][mkey] = {
279 283
                   mode: this.modeOptions[mkey].name,
280 284
                   mode_id: mkey,
281
-                  number: 0,
282
-                  date: key
285
+                  number: 0
283 286
                 };
284 287
               }
285 288
             }
286 289
             this.tableData.push({ date: key, data: dd[key], total: total });
287 290
           }
288 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 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,5 +375,10 @@ export default {
409 375
   .cell {
410 376
     text-align: center;
411 377
   }
378
+  .el-table{
379
+    ::-webkit-scrollbar{
380
+      height: 15px;
381
+    }
382
+  }
412 383
 }
413 384
 </style>