Blame view

src/components/community/RoomDecorationRecord.vue 4.95 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
8fc7c791   wuxw   测试完成房屋装修模块
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
    <el-dialog :title="$t('roomDecorationRecord.title')" :visible.sync="visible" width="40%" @close="handleClose">
      <el-form ref="form" :model="roomDecorationRecordInfo" label-width="120px" class="text-left" label-position="left">
        <el-form-item :label="$t('roomDecorationRecord.room')">
          <el-input v-model="roomDecorationRecordInfo.roomName" disabled
            :placeholder="$t('roomDecorationRecord.roomPlaceholder')" />
        </el-form-item>
        <el-form-item :label="$t('roomDecorationRecord.status')">
          <el-input v-model="roomDecorationRecordInfo.stateName" disabled />
        </el-form-item>
        <el-form-item :label="$t('roomDecorationRecord.isViolation')" required>
          <el-select v-model="roomDecorationRecordInfo.isTrue" style="width: 100%"
            :placeholder="$t('roomDecorationRecord.isViolationPlaceholder')">
            <el-option value="" disabled :label="$t('roomDecorationRecord.isViolationPlaceholder')" />
            <el-option value="true" :label="$t('roomDecorationRecord.yes')" />
            <el-option value="false" :label="$t('roomDecorationRecord.no')" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('roomDecorationRecord.remark')" required>
          <el-input v-model="roomDecorationRecordInfo.remark" type="textarea"
            :placeholder="$t('roomDecorationRecord.remarkPlaceholder')" :rows="3" />
        </el-form-item>
        <el-form-item :label="$t('roomDecorationRecord.uploadImage')">
          <upload-image-url ref="uploadImageUrl" :image-count="99" @notifyUploadCoverImage="handleImageChange" />
        </el-form-item>
        <el-form-item :label="$t('roomDecorationRecord.uploadVideo')">
          <upload-vedio ref="uploadVedio" @change="handleVideoChange" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">
          {{ $t('common.cancel') }}
        </el-button>
        <el-button type="primary" @click="saveRoomDecorationRecordInfo">
          {{ $t('common.save') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { updateRoomDecorationRecord } from '@/api/community/listRoomDecorationRecordApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import UploadImageUrl from '@/components/upload/UploadImageUrl'
  import UploadVedio from './UploadVedio'
  
  export default {
    name: 'RoomDecorationRecord',
    components: {
      UploadImageUrl,
      UploadVedio
    },
    props: {
      callBackListener: {
        type: String,
        default: ''
      },
      callBackFunction: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        visible: false,
        roomDecorationRecordInfo: {
          rId: '',
          roomName: '',
          state: '',
          stateName: '',
          remark: '',
          examineRemark: '',
          roomId: '',
          photos: [],
          videoName: '',
          url: '',
          detailType: '1001',
          isTrue: '',
          isTrues: []
        }
      }
    },
    methods: {
      open(params) {
        this.clearRoomDecorationRecordInfo()
        this.roomDecorationRecordInfo.rId = params[0]
        this.roomDecorationRecordInfo.roomId = params[1]
        this.roomDecorationRecordInfo.roomName = params[2]
        this.roomDecorationRecordInfo.state = params[3]
        this.roomDecorationRecordInfo.stateName = params[4]
        this.visible = true
      },
      handleClose() {
        this.clearRoomDecorationRecordInfo()
      },
      handleImageChange(photosUrl) {
        this.roomDecorationRecordInfo.photos = photosUrl.map(item => item.fileId)
      },
      handleVideoChange(videoInfo) {
        this.roomDecorationRecordInfo.videoName = videoInfo.realFileName
      },
      validateForm() {
        if (!this.roomDecorationRecordInfo.isTrue) {
          this.$message.error(this.$t('roomDecorationRecord.isViolationRequired'))
          return false
        }
        if (!this.roomDecorationRecordInfo.remark) {
          this.$message.error(this.$t('roomDecorationRecord.remarkRequired'))
          return false
        }
        return true
      },
      async saveRoomDecorationRecordInfo() {
        if (!this.validateForm()) return
  
        try {
          this.roomDecorationRecordInfo.communityId = getCommunityId()
  
        
  
acfe91a9   wuxw   v1.9 修复客户反馈车位结构图部...
121
122
123
124
125
          const {code,msg} = await updateRoomDecorationRecord(this.roomDecorationRecordInfo)
          if(code != 0){
            this.$message.error(msg);
            return;
          }
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
126
          this.$message.success(this.$t('common.operationSuccess'))
8fc7c791   wuxw   测试完成房屋装修模块
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
          this.$emit('success')
          this.visible = false
        } catch (error) {
          this.$message.error(this.$t('common.saveFailed'))
        }
      },
      clearRoomDecorationRecordInfo() {
        setTimeout(() => {
        this.$refs.uploadImageUrl.clearImages()
        this.$refs.uploadVedio.clear()
        },100)
        this.roomDecorationRecordInfo = {
          rId: '',
          state: '',
          remark: '',
          examineRemark: '',
          roomId: '',
          photos: [],
          videoName: '',
          detailType: '1001',
          isTrue: '',
          isTrues: []
        }
      }
    }
  }
  </script>