|
@@ -14,13 +14,16 @@
|
|
|
<base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[17,21]">
|
|
|
<div slot="OI17" class="scoped-product">
|
|
|
<div class="sp-item" v-for="(product, one) in productData" :key="one">
|
|
|
- <div class="sp-title">{{product.label}}</div>
|
|
|
+ <div class="sp-title">{{product.product_type_name}}</div>
|
|
|
<div class="sp-content">
|
|
|
- <el-form-item label="产品类型均价">
|
|
|
- <el-input v-model="product.price" placeholder="请输入产品类型均价范围"></el-input>
|
|
|
+ <el-form-item label="产品最低均价">
|
|
|
+ <el-input v-model="product.price_min" placeholder="请输入产品类型最低均价"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="产品最高均价">
|
|
|
+ <el-input v-model="product.price_max" placeholder="请输入产品类型最大高价"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="户型">
|
|
|
- <el-select v-model="product.type" placeholder="请选择" :multiple="true" @change="roomTypeChange(one)">
|
|
|
+ <el-select v-model="product.house_type_list_val" placeholder="请选择" :multiple="true" @change="houseTypeChange(one)">
|
|
|
<el-option
|
|
|
v-for="item in $dictData.house_type"
|
|
|
:key="item.val"
|
|
@@ -30,12 +33,12 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<div class="room-box">
|
|
|
- <div class="room-item" v-for="(room, two) in product.room" :key="two">
|
|
|
- <div class="ri-title">{{room.label}}
|
|
|
+ <div class="room-item" v-for="(room, two) in product.house_type_list" :key="two">
|
|
|
+ <div class="ri-title">{{room.house_type_name}}
|
|
|
<el-button type="small" icon="el-icon-plus" class="xl-form-btn xs t3" @click="roomAreaAdd(one, two)">添加</el-button>
|
|
|
</div>
|
|
|
<div class="ri-content">
|
|
|
- <div class="ri-op" v-for="(area, three) in room.arr" :key="three">
|
|
|
+ <div class="ri-op" v-for="(area, three) in room.area_list" :key="three">
|
|
|
<el-upload
|
|
|
class="ri-img"
|
|
|
:action="`http://api.kaolanet.com/adm/upload/picture`"
|
|
@@ -46,8 +49,8 @@
|
|
|
:on-error="roomAreaUploadError"
|
|
|
:before-upload="roomAreaUploadBefore"
|
|
|
>
|
|
|
- <img v-if="area.imgUrl" :src="area.imgUrl" class="img" @click="roomAreaUploadImg(one, two, three)">
|
|
|
- <i v-else class="el-icon-plus icon" />
|
|
|
+ <img v-if="area.img_url" :src="area.img_url" class="img" @click="roomAreaUploadImg(one, two, three)">
|
|
|
+ <i v-else class="el-icon-plus icon" @click="roomAreaUploadImg(one, two, three)"/>
|
|
|
</el-upload>
|
|
|
<div class="ri-deal">
|
|
|
<input class="ri-input" v-model="area.area" type="text" placeholder="输面积">
|
|
@@ -79,6 +82,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { arrToObj } from '@/utils'
|
|
|
import handleMap from '@/components/Common/Map'
|
|
|
export default {
|
|
|
components: { handleMap },
|
|
@@ -96,46 +100,8 @@ export default {
|
|
|
formData: [],
|
|
|
cObj: {},
|
|
|
isShowMap: false,
|
|
|
- productData: [
|
|
|
- {
|
|
|
- label: '高层',
|
|
|
- type: ['322'],
|
|
|
- price: '12000-15000',
|
|
|
- room: [
|
|
|
- {
|
|
|
- label: '三室两厅两卫',
|
|
|
- value: '322',
|
|
|
- arr: [
|
|
|
- {imgUrl: 'http://dwz.date/etYc', area: '100'},
|
|
|
- {imgUrl: '', area: '100'},
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- label: '一室一厅一卫',
|
|
|
- value: '322',
|
|
|
- arr: [
|
|
|
- {imgUrl: 'http://dwz.date/etYc', area: '100'},
|
|
|
- {imgUrl: '', area: '100'},
|
|
|
- ]
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- label: '洋房',
|
|
|
- type: ['322'],
|
|
|
- price: '12000-15000',
|
|
|
- room: [
|
|
|
- {
|
|
|
- label: '三室两厅两卫',
|
|
|
- value: '322',
|
|
|
- arr: [
|
|
|
- {imgUrl: 'http://dwz.date/etYc', area: '100'},
|
|
|
- {imgUrl: '', area: '100'},
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ],
|
|
|
+ productData: [],
|
|
|
+ tempImgIndex: [0, 0, 0],
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -145,7 +111,6 @@ export default {
|
|
|
this.loading = true
|
|
|
this.$api.house.admestatedetail({id: this.curObj.id}).then(res => {
|
|
|
let curData = res || {}
|
|
|
- curData.pri_image = `${curData.pri_image_path}?id=${curData.pri_image}`
|
|
|
if (curData.house_type) curData.house_type = curData.house_type.split(',')
|
|
|
if (curData.product_type) curData.product_type = curData.product_type.split(',')
|
|
|
if (curData.hospital_type) curData.hospital_type = curData.hospital_type.split(',')
|
|
@@ -153,7 +118,23 @@ export default {
|
|
|
if (curData.park_type) curData.park_type = curData.park_type.split(',')
|
|
|
if (curData.metro_line) curData.metro_line = curData.metro_line.split(',')
|
|
|
if (curData.metro_type) curData.metro_type = curData.metro_type.split(',')
|
|
|
+ curData.pri_image = `${curData.domain}${curData.pri_image}?url=${curData.pri_image}`
|
|
|
this.cObj = curData || {}
|
|
|
+ let productData = curData.area_data || []
|
|
|
+ productData.map(one =>{
|
|
|
+ one.product_type_name = arrToObj(this.$dictData.product_type)[one.product_type_val]
|
|
|
+ let houseTypeList = one.house_type_list || []
|
|
|
+ one.house_type_list_val = []
|
|
|
+ houseTypeList.map(two => {
|
|
|
+ two.house_type_name = arrToObj(this.$dictData.house_type)[two.house_type_val]
|
|
|
+ one.house_type_list_val.push(String(two.house_type_val))
|
|
|
+ const areaList = two.area_list || []
|
|
|
+ areaList.map(three =>{
|
|
|
+ three.img_url = `${curData.domain}${three.img_url}?url=${three.img_url}`
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.productData = [...productData]
|
|
|
this.getDef()
|
|
|
this.loading = false
|
|
|
})
|
|
@@ -165,42 +146,45 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- roomTypeChange (one, val) {
|
|
|
- let curRoom = []
|
|
|
- let typeArr = this.productData[one].type || []
|
|
|
- this.$dictData.house_type.forEach(houseItem => {
|
|
|
- typeArr.forEach(typeItem => {
|
|
|
- if (houseItem.val === typeItem) {
|
|
|
- curRoom.push({
|
|
|
- label: houseItem.key,
|
|
|
- value: houseItem.val,
|
|
|
- arr: [{imgUrl: '', area: ''}]
|
|
|
- })
|
|
|
+ houseTypeChange (one) {
|
|
|
+ let productData = [...this.productData]
|
|
|
+ let tempList = []
|
|
|
+ let houseTypeList = productData[one].house_type_list || []
|
|
|
+ const curVal = productData[one].house_type_list_val ||[]
|
|
|
+ curVal.forEach(v =>{
|
|
|
+ let cObj = {
|
|
|
+ house_type_name: arrToObj(this.$dictData.house_type)[v],
|
|
|
+ house_type_val: v,
|
|
|
+ area_list: [{img_url: '', area: ''}]
|
|
|
+ }
|
|
|
+ houseTypeList.forEach((h, hIndex) =>{
|
|
|
+ if (v === String(h.house_type_val)) {
|
|
|
+ cObj.area_list = houseTypeList[hIndex].area_list || []
|
|
|
}
|
|
|
})
|
|
|
+ tempList.push(cObj)
|
|
|
})
|
|
|
- this.productData[one].room = curRoom
|
|
|
+ productData[one].house_type_list = tempList
|
|
|
+ this.productData = [...productData]
|
|
|
},
|
|
|
roomAreaDel (one, two, three) {
|
|
|
let productData = [...this.productData]
|
|
|
- productData[one].room[two].arr.splice(three, 1)
|
|
|
+ productData[one].house_type_list[two].area_list.splice(three, 1)
|
|
|
this.productData = [...productData]
|
|
|
},
|
|
|
roomAreaAdd (one, two) {
|
|
|
let productData = [...this.productData]
|
|
|
- productData[one].room[two].arr.push({imgUrl: '', area: ''})
|
|
|
+ productData[one].house_type_list[two].area_list.push({img_url: '', area: ''})
|
|
|
this.productData = [...productData]
|
|
|
},
|
|
|
roomAreaUploadImg (one, two, three) {
|
|
|
- console.log(one, two, three)
|
|
|
+ this.tempImgIndex = [one, two, three]
|
|
|
},
|
|
|
roomAreaUploadSuccess(res, file) {
|
|
|
- // const data = res.data || {}
|
|
|
- // const uploadItem = this.curData[this.curFormIndex]
|
|
|
- // this.baseForm[uploadItem.key] = `${data.url}?id=${data.file_id}`
|
|
|
- // // this.baseForm[uploadItem.key] = uploadItem.uploadData.domain + res.key
|
|
|
- // // this.imageUrl = URL.createObjectURL(file.raw)
|
|
|
- // this.changeHandle(file)
|
|
|
+ const data = res.data || {}
|
|
|
+ let productData = [...this.productData]
|
|
|
+ productData[this.tempImgIndex[0]].house_type_list[this.tempImgIndex[1]].area_list[this.tempImgIndex[2]].img_url = `${data.domain}${data.url}?url=${data.url}&id=${data.file_id}`
|
|
|
+ this.productData = [...productData]
|
|
|
},
|
|
|
roomAreaUploadError(file) {
|
|
|
// this.changeHandle(file)
|
|
@@ -221,16 +205,27 @@ export default {
|
|
|
this.getDef('change', 'metro_line')
|
|
|
},
|
|
|
productTypeChange (val, op, item) {
|
|
|
- const itemArr = item || []
|
|
|
- let productData = []
|
|
|
- productData = itemArr.map(item => {
|
|
|
- return {
|
|
|
- label: item.key,
|
|
|
- val: item.val,
|
|
|
+ let itemArr = item || []
|
|
|
+ let productData = [...this.productData]
|
|
|
+ let newArr = []
|
|
|
+ productData.forEach((one, o) => {
|
|
|
+ itemArr.forEach((two, t) => {
|
|
|
+ if (String(one.product_type_val) === String(two.val)) {
|
|
|
+ itemArr[t].edIndex = String(o)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ itemArr.forEach(cItem => {
|
|
|
+ if (cItem.edIndex) {
|
|
|
+ newArr.push(productData[Number(cItem.edIndex)])
|
|
|
+ } else {
|
|
|
+ newArr.push({
|
|
|
+ product_type_name: cItem.key,
|
|
|
+ product_type_val: cItem.val,
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- this.productData = productData
|
|
|
- // this.getDef('change', 'product_type', item)
|
|
|
+ this.productData = [...newArr]
|
|
|
},
|
|
|
getDef (str, strKey, strParams) {
|
|
|
let params = {}
|
|
@@ -253,20 +248,13 @@ export default {
|
|
|
let disabled = false
|
|
|
if (params.id) disabled = true
|
|
|
const remoteOptionsSchoolList = []
|
|
|
- // if (params.schoolList) {
|
|
|
- // params.school_id_list = params.schoolList.map(item => {
|
|
|
- // remoteOptionsSchoolList.push({ keyRO: item.machineName, valRO: item.machineSn })
|
|
|
- // return item.machineSn
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // params.schoolList = []
|
|
|
- // }
|
|
|
- let productTypeForm = []
|
|
|
- if (str === 'change' && strKey === 'product_type') {
|
|
|
- strParams.forEach(p => {
|
|
|
- productTypeForm.push({ label: `${p.key}房型`, key: `house_type-${p.val}`, type: 'select', options: this.$dictData.house_type, multiple: true})
|
|
|
- productTypeForm.push({ label: `${p.key}均价范围`, key: `price-${p.val}`})
|
|
|
+ if (params.school_list) {
|
|
|
+ params.school_id_list = params.school_list.map(item => {
|
|
|
+ remoteOptionsSchoolList.push({ keyRO: item.school_name, valRO: item.id })
|
|
|
+ return item.id
|
|
|
})
|
|
|
+ } else {
|
|
|
+ params.school_id_list = []
|
|
|
}
|
|
|
this.formData = [
|
|
|
{ label: '楼盘名称', key: 'estate_name' },
|
|
@@ -319,10 +307,13 @@ export default {
|
|
|
else if (!newForm.latitude) return this.$msgw('请选择纬度!')
|
|
|
if (newForm.pri_image && newForm.pri_image.indexOf('?') > -1) {
|
|
|
const imgArr = newForm.pri_image.split('?')
|
|
|
- const curPArr = imgArr[1].split('=')
|
|
|
- if (curPArr[0] === 'id') {
|
|
|
- newForm.pri_image = curPArr[1]
|
|
|
- }
|
|
|
+ const queryArr = imgArr[1].split('&')
|
|
|
+ queryArr.forEach(q =>{
|
|
|
+ const curQArr = q.split('=')
|
|
|
+ if (curQArr[0] === 'url') {
|
|
|
+ newForm.pri_image = curQArr[1]
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
if (newForm.house_type) newForm.house_type = newForm.house_type.join(',')
|
|
|
if (newForm.product_type) newForm.product_type = newForm.product_type.join(',')
|
|
@@ -331,6 +322,26 @@ export default {
|
|
|
if (newForm.park_type) newForm.park_type = newForm.park_type.join(',')
|
|
|
if (newForm.metro_line) newForm.metro_line = newForm.metro_line.join(',')
|
|
|
if (newForm.metro_type) newForm.metro_type = newForm.metro_type.join(',')
|
|
|
+ let productData = this.productData || []
|
|
|
+ productData.map(one => {
|
|
|
+ const houseTypeList = one.house_type_list || []
|
|
|
+ houseTypeList.map(two => {
|
|
|
+ const areaList = two.area_list || []
|
|
|
+ areaList.map(three =>{
|
|
|
+ if (three.img_url && three.img_url.indexOf('?') > -1) {
|
|
|
+ const imgArr = three.img_url.split('?')
|
|
|
+ const queryArr = imgArr[1].split('&')
|
|
|
+ queryArr.forEach(q =>{
|
|
|
+ const curQArr = q.split('=')
|
|
|
+ if (curQArr[0] === 'url') {
|
|
|
+ three.img_url = curQArr[1]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ newForm.area_data = JSON.stringify([...productData])
|
|
|
let apiStr = 'admestateadd'
|
|
|
if (this.curObj.id) apiStr = 'admestateedit'
|
|
|
this.$api.house[apiStr](newForm).then(data => {
|