Commit b783cddda1aa56af90757c194e46dfd64067ee59

Authored by wuxw
1 parent 16b469fe

v1.9 优化添加小区因为提示bug

src/components/community/addCommunity.vue
1 <template> 1 <template>
2 <el-dialog :title="$t('addCommunity.title')" :visible.sync="visible" width="40%" @close="clearAddCommunityInfo"> 2 <el-dialog :title="$t('addCommunity.title')" :visible.sync="visible" width="40%" @close="clearAddCommunityInfo">
3 - <el-form ref="form" :model="addCommunityInfo" label-width="120px" class="text-left">  
4 - <el-form-item :label="$t('addCommunity.name')" prop="name" required> 3 + <el-form ref="form" :model="addCommunityInfo" :rules="rules" label-width="120px" class="text-left">
  4 + <el-form-item :label="$t('addCommunity.name')" prop="name" >
5 <el-input v-model="addCommunityInfo.name" :placeholder="$t('addCommunity.name')" /> 5 <el-input v-model="addCommunityInfo.name" :placeholder="$t('addCommunity.name')" />
6 </el-form-item> 6 </el-form-item>
7 <el-form-item :label="$t('addCommunity.area')" prop="area"> 7 <el-form-item :label="$t('addCommunity.area')" prop="area">
8 <area-select ref="areaSelectRef" @selectArea="selectArea" /> 8 <area-select ref="areaSelectRef" @selectArea="selectArea" />
9 </el-form-item> 9 </el-form-item>
10 - <el-form-item :label="$t('addCommunity.address')" prop="tmpAddress" required> 10 + <el-form-item :label="$t('addCommunity.address')" prop="tmpAddress" >
11 <el-input v-model="addCommunityInfo.tmpAddress" :placeholder="$t('addCommunity.address')" /> 11 <el-input v-model="addCommunityInfo.tmpAddress" :placeholder="$t('addCommunity.address')" />
12 </el-form-item> 12 </el-form-item>
13 - <el-form-item :label="$t('addCommunity.nearbyLandmarks')" prop="nearbyLandmarks" required> 13 + <el-form-item :label="$t('addCommunity.nearbyLandmarks')" prop="nearbyLandmarks" >
14 <el-input v-model="addCommunityInfo.nearbyLandmarks" 14 <el-input v-model="addCommunityInfo.nearbyLandmarks"
15 :placeholder="$t('addCommunity.nearbyLandmarks')" /> 15 :placeholder="$t('addCommunity.nearbyLandmarks')" />
16 </el-form-item> 16 </el-form-item>
17 - <el-form-item :label="$t('addCommunity.tel')" prop="tel" required> 17 + <el-form-item :label="$t('addCommunity.tel')" prop="tel" >
18 <el-input v-model="addCommunityInfo.tel" :placeholder="$t('addCommunity.tel')" /> 18 <el-input v-model="addCommunityInfo.tel" :placeholder="$t('addCommunity.tel')" />
19 </el-form-item> 19 </el-form-item>
20 - <el-form-item :label="$t('addCommunity.payFeeMonth')" prop="payFeeMonth" required> 20 + <el-form-item :label="$t('addCommunity.payFeeMonth')" prop="payFeeMonth" >
21 <el-input v-model="addCommunityInfo.payFeeMonth" :placeholder="$t('addCommunity.payFeeMonth')" /> 21 <el-input v-model="addCommunityInfo.payFeeMonth" :placeholder="$t('addCommunity.payFeeMonth')" />
22 </el-form-item> 22 </el-form-item>
23 - <el-form-item :label="$t('addCommunity.feePrice')" prop="feePrice" required> 23 + <el-form-item :label="$t('addCommunity.feePrice')" prop="feePrice" >
24 <el-input v-model="addCommunityInfo.feePrice" :placeholder="$t('addCommunity.feePrice')" /> 24 <el-input v-model="addCommunityInfo.feePrice" :placeholder="$t('addCommunity.feePrice')" />
25 </el-form-item> 25 </el-form-item>
26 <el-form-item v-for="(item, index) in addCommunityInfo.attrs" :key="index" :label="item.specName" 26 <el-form-item v-for="(item, index) in addCommunityInfo.attrs" :key="index" :label="item.specName"
@@ -50,6 +50,32 @@ export default { @@ -50,6 +50,32 @@ export default {
50 data() { 50 data() {
51 return { 51 return {
52 visible: false, 52 visible: false,
  53 + rules: {
  54 + name: [
  55 + { required: true, message: this.$t('addCommunity.validate.name'), trigger: 'blur' }
  56 + ],
  57 + cityCode: [
  58 + { required: true, message: this.$t('addCommunity.validate.cityCode'), trigger: 'blur' }
  59 + ],
  60 + address: [
  61 + { required: true, message: this.$t('addCommunity.validate.address'), trigger: 'blur' }
  62 + ],
  63 + nearbyLandmarks: [
  64 + { required: true, message: this.$t('addCommunity.validate.nearbyLandmarks'), trigger: 'blur' }
  65 + ],
  66 + tel: [
  67 + { required: true, message: this.$t('addCommunity.validate.tel'), trigger: 'blur' }
  68 + ],
  69 + payFeeMonth: [
  70 + { required: true, message: this.$t('addCommunity.validate.payFeeMonth'), trigger: 'blur' }
  71 + ],
  72 + feePrice: [
  73 + { required: true, message: this.$t('addCommunity.validate.feePrice'), trigger: 'blur' }
  74 + ],
  75 + attrs: [
  76 + { required: true, message: this.$t('addCommunity.validate.attrs'), trigger: 'blur' }
  77 + ]
  78 + },
53 addCommunityInfo: { 79 addCommunityInfo: {
54 name: '', 80 name: '',
55 address: '', 81 address: '',
src/components/community/editCommunity.vue
1 <template> 1 <template>
2 <el-dialog :title="$t('editCommunity.title')" :visible.sync="visible" width="60%" @close="refreshEditCommunityInfo"> 2 <el-dialog :title="$t('editCommunity.title')" :visible.sync="visible" width="60%" @close="refreshEditCommunityInfo">
3 - <el-form ref="form" :model="editCommunityInfo" label-width="120px">  
4 - <el-form-item :label="$t('editCommunity.name')" prop="name" required> 3 + <el-form ref="form" :model="editCommunityInfo" :rules="rules" class="text-left" label-width="120px">
  4 + <el-form-item :label="$t('editCommunity.name')" prop="name" >
5 <el-input v-model="editCommunityInfo.name" :placeholder="$t('editCommunity.namePlaceholder')" /> 5 <el-input v-model="editCommunityInfo.name" :placeholder="$t('editCommunity.namePlaceholder')" />
6 </el-form-item> 6 </el-form-item>
7 - <el-form-item :label="$t('editCommunity.address')" prop="address" required> 7 + <el-form-item :label="$t('editCommunity.address')" prop="address" >
8 <el-input v-model="editCommunityInfo.address" :placeholder="$t('editCommunity.addressPlaceholder')" /> 8 <el-input v-model="editCommunityInfo.address" :placeholder="$t('editCommunity.addressPlaceholder')" />
9 </el-form-item> 9 </el-form-item>
10 - <el-form-item :label="$t('editCommunity.nearbyLandmarks')" prop="nearbyLandmarks" required> 10 + <el-form-item :label="$t('editCommunity.nearbyLandmarks')" prop="nearbyLandmarks" >
11 <el-input v-model="editCommunityInfo.nearbyLandmarks" 11 <el-input v-model="editCommunityInfo.nearbyLandmarks"
12 :placeholder="$t('editCommunity.nearbyLandmarksPlaceholder')" /> 12 :placeholder="$t('editCommunity.nearbyLandmarksPlaceholder')" />
13 </el-form-item> 13 </el-form-item>
14 - <el-form-item :label="$t('editCommunity.payFeeMonth')" prop="payFeeMonth" required> 14 + <el-form-item :label="$t('editCommunity.payFeeMonth')" prop="payFeeMonth" >
15 <el-input v-model="editCommunityInfo.payFeeMonth" :placeholder="$t('editCommunity.payFeeMonthPlaceholder')" /> 15 <el-input v-model="editCommunityInfo.payFeeMonth" :placeholder="$t('editCommunity.payFeeMonthPlaceholder')" />
16 </el-form-item> 16 </el-form-item>
17 - <el-form-item :label="$t('editCommunity.feePrice')" prop="feePrice" required> 17 + <el-form-item :label="$t('editCommunity.feePrice')" prop="feePrice" >
18 <el-input v-model="editCommunityInfo.feePrice" :placeholder="$t('editCommunity.feePricePlaceholder')" /> 18 <el-input v-model="editCommunityInfo.feePrice" :placeholder="$t('editCommunity.feePricePlaceholder')" />
19 </el-form-item> 19 </el-form-item>
20 - <el-form-item :label="$t('editCommunity.tel')" prop="tel" required> 20 + <el-form-item :label="$t('editCommunity.tel')" prop="tel" >
21 <el-input v-model="editCommunityInfo.tel" :placeholder="$t('editCommunity.telPlaceholder')" /> 21 <el-input v-model="editCommunityInfo.tel" :placeholder="$t('editCommunity.telPlaceholder')" />
22 </el-form-item> 22 </el-form-item>
23 <el-form-item v-for="(item, index) in editCommunityInfo.attrs" :key="index" :label="item.specName" 23 <el-form-item v-for="(item, index) in editCommunityInfo.attrs" :key="index" :label="item.specName"
@@ -46,6 +46,29 @@ export default { @@ -46,6 +46,29 @@ export default {
46 data() { 46 data() {
47 return { 47 return {
48 visible: false, 48 visible: false,
  49 + rules: {
  50 + name: [
  51 + { required: true, message: this.$t('editCommunity.validate.name'), trigger: 'blur' }
  52 + ],
  53 + address: [
  54 + { required: true, message: this.$t('editCommunity.validate.address'), trigger: 'blur' }
  55 + ],
  56 + nearbyLandmarks: [
  57 + { required: true, message: this.$t('editCommunity.validate.nearbyLandmarks'), trigger: 'blur' }
  58 + ],
  59 + payFeeMonth: [
  60 + { required: true, message: this.$t('editCommunity.validate.payFeeMonth'), trigger: 'blur' }
  61 + ],
  62 + feePrice: [
  63 + { required: true, message: this.$t('editCommunity.validate.feePrice'), trigger: 'blur' }
  64 + ],
  65 + tel: [
  66 + { required: true, message: this.$t('editCommunity.validate.tel'), trigger: 'blur' }
  67 + ],
  68 + attrs: [
  69 + { required: true, message: this.$t('editCommunity.validate.attrs'), trigger: 'blur' }
  70 + ]
  71 + },
49 editCommunityInfo: { 72 editCommunityInfo: {
50 communityId: '', 73 communityId: '',
51 name: '', 74 name: '',