zhangyanpeng
2024-05-29 1f227a1cf627526701c652ba84bae3e430bba8d3
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
<!DOCTYPE html>
<html>
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>TOP20经销商业绩评估</title>
    </head>
 
    <body>
        <script type="text/javascript">
            var pageVue = null;
            function loadJsCss(callback) {
                var jscss_urls = [
                    {id: "js6", type: "js", url: "root/js/echarts.js"},
                    {id: "js7", type: "js", url: "root/js/calendar.js"},
                    {id: "js8", type: "js", url: "root/js/China.js"},
                ];
                window.top.initJsCss(document, jscss_urls, callback);
            }
        
            function initVue() {
                new ListVue({
                    el: "#hbody",
                    data: {
                        dataRequest: [],
                        dataRequestObj: {},
 
                        dataCharts: {
                            chart10:  [
                                [10.0, 8.04, 3363, '上海通泰慷医疗科技有限公司'],
                                [8.07, 6.95, 7379, '上海芷昉翙贸易商行'],
                                [13.0, 7.58, 32345, '长沙誉美医疗器械贸易有限公司'],
                                [9.05, 8.81, 3462, '吉安市吉州区双马商贸有限公司'],
                                [11.0, 8.33, 2526, '广州福源医疗科技有限公司'],
                                [14.0, 7.66, 6312, '湖南省国图医疗器械有限公司'],
                                [13.4, 6.81, 2123, '湖南省新皓泰源医疗器械有限公司'],
                                [10.0, 6.33, 12524, '湖南怡康医药物流有限公司'],
                                [14.0, 8.96, 4352, '自贡市一品堂商贸有限责任公司'],
                                [12.5, 6.82, 11111, '广州健茗医疗器械有限公司'],
                                [9.15, 7.2, 27378, '广州德汇同创医疗器械有限公司'],
                                [11.5, 7.2, 12210, '湖南成一贸易有限公司'],
                                [3.03, 4.23, 9999, '河南亚太医疗用品有限公司'],
                                [12.2, 7.83, 7897, '南宁市纳良医疗器械有限公司'],
                                [2.02, 4.47, 7163, '湖南博尔特医疗科技有限公司'],
                                [1.05, 3.33, 1436, '广州瑞晖医疗科技有限公司'],
                                [4.05, 4.96, 16282, '江苏中和泰药品有限公司'],
                            ],
                        },
                        tableFields_nonActive: [
                            {isshow: "T",field: "customer_name",name: "经销商名称",width: "200",align: "left",isminwidth: true},
                            {isshow: "T",field: "YTD_Target",name: "YTD Shipment Target",width: "100"},
                            {isshow: "T",field: "YTD_Actual",name: "YTD Shipment Actual",width: "100"},
                            {isshow: "T",field: "PTQ",name: "PTQ",width: "100"},
                            {isshow: "T",field: "YoY_Growth",name: "YoY Growth",width: "100"},
                            {isshow: "T",field: "cover",name: "医院覆盖",width: "100"},
                        ],
                        tableData_nonActive: [
                            {
                                customer_name: '山东瑞康德一医疗器械有限公司',
                                YTD_Target: '4.2',
                                YTD_Actual: '3.1',
                                PTQ: '83.9',
                                YoY_Growth: '-5.0',
                                cover: '1',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '99.0',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '72.0',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '100',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '92.0',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '72.0',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '72.0',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                            {
                                customer_name: '上海嘉事嘉意医疗器材有限公司',
                                YTD_Target: '4.8',
                                YTD_Actual: '3.6',
                                PTQ: '72.0',
                                YoY_Growth: '3.0',
                                cover: '2',
                            },
                        ],
                        //Area
                        options_area: [
                            {
                                value: 'East',
                                label: '东区'
                            },
                            {
                                value: 'West',
                                label: '西区'
                            },
                            {
                                value: 'South',
                                label: '南区'
                            },
                            {
                                value: 'North',
                                label: '北区'
                            },
                            {
                                value: 'Middle',
                                label: '中区'
                            },
                        ],
                        value_area: '',
                        //Province
                        options_province: [
                            
                        ],
                        value_province: '',
                        tablefieldClick: {},
 
                    },
 
                    created() {
                        var me = this;
 
                    },
                
                    mounted() {
                        var me = this;
                        //预加载数据
                        if (this.dataRequest && this.dataRequest.length) {
                            var result = {};
                            this.loadRequestData(this.dataRequest, result, function(data) {
                                me.dataRequestObj = data;
                                
                            });
                        }
 
                        me.$nextTick(() => {
                            hideLoading();
                            let clientHeight = document.documentElement.clientHeight;
                            me.initData();
                        })
                    },
 
                    methods: {
                        initData() {
                            var me = this;
                            this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
                                // if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
                                //     var metas = clone(result.meta[me.dataname].fields);
                                //     var filterFields_ = [];
                                //     var tableFields_ = [];
                                    
                                //     metas.map(f=>{
                                //         f.isshow = "T";
                                //         if (f.isfilter) {
                                //             filterFields_.push(clone(f));
                                //         }
                                //         else {
                                //             var filter_f = clone(f);
                                //             filter_f.isshow = "F";
                                //             filterFields_.push(filter_f);
                                //         }
                                //         tableFields_.push(clone(f));
                                //     })
                                //     if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
                                //         me.filterFields = clone(filterFields_);
                                //         me.tableFields = clone(tableFields_);
                                        
                                        // //字段数组转字段obj,目的为了筛选时获取字段属性
                                        // me.fieldsToFieldsObj();
                                        
                                        // //设置字段事件
                                        // me.tableFieldClick();
                                //     }
                                // }
                                
                                // if (callback) {
                                //     callback();
                                // }
                            });
                            //字段数组转字段obj,目的为了筛选时获取字段属性
                            me.fieldsToFieldsObj();
                            //设置字段事件
                            me.tableFieldClick();
 
                            me.chart10();
                        },
 
                        filter() {
                            var me = this;
                            console.log("filter area", me.value_area);
                            console.log("filter province", me.value_province);
                        },
 
                        tableFieldClick() {
                            var me = this;
 
                            //表格字段事件设置
                            this.tablefieldClick = {
                                PTQ: {//字段事件设置
                                    prefixclass: {
                                        setclass: function(row, field){
                                            // 根据逻辑返回class名称
                                            console.log(row);
                                            if (row.PTQ * 1 >= 90) {
                                                return "prefixclass";
                                            } else {
                                                return 'whitefixclass';
                                            }
                                        }
                                    },
                                },
                            };
                        },
 
                        domColor(dataIndex) {
                            const newAry = [];
                            for (let k = 0; k < 20; k++) {
                                const r = Math.floor(Math.random() * 256);
                                const g = Math.floor(Math.random() * 256);
                                const b = Math.floor(Math.random() * 256);
                                newAry.push(`rgb(${r}, ${g}, ${b})`);
                            }
                            return newAry[dataIndex];
                        },
 
                        //Top20 经销商业绩评估
                        chart10() {
                            var d10 = document.getElementById("ct10");
                            var c10 = echarts.init(d10);
                            // var COLOR_ALL = [
                            //   "#37A2DA",
                            //   "#e06343",
                            //   "#37a354",
                            //   "#b55dba",
                            //   "#b5bd48",
                            //   "#8378EA",
                            //   "#96BFFF",
                            // ];
                            var o10 = {
                                title: {
                                    text: "Top20 经销商业绩评估",
                                    show: false,
                                },
                                xAxis: {
                                    name: "YTD Achievement"
                                },
                                yAxis: {
                                    name: "YTD Growth"
                                },
                                series: [
                                    {
                                        symbolSize: function (data) {
                                            return Math.sqrt(data[2]) / 2;
                                        },
                                        data: this.dataCharts.chart10,
                                        type: "scatter",
                                        label: {
                                            show: true,
                                            formatter: function (param) {
                                                return param.data[2];
                                            },
                                            color: "black",
                                        },
                                        emphasis: {
                                            focus: "series",
                                            label: {
                                                show: true,
                                                formatter: function (param) {
                                                return param.data[3] + "\n" + param.data[2];
                                                },
                                                // position: "top",
                                            },
                                        },
                                        itemStyle: {
                                            shadowBlur: 10,
                                            shadowColor: "rgba(120, 36, 50, 0.5)",
                                            shadowOffsetY: 5,
                                            color: (e) => {
                                                return this.domColor(e.dataIndex);
                                            }
                                        },
                                    },
                                ],
                            };
                            c10.setOption(o10);
                        },
                    },
                });
            };
 
            loadJsCss(function() {
                initVue();
            });
        </script>
 
        <style>
            [v-cloak] {
                display: none !important;
            }
 
            .v_main {
                background:linear-gradient(rgba(246, 247, 248, 0.878), rgba(170, 207, 243, 0.785));
                background-size: contain;
                background-position: bottom left; 
            }
            
            .prefixclass {
                width: 10px;
                height: 10px;
                border-radius: 5px;
                background-color: #087e13;
                display: inline-block;
            }
 
            .whitefixclass {
                width: 10px;
                height: 10px;
                border-radius: 5px;
                display: inline-block;
            }
 
            .selectors {
                display: flex;
                align-items: center;
                 justify-content: space-around;
            }
            .selectors el-select {
                flex: 1;
            }
 
            .charts {
                width: 100%;
                height: 85%;
                display: flex;
                /* 只要您把这个属性去掉,就不会自动换行了 */
                flex-wrap: wrap;
                justify-content: space-around;
                /* padding-bottom: 10%; */
            }
 
            .chart {
                height: 100%;
                /* background: #d7e3e1; */
                margin-top: 2%;
            }
        </style>
 
        <div v-cloak id="hbody" class="h_body" style="margin: 0;padding: 0;">
            <div id="page_root" ref="ref_main" class="v_main" style="padding: 0px 0px 0px 10px">
                <div style="width: 100%; height: 100%; overflow-y: hidden;">
                    <div>
                        <h3 style="font-weight: 600;color: #045c24;text-align: center;">TOP20经销商业绩评估</h3>
                    </div>
 
                    <div class="selectors">
                        <el-select 
                            placeholder="Area"
                            v-model="value_area" 
                            clearable 
                            @change="filter"
                            >
                            <el-option
                                v-for="item in options_area"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value"
                                >
                            </el-option>
                        </el-select>
                        <el-select 
                            placeholder="Province"
                            v-model="value_province" 
                            clearable 
                            @change="filter"
                            >
                            <el-option
                                v-for="item in options_province"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value"
                                >
                            </el-option>
                        </el-select>
                    </div>
 
                    <div class="charts">
                        <div class="chart" style="width: 60%">
                            <h-table
                                v-if="tableFields_nonActive"
                                ref="table_nonActive"
                                :table-fields="tableFields_nonActive" 
                                :table-data="tableData_nonActive" 
                                :is-show-index="true"
 
                                :table-field-click="tablefieldClick"
                                >
                            </h-table>
                        </div>
 
                        <div class="chart" style="width: 40%">
                            <div id = "ct10" style = "width: 100%; height: 100%;" ></div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
                <div class="spinner">
                  <div class="cube1"></div>
                  <div class="cube2"></div>
                </div>
            </div>
        </div>
    </body>
</html>