IndexEdit.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <template>
  2. <div>
  3. <el-drawer
  4. v-loading="loading"
  5. :show-close="false"
  6. :title="curObj.id ? '编辑楼盘' : '新增楼盘'"
  7. :wrapper-closable="false"
  8. :close-on-press-escape="false"
  9. :visible.sync="isShow"
  10. size="960px"
  11. custom-class="xl-drawer"
  12. direction="rtl"
  13. >
  14. <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[24,26]">
  15. <div slot="OI24" class="scoped-product">
  16. <div class="sp-item" v-for="(product, one) in productData" :key="one">
  17. <div class="sp-title">{{product.product_type_name}}
  18. <div class="scoped-sp-box" @click="openPtPopup(product, one)">
  19. 修改类型
  20. </div>
  21. </div>
  22. <div class="sp-content">
  23. <div class="sc-input">
  24. <el-form-item label-width="80px" label="产品均价">
  25. <el-input v-model="product.average_price" placeholder="数字如:15000" onkeyup="value=value.replace(/[^\d]/g,'')"></el-input>
  26. </el-form-item>
  27. <el-form-item label-width="80px" label="梯户比">
  28. <el-input v-model="product.stairs_rate" placeholder="如:2梯4户"></el-input>
  29. </el-form-item>
  30. <!-- <el-form-item label-width="80px" label="装标">
  31. <el-input v-model="product.standard" placeholder="装修标准"></el-input>
  32. </el-form-item> -->
  33. <!-- <el-form-item label-width="80px" label="最低单价">
  34. <el-input v-model="product.price_min" placeholder="选填"></el-input>
  35. </el-form-item>
  36. <el-form-item label-width="80px" label="最高单价">
  37. <el-input v-model="product.price_max" placeholder="选填"></el-input>
  38. </el-form-item> -->
  39. </div>
  40. <el-form-item label="户型">
  41. <el-select v-model="product.house_type_list_val" placeholder="请选择" :multiple="true" @change="houseTypeChange(one)">
  42. <el-option
  43. v-for="item in $dictData.house_type"
  44. :key="item.val"
  45. :label="item.key"
  46. :value="item.val">
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. <div class="room-box">
  51. <div class="room-item" v-for="(room, two) in product.house_type_list" :key="two">
  52. <div class="ri-title">{{room.house_type_name}}
  53. <el-button type="small" icon="el-icon-plus" class="xl-form-btn xs t3" @click="roomAreaAdd(one, two)">添加</el-button>
  54. </div>
  55. <div class="ri-content">
  56. <div class="ri-op" v-for="(area, three) in room.area_list" :key="three">
  57. <el-upload
  58. class="ri-img"
  59. :action="`${domainUrl}/adm/upload/cloud`"
  60. :data="{logic_type: 'estate', token}"
  61. name="upload"
  62. :show-file-list="false"
  63. :on-success="roomAreaUploadSuccess"
  64. :on-error="roomAreaUploadError"
  65. :before-upload="roomAreaUploadBefore"
  66. >
  67. <img v-if="area.img_url" :src="area.img_url + '_adm0'" class="img" @click="roomAreaUploadImg(one, two, three)">
  68. <i v-else class="el-icon-plus icon" @click="roomAreaUploadImg(one, two, three)"/>
  69. <img :src="area.img_url + '_adm0'" class="ri-img-big">
  70. </el-upload>
  71. <div class="ri-deal">
  72. <div class="ops">
  73. <div class="k">面积:</div>
  74. <input class="ri-input" v-model="area.area" type="text" placeholder="请输入">
  75. </div>
  76. <div class="ops">
  77. <div class="k">VR地址:</div>
  78. <input class="ri-input" v-model="area.vr_key" type="text" placeholder="请输入">
  79. </div>
  80. <div class="ops">
  81. <div class="k">总价(万):</div>
  82. <input class="ri-input" v-model="area.price" type="text" placeholder="请输入">
  83. </div>
  84. <div class="ops">
  85. <div class="k">备注:</div>
  86. <input class="ri-input" v-model="area.remark" type="text" placeholder="请输入">
  87. </div>
  88. <span class="ri-del" @click="roomAreaDel(one, two, three)">删除</span>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div slot="OI26" class="scoped-other-form">
  98. <el-form-item label="点位坐标" class="scoped-item-two item">
  99. 纬度N<el-input v-model="cObj.latitude" disabled />
  100. 经度E<el-input v-model="cObj.longitude" disabled />
  101. <el-button type="primary" class="map-btn" size="small" @click="openMap">点击从地图获取</el-button>
  102. </el-form-item>
  103. </div>
  104. </base-form>
  105. <div class="xl-form">
  106. <div class="xl-form-footer fixed" style="width:960px;padding-top: 20px;border-top: 1px solid #dcdcdc;right:0;">
  107. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  108. <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
  109. </div>
  110. </div>
  111. </el-drawer>
  112. <handle-map :is-show="isShowMap" @close="closeMap" />
  113. <pt-edit
  114. :isShow="isPtShow"
  115. :curObj="ptObj"
  116. @close="closePtPopup"
  117. />
  118. </div>
  119. </template>
  120. <script>
  121. import { arrToObj } from '@/utils'
  122. import handleMap from '@/components/Common/Map'
  123. import PtEdit from './ProductTypeEdit'
  124. export default {
  125. components: {
  126. handleMap,
  127. PtEdit,
  128. },
  129. mixins,
  130. props: {
  131. isShow: Boolean,
  132. curObj: Object
  133. },
  134. inject: ['parentData'],
  135. data() {
  136. const token = window.sessionStorage.getItem('fp_token')
  137. let domainUrl = process.env.VUE_APP_BASE_API
  138. return {
  139. domainUrl,
  140. token,
  141. loading: false,
  142. formData: [],
  143. cObj: {},
  144. isShowMap: false,
  145. productData: [],
  146. tempImgIndex: [0, 0, 0],
  147. ptObj: {},
  148. isPtShow: false,
  149. areaList: [],
  150. areaChildList: [],
  151. areaValIdObj: {},
  152. oldVrKeys: [],
  153. newVrKeys: [],
  154. }
  155. },
  156. watch: {
  157. isShow: function(val) {
  158. if (val) {
  159. if (this.curObj.id) {
  160. this.loading = true
  161. this.$api.house.admestatedetail({id: this.curObj.id}).then(res => {
  162. let curData = res || {}
  163. if (curData.house_type) curData.house_type = curData.house_type.split(',')
  164. if (curData.product_type) curData.product_type = curData.product_type.split(',')
  165. if (curData.hospital_type) curData.hospital_type = curData.hospital_type.split(',')
  166. if (curData.high_street) curData.high_street = curData.high_street.split(',')
  167. if (curData.park_type) curData.park_type = curData.park_type.split(',')
  168. if (curData.metro_line) curData.metro_line = curData.metro_line.split(',')
  169. if (curData.metro_type) curData.metro_type = curData.metro_type.split(',')
  170. this.cObj = curData || {}
  171. let productData = curData.area_data || []
  172. let vrkeys = []
  173. productData.map((one, oneIndex) =>{
  174. one.product_type_name = arrToObj(this.$dictData.product_type)[one.product_type_val]
  175. let houseTypeList = one.house_type_list || []
  176. one.house_type_list_val = []
  177. houseTypeList.map(two => {
  178. two.area_list.forEach(three => {
  179. if (three.vr_key) vrkeys.push(three.vr_key)
  180. })
  181. two.house_type_name = arrToObj(this.$dictData.house_type)[two.house_type_val]
  182. one.house_type_list_val.push(String(two.house_type_val))
  183. })
  184. })
  185. this.oldVrKeys = [...vrkeys]
  186. this.productData = [...productData]
  187. if (curData.area_data) {
  188. this.getAreaChild('bc', () => {
  189. this.getDef()
  190. })
  191. } else {
  192. this.getDef()
  193. }
  194. this.loading = false
  195. })
  196. } else {
  197. this.cObj = this.curObj
  198. this.getDef()
  199. }
  200. }
  201. },
  202. },
  203. created () {
  204. this.$api.other.admareainfolist({
  205. level: 1,
  206. page_size: 99
  207. }).then(res => {
  208. let list = res.list || []
  209. let areaValIdObj = {}
  210. list.map(item => {
  211. item.key = item.area_name
  212. item.val = item.option1
  213. areaValIdObj[item.val] = item.id
  214. })
  215. this.areaList = [...list]
  216. this.areaValIdObj = {...areaValIdObj}
  217. // console.log(areaValIdObj)
  218. })
  219. },
  220. methods: {
  221. getAreaChild (str, bc) {
  222. const cObj = this.cObj
  223. this.$api.other.admareainfolist({
  224. level: 2,
  225. page_size: 99,
  226. parent_id: this.areaValIdObj[cObj.area_type] || ''
  227. }).then(res => {
  228. let list = res.list || []
  229. list.map(item => {
  230. item.key = item.area_name
  231. item.val = String(item.id)
  232. })
  233. this.areaChildList = [...list]
  234. if (str && str === 'bc') {
  235. bc()
  236. }
  237. })
  238. },
  239. closePtPopup (bcData) {
  240. this.isPtShow = false
  241. if (bcData) {
  242. let productData = [...this.productData]
  243. let cObj = productData[bcData.index]
  244. cObj.product_type_val = bcData.ptVal
  245. cObj.product_type_name = bcData.ptName
  246. productData[bcData.index] = cObj
  247. this.productData = [...productData]
  248. let params = {...this.$refs.ruleForm.baseForm}
  249. let curPt = [...params.product_type]
  250. curPt[bcData.index] = bcData.ptVal
  251. params.product_type = curPt
  252. this.setDefaultValue(params)
  253. }
  254. },
  255. openPtPopup (row, index) {
  256. this.isPtShow = true
  257. this.ptObj = {
  258. row,
  259. index
  260. }
  261. },
  262. houseTypeChange (one) {
  263. let productData = [...this.productData]
  264. let tempList = []
  265. let houseTypeList = productData[one].house_type_list || []
  266. const curVal = productData[one].house_type_list_val ||[]
  267. curVal.forEach(v =>{
  268. let cObj = {
  269. house_type_name: arrToObj(this.$dictData.house_type)[v],
  270. house_type_val: v,
  271. area_list: [{img_url: '', area: '0', vr_key: ''}]
  272. }
  273. houseTypeList.forEach((h, hIndex) =>{
  274. if (v === String(h.house_type_val)) {
  275. cObj.area_list = houseTypeList[hIndex].area_list || []
  276. }
  277. })
  278. tempList.push(cObj)
  279. })
  280. productData[one].house_type_list = tempList
  281. this.productData = [...productData]
  282. },
  283. roomAreaDel (one, two, three) {
  284. this.$msg(`您确定要删除吗?`, 'confirm', () => {
  285. let productData = [...this.productData]
  286. productData[one].house_type_list[two].area_list.splice(three, 1)
  287. this.productData = [...productData]
  288. })
  289. },
  290. roomAreaAdd (one, two) {
  291. let productData = [...this.productData]
  292. productData[one].house_type_list[two].area_list.push({img_url: '', area: '0', vr_key: ''})
  293. this.productData = [...productData]
  294. },
  295. roomAreaUploadImg (one, two, three) {
  296. this.tempImgIndex = [one, two, three]
  297. },
  298. roomAreaUploadSuccess(res, file) {
  299. const data = res.data || {}
  300. let productData = [...this.productData]
  301. // 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}`
  302. productData[this.tempImgIndex[0]].house_type_list[this.tempImgIndex[1]].area_list[this.tempImgIndex[2]].img_url = `${data.url}`
  303. this.productData = [...productData]
  304. },
  305. roomAreaUploadError(file) {
  306. // this.changeHandle(file)
  307. },
  308. roomAreaUploadBefore(file) {
  309. const isJPGPNG = file.type === 'image/jpeg' || file.type === 'image/png'
  310. const isLtM = file.size / 1024 / 1024 < 10
  311. if (!isJPGPNG) {
  312. this.$message.error('上传图片只能是 JPG PNG GIF 格式!')
  313. }
  314. if (!isLtM) {
  315. this.$message.error('上传图片大小不能超过 10M!')
  316. }
  317. return isJPGPNG && isLtM
  318. },
  319. metroLineChange (val) {
  320. this.getDef('change', 'metro_line')
  321. },
  322. productTypeChange (val, op, item) {
  323. const valArr = [...val]
  324. const productData = [...this.productData]
  325. let newArr = []
  326. valArr.forEach(v => {
  327. let vObj = {
  328. product_type_name: arrToObj(this.$dictData.product_type)[v],
  329. product_type_val: v,
  330. }
  331. productData.forEach(old =>{
  332. if (v === String(old.product_type_val)) {
  333. vObj = {...old}
  334. }
  335. })
  336. newArr.push(vObj)
  337. })
  338. this.productData = [...newArr]
  339. },
  340. areaChange (val) {
  341. this.cObj.area_type = val
  342. this.getAreaChild('bc', () => {
  343. this.getDef('change', 'area_type')
  344. })
  345. },
  346. getDef (str, strKey, strParams) {
  347. let params = {}
  348. if (str === 'change') {
  349. params = {...this.cObj, ...this.$refs.ruleForm.baseForm}
  350. } else {
  351. params = { ...this.cObj }
  352. }
  353. let metroLine = params.metro_line || []
  354. let metroTypeArr = []
  355. if (str === 'change' && strKey === 'metro_line') params.metro_type = ''
  356. if (str === 'change' && strKey === 'area_type') params.area_child = ''
  357. const metroTypeAll = this.$dictData.metro_type || []
  358. metroTypeAll.map(item => {
  359. metroLine.map(mline => {
  360. if (item.option1.indexOf(mline) > -1) {
  361. metroTypeArr.push(item)
  362. }
  363. })
  364. })
  365. let disabled = false
  366. if (params.id) disabled = true
  367. let remoteOptionsDkSchoolList = []
  368. if (params.school_list && params.school_list.duikou && params.school_list.duikou.length > 0) {
  369. params.school_dk_list = params.school_list.duikou.map(item => {
  370. remoteOptionsDkSchoolList.push({ keyRO: item.school_name, valRO: item.id })
  371. return item.id
  372. })
  373. } else {
  374. params.school_dk_list = []
  375. }
  376. let remoteOptionsGhSchoolList = []
  377. if (params.school_list && params.school_list.guihua && params.school_list.guihua.length > 0) {
  378. params.school_gh_list = params.school_list.guihua.map(item => {
  379. remoteOptionsGhSchoolList.push({ keyRO: item.school_name, valRO: item.id })
  380. return item.id
  381. })
  382. } else {
  383. params.school_gh_list = []
  384. }
  385. this.formData = [
  386. { label: '楼盘名称', key: 'estate_name', rules: 1 },
  387. { label: '所属区域', key: 'area_type', type: 'select', class: 'c-3', options: this.areaList, changeHandle: this.areaChange },
  388. { label: '二级区域', key: 'area_child', type: 'select', class: 'c-3', options: this.areaChildList },
  389. // { label: '二级区域', key: 'area_child', type: 'selectRemote', class: 'c-3',
  390. // remoteParams: { skey: 'area_name', api: `other.admareainfolist?level=2&&page_size=99&parent_id=${params.area_type ? this.areaValIdObj[params.area_type] : ''}`, opKey: 'area_name', opVal: 'id' },
  391. // },
  392. { label: '地铁线路', key: 'metro_line', type: 'select', class: 'c-3', options: this.$dictData.metro_line, changeHandle: this.metroLineChange, multiple: true },
  393. { label: '地铁站名', key: 'metro_type', type: 'select', class: 'c-3', options: metroTypeArr, multiple: true},
  394. // { label: '周边医院', key: 'hospital_type', type: 'select', class: 'c-3', options: this.$dictData.hospital_type, multiple: true },
  395. // { label: '周边商圈', key: 'high_street', type: 'select', class: 'c-3', options: this.$dictData.high_street, multiple: true },
  396. // { label: '周边公园', key: 'park_type', type: 'select', class: 'c-3', options: this.$dictData.park_type, multiple: true },
  397. { label: '建设时间', key: 'build_time', class: 'c-3', type: 'datePicker', type2: 'month', valueFormat: 'yyyy-MM'},
  398. { label: '竣工时间', key: 'complete_time', class: 'c-3', type: 'datePicker', type2: 'month', valueFormat: 'yyyy-MM'},
  399. { label: '容积率', key: 'plot_ratio', class: 'c-3'},
  400. { label: '占地面积', key: 'acreage', class: 'c-3', type: 'inputFont', appendFont: '㎡'},
  401. { label: '建筑面积', key: 'built_up_area', class: 'c-3', type: 'inputFont', appendFont: '㎡'},
  402. { label: '总户数', key: 'household', class: 'c-3', type: 'inputFont', appendFont: '户', rules: [
  403. { validator: (rule, value, callback) => {
  404. if (Number(value) < 0 || isNaN(Number(value))) {
  405. callback(new Error('请输入数字'))
  406. } else {
  407. callback()
  408. }
  409. }, trigger: 'blur' },
  410. // { type: 'number', message: '请输入数字', trigger: 'blur' }
  411. ]},
  412. { label: '物业公司', key: 'property_type', class: 'c-3'},
  413. { label: '物业费', key: 'property_fee', class: 'c-3'},
  414. { label: '车位数量', key: 'parking', class: 'c-3', type: 'inputFont', appendFont: '个'},
  415. { label: '绿化率', key: 'green_rate', class: 'c-3', type: 'inputFont', appendFont: '%' },
  416. { label: '楼盘标签', key: 'estate_tag', type: 'select', class: 'c-3', options: this.$dictData.estate_tag, rules: 1 },
  417. { label: '自定义标签', key: 'custom_tag', class: 'c-3' },
  418. { label: '开发商', key: 'developer', class: 'c-3' },
  419. { label: '楼栋数', key: 'seat_sum', class: 'c-3', type: 'inputFont', appendFont: '栋' },
  420. { label: '产权年限', key: 'ownership', class: 'c-3' },
  421. { label: '初次交付时间', key: 'deliver_time', class: 'c-3', type: 'datePicker', type2: 'month', valueFormat: 'yyyy-MM'},
  422. { label: '楼盘单价', key: 'price_range', class: 'c-3', type: 'inputFont', appendFont: '/㎡', rules: 1 },
  423. { label: '户型面积区间', key: 'built_area', class: 'c-3', type: 'inputFont', appendFont: '㎡' },
  424. // { label: '是否销控', key: 'sale_ctrl', type: 'select', class: 'c-3', options: this.$dictData.sys_yesno },
  425. { label: '产品类型', key: 'product_type', type: 'select', class: 'c-3s', options: this.$dictData.product_type, multiple: true, changeHandle: this.productTypeChange},
  426. // { label: '房型', key: 'house_type', type: 'select', options: this.$dictData.house_type, multiple: true},
  427. // { label: '面积', label2: '多个面积英文逗号,分开(如:100,120)', key: 'house_area', type: 'inputFont', appendFont: '㎡'},
  428. // { label: '均价范围1', key: 'price_min', class: 'c-3', type: 'inputFont', appendFont: '元(最小)'},
  429. // { label: '均价范围2', key: 'price_max', class: 'c-3', type: 'inputFont', appendFont: '元(最大)'},
  430. { label: '对口学校', key: 'school_dk_list', type: 'selectRemote', multiple: true,
  431. remoteParams: { skey: 'school_name', api: `school.admschoollist`, opKey: 'school_name', opVal: 'id' },
  432. remoteOptions: remoteOptionsDkSchoolList
  433. },
  434. { label: '规划就读', key: 'school_gh_list', type: 'selectRemote', multiple: true,
  435. remoteParams: { skey: 'school_name', api: `school.admschoollist`, opKey: 'school_name', opVal: 'id' },
  436. remoteOptions: remoteOptionsGhSchoolList
  437. },
  438. { label: '楼盘地址', key: 'address', rules: 1 },
  439. // { label: '是否新房', key: 'is_new', type: 'select', class: 'c-3', options: this.$dictData.sys_yesno, rules: 1 },
  440. // { label: '梯户比', label2: '如:2梯4户', key: 'stairs_rate', class: 'c-3' },
  441. { label: '车位价格', key: 'parking_price', class: 'c-3' },
  442. { label: '不利因素', key: 'minus_points' },
  443. { label: '楼盘图', key: 'pri_image', class: 'c-3', type: 'cuImg',
  444. options: {
  445. w: 375,
  446. h: 250,
  447. SY: 1,
  448. }
  449. , rules: 1 },
  450. { label: '简评', key: 'remarked', class: 'c-3s', type: 'textarea' },
  451. ]
  452. params.pri_image = this.IMadd(params.pri_image)
  453. this.setDefaultValue(params)
  454. },
  455. close (str) {
  456. if (str === 'confirm') {
  457. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  458. if (valid) {
  459. const oldform = this.$refs.ruleForm.baseForm
  460. const newForm = { ...oldform }
  461. if (this.curObj.id) newForm.id = this.curObj.id
  462. if (newForm.school_dk_list && newForm.school_dk_list.length > 0) {
  463. newForm.school_dk_list = newForm.school_dk_list.join(',')
  464. } else {
  465. newForm.school_dk_list = ''
  466. }
  467. if (newForm.school_gh_list && newForm.school_gh_list.length > 0) {
  468. newForm.school_gh_list = newForm.school_gh_list.join(',')
  469. } else {
  470. newForm.school_gh_list = ''
  471. }
  472. newForm.longitude = this.cObj.longitude
  473. newForm.latitude = this.cObj.latitude
  474. if (!newForm.longitude) return this.$msgw('请选择经度!')
  475. else if (!newForm.latitude) return this.$msgw('请选择纬度!')
  476. if (newForm.house_type) newForm.house_type = newForm.house_type.join(',')
  477. if (newForm.product_type) newForm.product_type = newForm.product_type.join(',')
  478. if (newForm.hospital_type) newForm.hospital_type = newForm.hospital_type.join(',')
  479. if (newForm.high_street) newForm.high_street = newForm.high_street.join(',')
  480. if (newForm.park_type) newForm.park_type = newForm.park_type.join(',')
  481. if (newForm.metro_line) newForm.metro_line = newForm.metro_line.join(',')
  482. if (newForm.metro_type) newForm.metro_type = newForm.metro_type.join(',')
  483. let customTag = newForm.custom_tag.replace(/,|、|\/|\\/g, ',')
  484. if (!newForm.standard) newForm.standard = ''
  485. // newForm.stairs_rate = newForm.stairs_rate.replace(',', ',')
  486. let productData = this.productData || []
  487. let pFlag = false
  488. let vrFlag = false
  489. let vrkeys = []
  490. productData.forEach(pOne => {
  491. let oneArr = pOne.house_type_list || []
  492. oneArr.forEach(pTwo => {
  493. let twoArr = pTwo.area_list || []
  494. twoArr.forEach(pThree => {
  495. if (pThree.vr_key) vrFlag = true
  496. if (pThree.vr_key) vrkeys.push(pThree.vr_key)
  497. })
  498. })
  499. // if (!pOne.average_price || !pOne.house_type_list_val) {
  500. // pFlag = true
  501. // }
  502. if (!pOne.stairs_rate) pOne.stairs_rate = ''
  503. if (!pOne.average_price) pOne.average_price = 0
  504. if (!pOne.house_type_list_val) pOne.house_type_list_val = ''
  505. })
  506. this.newVrKeys = [...vrkeys]
  507. // if (pFlag) {
  508. // this.$msg('请输入完整的产品均价、户型图!')
  509. // return
  510. // }
  511. if (vrFlag && newForm.custom_tag.indexOf('户型VR') === -1) {
  512. customTag = `户型VR,${newForm.custom_tag}`
  513. }
  514. if (this.curObj.vr_key && newForm.custom_tag.indexOf('航拍') === -1) {
  515. customTag = `航拍,${newForm.custom_tag}`
  516. }
  517. newForm.custom_tag = customTag
  518. if (productData.length === 0) {
  519. newForm.area_data = ''
  520. } else {
  521. newForm.area_data = JSON.stringify([...productData])
  522. }
  523. let apiStr = 'admestateadd'
  524. if (this.curObj.id) apiStr = 'admestateedit'
  525. newForm.pri_image = this.IMdel(newForm.pri_image)
  526. this.$api.house[apiStr](newForm).then(data => {
  527. this.$msgs(newForm.id ? '编辑成功' : '新增成功')
  528. this.$api.house.admestatehousevrscoring({
  529. estate_id: this.curObj.id,
  530. old_list: JSON.stringify(this.oldVrKeys),
  531. new_list: JSON.stringify(this.newVrKeys),
  532. })
  533. this.productData = []
  534. this.$emit('close', newForm)
  535. })
  536. }
  537. })
  538. } else {
  539. this.$emit('close')
  540. this.productData = []
  541. this.setDefaultValue()
  542. }
  543. },
  544. openMap() { // 定位
  545. this.isShowMap = true
  546. const pointObj = {
  547. latitude: this.cObj.latitude || '',
  548. longitude: this.cObj.longitude || '',
  549. address: this.cObj.address || ''
  550. }
  551. this.$root.$emit('handleMap', pointObj)
  552. },
  553. closeMap(obj) {
  554. if (obj) {
  555. const oldform = this.$refs.ruleForm.baseForm
  556. const newForm = { ...oldform, ...obj }
  557. this.cObj = newForm
  558. this.setDefaultValue(newForm)
  559. }
  560. this.isShowMap = false
  561. }
  562. }
  563. }
  564. </script>
  565. <style lang="scss" scoped>
  566. @import '../../../../styles/libEdit.scss';
  567. .lib-edit {
  568. width: 900px;
  569. padding-top: 0;
  570. padding-left: 0;
  571. padding-bottom: 40px;
  572. ::v-deep .el-form-item {
  573. margin-bottom: 10px;
  574. }
  575. ::v-deep .el-date-editor.el-input {
  576. width: 100%;
  577. }
  578. }
  579. .scoped-other-form {
  580. .scoped-item-two {
  581. .el-input {
  582. display: inline-block;
  583. width: 140px;
  584. margin: 0 10px;
  585. }
  586. }
  587. }
  588. .map-btn{
  589. height: 36px;
  590. }
  591. ::v-deep .el-drawer__header {
  592. margin-bottom: 10px;
  593. }
  594. .scoped-product {
  595. width: 100%;
  596. .sp-item {
  597. position: relative;
  598. border: 1px solid #dcdcdc;
  599. margin-bottom: 10px;
  600. margin-left: 55px;
  601. margin-right: 30px;
  602. border-radius: 10px;
  603. }
  604. .sp-title {
  605. background: #dcdcdc;
  606. font-weight: bold;
  607. padding: 10px;
  608. border-top-left-radius: 10px;
  609. border-top-right-radius: 10px;
  610. font-size: 14px;
  611. color: #666;
  612. }
  613. .sp-content {
  614. padding: 10px 10px 0;
  615. }
  616. .sc-input {
  617. display: flex;
  618. }
  619. }
  620. .room-box {
  621. margin: 0 20px 10px 80px;
  622. .room-item {
  623. background: #f7f7f7;
  624. border-radius: 10px;
  625. padding: 10px;
  626. margin-bottom: 10px;
  627. }
  628. .ri-title {
  629. color: #666;
  630. margin-bottom: 10px;
  631. }
  632. .ri-op {
  633. display: inline-block;
  634. vertical-align: middle;
  635. margin-right: 20px;
  636. margin-bottom: 10px;
  637. }
  638. .ri-img {
  639. display: inline-block;
  640. vertical-align: middle;
  641. width: 82px;
  642. height: 82px;
  643. border: 1px dashed #e6a23c;
  644. position: relative;
  645. box-sizing: border-box;
  646. &:hover {
  647. .ri-img-big {
  648. display: block;
  649. }
  650. }
  651. img {
  652. width: 80px;
  653. height: 80px;
  654. }
  655. .ri-img-big {
  656. position: absolute;
  657. top: 80px;
  658. left: 0;
  659. width: 400px;
  660. height: auto;
  661. display: none;
  662. box-shadow: 0 0 20px #ccc;
  663. z-index: 99;
  664. }
  665. .el-icon-plus {
  666. color: #999;
  667. padding: 30px;
  668. }
  669. }
  670. .ri-deal {
  671. display: inline-block;
  672. vertical-align: middle;
  673. width: 200px;
  674. text-align: left;
  675. .ops {
  676. text-align: left;
  677. display: inline-block;
  678. vertical-align: middle;
  679. width: 100px;
  680. margin-bottom: 2px;
  681. .k {
  682. display: inline-block;
  683. vertical-align: middle;
  684. width: 50px;
  685. font-size: 12px;
  686. color: #666;
  687. text-align: right;
  688. }
  689. }
  690. }
  691. .ri-input {
  692. display: inline-block;
  693. vertical-align: middle;
  694. width: 50px;
  695. border: 1px solid #dcdcdc;
  696. height: 26px;
  697. text-align: center;
  698. border-radius: 0;
  699. outline: none;
  700. color: #666;
  701. font-size: 12px;
  702. }
  703. .ri-del {
  704. font-size: 12px;
  705. background: #e6a23c;
  706. color: #fff;
  707. width: 50%;
  708. height: 26px;
  709. line-height: 26px;
  710. cursor: pointer;
  711. display: inline-block;
  712. text-align: center;
  713. }
  714. }
  715. .scoped-sp-box {
  716. position: absolute;
  717. top: -2px;
  718. right: 0;
  719. background: #fff;
  720. ::v-deep {
  721. .el-input__inner {
  722. width: 80px;
  723. }
  724. .el-input-group__append {
  725. background: #f2f2f2;
  726. }
  727. }
  728. }
  729. </style>