IndexEdit.vue 27 KB

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