IndexEdit.vue 30 KB

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