Newer
Older
smart-economy / src / components / economic / subject / qyrz.vue
<template>
  <div class="full-box ztfx">
    <div class="" style="width: 100%;height:100%;" >
      <div class="top-tip-box t-title">当前位置:专题分析  >  企业融资分析</div>
      <div class="ztfx-info-box">
        <div class="left-search-box">
          <div class="lsb-top">数据截止时间:{{$Util.isEmpty(totalData.latestDate)?lastTime:totalData.latestDate}}</div>
          <div class="lsb-search">
            <div class="lsb-search-box">
              <div class="sl-row">
                <div class="sl-row-label">时间</div>
                <el-date-picker
                  type="date"
                  :picker-options="beginDate(filter.endDate)"
                  v-model="filter.startDate"
                  placeholder="开始日期"
                  value-format="yyyy-MM-dd"
                  style="width:calc(100% - 40px);float: left;">
                </el-date-picker>
              </div>
              <div class="sl-row">
                <div class="sl-row-label">至</div>
                <el-date-picker
                  type="date"
                  :picker-options="processDate(filter.startDate)"
                  v-model="filter.endDate"
                  placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  style="width:calc(100% - 40px);float: left;">
                </el-date-picker>
              </div>
            </div>
            <div class="lsb-search-border">
              <div class="lsbb-top"></div>
              <div class="lsbb-role"></div>
              <div class="lsbb-bottom"></div>
            </div>
          </div>
          <div class="lsb-info">
            <div class="lsb-title"><span class="dot"></span>年度信息汇总</div>
            <div class="item-chart">
                <div class="chart-group">
                  <div class="chart-pie">
                    <div class="pie-box">
                      <div class="circle"><div class="circle2"><div class="circle3">{{totalData.total}}</div></div></div>
                    </div>
                    <div class="pie-title">累计全区融资额</div>
                  </div>
                  <div class="chart-pie">
                    <div  class="pie-box">
                      <div class="circle7"><div class="circle8"><div class="circle9">{{totalData.totalTb}}%</div></div></div>
                    </div>
                    <div class="pie-title">同比</div>
                  </div>
                </div>
                <div class="chart-group">
                  <div class="chart-pie">
                    <div class="pie-box">
                      <div class="circle4"><div class="circle5"><div class="circle6">{{totalData.current}}</div></div></div>
                    </div>
                    <div class="pie-title">当月融资额</div>
                  </div>
                  <div class="chart-pie">
                    <div class="pie-box">
                      <div class="circle10"><div class="circle11"><div class="circle12">{{totalData.currentTb}}%</div></div></div>
                    </div>
                    <div class="pie-title">同比</div>
                  </div>
                </div>
              </div>
          </div>
        </div>
        <div class="right-info-box">
          <div class="right-left-border">
            <div class="rlb-top"></div>
            <div class="rlb-role"></div>
            <div class="rlb-bottom"></div>
          </div>
          <div class="ri-box">
            <div class="ztfx-charts-box" style="width:100%;height:calc(100% - 10px);">
              <div class="ztfx-chart-item">
                <div class="roles-one"></div><div class="roles-two"></div>
                <div class="roles-three"></div><div class="roles-four"></div>
                <div class="ztfx-chart-title"><span class="dot"></span>企业融资额行业分析</div>
                <div class="ztfx-chart-info" id="chartOne"></div>
              </div>
              <div class="ztfx-chart-item">
                <div class="roles-one"></div><div class="roles-two"></div>
                <div class="roles-three"></div><div class="roles-four"></div>
                <div class="ztfx-chart-title"><span class="dot"></span>企业融资额时间趋势分析</div>
                <div class="ztfx-chart-info" id="chartTwo"></div>
              </div>
              <div class="ztfx-chart-item">
                <div class="roles-one"></div><div class="roles-two"></div>
                <div class="roles-three"></div><div class="roles-four"></div>
                <div class="ztfx-chart-title"><span class="dot"></span>企业融资额排名</div>
                <div class="more-table-detail" @click="moreDataClick()">更多>></div>
                <div class="ztfx-chart-info result-table">
                  <div class="table-container-style" >
                    <el-table :data="chartTable" :height="200">
                      <el-table-column type="index" align="center" label="排名" width="60"></el-table-column>
                      <el-table-column align="center" label="企业名称" >
                        <template  slot-scope="scope">
                          <el-tooltip class="item" effect="dark" :content="scope.row.name" placement="left">
                            <div class="ellipsis" style="width:100%;cursor: pointer;" @click="jumpToDetail(scope.row)">{{scope.row.name}}</div>
                          </el-tooltip>
                        </template>
                      </el-table-column>
                      <el-table-column prop="value" align="center" label="贷款额(万元)"></el-table-column>
                      <el-table-column prop="valueTb" align="center" label="同比" width="100"></el-table-column>
                    </el-table>
                  </div>
                </div>
              </div>
              <div class="ztfx-chart-item" style='position: relative'>
                <div class="roles-one"></div><div class="roles-two"></div>
                <div class="roles-three"></div><div class="roles-four"></div>
                <div class="ztfx-chart-title"><span class="dot"></span>企业融资代偿比例</div>
                <div class="ztfx-chart-info" id="chartThree"></div>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>
    <!--pop列表   :title="'规上工业'+typeName+'排名'"-->
    <el-dialog title="企业融资额排名" :visible.sync="dialogVisible" width="800px" :close-on-click-modal=false top="40px">
      <el-table :data="moreData.list" highlight-current-row style="width: 100%">
        <el-table-column type="index" align="center" label="排名" width="60"></el-table-column>
        <el-table-column prop="name"  align="center" label="企业名称" ></el-table-column>
        <el-table-column prop="value" align="center" label="贷款额(万元)"></el-table-column>
        <el-table-column prop="valueTb" align="center" label="同比" width="100"></el-table-column>
      </el-table>
      <el-pagination @current-change="morePageChange" background layout="prev, pager, next" :page-size="moreData.pageSize" :current-page="moreData.pageNum" :total="moreData.total" style="text-align: right;"></el-pagination>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  const currentDate = new Date('2020/12/31') // 当前日期
  const month = currentDate.getMonth()+1; // 月份
  const year = month<10?currentDate.getFullYear()+"-0"+month :currentDate.getFullYear()+"-"+month;
  const startDate = currentDate.format("yyyy-")+"01-01"
  const endDate = currentDate.format("yyyy-MM-dd")
  export default {
    name: 'jjyx',
    data () {
      return {
        showCondition:false,
        year:currentDate.format("yyyy"),
        lastTime:endDate,
        timeFilter:[startDate,endDate],
        locations: [],
        filter:{
          startDate: startDate,
          endDate:endDate
        },
        totalData:{total: 0,current: 0,currentTb: 0,year: 2017,totalTb: 0,latestDate:''},
        chartTable:[],
        chartsTitle:{left:'',right:'同比'},
        defaultOp:{
          title: { show: false },
          legend:{show:false,height:"0"},
          grid:{top:30,bottom:30},
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'cross',
              label: {
                backgroundColor: '#777'
              },
              crossStyle: {
                color: 'rgba(255,255,255,.8)',
              }
            }
          },
          xAxis: {
            axisLabel:{color:'rgba(255,255,255,.9)'/*,interval:0*/},
            axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
            splitLine:{lineStyle:{color:'rgba(255,255,255,.1)'}}
          }
        },
        dialogVisible:false,
        moreData:{list:[], pageNum:1, pageSize:10, total:0},
      }
    },
    mounted (){
      this.getTotalData();
      this.loadTabCharts();
    },
    watch:{
      "filter.startDate":function(){
        let vm = this
        vm.loadTabCharts()
        /*vm.getTableData(1)*/
      },
      "filter.endDate":function(){
        let vm = this
        vm.loadTabCharts()
        /*vm.getTableData(1)*/
      },
    },
    methods:{
      initChartsByType (type){
        let vm = this
        vm.filter.type = type
      },
      loadTabCharts(){
        let vm = this;
        /*this.drawLineOne('chartOne',['生物医药','电子信息','新能源','金属加工','轻工制造'],[12,334,344,333,787],[122,223,440,22,678],[2,22,34,45,88]);*/
        /*this.drawLine('chartTwo',['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],[12,334,344,333,787,12,122,334,34,5,66,111],[122,223,440,22,678,22,22,22,344,56,56,56],[2,22,34,45,88,2,22,34,45,88,12,24]);*/
        /*let t = [{name: "代偿企业", value: 122},{name: "其他", value: 233}];
        let legend=[];
        t.forEach(function (item) {
          legend.push(item.name)
        })
        this.drawPie("chartThree",t,legend)*/
        let timeStart = !vm.$Util.isEmpty(vm.filter.startDate) ? vm.filter.startDate.split("-")[0] : null,
          timeEnd = !vm.$Util.isEmpty(vm.filter.endDate) ? vm.filter.endDate.split("-")[0] : null;
        if(timeStart == null || timeEnd== null || timeStart > timeEnd || timeStart <timeEnd){
          let dataText = timeStart == null ? '请选择开始时间':timeEnd ==null ? '请选择结算时间':'支持查询同一年数据,请选择起止时间为同一年后查询!';
          vm.$message({
            showClose: true,
            message:dataText,
            type: 'warning'
          });
          return;
        }
        this.getOneData();
        this.getTwoData()
        this.getThreeData();
        this.getFourData();
      },
      getTotalData(){
        let vm = this;
        vm.$http.get('/dx-economy-api/subject/qyrz/total',{params:{year:vm.year}}).then(function (resp) {
          let _data = resp.data;
          if(_data.code === 200 && !vm.$Util.isEmpty(_data.data)) {
            vm.totalData = _data.data;
          }
        })
      },
      getOneData(){
        let vm = this;
        vm.$http.get('/dx-economy-api/subject/qyrz/industry',{params:vm.filter}).then(function (resp) {
          let _data = resp.data;
          if(_data.code === 200 && !vm.$Util.isEmpty(_data.data)) {
            let t = resp.data.data
            vm.chartsTitle.left = '融资额(亿元)';
            vm.chartsTitle.right = '同比';
            vm.drawLineOne('chartOne', t.xAxis, t.value, t.value2);
          }
        })
      },
      getTwoData(){
        let vm = this;
        vm.$http.get('/dx-economy-api/subject/qyrz/times',{params:vm.filter}).then(function (resp) {
          let _data = resp.data;
          if(_data.code === 200 && !vm.$Util.isEmpty(_data.data)) {
            let t = resp.data.data
            vm.chartsTitle.left = '融资额(亿元)';
            vm.chartsTitle.right = '同比';
            t.xAxis = t.xAxis.map(item=>item.split('-')[1].replace(/\b(0+)/gi,"")+'月')
            vm.drawLineOne('chartTwo', t.xAxis, t.value, t.value2);
          }
        })
      },
      getThreeData(){
        let vm = this;
        vm.$http.get('/dx-economy-api/subject/qyrz/companyList',{params:$.extend({pageNum:1,pageSize:5},vm.filter)}).then(function (resp) {
          let _data = resp.data;
          if(_data.code === 200 && !vm.$Util.isEmpty(_data.data)) {
            let t = resp.data.data
            t.list.forEach(function (i, k) {
              i.valueTb = i.valueTb + '%';
            });
            vm.chartTable = t.list;
          }
        })
      },
      getFourData(){
        let vm = this;
        vm.$http.get('/dx-economy-api/subject/qyrz/dcqyScale',{params:vm.filter}).then(function (resp) {
          let _data = resp.data;
          if(_data.code === 200 && !vm.$Util.isEmpty(_data.data)) {
            let t = resp.data.data
            let legend = [];
            t.forEach(function (item) {
              legend.push(item.name)
            })
            vm.drawPie("chartThree", t, legend)
          }
        })
      },
      /*pop-table*/
      moreDataClick(){
        this.dialogVisible = true
        this.getMoreTableData(1)
      },
      getMoreTableData(pageNum){
        let vm = this;
        let pageNums = vm.$Util.isEmpty(pageNum) ? vm.moreData.pageNum : pageNum;
        vm.$http.get('/dx-economy-api/subject/qyrz/companyList',{params:$.extend({pageSize:10,pageNum:pageNums},vm.filter)}).then(function (resp) {
          let _data = resp.data;
          if(_data.code === 200 && !vm.$Util.isEmpty(_data.data)) {
            let temp = resp.data.data;
            temp.list.forEach(function (i, k) {
              i.valueTb = i.valueTb + '%';
            });
            vm.moreData.list = temp.list;
            vm.moreData.pageNum = temp.pageNum;
            vm.moreData.total = temp.total;
          }
        })
      },
      morePageChange(currentPage){
        this.getMoreTableData(currentPage)
      },
      /*pop-table -- end*/
      drawLine(container,cate,d1,d2,d3){
        let vm = this
        let myChart = vm.$echarts.init(document.getElementById(container))
        let op = {
          xAxis: {
            type:"category",
            data: cate,
            axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
            axisLabel: {
              interval: 0,      // 坐标轴刻度标签的显示间隔
              rotate: cate.length>5?40:0,        // 标签倾斜的角度
              formatter: function(value) {
                var res = value;
                if(cate.length>5 && res.length > 3) {
                  res = res.substring(0, 2) + "..";
                }
                return res;
              },
            }
          },
          yAxis:[
            {
              type: 'value',
              name:'出口额',
              minInterval: 10,
              nameTextStyle:{color:'rgba(255,255,255,.8)'},
              axisLabel:{
                color:'rgba(255,255,255,.8)',
                formatter: function (value) {
                  let texts = [];
                  if(value<1000){
                    texts.push(value)
                  }else if(Math.ceil(value/1000)>=1&&Math.ceil(value/1000)<10){
                    texts.push(Math.ceil(value/1000) + "千")
                  }else if(Math.ceil(value/10000)>=1&&Math.ceil(value/10000)<100){
                    texts.push(Math.ceil(value/10000) + "万")
                  }else if(Math.ceil(value/1000000)>=1){
                    texts.push(Math.ceil(value/1000000) + "百万")
                  }
                  return value
                }},
              axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
              splitLine:{lineStyle:{color:'rgba(255,255,255,.1)'}}
            },
            {
              type: 'value',
              name: '同比',
              minInterval: 100,
              nameTextStyle:{color:'rgba(255,255,255,.8)'},
              axisLabel:{color:'rgba(255,255,255,.8)'},
              axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
              splitLine:{show:false}
            }
          ],
          series: [
            {
            name: '出口额',
            type: 'bar',
            color:"#6ee988",
            barMaxWidth:'20',
            data: d1,//[100,200,33,56,188,123,143,23,99],//res.zcz
            itemStyle: {
              color: {
                type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
                colorStops: [{
                  offset: 0, color: '#6ee988' // 0% 处的颜色
                }, {
                  offset: 1, color: '#6ee988' // 100% 处的颜色
                }]
              }
            }
          },
            {
              name: '工业产值',
              type: 'bar',
              color:"#16e1ff",
              barMaxWidth:'20',
              data: d2,//[100,200,33,56,188,123,143,23,99],//res.zcz
              itemStyle: {
                color: {
                  type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
                  colorStops: [{
                    offset: 0, color: '#16e1ff' // 0% 处的颜色
                  }, {
                    offset: 1, color: '#16e1ff' // 100% 处的颜色
                  }]
                }
              }
            },
            {
            name: '同比',
            type: 'line',
            yAxisIndex: 1,
            color:"#e0e63d",
            data: d3,//[10,20,30,44,77,55,66,22,100],//res.tb
            areaStyle: {
              color: {
                type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
                colorStops: [{
                  offset: 0, color: '#e0e63d' // 0% 处的颜色
                }, {
                  offset: 1, color: 'rgba(255,255,255,0)' // 100% 处的颜色
                }]
              }
            }
          }]
        }
        myChart.setOption($.extend(true,op,vm.defaultOp));
        if(container == "gytz") {
          myChart.on('click', function (param) {
            let _start = "",_end = "";
            if(!vm.$Util.isEmpty(vm.timeFilter)){
              if(vm.timeFilter.length === 1){
                _start = vm.timeFilter[0];
              }else if(vm.timeFilter.length === 2){
                _start = vm.timeFilter[0];
                _end = vm.timeFilter[1];
              }
            }
            vm.$router.push({name: "gytz", params: {sDate: _start, eDate: _end}})
          })
        }
      },
      drawLineOne(container,cate,d1,d3){
        let vm = this
        let myChart = vm.$echarts.init(document.getElementById(container))
        let op = {
          xAxis: {
            type:"category",
            data: cate,
            axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
            axisLabel: {
              interval: 0,      // 坐标轴刻度标签的显示间隔
              // rotate: cate.length>5?40:0,        // 标签倾斜的角度
            }
          },
          yAxis:[
            {
              type: 'value',
              name:vm.chartsTitle.left,/*
              minInterval: 10,*/
              nameTextStyle:{color:'rgba(255,255,255,.8)'},
              axisLabel:{
                color:'rgba(255,255,255,.8)',
                formatter: function (value) {
                  let texts = [];
                  if(value<1000){
                    texts.push(value)
                  }else if(Math.ceil(value/1000)>=1&&Math.ceil(value/1000)<10){
                    texts.push(Math.ceil(value/1000) + "千")
                  }else if(Math.ceil(value/10000)>=1&&Math.ceil(value/10000)<100){
                    texts.push(Math.ceil(value/10000) + "万")
                  }else if(Math.ceil(value/1000000)>=1){
                    texts.push(Math.ceil(value/1000000) + "百万")
                  }
                  return value
                }},
              axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
              splitLine:{lineStyle:{color:'rgba(255,255,255,.1)'}}
            },
            {
              type: 'value',
              name: vm.chartsTitle.right,
              minInterval: 1,
              nameTextStyle:{color:'rgba(255,255,255,.8)'},
              axisLabel:{color:'rgba(255,255,255,.8)'},
              axisLine:{lineStyle:{color:'rgba(255,255,255,.3)'}},
              splitLine:{show:false}
            }
          ],
          series: [
            {
              name: vm.chartsTitle.left,
              type: 'bar',
              color:"#6ee988",
              barMaxWidth:'20',
              data: d1,//[100,200,33,56,188,123,143,23,99],//res.zcz
              itemStyle: {
                color: {
                  type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
                  colorStops: [{
                    offset: 0, color: '#6ee988' // 0% 处的颜色
                  }, {
                    offset: 1, color: '#6ee988' // 100% 处的颜色
                  }]
                }
              }
            },
            {
              name: vm.chartsTitle.right,
              type: 'line',
              yAxisIndex: 1,
              color:"#e0e63d",
              data: d3,//[10,20,30,44,77,55,66,22,100],//res.tb
              areaStyle: {
                color: {
                  type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
                  colorStops: [{
                    offset: 0, color: '#e0e63d' // 0% 处的颜色
                  }, {
                    offset: 1, color: 'rgba(255,255,255,0)' // 100% 处的颜色
                  }]
                }
              }
            }]
        }
        myChart.setOption($.extend(true,op,vm.defaultOp));
        if(container == "gytz") {
          /*myChart.on('click', function (param) {
            let _start = "",_end = "";
            if(!vm.$Util.isEmpty(vm.timeFilter)){
              if(vm.timeFilter.length === 1){
                _start = vm.timeFilter[0];
              }else if(vm.timeFilter.length === 2){
                _start = vm.timeFilter[0];
                _end = vm.timeFilter[1];
              }
            }
            vm.$router.push({name: "gytz", params: {sDate: _start, eDate: _end}})
          })*/
        }
      },
      drawPie(container,data,legend){
        let vm = this
        let myChart = vm.$echarts.init(document.getElementById(container))
        let op = {
          tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}: {c} ({d}%)"
          },
          color:['rgba(22,225,255,1)','rgba(22,225,255,0.4)','rgba(22,225,255,0.2)'],
          legend: {
            type: 'scroll',
            orient: 'vertical',
            x:"right",
            data:legend,
            textStyle:{color:"rgba(255,255,255,.8)"}
          },
          series: [
            {
              name:'企业融资代偿比例',
              type:'pie',
              radius:['55%', '85%'],
              // minAngle: 30,
              center:['40%', '50%'],
              avoidLabelOverlap: false,
              label: {normal:{show:false}},
              data:data
            }
          ]
        }
        myChart.setOption(op)
        /*myChart.on('click', function (param) {
          let _start = "",_end = "";
          if(!vm.$Util.isEmpty(vm.timeFilter)){
            if(vm.timeFilter.length === 1){
              _start = vm.timeFilter[0];
            }else if(vm.timeFilter.length === 2){
              _start = vm.timeFilter[0];
              _end = vm.timeFilter[1];
            }
          }
          vm.$router.push({name:"jjyx",params:{sDate:_start,eDate:_end,bk:'',industry:param.name}})
        })*/
      },
    }
  }
</script>
<style>
  .search-row-condition .el-date-editor .el-range-input{width:35%!important;}
</style>
<style scoped>


</style>