|
@@ -0,0 +1,279 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-dialog
|
|
|
+ v-loading="loading"
|
|
|
+ :show-close="false"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="isShow"
|
|
|
+ :title="'编辑公共配套'"
|
|
|
+ :fullscreen="false"
|
|
|
+ width="700px"
|
|
|
+ custom-class="xl-dialog"
|
|
|
+ center
|
|
|
+ >
|
|
|
+ <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[3,5]">
|
|
|
+ <div slot="OI3" class="scoped-img-area">
|
|
|
+ <div class="sia-title">更多图片</div>
|
|
|
+ <div class="sia-op" v-for="(imgsrc,index) in imagesArr" :key="index">
|
|
|
+ <img class="img" :src="imgsrc + '_adm0'" alt="img" @click="openbigImg(imgsrc + '_adm0')">
|
|
|
+ <span class="close" @click="imgDel(index)"></span>
|
|
|
+ </div>
|
|
|
+ <el-upload
|
|
|
+ class="sia-img"
|
|
|
+ :action="`${domainUrl}/adm/upload/cloud`"
|
|
|
+ :data="{logic_type: 'estate', token}"
|
|
|
+ name="upload"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="roomAreaUploadSuccess"
|
|
|
+ :before-upload="roomAreaUploadBefore"
|
|
|
+ >
|
|
|
+ <i class="el-icon-plus icon" />
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ <div slot="OI5" class="scoped-other-form">
|
|
|
+ <el-form-item label="点位坐标" class="scoped-item-two item">
|
|
|
+ 纬度N<el-input v-model="cObj.latitude" disabled />
|
|
|
+ 经度E<el-input v-model="cObj.longitude" disabled />
|
|
|
+ <el-button type="primary" class="map-btn" size="small" @click="handleMap">点击从地图获取</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div slot="footer" style="padding-top: 20px;">
|
|
|
+ <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
|
|
|
+ <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </base-form>
|
|
|
+ </el-dialog>
|
|
|
+ <handle-map :is-show="isShowMap" @close="closeMap" />
|
|
|
+ <popup-big-img :is-show="bigImgShow" :src="`${bigImgSrc}`" @close="closebigImg" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import handleMap from '@/components/Common/Map'
|
|
|
+import bigImgPopup from '_m/bigImgPopup.js'
|
|
|
+export default {
|
|
|
+ components: { handleMap },
|
|
|
+ mixins: [...mixins, bigImgPopup],
|
|
|
+ props: {
|
|
|
+ isShow: Boolean,
|
|
|
+ curObj: Object
|
|
|
+ },
|
|
|
+ inject: ['parentData'],
|
|
|
+ data() {
|
|
|
+ let domainUrl = process.env.VUE_APP_BASE_API
|
|
|
+ const token = window.sessionStorage.getItem('fp_token')
|
|
|
+ return {
|
|
|
+ imagesArr: [],
|
|
|
+ domainUrl,
|
|
|
+ token,
|
|
|
+ formData: [],
|
|
|
+ loading: true,
|
|
|
+ cObj: {},
|
|
|
+ isShowMap: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ isShow: function(val) {
|
|
|
+ if (val) {
|
|
|
+ if (this.curObj.id) {
|
|
|
+ this.$api.facility.admfacilitydetail({id: this.curObj.id}).then(res => {
|
|
|
+ let curData = res || {}
|
|
|
+ this.cObj = curData || {}
|
|
|
+ if (curData.images && curData.images.length > 0) this.imagesArr = curData.images.split(',')
|
|
|
+ this.getDef()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.cObj = this.curObj
|
|
|
+ this.getDef()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ imgDel (index) {
|
|
|
+ this.imagesArr.splice(index, 1)
|
|
|
+ this.imagesArr = [...this.imagesArr]
|
|
|
+ },
|
|
|
+ roomAreaUploadSuccess(res, file) {
|
|
|
+ const data = res.data || {}
|
|
|
+ let urls = this.imagesArr || []
|
|
|
+ urls.push(`${data.url}`)
|
|
|
+ this.imagesArr = urls
|
|
|
+ this.imagesArr = [...this.imagesArr]
|
|
|
+ },
|
|
|
+ roomAreaUploadBefore(file) {
|
|
|
+ const isJPGPNG = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
+ if (!isJPGPNG) {
|
|
|
+ this.$message.error('上传图片只能是 JPG PNG 格式!')
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片大小不能超过 2M!')
|
|
|
+ }
|
|
|
+ return isJPGPNG && isLt2M
|
|
|
+ },
|
|
|
+ getDef (str) {
|
|
|
+ let params = { ...this.cObj }
|
|
|
+ this.formData = [
|
|
|
+ { label: '名称', key: 'name', class: 'c-2', rules: 1 },
|
|
|
+ { label: '排序', key: 'sort', class: 'c-2', rules: 1 },
|
|
|
+ { label: '主图', key: 'pri_image', type: 'upload', class: 'c-2', rules: 1 },
|
|
|
+ { label: '航拍背景图', key: 'vr_image', class: 'c-2', type: 'cuImg',
|
|
|
+ options: {
|
|
|
+ w: 375,
|
|
|
+ h: 250,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { label: '当前航拍key', key: 'vr_key', class: 'c-2'},
|
|
|
+ { label: '地址', key: 'address' },
|
|
|
+ { label: '备注', key: 'remarked', type: 'textarea' },
|
|
|
+ ]
|
|
|
+ params.pri_image = this.IMadd(params.pri_image)
|
|
|
+ if (!params.sort) params.sort = 1
|
|
|
+ this.setDefaultValue(params)
|
|
|
+ },
|
|
|
+ close(str) {
|
|
|
+ if (str === 'confirm') {
|
|
|
+ this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const oldform = this.$refs.ruleForm.baseForm
|
|
|
+ const newForm = { ...oldform }
|
|
|
+ newForm.longitude = this.cObj.longitude
|
|
|
+ newForm.latitude = this.cObj.latitude
|
|
|
+ newForm.pri_image = this.IMdel(newForm.pri_image)
|
|
|
+ if (this.imagesArr && this.imagesArr.length > 0) {
|
|
|
+ newForm.images = this.imagesArr.join(',')
|
|
|
+ }
|
|
|
+ if (!newForm.longitude) return this.$msgw('请选择经度!')
|
|
|
+ else if (!newForm.latitude) return this.$msgw('请选择纬度!')
|
|
|
+ let apiStr = 'admfacilityadd'
|
|
|
+ if (this.curObj.id) {
|
|
|
+ newForm.id = this.curObj.id
|
|
|
+ apiStr = 'admfacilityedit'
|
|
|
+ }
|
|
|
+ this.$api.facility[apiStr](newForm).then(data => {
|
|
|
+ this.$msgs(this.curObj.id ? '编辑成功' : '新增成功')
|
|
|
+ this.$emit('close', newForm)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$emit('close')
|
|
|
+ this.setDefaultValue()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleMap() { // 定位
|
|
|
+ this.isShowMap = true
|
|
|
+ const pointObj = {
|
|
|
+ latitude: this.cObj.latitude || '',
|
|
|
+ longitude: this.cObj.longitude || '',
|
|
|
+ address: this.cObj.address || ''
|
|
|
+ }
|
|
|
+ this.$root.$emit('handleMap', pointObj)
|
|
|
+ },
|
|
|
+ closeMap(obj) {
|
|
|
+ if (obj) {
|
|
|
+ const oldform = this.$refs.ruleForm.baseForm
|
|
|
+ const newForm = { ...oldform, ...obj }
|
|
|
+ this.cObj = newForm
|
|
|
+ this.setDefaultValue(newForm)
|
|
|
+ }
|
|
|
+ this.isShowMap = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+@import '../../../../styles/libEdit.scss';
|
|
|
+.lib-edit {
|
|
|
+ padding-top: 0;
|
|
|
+ ::v-deep .el-form-item {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ ::v-deep .el-date-editor.el-input {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+.scoped-other-form {
|
|
|
+ .scoped-item-two {
|
|
|
+ .el-input {
|
|
|
+ display: inline-block;
|
|
|
+ width: 115px;
|
|
|
+ margin: 0 10px;
|
|
|
+ ::v-deep input {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.map-btn{
|
|
|
+ height: 36px;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+.scoped-img-area {
|
|
|
+ padding-left: 40px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ .sia-title {
|
|
|
+ font-size: 14px;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ color: #666;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .sia-op {
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ border: 1px solid #f2f2f2;
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ position: relative;
|
|
|
+ &:hover {
|
|
|
+ .img-big {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .img {
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ }
|
|
|
+ .close {
|
|
|
+ position: absolute;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ top: -10px;
|
|
|
+ right: -10px;
|
|
|
+ background: url(../../../../assets/icon_g_close.png) no-repeat;
|
|
|
+ background-size: 20px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .img-big {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 400px;
|
|
|
+ height: auto;
|
|
|
+ display: none;
|
|
|
+ box-shadow: 10px 10px 10px #ccc;
|
|
|
+ z-index: 99;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .sia-img {
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: middle;
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ overflow: hidden;
|
|
|
+ border: 1px dashed #999;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ .el-icon-plus {
|
|
|
+ color: #999;
|
|
|
+ padding: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|