代码片段
<!-- 小漏斗 搜索🔍--> <span @click.stop="showMapText" class="maptest" :class="checkMap ? 'activeDiv' : ''"> <i class="iconfont icon-showcolor title_span"></i> </span> <div v-show="checkMap" class="check_wrapper" style="height: 180px;"> <div class="sous" style="margin: 6px 0;text-align: left;"> <falcon-input style="padding-left: 20px;" width='260px' v-model="inputSearchList" placeholder="请输入" ></falcon-input> </div> <div class="searchCon"> <p class="mapText" :class="items.target == eyesIndex ? 'isActive' : ''" v-for="(items, index) in inputSearchList !== '' ? searchList:zhuos" @click="setBlockPlate(index,items)" :key="index" >{{items.target}}</p> </div> </div> watch: { inputSearchList (newValue) { clearTimeout(this.timer) this.timer = setTimeout(() => { this.searchList = [] if (newValue !== '') { this.zhuos.forEach(val => { if (val.target.indexOf(newValue) !== -1) { this.searchList.push(val) } }) } }, 300) }, showPlate(newVal) { setTimeout(() => { this.addClass(0, 1) }, 300) } },
// 级联选择
let checkLists = [] let check = [] this.checkModeTabA.forEach(item => { item.infos.forEach((itemm,ind) => { if (itemm.checked) { checkLists.push(itemm) } }) }) this.$set(this.$data, 'checkModeTabC', checkLists)
数据组装 租金对标 - - let obj = [] name = [...new Set(name)] name.forEach(item => { let list = b.filter(is => is.productLineName == item) obj.push({ name: item, list: list }) })
// 租金 自动获取数据 响应 watch: { valueList: { handler (val) { // 获取最新的对标竞品名称 shopName let shopName = [] val.newVal.forEach(item => shopName.push(item.shopName)) /* 遍历组件数据 目的是如果对标竞品已选的话 判断最新的shopName 如果有就不发生改变 如果没有则清空此列数据 */ this.reprisesResult.forEach((item, i) => { console.log(item) if (!this.apartMent[i]) this.apartMent[i] = [] item.list.forEach((itemm, index) => { console.log(itemm) if (itemm.competingName && shopName.indexOf(itemm.competingName) == -1) { itemm.competingName = '' itemm.competingHouse = '' itemm.competingAmount = '' itemm.competingArea = '' itemm.configurationType = '' } else { /* 对比新老数据 以下处理的是同一对标竞品下的list长度一致 表示当前只是更改了竞品面积和竞品租金 没有发生增和减 */ // 新数据当前对标竞品 let objNew = val.newVal.find(value => value.shopName == itemm.competingName) // 老数据当前对标竞品 let objOld = val.oldVal.find(value => value.shopName == itemm.competingName) // 老于原始数据发生变化把二级菜单替换成新的 if (objNew) { this.apartMent[i][index] = objNew.list this.apartMentFlag = true } if (objOld) { // 下拉更新了 但是选中的值还是旧值 // 在老数据中根据以前选中的值找出原值所在下标 用新数据的此下标值替换 let typeOld = objOld.list.findIndex(val => val.label == itemm.competingHouse) console.log(typeOld) if (objNew.list.length == objOld.list.length && typeOld > -1) { console.log(objNew.list) itemm.competingHouse = objNew.list[typeOld].label itemm.competingAmount = objNew.list[typeOld].leasePrice itemm.competingArea = objNew.list[typeOld].area } } if (itemm.competingHouse) { let type = objNew.list.find(val => val.label == itemm.competingHouse) if (!type) { itemm.competingHouse = '' itemm.competingAmount = '' itemm.competingArea = '' } } } }) }) this.valueList = val }, deep: true }, reprisesResult: { handler (val) { this.reprisesResult = val }, deep: true } },
一辈子很短,努力的做好两件事就好;第一件事是热爱生活,好好的去爱身边的人;第二件事是努力学习,在工作中取得不一样的成绩,实现自己的价值,而不是仅仅为了赚钱;