IndexEdit.vue 27 KB

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