|
@@ -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())
|
|
|
}
|
|
|
}
|
|
|
}
|