VrEdit.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-loading="loading"
  5. :show-close="false"
  6. :close-on-click-modal="false"
  7. :visible.sync="isShow"
  8. :title="curObj.id ? '编辑楼盘航拍' : '新增楼盘航拍'"
  9. :fullscreen="false"
  10. width="700px"
  11. custom-class="xl-dialog"
  12. center
  13. >
  14. <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
  15. <div slot="footer" style="padding-top: 20px;">
  16. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  17. <el-button class="xl-form-btn t3" @click="close('confirm')">保存</el-button>
  18. <!-- <el-button class="xl-form-btn t3" @click="close('new')">新增并覆盖航拍</el-button>
  19. <el-button class="xl-form-btn t1" @click="close('confirm')">编辑修改原来航拍,不新增</el-button> -->
  20. </div>
  21. </base-form>
  22. <div class="scoped-vr-list">
  23. <div class="vl-op" v-for="(vr, i) in vrList" :key="vr.id">
  24. <img class="img" :src="vr.vr_image + '_xs'" alt="img">
  25. <div class="t">{{vr.create_at ? vr.create_at.substr(0, 10) : '未知'}}</div>
  26. </div>
  27. </div>
  28. </el-dialog>
  29. </div>
  30. </template>
  31. <script>
  32. export default {
  33. components: { },
  34. mixins,
  35. props: {
  36. isShow: Boolean,
  37. curObj: Object
  38. },
  39. inject: ['parentData'],
  40. data() {
  41. return {
  42. formData: [],
  43. loading: true,
  44. cObj: {},
  45. vrList: [],
  46. }
  47. },
  48. watch: {
  49. isShow: function(val) {
  50. if (val) {
  51. if (this.curObj.id) {
  52. this.getList()
  53. this.$api.house.admestatevrdetail({id: this.curObj.id}).then(res => {
  54. let curData = res || {}
  55. this.cObj = curData || {}
  56. this.getDef()
  57. })
  58. } else {
  59. this.cObj = this.curObj
  60. this.getDef()
  61. }
  62. }
  63. },
  64. },
  65. methods: {
  66. getList () {
  67. this.$api.house.admestatevrhistorylist({estate_id: this.curObj.id}).then(data => {
  68. this.vrList = data.list || []
  69. })
  70. },
  71. getDef() {
  72. const params = { ...this.cObj }
  73. this.formData = [
  74. { label: '当前航拍key', key: 'vr_key', rules: 1 },
  75. { label: '航拍背景图', key: 'vr_image', type: 'cuImg',
  76. options: {
  77. w: 375,
  78. h: 250,
  79. }
  80. , rules: 1 },
  81. ]
  82. this.setDefaultValue(params)
  83. },
  84. close(str) {
  85. if (str === 'confirm' || str === 'new') {
  86. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  87. if (valid) {
  88. const oldform = this.$refs.ruleForm.baseForm
  89. const newForm = { ...oldform }
  90. if (this.curObj.id) {
  91. newForm.id = this.curObj.id
  92. }
  93. let apiStr = 'admestatevredit'
  94. if (newForm.id) apiStr = 'admestatevredit'
  95. this.$api.house[apiStr](newForm).then(data => {
  96. if (str === 'new') {
  97. this.$api.house.admestatevrhistoryadd({estate_id: this.curObj.id}).then(data => {
  98. this.$msgs('航拍新增成功!最新航拍已更新')
  99. this.getList()
  100. })
  101. } else {
  102. this.$msgs(newForm.id ? '编辑成功' : '新增成功')
  103. this.$emit('close', newForm)
  104. }
  105. })
  106. }
  107. })
  108. } else {
  109. this.$emit('close')
  110. this.setDefaultValue()
  111. }
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. @import '../../../../styles/libEdit.scss';
  118. .lib-edit {
  119. padding-top: 0;
  120. ::v-deep .el-form-item {
  121. margin-bottom: 10px;
  122. }
  123. ::v-deep .el-date-editor.el-input {
  124. width: 100%;
  125. }
  126. }
  127. .scoped-vr-list {
  128. .vl-op {
  129. width: 120px;
  130. display: inline-block;
  131. vertical-align: middle;
  132. margin-right: 10px;
  133. margin-bottom: 10px;
  134. text-align: center;
  135. .img {
  136. width: 100px;
  137. }
  138. .t {
  139. }
  140. }
  141. }
  142. </style>