af1bcbd6
wuxw
房屋页面开发中
|
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
|
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="handleSave">{{ $t('common.save') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { addFloor } from '@/api/room/addFloorApi'
export default {
name: 'AddFloor',
props: {
callBackListener: String,
callBackFunction: String
},
data() {
return {
visible: false,
form: {
communityId: this.getCommunityId(),
floorNum: '',
name: '',
floorArea: '',
seq: 1,
remark: ''
},
errorInfo: '',
rules: {
floorNum: [
{ required: true, message: this.$t('room.addFloor.floorNumRequired'), trigger: 'blur' },
{ min: 1, max: 64, message: this.$t('room.addFloor.floorNumLength'), trigger: 'blur' }
],
name: [
{ required: true, message: this.$t('room.addFloor.nameRequired'), trigger: 'blur' },
{ min: 2, max: 64, message: this.$t('room.addFloor.nameLength'), trigger: 'blur' }
],
floorArea: [
{ required: true, message: this.$t('room.addFloor.floorAreaRequired'), trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: this.$t('room.addFloor.floorAreaFormat'), trigger: 'blur' }
],
seq: [
{ required: true, message: this.$t('room.addFloor.seqRequired'), trigger: 'blur' },
{ type: 'number', message: this.$t('room.addFloor.seqNumber'), trigger: 'blur' }
],
remark: [
{ max: 200, message: this.$t('room.addFloor.remarkMaxLength'), trigger: 'blur' }
]
}
}
},
watch: {
'form.floorNum': function(newVal) {
if (newVal) {
this.form.name = `${newVal}${this.$t('room.addFloor.buildingSuffix')}`
} else {
this.form.name = ''
}
}
},
methods: {
open() {
this.visible = true
this.resetForm()
},
handleClose() {
this.visible = false
this.resetForm()
},
resetForm() {
this.form = {
communityId: this.getCommunityId(),
floorNum: '',
name: '',
floorArea: '',
seq: 1,
remark: ''
}
this.errorInfo = ''
this.$refs.form.resetFields()
},
async handleSave() {
this.$refs.form.validate(async (valid) => {
if (!valid) return
try {
|