Browse Source

fix: 时间选择器回显时间问题

cuiyalong 3 years ago
parent
commit
a31f704803

+ 9 - 1
src/assets/style/reset-ele.scss

@@ -51,9 +51,17 @@
       color: #fff;
     }
   }
+
+  .el-link {
+    &.el-link--default{
+      &:hover {
+        color: $color-text--highlight;
+      }
+    }
+  }
 }
 .el-popper {
   li{
     float: none;
   }
-}
+}

+ 5 - 1
src/components/chart/SimpleHistogramChart.vue

@@ -133,8 +133,12 @@ export default {
           bottom: 20,
           align: 'left',
           itemGap: 20,
+          itemWidth: 9,
+          itemHeight: 9,
           textStyle: {
-            fontSize: 12,
+            fontSize: 10,
+            lineHeight: 14,
+            verticalAlign: 'bottom',
             rich: {
               a: {
                 fontSize: 16,

+ 1 - 0
src/components/selector/PopSelector.vue

@@ -549,6 +549,7 @@ export default {
   }
   .card-list {
     align-items: flex-start;
+    width: 100%;
     max-height: 124px;
     overflow-y: scroll;
   }

+ 1 - 0
src/main.js

@@ -9,6 +9,7 @@ import echarts from 'echarts'
 // import axios from 'axios'
 import Toast from './components/toast/index'
 import '@/utils/'
+import '@/utils/common'
 
 Vue.use(VueCookies)
 Vue.use(Loading.directive)

+ 13 - 0
src/utils/common.js

@@ -0,0 +1,13 @@
+import Vue from 'vue'
+
+Vue.prototype.$checkLogin = function () {
+  try {
+    var moduleOpen = $('body').hasClass('modal-open')
+    if (moduleOpen) return
+    if (!loginflag) {
+      $('#bidLogin').modal('show')
+    }
+  } catch (error) {
+    console.log(error)
+  }
+}

+ 23 - 15
src/views/analysisReport/MarketAnalysis.vue

@@ -104,18 +104,18 @@ export default {
   },
   watch: {
     showMoreFilters (newVal) {
-      if (newVal) {
-        try {
-          if (this.timerId) clearTimeout(this.timerId)
-          this.timerId = setTimeout(() => {
+      try {
+        if (this.timerId) clearTimeout(this.timerId)
+        this.timerId = setTimeout(() => {
+          if (newVal) {
             this.$refs.keySelector.computRow()
-            if (this.resultShow) {
-              this.$refs.result.calcStickyNav()
-            }
-          }, 200)
-        } catch (error) {
-          console.log(error)
-        }
+          }
+          if (this.resultShow) {
+            this.$refs.result.calcStickyNav()
+          }
+        }, 200)
+      } catch (error) {
+        console.log(error)
       }
     },
     bigKeywordsData () {
@@ -282,6 +282,7 @@ export default {
     // 整理数据,并赋值给filters
     loadedFilters (filters) {
       this.showMoreFilters = false
+      this.$emit('refreshTab2')
       // 当前页面分析过,则不恢复filters
       if (this.analysisDone) return
       if (filters.keys) {
@@ -291,10 +292,11 @@ export default {
       if (filters.selectTime) {
         this.filters.selectTime = filters.selectTime
       }
-      if (filters.selectTimeExtra) {
-        this.filters.selectTimeExtra = filters.selectTimeExtra
-      }
-      this.restoreFilterTimes(filters.selectTime, filters.selectTimeExtra)
+      // if (filters.selectTimeExtra) {
+      //   this.filters.selectTimeExtra = filters.selectTimeExtra
+      // }
+      // this.restoreFilterTimes(filters.selectTime, filters.selectTimeExtra)
+      this.restoreFilterTimes(filters.selectTime)
 
       if (filters.area) {
         this.filters.area = filters.area
@@ -331,6 +333,12 @@ export default {
         end: selectTimeArr[1] * 1000,
         exact: extra ? extra : 'exact'
       }
+
+      if (!extra) {
+        const date = new Date(struct.end)
+        const timeString = date.pattern('yyyy/MM/dd')
+        struct.end = new Date(timeString).getTime()
+      }
       this.$refs.timeSelector.setState(struct)
     },
     restoreFilterArea (area) {

+ 6 - 10
src/views/analysisReport/MarketAnalysisResult.vue

@@ -469,11 +469,12 @@ export default {
     this.sendRequest()
   },
   mounted () {
-    this.calcStickyNav()
+    setTimeout(this.calcStickyNav, 1000)
   },
   methods: {
     calcStickyNav () {
-      const offset = $(`.${this.dimensionsTitle.market.anchor}`).offset()
+      // const offset = $(`.${this.dimensionsTitle.market.anchor}`).offset()
+      const offset = $('.analysis-result-list').offset()
       if (offset) {
         this.stickyed.startFixedTop = offset.top + 5
       }
@@ -737,14 +738,11 @@ export default {
 
       // 项目规模
       const mDAmount = {
-        columns: ['日期', '项目金额', '项目金额环比'],
+        columns: ['日期', '项目金额(万元)', '项目金额环比'],
         rows: []
       }
       let mDAmuntTotal = 0
       if (Array.isArray(data.project_amount)) {
-        // 求金额平均值,计算单位
-        const avg = data.project_amount.reduce((prev, current) => current.value + prev, 0) / data.project_amount.length
-        mDAmount.columns[1] += `(${this.moneyUnit(avg).unit})` // 得到单位
         const field = {
           [mDAmount.columns[0]]: 'minth',
           [mDAmount.columns[1]]: 'value',
@@ -756,9 +754,7 @@ export default {
             const value = item[field[column]]
             if (value) {
               if (field[column] === 'value') {
-                // 把所有值的单位都转换为坐标上显示的单位
-                const mUint = this.moneyUnit(value).unit
-                row[column] = this.moneyUnit(value, 'transfer', mUint).count
+                row[column] = formatPrice(value / 10000) - 0
               } else if (field[column] === 'ratio') {
                 row[column] = formatPrice(value * 100)
               } else {
@@ -1593,7 +1589,7 @@ export default {
 
   // reset-ele-table
   .ar-table {
-    margin: 10px 0;
+    margin: 20px 0;
     .ar-table-title {
       padding: 10px 0;
       font-size: 16px;

+ 4 - 0
src/views/analysisReport/components/MarketLineChart.vue

@@ -74,6 +74,10 @@ export default {
         }
       })
 
+      Object.assign(options.legend, {
+        icon: 'rect'
+      })
+
       options.tooltip.formatter = params => {
         let tip = `<div style="padding-top:2px;color:#9B9CA3;">${params[0].name}</div>`
         for (let i = 0; i < params.length; i++) {

+ 8 - 4
src/views/analysisReport/components/MarketTimeScatter.vue

@@ -95,10 +95,14 @@ export default {
           if (params[i].value === undefined || params[i].value === '') {
             params[i].value = 0
           }
-          if (i === 0) {
-            const unit = params[i].seriesName.match(/((.*))$/g).join('').replace(/[()]/g, '')
-            tip = tip + params[i].marker + params[i].seriesName + ':' + params[i].value + unit + '<br/>'
-          } else if (i === 1) {
+          if (params[i].seriesName.indexOf('环比') === -1) {
+            const match = params[i].seriesName.match(/((.*))$/g)
+            let unit = ''
+            if (Array.isArray(match)) {
+              unit = match.join('').replace(/[()]/g, '')
+            }
+            tip = tip + params[i].marker + params[i].seriesName.seriesName.replace(`(${unit})`, '') + ':' + params[i].value + unit + '<br/>'
+          } else {
             tip = tip + params[i].marker + params[i].seriesName + ':' + params[i].value + '%' + '<br/>'
           }
         }

+ 3 - 2
src/views/analysisReport/components/MarketTop3Table.vue

@@ -25,7 +25,8 @@
         </template>
       </el-table-column>
       <el-table-column
-        header-align="center"
+        header-align="left"
+        width="320"
         :label="tableData.columns[1]">
         <template slot-scope="scope">
           <div class="area" v-if="scope.row.name_type">
@@ -42,7 +43,7 @@
         </template>
       </el-table-column>
       <el-table-column
-        header-align="center"
+        header-align="left"
         :label="tableData.columns[2]">
         <template slot-scope="scope">
           <div class="area" v-if="scope.row.winner_name">

+ 1 - 1
src/views/analysisReport/components/ProjectScatter.vue

@@ -32,7 +32,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          align="center"
+          align="left"
           header-align="center"
           class-name="cursor"
           label="项目名称">

+ 15 - 2
src/views/analysisReport/index.vue

@@ -2,10 +2,10 @@
   <div class="analysis-report">
     <el-tabs v-model="activeTabName">
       <el-tab-pane label="定制化市场分析" name="analysis" lazy>
-        <MarketAnalysis ref="marketAnalysis" />
+        <MarketAnalysis @refreshTab2="needRefreshTab2 = true" ref="marketAnalysis" />
       </el-tab-pane>
       <el-tab-pane label="历史报告" name="history" lazy>
-        <ReportHistoryList />
+        <ReportHistoryList :key="historyKey" />
       </el-tab-pane>
     </el-tabs>
   </div>
@@ -26,6 +26,8 @@ export default {
   data () {
     return {
       activeTabName: 'analysis',
+      needRefreshTab2: false, // 需不需要实时刷新tab2
+      historyKey: '',
       analysisTab: {
         scrollTop: 0
       },
@@ -41,10 +43,20 @@ export default {
   },
   async created () {
     this.getTabQuery()
+    this.refreshKey()
     // 把用户订阅信息先请求下来,marketAnalysis 里面要用到
     await this.$store.dispatch('user/getKeywordsList')
   },
   methods: {
+    refreshKey () {
+      this.historyKey = Date.now() + ''
+    },
+    refreshTab2 () {
+      if (this.needRefreshTab2) {
+        this.refreshKey()
+        this.needRefreshTab2 = false
+      }
+    },
     getTabQuery () {
       const { tab } = this.$route.query
       if (tab) {
@@ -54,6 +66,7 @@ export default {
     tabChange (newVal, oldVal) {
       // 设置URL参数
       this.changeURLQuery(newVal)
+      this.refreshTab2()
       // 保存并滚动高度
       // this.saveScrollTop()
     },