123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529 |
- <template>
- <div>
- <el-container>
- <el-main>
- <el-row>
- <el-col span="12" offset="6" style="border: #b11116 solid 1px;padding: 15px">
- <el-row>
- <el-col span="24" style="text-align: center">
- <h3>中国招投标公共服务平台爬虫</h3>
- <h5>https://ctbpsp.com/</h5>
- </el-col>
- <el-col span="8" style="text-align: center">
- 爬取总数: <span v-html="allCount"></span>
- <div id="allCount"></div>
- </el-col>
- <el-col span="8" style="text-align: center">
- 招标公告:<span v-html="zbCount"></span>
- <div id="ZBCount"></div>
- </el-col>
- <el-col span="8" style="text-align: center">
- 中标结果公示:<span v-html="jgCount"></span>
- <div id="JGCount"></div>
- </el-col>
- <el-col span="24">
- <h6>每月份招标公告和中标结果公示分析</h6>
- <div id="ZBandJGByMon"></div>
- </el-col>
- <el-col span="24">
- <h6>招标公告中招标人分析</h6>
- <div id="depByMon"></div>
- </el-col>
- <el-col span="24">
- <h6>中标结果公示每月金额分析</h6>
- <div id="priceByMon"></div>
- </el-col>
- <el-col span="24">
- <div id="echarts">
- <div id="myChart"></div>
- <div id="myChart2"></div>
- </div>
- </el-col>
- </el-row>
- </el-col>
- </el-row>
- </el-main>
- </el-container>
- </div>
- </template>
- <script type="text/javascript">
- import {getAllCount,selectAllSumPriceByMon,getCleanCake,getTypeByMon,getCountByDepType} from "../../static/js/api/echarts"
- export default {
- name: 'Echarts',
- head(){
- return{
- title:"中国招投标公共服务平台爬虫分析"
- }
- },
- data () {
- return {
- allCount:0,
- zbCount:0,
- jgCount:0
- }
- },
- methods: {
- echartsInit () {
- // 找到容器
- let myChart = this.$echarts.init(document.getElementById('myChart'))
- // 开始渲染
- myChart.setOption({
- title: {text: '在Vue中使用echarts'},
- tooltip: {},
- xAxis: {
- data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
- },
- yAxis: {},
- series: [{
- name: '销量',
- type: 'bar',
- data: [5, 20, 36, 10, 10, 20]
- }]
- })
- },
- echartsInit1 () {
- let that=this
- getAllCount().then(res=>{
- that.allCount=res.data.clean;
- let myChart = this.$echarts.init(document.getElementById('allCount'))
- myChart.setOption({
- // title: {text: 'echarts 饼图'},
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '访问来源',
- type: 'pie',
- radius: '55%',
- data: [
- {value: (res.data.clean-res.data.noClean), name: '已清洗'},
- {value: res.data.noClean, name: '未清洗'},
- ]
- }
- ]
- })
- })
- },
- echartsInit2 () {
- let that=this
- getCleanCake().then(res=>{
- that.zbCount=res.data[0].count;
- that.jgCount=res.data[1].count;
- let myChart1 = this.$echarts.init(document.getElementById('ZBCount'))
- myChart1.setOption({
- // title: {text: 'echarts 饼图'},
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '访问来源',
- type: 'pie',
- radius: '55%',
- data: [
- {value: (res.data[0].count-res.data[2].count), name: '已清洗'},
- {value: res.data[2].count, name: '未清洗'},
- ]
- }
- ]
- })
- let myChart2 = this.$echarts.init(document.getElementById('JGCount'))
- myChart2.setOption({
- // title: {text: 'echarts 饼图'},
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- name: '访问来源',
- type: 'pie',
- radius: '55%',
- data: [
- {value: (res.data[1].count-res.data[3].count), name: '已清洗'},
- {value: res.data[3].count, name: '未清洗'},
- ]
- }
- ]
- })
- })
- },
- echartsInit3 () {
- },
- echartsInit4 () {
- getTypeByMon().then(res=>{
- var data1=['招标公告'];
- var data2=['中标结果公示'];
- var data3=['日期'];
- for(let i=0;i<res.data.gg.length;i++){
- data3.push(res.data.gg[i].mon)
- }
- for(let i=0;i<res.data.gg.length;i++){
- data1.push(res.data.gg[i].count)
- }
- for(let i=0;i<res.data.jg.length;i++){
- data2.push(res.data.jg[i].count)
- }
- var chartDom = document.getElementById('ZBandJGByMon');
- var myChart = this.$echarts.init(chartDom);
- var option;
- setTimeout(function () {
- option = {
- legend: {},
- tooltip: {
- trigger: 'axis',
- showContent: false
- },
- dataset: {
- source: [
- data3,data1,data2,
- ]
- },
- xAxis: { type: 'category' },
- yAxis: { gridIndex: 0 },
- grid: { top: '55%' },
- series: [
- {
- type: 'line',
- smooth: true,
- seriesLayoutBy: 'row',
- emphasis: { focus: 'series' }
- },
- {
- type: 'line',
- smooth: true,
- seriesLayoutBy: 'row',
- emphasis: { focus: 'series' }
- },
- {
- type: 'line',
- smooth: true,
- seriesLayoutBy: 'row',
- emphasis: { focus: 'series' }
- },
- {
- type: 'line',
- smooth: true,
- seriesLayoutBy: 'row',
- emphasis: { focus: 'series' }
- },
- {
- type: 'pie',
- id: 'pie',
- radius: '30%',
- center: ['50%', '25%'],
- emphasis: {
- focus: 'self'
- },
- label: {
- formatter: '{b}: {@2012} ({d}%)'
- },
- encode: {
- itemName: 'product',
- value: '2012',
- tooltip: '2012'
- }
- }
- ]
- };
- myChart.on('updateAxisPointer', function (event) {
- const xAxisInfo = event.axesInfo[0];
- if (xAxisInfo) {
- const dimension = xAxisInfo.value + 1;
- myChart.setOption({
- series: {
- id: 'pie',
- label: {
- formatter: '{b}: {@[' + dimension + ']} ({d}%)'
- },
- encode: {
- value: dimension,
- tooltip: dimension
- }
- }
- });
- }
- });
- myChart.setOption(option);
- });
- option && myChart.setOption(option);
- })
- },
- echartsInit5 () {
- getCountByDepType().then(res=>{
- var data1=[];
- var data2=[];
- var data3=[];
- for(let i=0;i<res.data.dw.length;i++){
- data3.push(res.data.dw[i].mon)
- }
- for(let i=0;i<res.data.dw.length;i++){
- data1.push(res.data.dw[i].count)
- }
- for(let i=0;i<res.data.gs.length;i++){
- data2.push(res.data.gs[i].count)
- }
- var chartDom = document.getElementById('depByMon');
- var myChart = this.$echarts.init(chartDom);
- var option;
- option = {
- title: {
- // text: '招标公告中招标人成分分析'
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985'
- }
- }
- },
- legend: {
- data: ['公司', '单位']
- },
- toolbox: {
- feature: {
- saveAsImage: {}
- }
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- boundaryGap: false,
- data: data3
- }
- ],
- yAxis: [
- {
- type: 'value'
- }
- ],
- series: [
- {
- name: '公司',
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- },
- data: data2
- },
- {
- name: '单位',
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- emphasis: {
- focus: 'series'
- },
- data: data1
- },
- ]
- };
- option && myChart.setOption(option);
- })
- },
- echartsInit6 () {
- selectAllSumPriceByMon().then(res=>{
- var data1=[];
- var data2=[];
- for(let i=0;i<res.data.length;i++){
- data1.push(res.data[i].mon)
- }
- for(let i=0;i<res.data.length;i++){
- data2.push(res.data[i].price)
- }
- var chartDom = document.getElementById('priceByMon');
- var myChart = this.$echarts.init(chartDom);
- var option;
- option = {
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'top'
- },
- xAxis: {
- type: 'category',
- data: data1
- },
- yAxis: {
- type: 'value'
- },
- series: [
- {
- data: data2,
- type: 'bar'
- }
- ],
- dataZoom: [
- {
- show: true,
- start: 74,
- end: 100
- },
- {
- type: 'inside',
- start: 94,
- end: 100
- },
- {
- show: true,
- yAxisIndex: 0,
- filterMode: 'empty',
- width: 30,
- height: '80%',
- showDataShadow: false,
- left: '93%'
- }
- ],
- };
- option && myChart.setOption(option);
- })
- },
- },
- mounted () {
- this.echartsInit()
- this.echartsInit1()
- this.echartsInit2()
- this.echartsInit3()
- this.echartsInit4()
- this.echartsInit5()
- this.echartsInit6()
- }
- }
- </script>
- <style scoped >
- h6{
- text-align: center;
- }
- #ZBCount{
- width: 100%;
- height: 300px;
- margin-left: auto;
- margin-right: auto;
- float: left;
- }
- #JGCount{
- width: 100%;
- height: 300px;
- margin-left: auto;
- margin-right: auto;
- float: right;
- }
- #allCount{
- width: 100%;
- height: 300px;
- margin-left: auto;
- margin-right: auto;
- float: right;
- }
- #ZBandJGByMon{
- width: 100%;
- height: 700px;
- margin-left: auto;
- margin-right: auto;
- float: right;
- }
- #depByMon{
- width: 100%;
- height: 700px;
- margin-left: auto;
- margin-right: auto;
- float: right;
- }
- #priceByMon{
- width: 100%;
- height: 500px;
- margin-left: auto;
- margin-right: auto;
- float: right;
- }
- h6{
- font-size: 18px;
- margin-top: 25px;
- text-align: center;
- }
- </style>
|