表单校验完善
Showing
3 changed files
with
26 additions
and
7 deletions
... | @@ -620,8 +620,10 @@ export default { | ... | @@ -620,8 +620,10 @@ export default { |
620 | if(item.rule.test(item.data) || item.data == null){ | 620 | if(item.rule.test(item.data) || item.data == null){ |
621 | if(item.dom.$el){ | 621 | if(item.dom.$el){ |
622 | item.dom.$el.style.border = '1px solid red'; | 622 | item.dom.$el.style.border = '1px solid red'; |
623 | item.dom.$el.style.boxSizing = 'border-box'; | ||
623 | }else{ | 624 | }else{ |
624 | item.dom.style.border = '1px solid red'; | 625 | item.dom.style.border = '1px solid red'; |
626 | item.dom.style.boxSizing = 'border-box'; | ||
625 | } | 627 | } |
626 | // this.$message({ | 628 | // this.$message({ |
627 | // // message: item.name+'不能为空', | 629 | // // message: item.name+'不能为空', |
... | @@ -643,12 +645,14 @@ export default { | ... | @@ -643,12 +645,14 @@ export default { |
643 | e.$el.style.border="" | 645 | e.$el.style.border="" |
644 | }else{ | 646 | }else{ |
645 | e.$el.style.border="1px solid red" | 647 | e.$el.style.border="1px solid red" |
648 | e.$el.style.boxSizing = 'border-box'; | ||
646 | } | 649 | } |
647 | }else{ | 650 | }else{ |
648 | if(e.target.value!=''){ | 651 | if(e.target.value!=''){ |
649 | e.target.style.border="" | 652 | e.target.style.border="" |
650 | }else{ | 653 | }else{ |
651 | e.target.style.border="1px solid red" | 654 | e.target.style.border="1px solid red" |
655 | e.target.style.boxSizing = 'border-box'; | ||
652 | } | 656 | } |
653 | } | 657 | } |
654 | }, | 658 | }, | ... | ... |
... | @@ -702,8 +702,10 @@ export default { | ... | @@ -702,8 +702,10 @@ export default { |
702 | if(item.rule.test(item.data) || item.data == null){ | 702 | if(item.rule.test(item.data) || item.data == null){ |
703 | if(item.dom.$el){ | 703 | if(item.dom.$el){ |
704 | item.dom.$el.style.border = '1px solid red'; | 704 | item.dom.$el.style.border = '1px solid red'; |
705 | item.dom.$el.style.boxSizing = 'border-box'; | ||
705 | }else{ | 706 | }else{ |
706 | item.dom.style.border = '1px solid red'; | 707 | item.dom.style.border = '1px solid red'; |
708 | item.dom.style.boxSizing = 'border-box'; | ||
707 | } | 709 | } |
708 | // this.$message({ | 710 | // this.$message({ |
709 | // // message: item.name+'不能为空', | 711 | // // message: item.name+'不能为空', |
... | @@ -775,7 +777,8 @@ export default { | ... | @@ -775,7 +777,8 @@ export default { |
775 | if(e.target.value!=''){ | 777 | if(e.target.value!=''){ |
776 | e.target.style.border="" | 778 | e.target.style.border="" |
777 | }else{ | 779 | }else{ |
778 | e.target.style.border="1px solid red" | 780 | e.target.style.border="1px solid red"; |
781 | e.target.style.boxSizing = 'border-box'; | ||
779 | } | 782 | } |
780 | }, | 783 | }, |
781 | //提交宗地基本信息 | 784 | //提交宗地基本信息 | ... | ... |
... | @@ -14,18 +14,18 @@ | ... | @@ -14,18 +14,18 @@ |
14 | </td> | 14 | </td> |
15 | <td colspan="2" >自然幢号<i class="requisite">*</i></td> | 15 | <td colspan="2" >自然幢号<i class="requisite">*</i></td> |
16 | <td colspan="4" class="psr"> | 16 | <td colspan="4" class="psr"> |
17 | <input class="formInput percent80" ref="zrzh" :disabled="form.qszt!='0'" maxlength="24" v-model="form.zrzh"> | 17 | <input class="formInput percent80" ref="zrzh" @blur="inputBlur($event)" :disabled="form.qszt!='0'" maxlength="24" v-model="form.zrzh"> |
18 | <el-button @click.prevent="generatorCode" type="warning" class="createBtn" size="mini">生成</el-button> | 18 | <el-button @click.prevent="generatorCode" type="warning" class="createBtn" size="mini">生成</el-button> |
19 | </td> | 19 | </td> |
20 | </tr> | 20 | </tr> |
21 | <tr> | 21 | <tr> |
22 | <td colspan="2" >项目名称<i class="requisite">*</i></td> | 22 | <td colspan="2" >项目名称<i class="requisite">*</i></td> |
23 | <td colspan="4" > | 23 | <td colspan="4" > |
24 | <input class="formInput " ref="xmmc" :disabled="form.qszt!='0'" v-model="form.xmmc"> | 24 | <input class="formInput " ref="xmmc" @blur="inputBlur($event)" :disabled="form.qszt!='0'" v-model="form.xmmc"> |
25 | </td> | 25 | </td> |
26 | <td colspan="2" >不动产单元号<i class="requisite">*</i></td> | 26 | <td colspan="2" >不动产单元号<i class="requisite">*</i></td> |
27 | <td colspan="4"> | 27 | <td colspan="4"> |
28 | <input class="formInput " ref="bdcdyh" :disabled="form.qszt!='0'" maxlength="28" v-model="form.bdcdyh"> | 28 | <input class="formInput " ref="bdcdyh" @blur="inputBlur($event)" :disabled="form.qszt!='0'" maxlength="28" v-model="form.bdcdyh"> |
29 | </td> | 29 | </td> |
30 | </tr> | 30 | </tr> |
31 | 31 | ||
... | @@ -43,7 +43,7 @@ | ... | @@ -43,7 +43,7 @@ |
43 | <tr> | 43 | <tr> |
44 | <td colspan="2" >房屋性质<i class="requisite">*</i></td> | 44 | <td colspan="2" >房屋性质<i class="requisite">*</i></td> |
45 | <td colspan="4" > | 45 | <td colspan="4" > |
46 | <el-select class="formSelect" ref="fwxz" :disabled="form.qszt!='0'" v-model="form.fwxzbsm" placeholder="请选择" > | 46 | <el-select class="formSelect" ref="fwxz" @blur="inputBlur($event)" :disabled="form.qszt!='0'" v-model="form.fwxzbsm" placeholder="请选择" > |
47 | <el-option | 47 | <el-option |
48 | v-for="item in $store.state.fwxzOptions" | 48 | v-for="item in $store.state.fwxzOptions" |
49 | :key="item.bsm" | 49 | :key="item.bsm" |
... | @@ -156,6 +156,7 @@ | ... | @@ -156,6 +156,7 @@ |
156 | <td colspan="3" > | 156 | <td colspan="3" > |
157 | <el-select-tree style="width:100%" | 157 | <el-select-tree style="width:100%" |
158 | ref="ghyt" | 158 | ref="ghyt" |
159 | @blur="inputBlur($event)" | ||
159 | v-if="show" | 160 | v-if="show" |
160 | :default-expand-all="defaultExpandAll" | 161 | :default-expand-all="defaultExpandAll" |
161 | :multiple="multiple" | 162 | :multiple="multiple" |
... | @@ -172,6 +173,7 @@ | ... | @@ -172,6 +173,7 @@ |
172 | <td colspan="4" > | 173 | <td colspan="4" > |
173 | <el-select-tree style="width:100%" | 174 | <el-select-tree style="width:100%" |
174 | ref="yt" | 175 | ref="yt" |
176 | @blur="inputBlur($event)" | ||
175 | v-if="show" | 177 | v-if="show" |
176 | :default-expand-all="defaultExpandAll" | 178 | :default-expand-all="defaultExpandAll" |
177 | :multiple="multiple" | 179 | :multiple="multiple" |
... | @@ -196,7 +198,7 @@ | ... | @@ -196,7 +198,7 @@ |
196 | <span> 删除</span> | 198 | <span> 删除</span> |
197 | </td> | 199 | </td> |
198 | <td colspan="9" > | 200 | <td colspan="9" > |
199 | <el-select class="persent78" ref="fwjg" :disabled="form.qszt!='0'" v-model="item1.fwjgzdbsm" placeholder="请选择" > | 201 | <el-select class="persent78" ref="fwjg" @blur="inputBlur($event)" :disabled="form.qszt!='0'" v-model="item1.fwjgzdbsm" placeholder="请选择" > |
200 | <el-option | 202 | <el-option |
201 | v-for="item in $store.state.jgOptions" | 203 | v-for="item in $store.state.jgOptions" |
202 | :key="item.bsm" | 204 | :key="item.bsm" |
... | @@ -218,7 +220,7 @@ | ... | @@ -218,7 +220,7 @@ |
218 | <span>坐落<i class="requisite">*</i></span> | 220 | <span>坐落<i class="requisite">*</i></span> |
219 | </td> | 221 | </td> |
220 | <td colspan="10" > | 222 | <td colspan="10" > |
221 | <input class="formInput" ref="zl" :disabled="form.qszt!='0'" v-model="form.zl"> | 223 | <input class="formInput" ref="zl" @blur="inputBlur($event)" :disabled="form.qszt!='0'" v-model="form.zl"> |
222 | </td> | 224 | </td> |
223 | </tr> | 225 | </tr> |
224 | 226 | ||
... | @@ -522,8 +524,10 @@ | ... | @@ -522,8 +524,10 @@ |
522 | if(item.rule.test(item.data) || item.data == null){ | 524 | if(item.rule.test(item.data) || item.data == null){ |
523 | if(item.dom.$el){ | 525 | if(item.dom.$el){ |
524 | item.dom.$el.style.border = '1px solid red'; | 526 | item.dom.$el.style.border = '1px solid red'; |
527 | item.dom.$el.style.boxSizing = 'border-box'; | ||
525 | }else{ | 528 | }else{ |
526 | item.dom.style.border = '1px solid red'; | 529 | item.dom.style.border = '1px solid red'; |
530 | item.dom.style.boxSizing = 'border-box'; | ||
527 | } | 531 | } |
528 | flag = false; | 532 | flag = false; |
529 | return false | 533 | return false |
... | @@ -688,6 +692,14 @@ | ... | @@ -688,6 +692,14 @@ |
688 | } | 692 | } |
689 | }) | 693 | }) |
690 | }, | 694 | }, |
695 | inputBlur(e){ | ||
696 | if(e.target.value!=''){ | ||
697 | e.target.style.border="" | ||
698 | }else{ | ||
699 | e.target.style.border="1px solid red"; | ||
700 | e.target.style.boxSizing = 'border-box'; | ||
701 | } | ||
702 | }, | ||
691 | }, | 703 | }, |
692 | created(){ | 704 | created(){ |
693 | //todo 怎么判断进入到该页面是从新建处进来的,还是从右键宗地进来的!如果是从新建进来的就需要把虚拟宗标识码带过来; | 705 | //todo 怎么判断进入到该页面是从新建处进来的,还是从右键宗地进来的!如果是从新建进来的就需要把虚拟宗标识码带过来; | ... | ... |
-
Please register or sign in to post a comment