瀏覽代碼

fix:业务范围合并关键词接口数据、决策分析echarts判断条件、周报月报广告位参数

yangfeng 4 年之前
父節點
當前提交
46b2509294

+ 3 - 1
src/components/common/ContentLayout.vue

@@ -45,7 +45,9 @@ export default {
       adCodeMap: {
         projectInfo: 'jy-pc-bigmember-project-content-right', // 项目详情页右侧广告位code
         entportrait: 'jy-pc-bigmember-entportrait-content-right', // 企业情报详情页右侧广告位code
-        unitportrayal: 'jy-pc-bigmember-unitportrayal-content-right' // 采购单位全景分析详情页右侧广告位code
+        unitportrayal: 'jy-pc-bigmember-unitportrayal-content-right', // 采购单位全景分析详情页右侧广告位code
+        month: 'jy-pc-bigmember-month-content-right',
+        week: 'jy-pc-bigmember-week-content-right'
       },
       adList: [
         // {

+ 75 - 69
src/views/portrayal/components/AnalysisChart.vue

@@ -195,92 +195,98 @@ export default {
     },
     // 处理编制周期数据
     formatBidCycleData (data) {
-      if (!data) return
-      const arr = []
-      data.forEach((item) => {
-        arr.push({
-          '编制周期': item.key, // eslint-disable-line
-          '项目数量': item.doc_count // eslint-disable-line
+      if (data && data.length > 0) {
+        const arr = []
+        data.forEach((item) => {
+          arr.push({
+            '编制周期': item.key, // eslint-disable-line
+            '项目数量': item.doc_count // eslint-disable-line
+          })
         })
-      })
-      this.bidCycle.data.rows = arr
-      // 数据都为0 隐藏
-      var countArr = this.bidCycle.data.rows.map((v) => {
-        return v['项目数量']
-      })
-      const max = Math.max.apply(null, countArr)
-      if (max === 0) {
-        this.bidCycle.show = false
+        this.bidCycle.data.rows = arr
+        // 数据都为0 隐藏
+        var countArr = this.bidCycle.data.rows.map((v) => {
+          return v['项目数量']
+        })
+        const max = Math.max.apply(null, countArr)
+        if (max === 0) {
+          this.bidCycle.show = false
+        }
+        this.bidCycle.show = true
       }
-      this.bidCycle.show = true
     },
     // 处理类似项目预算分布数据
     formatBudgetData (arr) {
-      if (!arr) return
-      let data = []
-      data = arr.map((v, i) => {
-        v.avg = v.avg === null ? '0' : v.avg
-        const x = i % 10
-        const y = 10 - Math.ceil((i + 1) / 10)
-        return [x, y, v.avg, v.doc_count, v.key]
-      })
-      this.budget.data = data
-      this.budget.show = true
-      this.budget.flag = true
+      if (arr && arr.length > 0) {
+        let data = []
+        data = arr.map((v, i) => {
+          v.avg = v.avg === null ? '0' : v.avg
+          const x = i % 10
+          const y = 10 - Math.ceil((i + 1) / 10)
+          return [x, y, v.avg, v.doc_count, v.key]
+        })
+        this.budget.data = data
+        this.budget.show = true
+        this.budget.flag = true
+      }
     },
     formatAreaData (data) {
-      if (!data) return
-      const rows = []
-      data.forEach((item) => {
-        rows.push({
-          /* eslint-disable */
-          '省份': item.key,
-          '类似项目数量': item.doc_count,
-          '类似项目规模': moneyUnit(item.bidamount_sum)
-          /* eslint-enable */
+      if (data && data.length > 0) {
+        const rows = []
+        data.forEach((item) => {
+          rows.push({
+            /* eslint-disable */
+            '省份': item.key,
+            '类似项目数量': item.doc_count,
+            '类似项目规模': moneyUnit(item.bidamount_sum)
+            /* eslint-enable */
+          })
         })
-      })
-      this.area.data.rows = rows
-      this.area.show = true
+        this.area.data.rows = rows
+        this.area.show = true
+      }
     },
     // 处理类似项目采购单位类型分布数据
     formatBuyClassData (data) {
-      if (!data) return
-      const arr = []
-      // 降序排列
-      data.sort((a, b) => {
-        return b.doc_money - a.doc_money
-      })
-      data.forEach((item) => {
-        arr.push(item.key, item.doc_money, item.doc_count, item.avg, item.main)
-      })
-      const normal = ['行业', '类似项目规模', '类似项目数量', '平均折扣率', '是否当前项目']
-      const newArr = this.arrTrans(5, arr)
-      newArr.unshift(normal)
-      this.buyclass.data = newArr
-      this.buyclass.show = true
+      if (data && data.length > 0) {
+        const arr = []
+        // 降序排列
+        data.sort((a, b) => {
+          return b.doc_money - a.doc_money
+        })
+        data.forEach((item) => {
+          arr.push(item.key, item.doc_money, item.doc_count, item.avg, item.main)
+        })
+        const normal = ['行业', '类似项目规模', '类似项目数量', '平均折扣率', '是否当前项目']
+        const newArr = this.arrTrans(5, arr)
+        newArr.unshift(normal)
+        this.buyclass.data = newArr
+        this.buyclass.show = true
+      }
     },
     // 处理类似项目热点中标企业数据
     formatHotWinData (data) {
-      if (!data) return
-      this.hotWin.show = true
-      this.hotWin.data = data
-      this.hotWin.flag = true
+      if (data && data.length > 0) {
+        this.hotWin.show = true
+        this.hotWin.data = data
+        this.hotWin.flag = true
+      }
     },
     formatExpertData (data) {
-      if (!data) return
-      const arr = []
-      data.forEach((v) => {
-        v.parent = v.doc_count / data[0].doc_count * 100 + '%'
-        arr.push({
-          name: v.key,
-          count: v.doc_count,
-          parent: v.parent
+      if (data && data.length > 0) {
+        const arr = []
+        data.forEach((v) => {
+          v.parent = v.doc_count / data[0].doc_count * 100 + '%'
+          arr.push({
+            name: v.key,
+            count: v.doc_count,
+            parent: v.parent
+          })
         })
-      })
-      this.expert.show = true
-      this.expert.data = arr
-      this.expert.flag = true
+        this.expert.show = true
+        this.expert.data = arr
+        this.expert.flag = true
+      }
     },
     /* *********** 配置项部分 *********** */
     // 类似项目标书编制周期分布配置

+ 6 - 2
src/views/subscribe/Scope.vue

@@ -51,10 +51,9 @@ export default {
         } else {
           // 关键词
           if (res.member_jy.a_items && JSON.stringify(res.member_jy.a_items) !== '[]') {
-            this.setData.keywordsList = res.member_jy.a_items
             const scopeStorage = this.$store.state.user.scope
             if (scopeStorage && scopeStorage.length > 0) {
-              this.setData.keywordsList = scopeStorage
+              this.setData.keywordsList = this.unique(res.member_jy.a_items.concat(scopeStorage))
             } else {
               this.setData.keywordsList = res.member_jy.a_items
             }
@@ -77,6 +76,11 @@ export default {
     saveSetting () {
       this.$store.commit('user/setScope', this.setData.keywordsList)
       this.$router.back()
+    },
+    // 数组合并去重用于将新增的关键词组合并到本地缓存中
+    unique (arr) {
+      const res = new Map()
+      return arr.filter((item) => !res.has(item.s_item) && res.set(item.s_item, 1))
     }
   }
 

+ 2 - 2
src/views/subscribe/components/SubConfig.vue

@@ -186,7 +186,7 @@ export default {
           this.projectSwitch.loading = false
           this.projectSwitch.disabled = false
           this.$message({
-            message: '切换成功',
+            message: event === 1 ? '项目匹配已开启' : '项目匹配已关闭',
             type: 'success'
           })
         }
@@ -204,7 +204,7 @@ export default {
           this.unitSwitch.loading = false
           this.unitSwitch.disabled = false
           this.$message({
-            message: '切换成功',
+            message: state === 1 ? '"其它"采购单位已开启' : '"其它"采购单位已关闭',
             type: 'success'
           })
         }