TANGSHIZHE 4 years ago
parent
commit
9746a6cab7

+ 1 - 0
package.json

@@ -22,6 +22,7 @@
     "systemjs-webpack-interop": "^1.1.2",
     "v-charts": "1.19.0",
     "vue": "^2.6.10",
+    "vue-cookies": "^1.7.4",
     "vue-router": "^3.1.3",
     "vuex": "^3.6.2"
   },

+ 1 - 0
src/components/forecast/ForLimit.vue

@@ -161,6 +161,7 @@ export default {
     },
     // 回显采购内容
     getBuyContent (data) {
+      console.log(data)
       const arr = []
       data.forEach(function (item) {
         item.key.forEach(function (iitem) {

+ 0 - 2
src/components/forecast/ForeCast.vue

@@ -207,7 +207,6 @@ export default {
     }
   },
   created () {
-    // 我关注的企业
     // 中标企业预测
     if (this.type === 'bidfor') {
       this.initData(this.mydata, this.type)
@@ -309,7 +308,6 @@ export default {
     resInitData (list) {
       if (list && list.length !== 0) {
         list.forEach(function (item) {
-          console.log(item)
           item.weight = Number((item.weight * 100).toFixed(0))
           if (item.employee_no === '') {
             item.employee_no = '--'

+ 2 - 0
src/main.js

@@ -2,12 +2,14 @@ import Vue from 'vue'
 import App from './App.vue'
 import store from './store/'
 import router from './router/'
+import VueCookies from 'vue-cookies'
 import singleSpaVue from 'single-spa-vue'
 import { Loading, Message } from 'element-ui'
 import echarts from 'echarts'
 import axios from 'axios'
 import '@/utils/'
 
+Vue.use(VueCookies)
 Vue.use(Loading.directive)
 
 Vue.prototype.$message = Message

+ 18 - 3
src/store/forcast.js

@@ -1,10 +1,13 @@
 import { defaultLocalPageData } from '@/utils/'
+import cookies from 'vue-cookies'
 export default {
   namespaced: true,
   state: () => ({
     // 中标企业预测
     list: [],
-    historyList: defaultLocalPageData('bigmember-BID_DATA-login-clear', []),
+    historyList: defaultLocalPageData(`bigmember-BID_DATA-${cookies.get('SESSIONID')}`, []),
+    // 中标企业预测-详情页基本信息列表
+    detailBaseList: defaultLocalPageData('BIG_AI_LIST_PC', []),
     // 投标决策分析
     policyList: [],
     historyPolicyList: defaultLocalPageData('bigmember-POLICY_DATA-login-clear', []),
@@ -14,7 +17,9 @@ export default {
     entObject: {},
     type: 0,
     // 中标预测次数
-    bidForeCastNum: 0
+    bidForeCastNum: 0,
+    // 获取sessionid
+    sessionID: cookies.get('SESSIONID')
   }),
   mutations: {
     // 中标企业预测
@@ -23,8 +28,18 @@ export default {
     },
     setHistoryList (state, list) {
       state.historyList = list.concat(state.historyList)
-      localStorage.setItem('bigmember-BID_DATA-login-clear', JSON.stringify(state.historyList))
+      localStorage.setItem(`bigmember-BID_DATA-${state.sessionID}`, JSON.stringify(state.historyList))
     },
+    changeDetailBaseList (state, list) {
+      state.detailBaseList = list
+      localStorage.setItem('BIG_AI_LIST_PC', JSON.stringify(state.detailBaseList))
+    },
+    // 中标企业预测-详情页基本信息列表
+    setDetailBaseList (state, list) {
+      state.detailBaseList = list.concat(state.detailBaseList)
+      localStorage.setItem('BIG_AI_LIST_PC', JSON.stringify(state.detailBaseList))
+    },
+    // 判断是否搜索过
     setType (state, type) {
       state.type = type
     },

+ 13 - 9
src/views/bid-forecast/BidForecast.vue

@@ -48,7 +48,8 @@ export default {
       numTips: '您可以下载剑鱼标讯APP,在大会员产品中进行充值',
       pronametip: '',
       readyTime: null,
-      timer: ''
+      timer: '', // 请求接口所用时间定时器
+      timers: '' // 请求接口每5s调用一次定时器
     }
   },
   mounted () {
@@ -98,17 +99,20 @@ export default {
         // -1:预测失败;0:默认;1:有未查看得预测数据并返回id;2:正在预测中
         if (res.data.status === 1) {
           this.fid = res.data.id
-          // this.$router.push({
-          //   path: '/bidforlimit',
-          //   query: {
-          //     sid: res.data.id
-          //   }
-          // })
+          this.$router.push({
+            path: '/ai_add',
+            query: {
+              sid: res.data.id,
+              bidtype: '1'
+            }
+          })
         } else if (res.data.status === 2) {
           this.loading = true
           this.readyTime = new Date().getTime()
+          this.pronametip = `${res.data.pname}中标企业预测中运算很复杂,可能需要几十秒的时间,请耐心等待...`
           this.timer = setInterval(() => {
             if (this.timeDiff(this.readyTime) >= 120) {
+              clearInterval(this.timers)
               clearInterval(this.timer)
               this.$message.error('预测失败')
             } else {
@@ -132,10 +136,10 @@ export default {
                 this.fid = res.data.id
                 console.log(res.data.id)
                 this.$router.push({
-                  path: '/bidforlimit',
+                  path: '/ai_add',
                   query: {
                     sid: res.data.id,
-                    bidtype: 0
+                    bidtype: '1'
                   }
                 })
                 clearInterval(this.timer)

+ 77 - 2
src/views/bid-forecast/BidForecastLimit.vue

@@ -86,14 +86,32 @@ export default {
       resData: [],
       resquestData: {},
       isperfect: false,
-      iscomplete: false // 招标完成展示弹框
+      iscomplete: false, // 招标完成展示弹框
+      bidtype: '',
+      timer: '' // 定时器
     }
   },
   created () {
     // this.getData()
+    this.bidtype = this.$route.query.bidtype
+    if (this.bidtype) {
+      // 获取sessionStroage的pid 请求项目信息接口
+      const BID_PID = sessionStorage.getItem('BID_PID')
+      if (BID_PID) {
+        this.paramlist.ptid = BID_PID
+        this.getproStatus()
+      }
+      this.loading = true
+      this.proShow = true
+      this.getProForWResult(this.$route.query.sid)
+    }
     this.getBaseInfo()
     this.getproStatus()
   },
+  // 离开页面事件
+  beforeDestroy () {
+    clearInterval(this.timer)
+  },
   methods: {
     getData () {
       getResultDetail({ id: this.paramlist.id }).then(res => {
@@ -117,9 +135,53 @@ export default {
         ptid: this.paramlist.ptid,
         sourceinfoid: this.paramlist.sid
       }
+      const _this = this
       const res = await getProjectInfo(data)
       if (res.error_code === 0 && res.data) {
+        console.log(res.data)
+        if (res.data.buyerContent && res.data.buyerContent.length > 0) {
+          const newKeyArr = []
+          res.data.buyerContent.forEach(function (item, i) {
+            console.log(item)
+            item.key.forEach(function (v) {
+              newKeyArr.push(v)
+            })
+          })
+          res.data.buyerContent = newKeyArr
+        }
+        const bidListPC = this.$store.state.forcast.detailBaseList
+        if (bidListPC.filter(v => v.id === res.data.id).length) {
+          const newKeyArr = []
+          bidListPC.forEach(function (v) {
+            if (v.id === res.data.id) {
+              v.buyerContent.forEach(function (item, i) {
+                // const conList = {
+                // key: [item]
+                // appendkey: [],
+                // notkey: []
+                // }
+                newKeyArr.push(item)
+              })
+              v.buyerContent = newKeyArr
+              _this.baseInfo = v
+            }
+          })
+          return
+        }
+        // const newKeyArr = []
+        // console.log(res.data)
+        // res.data.buyerContent.forEach(function (item, i) {
+        //   const conList = {
+        //     key: [item]
+        //     // appendkey: [],
+        //     // notkey: []
+        //   }
+        //   newKeyArr.push(conList)
+        // })
+        // res.data.buyerContent = newKeyArr
         this.baseInfo = res.data
+        const result = [res.data]
+        this.$store.commit('forcast/setDetailBaseList', result)
       } else {
         console.log(res.error_code)
       }
@@ -128,6 +190,19 @@ export default {
     getLimit (data) {
       console.log(data)
       if (Object.keys(data.area).length !== 0 && data.buyerContent.length !== 0 && data.buyer !== '') {
+        const bidListPC = this.$store.state.forcast.detailBaseList
+        // 点击预测把筛选条件重新赋值存入本地local
+        if (bidListPC) {
+          const nowData = bidListPC.map(v =>{
+            if (this.paramlist.ptid === v.id) {
+              return Object.assign(v, data)
+            }
+            return v
+          })
+          this.$store.commit('forcast/changeDetailBaseList', nowData)
+        }
+        // 把预测的pid存入session,查询项目信息接口
+        sessionStorage.setItem('BID_PID', this.paramlist.ptid)
         this.getProForWData(data)
       } else {
         this.$refs.forlimits.isClick = false
@@ -173,7 +248,7 @@ export default {
       }
     },
     async getProForWStatus () {
-      const timer = setInterval(() => {
+      this.timer = setInterval(() => {
         getForWStatus().then(res => {
           console.log(res)
           if (res.error_code === 0) {

+ 26 - 1
src/views/bid-policy/components/PolicyLimit.vue

@@ -22,7 +22,7 @@
       <AreaSelector ref="areaSelector" selectorType="line" :initCityMap="backArea">
         <div slot="header">选择区域:</div>
       </AreaSelector>
-      <BusinessScopeSelector ref="scopeSelector" :initList="baseInfo.buyerContent" selectorType="line">
+      <BusinessScopeSelector ref="scopeSelector" :initList="getScopeKeyList" selectorType="line">
         <div slot="header">采购内容:</div>
       </BusinessScopeSelector>
       <BuyerclassSelector ref="buyerSelector" :initCate="baseInfo.buyerclass"  selectorType="line">
@@ -75,6 +75,7 @@ import IndustrySelector from '@/components/selector/IndustrySelector.vue'
 import BuyerclassSelector from '@/components/selector/BuyerclassSelector.vue'
 import BusinessScopeSelector from '@/components/selector/BusinessScopeSelector.vue'
 import { Input } from 'element-ui'
+import { mapState } from 'vuex'
 export default {
   props: ['baseInfo'],
   name: 'policy-limit',
@@ -95,7 +96,24 @@ export default {
       }
     }
   },
+  computed: {
+    ...mapState({
+      buyClass: state => state.user.buyClass
+    }),
+    getScopeKeyList () {
+      return this.buyClass.map(v => {
+        return v.key.join(' ')
+      })
+    }
+  },
+  mounted () {
+    this.initData(this.buyClass)
+  },
   watch: {
+    buyClass (newVal, oldVal) {
+      console.log(newVal)
+      this.initData(this.buyClass)
+    },
     baseInfo (newVal, oldVal) {
       if (newVal) {
         console.log(newVal)
@@ -110,6 +128,13 @@ export default {
     }
   },
   methods: {
+    initData (data) {
+      console.log(data)
+      if (!this.baseInfo.buyerContent) {
+        this.$store.dispatch('user/getKeywordsList')
+      }
+      this.baseInfo.buyerContent = data
+    },
     // 判断省市
     getAreaInfo (name) {
       const info = {

+ 0 - 3
vue.config.js

@@ -8,7 +8,6 @@ const cdn = {
     '//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
     '//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
     '//cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js',
-    '//cdn.jsdelivr.net/npm/v-charts@1.19.0/lib/index.min.js',
     '//cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
     '//cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'
   ],
@@ -18,7 +17,6 @@ const cdn = {
     '//cdn-common.jianyu360.cn/cdn/lib/vuex/3.4.0/vuex.min.js',
     '//cdn-common.jianyu360.cn/cdn/lib/axios/0.19.2/axios.min.js',
     '//cdn-common.jianyu360.cn/cdn/lib/echarts/4.8.0/echarts.min.js',
-    '//cdn.jsdelivr.net/npm/v-charts@1.19.0/lib/index.min.js',
     '//cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
     '//cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'
   ]
@@ -69,7 +67,6 @@ module.exports = {
           'vuex',
           'axios',
           'echarts',
-          'v-charts',
           'lodash',
           'moment'
         ])