roomImagesForm.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. switchFullscreen
  7. @ok="handleOk"
  8. @cancel="handleCancel"
  9. cancelText="关闭"
  10. >
  11. <a-form-model ref="form" :model="model">
  12. <a-form-model-item label="房间大图" >
  13. <j-image-upload class="avatar-uploader" text="上传" v-model="model.cover" ></j-image-upload>
  14. </a-form-model-item>
  15. <a-form-model-item label="图片" >
  16. <j-image-upload class="avatar-uploader" text="上传" v-model="model.images" :isMultiple="true"></j-image-upload>
  17. </a-form-model-item>
  18. </a-form-model>
  19. </j-modal>
  20. </template>
  21. <script>
  22. import { roomEdit } from '@/api/roomBuildingApi'
  23. export default {
  24. data() {
  25. return {
  26. title: '房间图片',
  27. width: '40%',
  28. visible: false,
  29. model: {
  30. id: null,
  31. cover: null,
  32. images: null,
  33. }
  34. }
  35. },
  36. methods: {
  37. // 设置模型图片数据
  38. setModel(data) {
  39. this.model = JSON.parse(JSON.stringify(data))
  40. this.visible = true
  41. },
  42. // save
  43. handleOk() {
  44. roomEdit(this.model).then(res => {
  45. if(res.code == 200) {
  46. this.$message.success('保存成功')
  47. this.$emit("saveOk")
  48. this.visible = false
  49. }
  50. }).catch(_ => {
  51. this.$message.success('保存失败')
  52. })
  53. },
  54. // 取消
  55. handleCancel() {
  56. this.visible = false
  57. }
  58. }
  59. }
  60. </script>
  61. <style>
  62. </style>