6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
1
|
<template>
|
84ba0155
wuxw
家庭成员测试
|
2
3
|
<el-dialog :title="$t('addCommunity.title')" :visible.sync="visible" width="40%" @close="clearAddCommunityInfo">
<el-form ref="form" :model="addCommunityInfo" label-width="120px" class="text-left">
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
4
|
<el-form-item :label="$t('addCommunity.name')" prop="name" required>
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
5
|
<el-input v-model="addCommunityInfo.name" :placeholder="$t('addCommunity.name')" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
6
7
|
</el-form-item>
<el-form-item :label="$t('addCommunity.area')" prop="area">
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
8
|
<area-select ref="areaSelectRef" @selectArea="selectArea" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
9
10
|
</el-form-item>
<el-form-item :label="$t('addCommunity.address')" prop="tmpAddress" required>
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
11
|
<el-input v-model="addCommunityInfo.tmpAddress" :placeholder="$t('addCommunity.address')" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
12
13
14
|
</el-form-item>
<el-form-item :label="$t('addCommunity.nearbyLandmarks')" prop="nearbyLandmarks" required>
<el-input v-model="addCommunityInfo.nearbyLandmarks"
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
15
|
:placeholder="$t('addCommunity.nearbyLandmarks')" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
16
17
|
</el-form-item>
<el-form-item :label="$t('addCommunity.tel')" prop="tel" required>
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
18
|
<el-input v-model="addCommunityInfo.tel" :placeholder="$t('addCommunity.tel')" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
19
20
|
</el-form-item>
<el-form-item :label="$t('addCommunity.payFeeMonth')" prop="payFeeMonth" required>
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
21
|
<el-input v-model="addCommunityInfo.payFeeMonth" :placeholder="$t('addCommunity.payFeeMonth')" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
22
23
|
</el-form-item>
<el-form-item :label="$t('addCommunity.feePrice')" prop="feePrice" required>
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
24
|
<el-input v-model="addCommunityInfo.feePrice" :placeholder="$t('addCommunity.feePrice')" />
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
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
|
</el-form-item>
<el-form-item v-for="(item, index) in addCommunityInfo.attrs" :key="index" :label="item.specName"
:prop="'attrs.' + index + '.value'">
<el-input v-if="item.specType === '2233'" v-model="item.value" :placeholder="item.specHoldplace" />
<el-select v-else-if="item.specType === '3344'" v-model="item.value" :placeholder="item.specHoldplace"
style="width: 100%">
<el-option v-for="value in item.values" :key="value.value" :label="value.valueName" :value="value.value" />
</el-select>
</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="saveCommunityInfo">{{ $t('common.save') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { saveCommunity } from '@/api/community/communityManageApi'
import { getAttrSpecList } from '@/api/dev/attrSpecApi'
import { getAttrValueList } from '@/api/dev/attrValueApi'
import AreaSelect from '@/components/community/areaSelect'
export default {
name: 'AddCommunity',
data() {
return {
visible: false,
addCommunityInfo: {
name: '',
address: '',
tmpAddress: '',
areaAddress: '',
nearbyLandmarks: '',
tel: '',
cityCode: '',
mapX: '101.33',
mapY: '101.33',
attrs: [],
payFeeMonth: 12,
feePrice: 0
}
}
},
components: { AreaSelect },
methods: {
openModal() {
this._loadCommunityAttrSpec()
|
6831c157
wuxw
v1.9 优化不能连续添加小区bug
|
73
74
75
|
setTimeout(() => {
this.$refs.areaSelectRef.clearArea()
}, 100)
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
76
77
78
79
80
81
82
83
84
85
86
87
|
this.visible = true
},
selectArea(area) {
this.addCommunityInfo.cityCode = area.selectArea
},
saveCommunityInfo() {
this.addCommunityInfo.address = this.addCommunityInfo.areaAddress + this.addCommunityInfo.tmpAddress
if (!this.validateForm()) {
return
}
saveCommunity(this.addCommunityInfo).then(res => {
console.log(res)
|
6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
88
|
this.$message.success(this.$t('common.operationSuccess'))
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
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
121
122
123
124
125
126
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
154
155
156
157
158
159
160
|
this.visible = false
this.$emit('listData')
}).catch(error => {
this.$message.error(error.message)
})
},
validateForm() {
if (!this.addCommunityInfo.name) {
this.$message.error(this.$t('addCommunity.validate.name'))
return false
}
if (!this.addCommunityInfo.cityCode) {
this.$message.error(this.$t('addCommunity.validate.cityCode'))
return false
}
if (!this.addCommunityInfo.address) {
this.$message.error(this.$t('addCommunity.validate.address'))
return false
}
if (!this.addCommunityInfo.nearbyLandmarks) {
this.$message.error(this.$t('addCommunity.validate.nearbyLandmarks'))
return false
}
if (!this.addCommunityInfo.tel) {
this.$message.error(this.$t('addCommunity.validate.tel'))
return false
}
return true
},
clearAddCommunityInfo() {
this.addCommunityInfo = {
name: '',
address: '',
tmpAddress: '',
areaAddress: '',
nearbyLandmarks: '',
cityCode: '',
mapX: '101.33',
mapY: '101.33',
attrs: [],
payFeeMonth: 12,
feePrice: 0
}
},
async _loadCommunityAttrSpec() {
this.addCommunityInfo.attrs = []
const { data } = await getAttrSpecList({
page: 1,
row: 100,
tableName: 'building_community_attr'
})
data.forEach(item => {
item.value = ''
if (item.specShow === 'Y') {
item.values = []
this._loadAttrValue(item.specCd, item.values)
this.addCommunityInfo.attrs.push(item)
}
})
},
async _loadAttrValue(specCd, values) {
const { data } = await getAttrValueList({ specCd, page: 1, row: 100 })
data.forEach(item => {
if (item.valueShow === 'Y') {
values.push(item)
}
})
}
}
}
</script>
|