浏览代码

投标决策分析筛选内容缓存

TANGSHIZHE 4 年之前
父节点
当前提交
a8c2ea087c

+ 1 - 1
src/components/report-data/SelectMonth.vue

@@ -48,7 +48,7 @@ export default {
       listYear: [],
       listWeek: [],
       setHeight: 'setHeight',
-      isActive: 0, // 年份坐标月份坐标
+      isActive: 0, // 月份坐标
       isIndexActive: 0, // 年份坐标
       isMany: false, // 是否显示更多按钮
       btnText: '更多',

+ 14 - 3
src/views/bid-policy/AnalysisResult.vue

@@ -12,7 +12,7 @@
       <ul class="digest_ul">
         <li class="digest_list">
           <div class="li_left">地区</div>
-          <div class="li_right">{{baseInfo.area?baseInfo.area:'--'}}</div>
+          <div class="li_right">{{areaStr}}</div>
         </li>
         <li class="digest_list">
           <div class="li_left">招标代理机构</div>
@@ -79,6 +79,7 @@ export default {
         text: '关注',
         type: 0
       },
+      areaStr: '',
       activeName: '1',
       baseInfo: {}, // 项目摘要及类似项目分析基础数据(渲染页面及需传给子组件使用)
       // 类似项目明细数据 传子组件的数据
@@ -123,9 +124,18 @@ export default {
       }
       const res = await getProjectInfo(data)
       if (res.error_code === 0 && res.data) {
+        console.log(res.data.s_subscopeclass)
         if (res.data.s_subscopeclass) {
           res.data.s_subscopeclass = this.initIndustryData(res.data.s_subscopeclass.split(','))
         }
+        if (res.data.area && Object.keys(res.data.area).length > 0) {
+          console.log(res.data.area[Object.keys(res.data.area)])
+          if (res.data.area[Object.keys(res.data.area)].length > 0) {
+            this.areaStr = Object.keys(res.data.area) + '省' + res.data.area[Object.keys(res.data.area)][0]
+          } else {
+            this.areaStr = Object.keys(res.data.area)
+          }
+        }
         this.ptid = res.data.id
         this.baseInfo = res.data
         this.getEntIsFollow(res.data.infoid)
@@ -135,6 +145,7 @@ export default {
     },
     // 处理数据为行业选择页面所需格式
     initIndustryData (data) {
+      console.log(data)
       var arr = []
       var obj = {}
       if (data) {
@@ -227,8 +238,8 @@ export default {
         buyerClass: item.buyer,
         buyerContent: item.scope,
         industry: item.industry,
-        maxPrice: item.range.minPrice,
-        minPrice: item.range.maxPrice,
+        maxPrice: Number(item.range.minPrice),
+        minPrice: Number(item.range.maxPrice),
         mobileModel: '',
         pid: this.baseInfo.id,
         pname: this.baseInfo.projectname,

+ 100 - 17
src/views/bid-policy/components/PolicyLimit.vue

@@ -16,7 +16,7 @@
       </div>
     </div>
     <div class="limit_content">
-      <IndustrySelector ref="industrySel" :initIndustry="baseInfo.s_subscopeclass" selectorType="line">
+      <IndustrySelector ref="industrySel" :initIndustry="baseInfo.industry" selectorType="line">
         <div slot="header">行业分类:</div>
       </IndustrySelector>
       <AreaSelector ref="areaSelector" selectorType="line" :initCityMap="baseInfo.area">
@@ -118,6 +118,7 @@ export default {
   },
   watch: {
     buyClass (newVal, oldVal) {
+      console.log(newVal)
       // this.initData(this.buyClass)
     },
     baseInfo (newVal, oldVal) {
@@ -127,13 +128,101 @@ export default {
         //   const p = this.getAreaInfo(newVal.area)
         //   this.backArea = p
         // }
-        if (!newVal.s_subscopeclass) {
-          newVal.s_subscopeclass = {}
+        let POLICY_OPTIONLIMIT = sessionStorage.getItem('BID_POLICY_OPTIONLIMIT')
+        if (POLICY_OPTIONLIMIT) {
+          POLICY_OPTIONLIMIT = JSON.parse(POLICY_OPTIONLIMIT)
+          newVal.area = POLICY_OPTIONLIMIT.area
+          newVal.buyerclass = POLICY_OPTIONLIMIT.buyer
+          // this.$refs.scopeSelector.setState = this.setBuyScope(POLICY_OPTIONLIMIT.scope)
+          this.range = POLICY_OPTIONLIMIT.range
+          if (POLICY_OPTIONLIMIT.range.minPrice !== '' || POLICY_OPTIONLIMIT.range.maxPrice) {
+            this.getSection(1)
+            this.range.minPrice = POLICY_OPTIONLIMIT.range.minPrice
+            this.range.maxPrice = POLICY_OPTIONLIMIT.range.maxPrice
+          } else {
+            this.getSection(0)
+          }
+          newVal.industry = this.initIndustryData(POLICY_OPTIONLIMIT.industry)
+          sessionStorage.removeItem('BID_POLICY_OPTIONLIMIT')
+        } else {
+          if (!newVal.industry) {
+            newVal.industry = []
+          } else {
+            newVal.industry = this.initIndustryData(newVal.industry)
+          }
+        }
+        for (const item in newVal.area) {
+          console.log(item)
+          newVal.area[item] = this.trimSpace(newVal.area[item])
+          console.log(newVal.area)
         }
       }
     }
   },
   methods: {
+    // 去除数组的空字符串
+    trimSpace (array) {
+      console.log(array)
+      for (var i = 0; i < array.length; i++) {
+        if (array[i] === '' || array[i] == null || typeof (array[i]) === 'undefined') {
+          array.splice(i, 1)
+          i = i - 1
+        }
+      }
+      return array
+    },
+    // 处理采购内容
+    setBuyScope (data) {
+      console.log(data)
+      const scopeArr = []
+      data.forEach(function (v, i) {
+        v.key.forEach(function (item, index) {
+          scopeArr.push(item)
+        })
+      })
+      return scopeArr
+    },
+    // 处理数据为行业选择页面所需格式
+    initIndustryData (data) {
+      console.log(data)
+      var arr = []
+      var obj = {}
+      if (data) {
+        data.forEach(function (item) {
+          item = item.split('_')
+          // obj[item[0]] = item[1]
+          arr.push({
+            key: item[0],
+            val: item[1]
+          })
+        })
+        var tempArr = []
+        var newArr = []
+        for (var i = 0; i < arr.length; i++) {
+          if (tempArr.indexOf(arr[i].key) === -1) {
+            newArr.push({
+              key: arr[i].key,
+              child: [arr[i].val]
+            })
+            tempArr.push(arr[i].key)
+          } else {
+            for (var j = 0; j < newArr.length; j++) {
+              if (newArr[j].key === arr[i].key) {
+                newArr[j].child.push(arr[i].val)
+                break
+              }
+            }
+          }
+        }
+        for (var t = 0; t < newArr.length; t++) {
+          obj[newArr[t].key] = newArr[t].child
+        }
+        console.log(obj)
+        return obj
+      } else {
+        return '请选择行业'
+      }
+    },
     initData (data) {
       console.log(data)
       this.baseInfo.buyerContent = data
@@ -181,10 +270,7 @@ export default {
         this.range.maxPrice = ''
       } else {
         this.moneySec = false
-        this.range.minPrice = this.input
-        this.range.maxPrice = this.input2
       }
-      console.log(this.range.minPrice, this.range.maxPrice)
     },
     // 价格区间大小翻转判断
     minAndMaxSort () {
@@ -203,7 +289,7 @@ export default {
     },
     // 采购内容设置
     setPurContent (title) {
-      console.log(title)
+      sessionStorage.setItem('BID_POLICY_OPTIONLIMIT', JSON.stringify(this.getParamsData()))
       this.$router.push({
         path: '/set_scope',
         query: {
@@ -221,11 +307,9 @@ export default {
         }
       })
     },
-    // 开始分析
-    StartAnsisy () {
+    getParamsData () {
       // 处理行业数据
       const instudys = this.$refs.industrySel.getSelected()
-      console.log(instudys)
       let industryStr = ''
       if (JSON.stringify(instudys) === '{}') {
         industryStr = ''
@@ -244,6 +328,7 @@ export default {
           ComArr += inArr
         }
         industryStr = ComArr.split(',').slice(0, ComArr.split(',').length - 1) + ''
+        industryStr = industryStr.split(',')
       }
       // 处理采购内容数据
       const scopeArr = this.$refs.scopeSelector.getState()
@@ -258,12 +343,6 @@ export default {
           }
           newScopearr.push(conList)
         })
-      } else {
-        // const conList = {
-        //   key: [],
-        //   appendkey: [],
-        //   notkey: []
-        // }
       }
       const dataList = {
         industry: industryStr,
@@ -272,8 +351,12 @@ export default {
         buyer: this.$refs.buyerSelector.getSelected(),
         range: this.range
       }
+      return dataList
+    },
+    // 开始分析
+    StartAnsisy () {
       this.isClick = true
-      this.$emit('dataList', dataList)
+      this.$emit('dataList', this.getParamsData())
     }
   }
 }

+ 1 - 1
src/views/reportData/pageMonth.vue

@@ -5,7 +5,7 @@
       <div class="week_time">
         <SelectMonth :queryDate="getQueryTime" :getTypeTime="{judgeTime: 'month'}" @selectYm="selectYear"></SelectMonth>
       </div>
-      <Empty v-if="nodata"></Empty>
+      <Empty tip="暂无数据" v-if="nodata"></Empty>
       <div v-else>
         <!-- 数据报告-周报 -->
         <div class="dataReport">

+ 1 - 1
src/views/reportData/pageWeek.vue

@@ -24,7 +24,7 @@
               </div>
             </div>
           </div>
-          <Empty v-if="!nodata"></Empty>
+          <Empty tip="暂无数据" v-if="!nodata"></Empty>
         </div>
       </div>
       <!-- 数据报告-周报 -->