123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <div>
- <el-dialog
- v-loading="loading"
- :show-close="false"
- :close-on-click-modal="false"
- :visible.sync="isShow"
- :title="curObj.id ? '编辑楼盘航拍' : '新增楼盘航拍'"
- :fullscreen="false"
- width="700px"
- custom-class="xl-dialog"
- center
- >
- <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
- <div slot="footer" style="padding-top: 20px;">
- <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
- <el-button class="xl-form-btn t3" @click="close('confirm')">保存</el-button>
- <!-- <el-button class="xl-form-btn t3" @click="close('new')">新增并覆盖航拍</el-button>
- <el-button class="xl-form-btn t1" @click="close('confirm')">编辑修改原来航拍,不新增</el-button> -->
- </div>
- </base-form>
- <div class="scoped-vr-list">
- <div class="vl-op" v-for="(vr, i) in vrList" :key="vr.id">
- <img class="img" :src="vr.vr_image + '_xs'" alt="img">
- <div class="t">{{vr.create_at ? vr.create_at.substr(0, 10) : '未知'}}</div>
- </div>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- components: { },
- mixins,
- props: {
- isShow: Boolean,
- curObj: Object
- },
- inject: ['parentData'],
- data() {
- return {
- formData: [],
- loading: true,
- cObj: {},
- vrList: [],
- }
- },
- watch: {
- isShow: function(val) {
- if (val) {
- if (this.curObj.id) {
- this.getList()
- this.$api.house.admestatevrdetail({id: this.curObj.id}).then(res => {
- let curData = res || {}
- this.cObj = curData || {}
- this.getDef()
- })
- } else {
- this.cObj = this.curObj
- this.getDef()
- }
- }
- },
- },
- methods: {
- getList () {
- this.$api.house.admestatevrhistorylist({estate_id: this.curObj.id}).then(data => {
- this.vrList = data.list || []
- })
- },
- getDef() {
- const params = { ...this.cObj }
- this.formData = [
- { label: '当前航拍key', key: 'vr_key', rules: 1 },
- { label: '航拍背景图', key: 'vr_image', type: 'cuImg',
- options: {
- w: 375,
- h: 250,
- }
- , rules: 1 },
- ]
- this.setDefaultValue(params)
- },
- close(str) {
- if (str === 'confirm' || str === 'new') {
- this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
- if (valid) {
- const oldform = this.$refs.ruleForm.baseForm
- const newForm = { ...oldform }
- if (this.curObj.id) {
- newForm.id = this.curObj.id
- }
- let apiStr = 'admestatevredit'
- if (newForm.id) apiStr = 'admestatevredit'
- this.$api.house[apiStr](newForm).then(data => {
- if (str === 'new') {
- this.$api.house.admestatevrhistoryadd({estate_id: this.curObj.id}).then(data => {
- this.$msgs('航拍新增成功!最新航拍已更新')
- this.getList()
- })
- } else {
- this.$msgs(newForm.id ? '编辑成功' : '新增成功')
- this.$emit('close', newForm)
- }
- })
- }
- })
- } else {
- this.$emit('close')
- this.setDefaultValue()
- }
- }
- }
- }
- </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-vr-list {
- .vl-op {
- width: 120px;
- display: inline-block;
- vertical-align: middle;
- margin-right: 10px;
- margin-bottom: 10px;
- text-align: center;
- .img {
- width: 100px;
- }
- .t {
- }
- }
- }
- </style>
|