123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <template>
- <div>
- <div class="statistically-all">
- <div class="yeardate">
- <el-date-picker
- @change="yearchange"
- style="width:200px;"
- v-model="year"
- type="year"
- placeholder="选择年">
- </el-date-picker>
- </div>
- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
- <el-tab-pane label="营业额、成本支出、毛利润" name="first">
- <div class="canvas-box">
- <div id="statisticallyone" style="width: 100%;height:400px;"></div>
- <div id="grossmargins" style="width: 100%;height:400px;"></div>
- <div id="grossmargin" style="width: 100%;height:400px;"></div>
- </div>
- </el-tab-pane>
- <el-tab-pane label="国交数据统计" name="second">
- <div class="canvas-box">
- <div id="grossmarginss" style="width: 50%;height:400px;"></div>
- </div>
- </el-tab-pane>
- <el-tab-pane label="会务数据统计" name="third">会务数据统计</el-tab-pane>
- <el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane>
- </el-tabs>
-
-
- </div>
- </div>
- </template>
- <script>
- import * as echarts from 'echarts';
- export default {
- data () {
- return {
- year:new Date(),
- businessincome:[],
- Grossprofit:[],
- costing:[],
- Airticketnum:[],
- aaa:[
- ['product', '去年销售额', '今年销售额'],
- ['1月', 43.3, 85.8],
- ['2月', 83.1, 73.4],
- ['3月', 86.4, 65.2],
- ['4月', 72.4, 53.9],
- ['5月', 72.4, 53.9],
- ['6月', 72.4, 53.9],
- ['7月', 72.4, 53.9],
- ['8月', 72.4, 53.9],
- ['9月', 72.4, 53.9],
- ['10月', 72.4, 53.9],
- ['11月', 72.4, 53.9],
- ['12月', 72.4, 53.9],
- ],
- bbb:[
- ['product', '毛利率',],
- ['1月', 43.3,],
- ['2月', 83.1,],
- ['3月', 86.4,],
- ['4月', 72.4,],
- ['5月', 72.4,],
- ['6月', 72.4,],
- ['7月', 72.4,],
- ['8月', 72.4,],
- ['9月', 72.4,],
- ['10月', 72.4,],
- ['11月', 72.4,],
- ['12月', 72.4,],
- ],
- activeName: 'second',
- }
- },
- methods: {
- handleClick(tab, event) {
- console.log(this.activeName);
-
- },
-
- getdate(val){
- var date=new Date(val);
- var y=date.getFullYear();
- return y
- },
- statisone(){
- console.log(this.businessincome,this.Grossprofit,this.costing);
- var myChart = echarts.init(document.getElementById('statisticallyone'));
- myChart.setOption({
- title:{
- text: '业务总营业额',
- },
- legend: {},
- tooltip: {},
- dataset: {
- source: this.businessincome
- },
- xAxis: { type: 'category' },
- yAxis: {
- name: '营业额',
- },
- series: [{ type: 'bar' }, { type: 'bar' },]
- });
- var grossmargins = echarts.init(document.getElementById('grossmargins'));
- grossmargins.setOption({
- title:{
- text: '成本',
- },
- legend: {},
- tooltip: {},
- dataset: {
- source: this.costing
- },
- xAxis: { type: 'category' },
- yAxis: {
- name: '成本额',
- },
- series: [{ type: 'bar' }, { type: 'bar' },]
- });
- var grossmargin = echarts.init(document.getElementById('grossmargin'));
- grossmargin.setOption({
- title:{
- text: '毛利润',
- },
- legend: {},
- tooltip: {
- formatter:function(params){
- console.log(params);
-
-
- }
- },
- dataset: {
- source: this.Grossprofit
- },
- xAxis: { type: 'category' },
- yAxis: {
- name: '毛利额',
- },
- color:['#EEAD0E','#a0a7e6'],
-
-
- series: [{ type: 'bar' },{ type: 'bar' }]
- });
- },
-
- yearchange(){
- this.businessincome=[];
- this.Grossprofit=[];
- this.costing=[];
- this.StatisticsYOY()
- },
-
- StatisticsYOY(){
- var url = "/api/Statistics/StatisticsYOY"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- year:that.getdate(that.year),
- }
- }).then(function (res) {
- if(res.data.code==200){
-
- that.businessincome.push(['product', '前一年该月营业额', '本年该月营业额']);
- for(let i=0;i<res.data.data.salesYOYData.length;i++){
- that.businessincome.push([res.data.data.salesYOYData[i].month+'月',res.data.data.salesYOYData[i].lastAmount,res.data.data.salesYOYData[i].thisAmount]);
- }
-
- that.Grossprofit.push(['product', '前一年该月毛利润', '本年该月毛利润']);
- for(let j=0;j<res.data.data.grossProfitYOYData.length;j++){
- that.Grossprofit.push([res.data.data.grossProfitYOYData[j].month+'月',res.data.data.grossProfitYOYData[j].lastAmount,res.data.data.grossProfitYOYData[j].thisAmount]);
- }
-
- that.costing.push(['product', '前一年该月成本', '本年该月成本']);
- for(let g=0;g<res.data.data.costYOYData.length;g++){
- that.costing.push([res.data.data.costYOYData[g].month+'月',res.data.data.costYOYData[g].lastAmount,res.data.data.costYOYData[g].thisAmount]);
- }
- that.statisone()
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
-
- StatisticsAirTicket(){
- var url = "/api/Statistics/StatisticsAirTicket"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- year:that.getdate(that.year),
- }
- }).then(function (res) {
- if(res.data.code==200){
- var datainfo=res.data.data;
-
- that.Airticketnum.push(['product','本年机票数量']);
- for(let i=0;i<datainfo.airTicketNumData.length;i++){
- that.Airticketnum.push([datainfo.airTicketNumData[i].month+'月',datainfo.airTicketNumData[i].quantity]);
- }
- console.log(that.Airticketnum);
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- },
- mounted(){
- this.StatisticsYOY();
- this.StatisticsAirTicket();
- }
- }
- </script>
- <style>
- .statistically-all{
- background-color: #fff;
- padding: 10px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- height: 100%;
- min-height: 830px;
- }
- .canvas-box{
- display: flex;
- flex-wrap: wrap;
- }
- .yeardate{
- margin-bottom: 10px;
- }
- </style>
|