自然幢表单校验完善
Showing
2 changed files
with
90 additions
and
23 deletions
| ... | @@ -284,6 +284,7 @@ | ... | @@ -284,6 +284,7 @@ |
| 284 | type="date" | 284 | type="date" |
| 285 | value-format="yyyy-MM-dd" | 285 | value-format="yyyy-MM-dd" |
| 286 | placeholder="选择日期" | 286 | placeholder="选择日期" |
| 287 | @blur="inputBlur($event,true)" | ||
| 287 | @input="startTime(index,childIndex)" | 288 | @input="startTime(index,childIndex)" |
| 288 | > | 289 | > |
| 289 | </el-date-picker> | 290 | </el-date-picker> |
| ... | @@ -332,6 +333,7 @@ | ... | @@ -332,6 +333,7 @@ |
| 332 | value-format="yyyy-MM-dd" | 333 | value-format="yyyy-MM-dd" |
| 333 | :picker-options="childItem.pickerEnd" | 334 | :picker-options="childItem.pickerEnd" |
| 334 | placeholder="选择日期" | 335 | placeholder="选择日期" |
| 336 | @blur="inputBlur($event,true)" | ||
| 335 | @input="endTime(index,childIndex)" | 337 | @input="endTime(index,childIndex)" |
| 336 | > | 338 | > |
| 337 | </el-date-picker> | 339 | </el-date-picker> | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="main"> | 2 | <div class="main" ref="mainBox"> |
| 3 | <div class="formMenu"> | 3 | <div class="formMenu"> |
| 4 | <Qlr ref="qlrxxModule" :bsm="bsm" :qszt="form.qszt"></Qlr> | 4 | <Qlr ref="qlrxxModule" :bsm="bsm" :qszt="form.qszt"></Qlr> |
| 5 | <table border="1" width="100%" cellspacing="0" cellpadding="0" class="zrzTable"> | 5 | <table border="1" width="100%" cellspacing="0" cellpadding="0" class="zrzTable"> |
| ... | @@ -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" @blur="inputBlur($event)" :disabled="form.qszt!='0'" v-model="form.fwxzbsm" placeholder="请选择" > | 46 | <el-select class="formSelect" ref="fwxz" :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,7 +156,6 @@ | ... | @@ -156,7 +156,6 @@ |
| 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)" | ||
| 160 | v-if="show" | 159 | v-if="show" |
| 161 | :default-expand-all="defaultExpandAll" | 160 | :default-expand-all="defaultExpandAll" |
| 162 | :multiple="multiple" | 161 | :multiple="multiple" |
| ... | @@ -173,7 +172,6 @@ | ... | @@ -173,7 +172,6 @@ |
| 173 | <td colspan="4" > | 172 | <td colspan="4" > |
| 174 | <el-select-tree style="width:100%" | 173 | <el-select-tree style="width:100%" |
| 175 | ref="yt" | 174 | ref="yt" |
| 176 | @blur="inputBlur($event)" | ||
| 177 | v-if="show" | 175 | v-if="show" |
| 178 | :default-expand-all="defaultExpandAll" | 176 | :default-expand-all="defaultExpandAll" |
| 179 | :multiple="multiple" | 177 | :multiple="multiple" |
| ... | @@ -198,7 +196,7 @@ | ... | @@ -198,7 +196,7 @@ |
| 198 | <span> 删除</span> | 196 | <span> 删除</span> |
| 199 | </td> | 197 | </td> |
| 200 | <td colspan="9" > | 198 | <td colspan="9" > |
| 201 | <el-select class="persent78" ref="fwjg" @blur="inputBlur($event)" :disabled="form.qszt!='0'" v-model="item1.fwjgzdbsm" placeholder="请选择" > | 199 | <el-select class="persent78" ref="fwjg" :disabled="form.qszt!='0'" v-model="item1.fwjgzdbsm" placeholder="请选择" > |
| 202 | <el-option | 200 | <el-option |
| 203 | v-for="item in $store.state.jgOptions" | 201 | v-for="item in $store.state.jgOptions" |
| 204 | :key="item.bsm" | 202 | :key="item.bsm" |
| ... | @@ -266,10 +264,11 @@ | ... | @@ -266,10 +264,11 @@ |
| 266 | </tr> | 264 | </tr> |
| 267 | 265 | ||
| 268 | </table> | 266 | </table> |
| 269 | <div style="min-height: 40px;text-align: center;margin-top: 10px"> | 267 | <div class="header-button" :style="{width:mainBoxWidth+'px'}"> |
| 270 | <el-button type="success" @click="onSave">保存</el-button> | 268 | <el-button type="primary" class="saveBtn" @click="onSave">保存</el-button> |
| 271 | <el-button type="primary" @click="onSubmit">提交</el-button> | 269 | <el-button type="primary" @click="onSubmit">提交</el-button> |
| 272 | <el-button type="primary" @click="registerCall">登记调用</el-button> | 270 | <el-button type="primary" @click="registerCall">登记调用</el-button> |
| 271 | <!-- <el-button type="primary" class="saveBtn" @click="save">保存</el-button> --> | ||
| 273 | </div> | 272 | </div> |
| 274 | </div> | 273 | </div> |
| 275 | </div> | 274 | </div> |
| ... | @@ -398,6 +397,7 @@ | ... | @@ -398,6 +397,7 @@ |
| 398 | BSM:"", | 397 | BSM:"", |
| 399 | }, | 398 | }, |
| 400 | rules:[], | 399 | rules:[], |
| 400 | mainBoxWidth:0, | ||
| 401 | } | 401 | } |
| 402 | }, | 402 | }, |
| 403 | methods: { | 403 | methods: { |
| ... | @@ -491,13 +491,13 @@ | ... | @@ -491,13 +491,13 @@ |
| 491 | this.form.fwytList.forEach((item,index)=>{ | 491 | this.form.fwytList.forEach((item,index)=>{ |
| 492 | this.rules.push( | 492 | this.rules.push( |
| 493 | { | 493 | { |
| 494 | data:this.form.fwytList[index].ghyt, | 494 | data:item.fwytzdbsm, |
| 495 | name:'规划用途', | 495 | name:'规划用途', |
| 496 | dom:this.$refs.ghyt[index], | 496 | dom:this.$refs.ghyt[index], |
| 497 | rule: /^\s*$/g, //非空 | 497 | rule: /^\s*$/g, //非空 |
| 498 | }, | 498 | }, |
| 499 | { | 499 | { |
| 500 | data:this.form.fwytList[index].yt, | 500 | data:item.fwytzdbsm, |
| 501 | name:'用途', | 501 | name:'用途', |
| 502 | dom:this.$refs.yt[index], | 502 | dom:this.$refs.yt[index], |
| 503 | rule: /^\s*$/g, //非空 | 503 | rule: /^\s*$/g, //非空 |
| ... | @@ -507,7 +507,7 @@ | ... | @@ -507,7 +507,7 @@ |
| 507 | this.form.fwjgList.forEach((item,index)=>{ | 507 | this.form.fwjgList.forEach((item,index)=>{ |
| 508 | this.rules.push( | 508 | this.rules.push( |
| 509 | { | 509 | { |
| 510 | data:this.form.fwjgList[index].fwjg, | 510 | data:item.fwjgzdbsm, |
| 511 | name:'房屋结构', | 511 | name:'房屋结构', |
| 512 | dom:this.$refs.fwjg[index], | 512 | dom:this.$refs.fwjg[index], |
| 513 | rule: /^\s*$/g, //非空 | 513 | rule: /^\s*$/g, //非空 |
| ... | @@ -541,15 +541,15 @@ | ... | @@ -541,15 +541,15 @@ |
| 541 | }); | 541 | }); |
| 542 | }else{ | 542 | }else{ |
| 543 | saveZrzInfo(this.form).then((res)=>{ | 543 | saveZrzInfo(this.form).then((res)=>{ |
| 544 | if(res.code===200){ | 544 | if(res.code===200){ |
| 545 | this.$message.success("保存完成!") | 545 | this.$message.success("保存完成!") |
| 546 | }else { | 546 | }else { |
| 547 | this.$message({ | 547 | this.$message({ |
| 548 | message: res.message, | 548 | message: res.message, |
| 549 | type: "warning", | 549 | type: "warning", |
| 550 | }); | 550 | }); |
| 551 | } | 551 | } |
| 552 | this.loading=false; | 552 | this.loading=false; |
| 553 | }) | 553 | }) |
| 554 | this.loading=false; | 554 | this.loading=false; |
| 555 | 555 | ||
| ... | @@ -717,7 +717,11 @@ | ... | @@ -717,7 +717,11 @@ |
| 717 | this.getZrzDetailByBsm(this.$route.query.bsm) | 717 | this.getZrzDetailByBsm(this.$route.query.bsm) |
| 718 | } | 718 | } |
| 719 | }, | 719 | }, |
| 720 | mounted() {}, | 720 | mounted() { |
| 721 | this.$nextTick(() => { | ||
| 722 | this.mainBoxWidth = this.$refs.mainBox.clientWidth; | ||
| 723 | }) | ||
| 724 | }, | ||
| 721 | computed: { | 725 | computed: { |
| 722 | zrzbsm() { | 726 | zrzbsm() { |
| 723 | return this.$store.state.zdbsm; | 727 | return this.$store.state.zdbsm; |
| ... | @@ -726,7 +730,46 @@ | ... | @@ -726,7 +730,46 @@ |
| 726 | watch:{ | 730 | watch:{ |
| 727 | zrzbsm:function (val) { | 731 | zrzbsm:function (val) { |
| 728 | this.reload() | 732 | this.reload() |
| 729 | } | 733 | }, |
| 734 | "form.bdcdyh":function (val) { | ||
| 735 | if (val != '') { | ||
| 736 | this.$refs.bdcdyh.style.border = ''; | ||
| 737 | } | ||
| 738 | }, | ||
| 739 | "form.zrzh":function (val) { | ||
| 740 | if (val != '') { | ||
| 741 | this.$refs.zrzh.style.border = ''; | ||
| 742 | } | ||
| 743 | }, | ||
| 744 | "form.fwxzbsm":{ | ||
| 745 | handler:function (val) { | ||
| 746 | if (val != '') { | ||
| 747 | this.$refs.fwxz.$el.style.border = ''; | ||
| 748 | } | ||
| 749 | }, | ||
| 750 | immediate:false | ||
| 751 | }, | ||
| 752 | "form.fwytList": { | ||
| 753 | handler : function (newVal, oldVal) { | ||
| 754 | newVal.forEach((item,ind)=>{ | ||
| 755 | if(item.fwytzdbsm != ''){ | ||
| 756 | this.$refs.ghyt[ind].$el.style.border="" | ||
| 757 | this.$refs.yt[ind].$el.style.border="" | ||
| 758 | } | ||
| 759 | }) | ||
| 760 | }, | ||
| 761 | deep:true | ||
| 762 | }, | ||
| 763 | "form.fwjgList": { | ||
| 764 | handler : function (newVal, oldVal) { | ||
| 765 | newVal.forEach((item,ind)=>{ | ||
| 766 | if(item.fwjgzdbsm != ''){ | ||
| 767 | this.$refs.fwjg[ind].$el.style.border="" | ||
| 768 | } | ||
| 769 | }) | ||
| 770 | }, | ||
| 771 | deep:true | ||
| 772 | }, | ||
| 730 | } | 773 | } |
| 731 | } | 774 | } |
| 732 | </script> | 775 | </script> |
| ... | @@ -738,6 +781,7 @@ | ... | @@ -738,6 +781,7 @@ |
| 738 | .formMenu { | 781 | .formMenu { |
| 739 | width: 100%; | 782 | width: 100%; |
| 740 | margin: 0 auto; | 783 | margin: 0 auto; |
| 784 | margin-bottom: 50px; | ||
| 741 | } | 785 | } |
| 742 | .zrzTable { | 786 | .zrzTable { |
| 743 | margin: 10px 0; | 787 | margin: 10px 0; |
| ... | @@ -791,5 +835,26 @@ | ... | @@ -791,5 +835,26 @@ |
| 791 | width: 100%; | 835 | width: 100%; |
| 792 | } | 836 | } |
| 793 | } | 837 | } |
| 838 | .header-button { | ||
| 839 | height: 50px; | ||
| 840 | position: fixed; | ||
| 841 | bottom: 0; | ||
| 842 | right: 6px; | ||
| 843 | text-align: center; | ||
| 844 | background-color: #ffffff; | ||
| 845 | .el-button{ | ||
| 846 | padding: 10px 30px; | ||
| 847 | margin-top: 8px; | ||
| 848 | cursor: pointer; | ||
| 849 | } | ||
| 850 | .saveBtn { | ||
| 851 | background-color: #00CACD; | ||
| 852 | border-color: #00CACD; | ||
| 853 | } | ||
| 854 | .saveBtn:hover { | ||
| 855 | background-color: rgba(0, 202, 205, .8); | ||
| 856 | border-color: rgba(0, 202, 205, .8); | ||
| 857 | } | ||
| 858 | } | ||
| 794 | } | 859 | } |
| 795 | </style> | 860 | </style> | ... | ... |
-
Please register or sign in to post a comment