hailu
2023-11-23 204cae9df06661ef0013cb64510777ed997cd8d3
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
<template>
    <div>
        <Card style="margin-top: 3px" v-if="tableList.length>0">
            <div ref="conversion" :style="{ width: '100%', height: '500px' }"></div>
        </Card>
 
        <Card style="margin-top: 3px">
            <div class="rentScrollOut" style="margin-top: 12px">
                <Table border :columns="tableListColumns" :data="tableList" :loading="loading" max-height="600">
                    <!-- <template slot="action" slot-scope="params">
                                <Tooltip content="查看" class="tableActionMargin" theme="light" transfer max-width="200"
                                    placement="top">
                                    <Icon custom="custom custom-chakan" size="18"
                                        :class="defaultassetsmode ? 'disabledIcon' : 'actionIcon'"
                                        @click="checkRentclick(params.row)" />
                                </Tooltip>
                            </template> -->
                </Table>
                <div style="margin-top: 12px">
                    <Page :current="pageIndex" :total="TotalItems" :page-size="pageSize" style="text-align: right"
                        @on-change="changePageIndex" show-elevator />
                </div>
            </div>
        </Card>
 
    </div>
</template>
 
<script>
import * as echarts from 'echarts';
import axios from '@/libs/api.request'
export default {
    data() {
        return {
            pageIndex: 1,
            TotalItems: 0,
            pageSize: 10,
            tableList: [],
            orderByFieldName: '',
            loading: false
        }
    },
 
    mounted() {
        this.GetJqjzList()
    },
    methods: {
        //获取表格数据
        GetJqjzList() {
            this.loading = true
            let data = {
                pageIndex: this.pageIndex,
                pageSize: this.pageSize,
                orderByFieldName: this.orderByFieldName,
                orderByType: 'desc'
            }
            axios.request({
                url: 'Rcy/GetJqjzPage',
                method: 'POST',
                data: data
            }).then((res) => {
                if (res.data.Check) {
                    console.log(res.data);
                    this.tableList = res.data.Data.Items
                    this.TotalItems = res.data.Data.TotalItems
                    this.loading = false
                    setTimeout(() => {
                        this.getCharts()
                    }, 100);
                    
                } else {
                    this.tableList = []
                    this.TotalItems = 0
                    this.loading = false
                }
 
            }).catch((err) => {
                this.tableList = []
                this.TotalItems = 0
                this.loading = false
                console.log(err);
            })
 
        },
        getCharts() {
            let data = []
            let colors = [
                '#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896',
                '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7',
                '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'
            ];
            for (let i = 0; i < this.tableList.length; i++) {
                let arr = []
                arr.push(this.tableList[i].Zml)
                arr.push(this.tableList[i].Zmlzs)
                arr.push(this.tableList[i].Zsr)
                arr.push(colors[i])
                arr.push(this.tableList[i].Cymc)
                data.push(arr)
            }
            var schema = [
                { name: 'date', index: 0, text: '农业产品' },
                { name: 'Zml', index: 1, text: '产品总毛利(亿元)' },
                { name: 'Zmlzs', index: 2, text: '总毛利增速(%)' },
                { name: 'Zsr', index: 3, text: '产品总收入(亿元)' },
            ];
 
            var itemStyle = {
                //设置圆形的样式
                shadowBlur: 10,
                shadowColor: function (e) {
                    console.log(e);
                    return 'rgba(0, 0, 0, 0.5)'
                },
                shadowOffsetY: 15,
            };
            let myChart = this.$echarts.init(this.$refs.conversion);
            myChart.setOption({
 
                // color: [
                //     '#dd4444', '#fec42c', '#80F1BE'
                // ],
                legend: {
                    itemHeight: 9,//改变圆圈大小
                    //改变圆形的位置 当前为底部
                    bottom: 0,
                    data: ['产业链-景气矩阵'],
                    //文字显示的颜色和字体大小 
                    textStyle: {
                        color: 'black',
                        fontSize: 16
                    }
                },
                grid: {
                    left: '10%',
                    right: 150,
                    top: '18%',
                    bottom: '13%'
                },
                tooltip: {
                    //十字线
                    axisPointer: {
                        type: 'cross'
                    },
                    padding: 10,
                    backgroundColor: '#222',
                    borderColor: '#777',
                    borderWidth: 1,
                    //设置tooltip的显示内容
                    formatter: function (obj) {
                        var value = obj.value;
                        return '<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 18px;padding-bottom: 7px;margin-bottom: 7px">'
                            +  value[4] + '<br>'
                            + '</div>'
                            + schema[1].text + ':' + value[0] + '<br>'
                            + schema[2].text + ':' + value[1] + '<br>'
                            + schema[3].text + ':' + value[2] + '<br>'
                            ;
                    }
                },
                xAxis: {
                    type: 'value',
                    name: '产品总毛利(亿元)',
                    show: true,
                    nameLocation: 'end',
                    nameGap: 16,
                    nameTextStyle: {
                        // color: '#fff',
                        fontSize: 14
                    },
                    splitLine: {
                        show: false
                    },
 
                },
                yAxis: {
                    type: 'value',
                    name: '总毛利增速(%)',
                    nameLocation: 'end',
                    nameGap: 20,
                    nameTextStyle: {
                        // color: '#fff',
                        fontSize: 16
                    },
                    splitLine: {
                        show: false
                    }
                },
                series: [
                    {
                        name: '产业链-景气矩阵',
                        data: data,
 
                        type: 'scatter',
                        itemStyle: {
                            color: function (params) {
                                return params.data[3];
                            }
                        },
                        symbolSize: (rawValue, params) => {
                            rawValue.symbolSize = rawValue[1] > 100 ? 100 : 50;
                            return rawValue.symbolSize
                        },
                    },
                ]
            })
        }
        ,
        changePageIndex(e) {
            this.pageIndex = e
            this.GetJqjzList()
        }
 
    },
    watch: {
        conversionOption: {
            handler(newVal, oldVal) {
                if (this.conversionChart) {
                    // 如何有变化 就获取最新的数据 并且渲染
                    this.conversionChart.setOption(newVal);
                } else {
                    // 如何无变化 还是老数据
                    this.conversionChart.setOption(oldVal);
                }
            },
            deep: true,
        },
    },
    computed: {
        tableListColumns() {
            let columns = []
 
            columns.push({
                title: '序号',
                key: 'Id',
                render: (h, params) => {
                    return h('span', params.index + this.pageIndex * 10 - 9)
                },
                width: 80,
                align: 'center',
                fixed: 'left'
            })
            columns.push({
                title: '产业名称',
                key: 'Cymc',
                align: 'center',
                minWidth: 150,
                render: (h, params) => {
                    return h('span', params.row.Cymc ? params.row.Cymc : '--')
                }
            })
            columns.push({
                title: '上下游',
                key: 'Sxy',
                align: 'center',
                minWidth: 150,
                render: (h, params) => {
                    return h('span', params.row.Sxy ? params.row.Sxy : '--')
                }
            })
            columns.push({
                title: '产品总毛利(亿元)',
                key: 'Zml',
                align: 'center',
                minWidth: 150,
                render: (h, params) => {
                    return h('span', params.row.Zml ? this.CustomMethods.numTo$(params.row.Zml) : '--')
                }
            })
            columns.push({
                title: '总毛利增速(%)',
                key: 'Zmlzs',
                align: 'center',
                minWidth: 150,
                render: (h, params) => {
                    return h('span', params.row.Zmlzs ? this.CustomMethods.numTo$(params.row.Zmlzs) : '--')
                }
            })
            columns.push({
                title: '产品总收入(亿元)',
                key: 'Zsr',
                align: 'center',
                minWidth: 150,
                render: (h, params) => {
                    return h('span', params.row.Zsr ? this.CustomMethods.numTo$(params.row.Zsr) : '--')
                }
            })
            columns.push({
                title: '上市公司家数',
                key: 'Ssgssl',
                align: 'center',
                minWidth: 150,
                render: (h, params) => {
                    return h('span', params.row.Ssgssl ? this.CustomMethods.numTo$(params.row.Ssgssl,0) : '--')
                }
            })
            return columns
        },
 
    }
 
 
}
</script>
 
<style lang="less" scoped></style>