Browse Source

Merge branch 'master' of http://39.106.184.70:3000/ctop/adsp-vue

zhuxinbo 5 years ago
parent
commit
04317be511

+ 14 - 4
src/components/DatePicker.vue

@@ -1,4 +1,7 @@
 <template>
+<!-- 组件使用时 需要传入属性 openOptions:true|false 控制是否打开
+    left :string|0  left为侧边的按钮的定位 0 表示不改变 或者传入字符串 如-100px 表示css中left:-100px
+ -->
     <div class="datePicker">
         <a-range-picker
             v-model="dateValue"
@@ -7,7 +10,7 @@
              :disabled-date="disabledDate"
              :openChange='openChange'
             @change="onChange" />
-        <div class="pickOptions" v-show='openOptions'>
+        <div class="pickOptions" v-show='openOptions' ref="pickOptions">
             <div v-for="item in pickOptions" :key="item.key" @click="changeDate(item)">{{item.title}}</div>
         </div>
     </div>
@@ -68,7 +71,7 @@ let pickOptions=[
 ]
 
     export default {
-        props:['openOptions'],
+        props:['openOptions','left'],
         data() {
             return {
                 moment,
@@ -78,11 +81,12 @@ let pickOptions=[
                 // pickOptions:JSON.parse(JSON.stringify(pickOptions))
             }
         },
+        
         methods: {
             //日期改变事件
             onChange(date,dateString){
                 this.dateValue=date;
-                console.log(this.dateValue)
+                // console.log(this.dateValue)
                 if(dateString.length==2){
                     this.$parent.opendate();
                     this.$parent.type=9
@@ -105,12 +109,17 @@ let pickOptions=[
                 return current && current > moment().subtract(1, 'day')
             },
             openChange(open){
-                console.log(open)
+                // console.log(open)
             },
 
         },
         mounted() {
             this.dateValue=[moment(),moment()]
+            if(this.left){
+                this.$refs.pickOptions.style.left=this.left
+            }
+            
+            // console.log(this.$refs.pickOptions.style.left)
         },
     }
 </script>
@@ -127,6 +136,7 @@ let pickOptions=[
         left: -402px;
         border-right: 1px solid #999;
         box-shadow: 0 0 15px rgba(0,0,0,0.1);
+        cursor: pointer;
         div{
             height: 43px;           
             padding: 10px 15px;

+ 1 - 1
src/views/dashboard/Analysis.vue

@@ -151,7 +151,7 @@
     <Workbench v-else-if="roleCode == 'plane'" />
 
     
-     <!-- <newHome v-else-if="roleCode == 'admin'" /> -->
+     <newHome v-else-if="roleCode == 'admin'" />
   </div>
 </template>
 

+ 11 - 6
src/views/modules/Statistics/CompareData.vue

@@ -37,7 +37,9 @@
             <span>  {{costcompare.next|decimalsHandle}} </span>
             </p>
           <p>环比:
-            <span class="huanbi">  {{(costcompare.next-costcompare.prev)/costcompare.prev| toPercentage}}
+            <span class="huanbi"> 
+              <span v-if="(costcompare.next-costcompare.prev)/costcompare.prev">{{(costcompare.next-costcompare.prev)/costcompare.prev| toPercentage}}</span> 
+              <span v-else>{{'-'}}</span>
                 <span
                   class="greenIcon"
                   v-if="(costcompare.next-costcompare.prev)/costcompare.prev >0"
@@ -56,8 +58,9 @@
             <span>  {{clickcompare.next |formatCurrency}}</span>
             </p>
           <p >环比:
-            <span class="huanbi">  {{
-                (clickcompare.next-clickcompare.prev)/clickcompare.prev| toPercentage}}
+            <span class="huanbi">  
+                <span v-if="(clickcompare.next-clickcompare.prev)/clickcompare.prev">{{(clickcompare.next-clickcompare.prev)/clickcompare.prev| toPercentage}}</span>
+                <span v-else>{{'-'}}</span>
                  <span
                   class="greenIcon"
                   v-if="(clickcompare.next-clickcompare.prev)/clickcompare.prev >0"
@@ -76,7 +79,9 @@
             <span>  {{showNumcompare.prev|formatCurrency}}</span>
               </p>
           <p>环比:
-            <span class="huanbi">  {{(showNumcompare.next-showNumcompare.prev)/showNumcompare.prev| toPercentage}}
+            <span class="huanbi"> 
+              <span v-if="(showNumcompare.next-showNumcompare.prev)/showNumcompare.prev">{{(showNumcompare.next-showNumcompare.prev)/showNumcompare.prev| toPercentage}}</span> 
+              <span v-else>{{'-'}}</span>
                 <span
                   class="greenIcon"
                   v-if="(showNumcompare.next-showNumcompare.prev)/showNumcompare.prev>0"
@@ -656,7 +661,7 @@ export default {
 <style lang="scss" scoped>
 .clickHandle {
   position: relative;
-  top: -24px;
+  top: 0px;
   left: 0px;
   .selectDate {
     margin-left: 2rem;
@@ -695,7 +700,7 @@ export default {
       .huanbi{
           font-weight: 500;
           font-size: 16px;
-         
+          margin-left: 0;
           position: relative;
           display: inline-block;
           padding: 0 15px  0;

+ 242 - 0
src/views/modules/Statistics/accountReport.vue

@@ -0,0 +1,242 @@
+<template>
+  <div class="accountReport">
+    <div class="optionLine">
+      
+          <span>项目选择:</span>
+          <a-tree-select
+            v-model="treeValue"
+            style="width: 50%"
+            :tree-data="treeData"
+            tree-checkable
+            :show-checked-strategy="SHOW_PARENT"
+            searchPlaceholder="请选择项目和账户"
+            :allowClear="true"
+            @change="treeChange"
+          />
+     
+     
+      <div style="float:right"   @click="opendate">
+            <DatePicker :openOptions='openOptions' :left=left />
+      </div>
+      <div class="optionTow">
+          <div class="optItem">
+              <span>折扣:</span>
+              <a-input-number :min="0" :max="10" :step="0.1" v-model="discount" />
+          </div>
+          <div class="optItem">
+              <span>返点比例:</span>
+              <a-input-number :min="0" :max="10" :step="0.1" v-model="rebateProp" />
+          </div>
+          <div class="btn">
+            <a-button type="primary" @click="searchgetData" :disabled='searchDisabled' class="mybtn">查询</a-button>
+            <a-button type="primary" @click="refreshgetData" :disabled='refreshDisabled' class="mybtn">刷新</a-button>
+            <a-button type="primary" @click="resetgetData" :disabled='resetDisabled' class="mybtn">重置</a-button>
+          </div>
+      </div>
+      
+    </div>
+    <div class="show">
+        
+        
+    </div>
+  </div>
+</template>
+
+<script>
+import moment from 'moment';
+import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
+import { TreeSelect } from 'ant-design-vue';
+const SHOW_PARENT = TreeSelect.SHOW_PARENT;
+import DatePicker from '@/components/DatePicker.vue'
+// 引入基本模板
+var echarts = require('echarts')
+// 引入柱状图组件
+require('echarts/lib/chart/bar')
+require('echarts/lib/chart/pie')
+require('echarts/lib/chart/line')
+// 引入提示框和title组件
+require('echarts/lib/component/tooltip')
+require('echarts/lib/component/title')
+require('echarts/lib/component/graphic')
+require('echarts/lib/component/toolbox')
+require('echarts/lib/component/legend')
+export default {
+   components:{
+        DatePicker,
+       
+    },
+  data() {
+    return {
+      left:0,
+      //treeselect的参数
+      treeValue: [],
+      treeData: [],
+      SHOW_PARENT,
+      //折扣数值
+      discount:1.0,
+      //返点比例
+      rebateProp:1.0,
+      //日期矿打开
+      openOptions:false,
+      //子元素的数据存储
+    
+        type:1,
+        dateValue:[moment(),moment()],
+
+        //处理按钮禁用
+        searchDisabled:false,
+        refreshDisabled:false,
+        resetDisabled:false,
+    }
+  },
+  methods: {
+    //项目改变后的事件
+    treeChange(val) {
+      this.projectId = []
+      this.accountName = []
+      console.log(val, this.treeValue)
+      this.treeValue.forEach((item, index) => {
+        if (parseInt(item)) {
+          this.projectId.push(item)
+        } else {
+          this.accountName.push(item)
+        }
+      })
+      if (this.treeValue.length == 0) {
+        this.optionArr = []
+      }
+      postAction('/pangolin/api/app/list', {
+        projectId: this.projectId,
+        accountName: this.accountName
+      }).then(res => {
+        console.log(res)
+        if (res.success) {
+          this.optionArr = res.data
+        }
+      })
+    },
+    disabledDate(current) {
+      // console.log(current)
+
+      return current && current > moment().subtract(1, 'day')
+    },
+
+    //查询按钮的事件
+    searchgetData(){
+           
+        console.log();
+        this.loading=true;
+        this.searchDisabled=true;
+        // this.HttpPost()
+            
+    },
+    //刷新
+    refreshgetData(){
+         this.loading=true;
+         this.refreshDisabled=true;
+    },
+    //重置
+    resetgetData(){
+         this.loading=true;
+         this.resetDisabled=true;
+    },
+      //打开日期框
+   opendate(){
+       this.openOptions=!this.openOptions;
+      //  console.log(this.openOptions)
+   },
+
+   HttpPost(params){
+     return new Promise((resolve, reject) => {
+        postAction('/ctop/byteDance/homePage/report/week', {}).then(res => {
+        //   console.log(res)
+          if (res.success) {
+            this.loading = false
+            this.refreshDisabled=false;
+            this.resetDisabled=false;
+            this.searchDisabled=false;
+            this.cost = res.result.costWeekLink
+            this.click = res.result.clickWeekLink
+            this.showNum = res.result.showNumWeekLink
+            // res.result.top.top7.forEach((element, index) => {
+            //   this.topOption.xAxis[0].data.push(element.authName)
+            //   this.topOption.series[0].data.push(element.cost)
+            // })
+
+            // for (let [key, value] of Object.entries(res.result.costWeek)) {
+            //   this.costOption.xAxis[0].data.push(key)
+            //   this.costOption.series[0].data.push(value)
+            // }
+            // for (let [key, value] of Object.entries(res.result.clickWeek)) {
+            //   this.clickOption.xAxis[0].data.push(key)
+            //   this.clickOption.series[0].data.push(value)
+            // }
+            // for (let [key, value] of Object.entries(res.result.showNumWeek)) {
+            //   this.showOption.xAxis[0].data.push(key)
+            //   this.showOption.series[0].data.push(value)
+            // }
+
+            // this.getEchartData('topChart', this.topOption)
+            // this.getEchartData('costChart', this.costOption)
+            // this.getEchartData('clickChart', this.clickOption)
+            // this.getEchartData('showChart', this.showOption)
+            
+          }
+        })
+      })
+   },
+    //获取echart的值
+    getEchartData(idName, optionName) {
+      const chart = this.$refs[idName]
+      //   console.log(chart)
+      if (chart) {
+        const myChart = echarts.init(document.getElementById(idName))
+        myChart.setOption(optionName)
+        window.addEventListener('resize', function() {
+          myChart.resize()
+        })
+      }
+    },
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.accountReport {
+  .optionLine {
+    padding: 0  15px;
+    position: relative;
+    margin-top: 20px;
+    margin-bottom: 15px;
+    // border: 1px solid #ccc;
+    
+    .optionTow{
+      margin-top: 15px;
+      position: relative;
+        .optItem{
+          display: inline-block;
+          margin-right: 15px;
+            span {
+            display: inline-block;
+            padding: 0 3px;
+            }
+        }
+    }
+
+    .btn {
+      position: absolute;
+      right: 0px;
+      top: 0px;
+      .mybtn{
+        margin-left: 10px;
+      }
+    }
+  }
+  .show{
+    background-color: #fff;
+    padding: 15px 15px;
+    
+  }
+ 
+}
+</style>

+ 13 - 4
src/views/modules/Statistics/newHome.vue

@@ -33,7 +33,8 @@
             <div class="footerInfo">
               周同比
               <span class="num">
-                {{cost.weekCostSumLink|toPercentage}}
+                <span v-if="cost.weekCostSumLink">{{cost.weekCostSumLink|toPercentage}}</span>
+                <span v-else>{{'-'}}</span>
                 <span
                   class="greenIcon"
                   v-if="cost.weekCostSumLink>0"
@@ -59,7 +60,9 @@
             <div class="footerInfo">
               周同比
               <span class="num">
-                {{click.weekClickSumLink|toPercentage}}
+                <span v-if="click.weekClickSumLink">{{click.weekClickSumLink|toPercentage}}</span>
+                <span v-else>{{'-'}}</span>
+                
                 <span
                   class="greenIcon"
                   v-if="click.weekClickSumLink>0"
@@ -85,7 +88,9 @@
             <div class="footerInfo">
               周同比
               <span class="num">
-                {{showNum.weekShowNumSumLink | toPercentage}}
+                <span v-if="showNum.weekShowNumSumLink">{{showNum.weekShowNumSumLink | toPercentage}}</span>
+                <span v-else>{{'-'}}</span>
+                
                 <span
                   class="greenIcon"
                   v-if="showNum.weekShowNumSumLink>0"
@@ -110,7 +115,7 @@
         <div id="sectionChart" style='width:100%;height:300px' ref="sectionChart"></div>
         <a-button class="duibi" @click="comparehandle" type='default' >对比</a-button>
         <div class="time"  @click="opendate">
-            <DatePicker :openOptions='openOptions'/>
+            <DatePicker :openOptions='openOptions' :left='0' />
         </div>
     </div>
 
@@ -476,6 +481,9 @@ export default {
           if (res.success) {
             this.loading = false
             //处理今天
+            if(res.result){
+
+            
             if(res.result.chart[0].afterData && res.result.chart[0].afterData.statDate==moment().format('YYYY-MM-DD')){
                 this.tabCost=JSON.parse(JSON.stringify(init))
                 this.tabClick=JSON.parse(JSON.stringify(init))
@@ -598,6 +606,7 @@ export default {
            total.cpm=(total.cost/total.showNum*1000).toFixed(2)
            this.tableData=[total,...res.result.list]
           }
+          }
         })
       })
     },

+ 2 - 2
vue.config.js

@@ -66,13 +66,13 @@ module.exports = {
       '/jeecg-boot': {
         // target: 'http://39.97.120.42:8080', //请求本地 需要jeecg-boot后台项目  生产环境
         // target: 'http://39.106.184.70:8080', //请求本地 需要jeecg-boot后台项目
-        target: 'http://192.168.1.13:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+        // target: 'http://192.168.1.13:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
         // target: 'http://192.168.1.22:8080', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.0.125:8080', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.1.103:8080', //请求本地 需要jeecg-boot后台项目
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
         // target: 'http://192.168.1.54:8080', //请求本地 需要jeecg-boot后台项目  孙震
-        // target: 'http://192.168.1.165:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
+        target: 'http://192.168.1.165:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
         ws: false,
         changeOrigin: true
       },