84cf8218 by 杨威

宗地表单和权利性质表单验证

1 parent 089a348b
...@@ -105,9 +105,11 @@ ...@@ -105,9 +105,11 @@
105 :disabled="formData.qszt!='0'" 105 :disabled="formData.qszt!='0'"
106 v-model="childItem.tdsyqssj" 106 v-model="childItem.tdsyqssj"
107 type="date" 107 type="date"
108 ref="tdsyqssj"
108 :picker-options="childItem.pickerStart" 109 :picker-options="childItem.pickerStart"
109 value-format="yyyy-MM-dd" 110 value-format="yyyy-MM-dd"
110 placeholder="选择日期" 111 placeholder="选择日期"
112 @blur="inputBlur($event,true)"
111 @input="startTime(index,childIndex)" 113 @input="startTime(index,childIndex)"
112 > 114 >
113 </el-date-picker> 115 </el-date-picker>
...@@ -151,7 +153,11 @@ ...@@ -151,7 +153,11 @@
151 <li> 153 <li>
152 <input 154 <input
153 type="text" 155 type="text"
154 156 ref="syqx"
157 @blur="inputBlur($event,false)"
158 maxlength="3"
159 onkeyup="value=value.replace(/[^\d]/g,'')"
160 @input="sumTime(index,childIndex,childItem.syqx,childItem.syqx)"
155 :disabled="formData.qszt!='0'" 161 :disabled="formData.qszt!='0'"
156 v-model="childItem.syqx" 162 v-model="childItem.syqx"
157 class="formInput" 163 class="formInput"
...@@ -212,8 +218,10 @@ ...@@ -212,8 +218,10 @@
212 :disabled="formData.qszt!='0'" 218 :disabled="formData.qszt!='0'"
213 v-model="childItem.tdsyjssj" 219 v-model="childItem.tdsyjssj"
214 type="date" 220 type="date"
221 ref="tdsyjssj"
222 @blur="inputBlur($event,true)"
215 :picker-options="childItem.pickerEnd" 223 :picker-options="childItem.pickerEnd"
216 @input="endTime(index,childIndex)" 224 @input="endTime(index,childIndex,$event)"
217 value-format="yyyy-MM-dd" 225 value-format="yyyy-MM-dd"
218 placeholder="选择日期" 226 placeholder="选择日期"
219 > 227 >
...@@ -234,6 +242,7 @@ ...@@ -234,6 +242,7 @@
234 :props="treeProps" 242 :props="treeProps"
235 :check-strictly="checkStrictly" 243 :check-strictly="checkStrictly"
236 :clearable="clearable" 244 :clearable="clearable"
245 ref="qlxzdm"
237 v-model="items.qlxzdm" 246 v-model="items.qlxzdm"
238 ></el-select-tree> 247 ></el-select-tree>
239 </div> 248 </div>
...@@ -301,6 +310,7 @@ export default { ...@@ -301,6 +310,7 @@ export default {
301 }, 310 },
302 ], 311 ],
303 outNum: 0, 312 outNum: 0,
313 rulesResult:true,//权利性质表单校验结果
304 }; 314 };
305 }, 315 },
306 created() {}, 316 created() {},
...@@ -323,10 +333,22 @@ export default { ...@@ -323,10 +333,22 @@ export default {
323 if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) { 333 if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) {
324 let startYear= new Date(startTime).getFullYear(); 334 let startYear= new Date(startTime).getFullYear();
325 let endYear=new Date(endTime).getFullYear(); 335 let endYear=new Date(endTime).getFullYear();
326 this.countList[index].list[childIndex].syqx=endYear-startYear; 336 //年限暂时不算
337 // this.countList[index].list[childIndex].syqx=endYear-startYear;
327 } 338 }
328 }, 339 },
329 endTime(index,childIndex){ 340 sumTime(index,childIndex,syqx,e){
341 console.log(e,'eeee');
342 this.$refs.syqx.forEach((item,index)=>{
343 if(item.value == syqx){
344 this.$refs.tdsyjssj[index].$el.style.border=""
345 }
346 })
347 let startTime = this.countList[index].list[childIndex].tdsyqssj;
348 this.countList[index].list[childIndex].tdsyjssj = Number(startTime.substring(0,4))+Number(syqx)+startTime.slice(4,10);
349 },
350 endTime(index,childIndex,e){
351 console.log(e,'eeeeee');
330 let startTime = this.countList[index].list[childIndex].tdsyqssj; 352 let startTime = this.countList[index].list[childIndex].tdsyqssj;
331 let endTime = this.countList[index].list[childIndex].tdsyjssj; 353 let endTime = this.countList[index].list[childIndex].tdsyjssj;
332 this.countList[index].list[childIndex].pickerStart={ 354 this.countList[index].list[childIndex].pickerStart={
...@@ -341,7 +363,7 @@ export default { ...@@ -341,7 +363,7 @@ export default {
341 if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) { 363 if (Object.keys(startTime).length > 0 && Object.keys(endTime).length > 0) {
342 let startYear= new Date(startTime).getFullYear(); 364 let startYear= new Date(startTime).getFullYear();
343 let endYear=new Date(endTime).getFullYear(); 365 let endYear=new Date(endTime).getFullYear();
344 this.countList[index].list[childIndex].syqx=endYear-startYear; 366 // this.countList[index].list[childIndex].syqx=endYear-startYear;
345 } 367 }
346 }, 368 },
347 //外层操作 369 //外层操作
...@@ -432,8 +454,94 @@ export default { ...@@ -432,8 +454,94 @@ export default {
432 }); 454 });
433 }, 455 },
434 getQlxzDataList() { 456 getQlxzDataList() {
457 console.log(this.countList,'this.countList');
435 return this.countList; 458 return this.countList;
436 }, 459 },
460 getRules(){
461 let rules = [];
462 console.log(this.$refs.tdsyqssj,'this.$refs.qlxzdm');
463 console.log(this.countList,'this.countList');
464 let temp = 0;
465 this.countList.forEach((item,index)=>{
466 rules.push({
467 data:this.countList[index].qlxzdm,
468 name:'权利性质',
469 dom:this.$refs.qlxzdm[index],
470 rule: /^\s*$/g, //非空
471 })
472 item.list.forEach((j,ind)=>{
473 rules.push(
474 {
475 data:item.list[ind].tdsyqssj,
476 name:'土地使用起始时间',
477 dom:this.$refs.tdsyqssj[temp+ind],
478 // val:this.$refs.tdsyqssj[temp+ind].value,
479 rule: /^\s*$/g, //非空
480 },
481 {
482 data:item.list[ind].syqx,
483 name:'使用期限',
484 dom:this.$refs.syqx[temp+ind],
485 // val:this.$refs.syqx[temp+ind].value,
486 rule: /^\s*$/g, //非空
487 },
488 {
489 data:item.list[ind].tdsyjssj,
490 name:'土地使用结束时间',
491 dom:this.$refs.tdsyjssj[temp+ind],
492 // val:this.$refs.tdsyjssj[temp+ind].value,
493 rule: /^\s*$/g, //非空
494 },
495 )
496 if (ind == item.list.length-1) {
497 temp += item.list.length;
498 }
499 })
500 })
501 this.rulesResult = true;
502 rules.forEach(item=>{
503 if(item.rule.test(item.data) || item.data == null){
504 if(item.dom.$el){
505 item.dom.$el.style.border = '1px solid red';
506 }else{
507 item.dom.style.border = '1px solid red';
508 }
509 // this.$message({
510 // // message: item.name+'不能为空',
511 // message: '不能为空',
512 // type: "warning",
513 // });
514 this.rulesResult = false;
515 return false
516 }
517 })
518 // console.log(rules,'rules');
519 },
520 getRulesResult(){
521 return this.rulesResult
522 },
523 inputBlur(e,flag){
524 if (flag) {
525 if(e.value!=''){
526 e.$el.style.border=""
527 }else{
528 e.$el.style.border="1px solid red"
529 }
530 }else{
531 if(e.target.value!=''){
532 e.target.style.border=""
533 }else{
534 e.target.style.border="1px solid red"
535 }
536 }
537 },
538 //后续考虑在点击加减号时操作校验规则
539 // addRules(){
540 // this.tempQssj.push()
541 // },
542 // minusRules(){
543
544 // },
437 }, 545 },
438 }; 546 };
439 </script> 547 </script>
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
81 </td> 81 </td>
82 <td colspan="2">宗地特征码<i class="requisite">*</i></td> 82 <td colspan="2">宗地特征码<i class="requisite">*</i></td>
83 <td colspan="4"> 83 <td colspan="4">
84 <el-select class="formSelect" :disabled="formData.qszt!='0'" v-model="formData.zdtzmbsm"> 84 <el-select class="formSelect" ref="zdtzm" :disabled="formData.qszt!='0'" v-model="formData.zdtzmbsm">
85 <el-option 85 <el-option
86 v-for="item in $store.state.zdtzmList" 86 v-for="item in $store.state.zdtzmList"
87 :key="item.bsm" 87 :key="item.bsm"
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
107 </td> 107 </td>
108 <td colspan="2">宗地代码<i class="requisite">*</i></td> 108 <td colspan="2">宗地代码<i class="requisite">*</i></td>
109 <td colspan="4" class="psr"> 109 <td colspan="4" class="psr">
110 <input :disabled="formData.qszt!='0'" maxlength="19" 110 <input :disabled="formData.qszt!='0'" @blur="inputBlur($event)" ref="zddm" on maxlength="19"
111 type="text" 111 type="text"
112 class="formInput percent80" 112 class="formInput percent80"
113 v-model="formData.zddm" 113 v-model="formData.zddm"
...@@ -126,8 +126,8 @@ ...@@ -126,8 +126,8 @@
126 <td colspan="2">不动产单元号<i class="requisite">*</i></td> 126 <td colspan="2">不动产单元号<i class="requisite">*</i></td>
127 <td colspan="4" class="psr"> 127 <td colspan="4" class="psr">
128 <input 128 <input
129 type="text" :disabled="formData.qszt!='0'" maxlength="28" 129 type="text" :disabled="formData.qszt!='0'" @blur="inputBlur($event)" ref="bdcdyh" maxlength="28"
130 class="formInput percent80" 130 class="formInput"
131 v-model="formData.bdcdyh" 131 v-model="formData.bdcdyh"
132 /> 132 />
133 <!-- <el-button type="warning" :disabled="formData.qszt!='0'" class="createBtn">生成</el-button> --> 133 <!-- <el-button type="warning" :disabled="formData.qszt!='0'" class="createBtn">生成</el-button> -->
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
136 <tr> 136 <tr>
137 <td colspan="2">坐落<i class="requisite">*</i></td> 137 <td colspan="2">坐落<i class="requisite">*</i></td>
138 <td colspan="4"> 138 <td colspan="4">
139 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zl" /> 139 <input type="text" :disabled="formData.qszt!='0'" @blur="inputBlur($event)" ref="zl" class="formInput" v-model="formData.zl" />
140 </td> 140 </td>
141 <td colspan="2">项目名称</td> 141 <td colspan="2">项目名称</td>
142 <td colspan="4" class="psr"> 142 <td colspan="4" class="psr">
...@@ -278,25 +278,25 @@ ...@@ -278,25 +278,25 @@
278 <td colspan="2" rowspan="4">宗地四至</td> 278 <td colspan="2" rowspan="4">宗地四至</td>
279 <td colspan="2">北至<i class="requisite">*</i></td> 279 <td colspan="2">北至<i class="requisite">*</i></td>
280 <td colspan="8" class="psr"> 280 <td colspan="8" class="psr">
281 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszb" /> 281 <input type="text" @blur="inputBlur($event)" ref="zdszb" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszb" />
282 </td> 282 </td>
283 </tr> 283 </tr>
284 <tr> 284 <tr>
285 <td colspan="2">东至<i class="requisite">*</i></td> 285 <td colspan="2">东至<i class="requisite">*</i></td>
286 <td colspan="8" class="psr"> 286 <td colspan="8" class="psr">
287 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszd" /> 287 <input type="text" @blur="inputBlur($event)" ref="zdszd" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszd" />
288 </td> 288 </td>
289 </tr> 289 </tr>
290 <tr> 290 <tr>
291 <td colspan="2">南至<i class="requisite">*</i></td> 291 <td colspan="2">南至<i class="requisite">*</i></td>
292 <td colspan="8" class="psr"> 292 <td colspan="8" class="psr">
293 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszn" /> 293 <input type="text" @blur="inputBlur($event)" ref="zdszn" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszn" />
294 </td> 294 </td>
295 </tr> 295 </tr>
296 <tr> 296 <tr>
297 <td colspan="2">西至<i class="requisite">*</i></td> 297 <td colspan="2">西至<i class="requisite">*</i></td>
298 <td colspan="8" class="psr"> 298 <td colspan="8" class="psr">
299 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszx" /> 299 <input type="text" @blur="inputBlur($event)" ref="zdszx" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdszx" />
300 </td> 300 </td>
301 </tr> 301 </tr>
302 <tr> 302 <tr>
...@@ -307,21 +307,21 @@ ...@@ -307,21 +307,21 @@
307 <tr> 307 <tr>
308 <td colspan="2" rowspan="2">批准面积(㎡)</td> 308 <td colspan="2" rowspan="2">批准面积(㎡)</td>
309 <td colspan="2" rowspan="2"> 309 <td colspan="2" rowspan="2">
310 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.pzmj" /> 310 <input type="text" :disabled="formData.qszt!='0'" onkeyup="value=value.replace(/[^\d\.]/g,'')" class="formInput" v-model="formData.pzmj" />
311 </td> 311 </td>
312 <td colspan="2" rowspan="2">宗地面积(㎡)</td> 312 <td colspan="2" rowspan="2">宗地面积(㎡)<i class="requisite">*</i></td>
313 <td colspan="2" rowspan="2"> 313 <td colspan="2" rowspan="2">
314 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.zdmj" /> 314 <input type="text" :disabled="formData.qszt!='0'" @blur="inputBlur($event)" ref="zdmj" onkeyup="value=value.replace(/[^\d\.]/g,'')" class="formInput" v-model="formData.zdmj" />
315 </td> 315 </td>
316 <td colspan="2">建筑占地总面积</td> 316 <td colspan="2">建筑占地总面积</td>
317 <td colspan="2"> 317 <td colspan="2">
318 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.jzzdzmj" /> 318 <input type="text" :disabled="formData.qszt!='0'" onkeyup="value=value.replace(/[^\d\.]/g,'')" class="formInput" v-model="formData.jzzdzmj" />
319 </td> 319 </td>
320 </tr> 320 </tr>
321 <tr> 321 <tr>
322 <td colspan="2">建筑面积(㎡)</td> 322 <td colspan="2">建筑面积(㎡)</td>
323 <td colspan="2"> 323 <td colspan="2">
324 <input type="text" :disabled="formData.qszt!='0'" class="formInput" v-model="formData.jzzmj" /> 324 <input type="text" :disabled="formData.qszt!='0'" onkeyup="value=value.replace(/[^\d\.]/g,'')" class="formInput" v-model="formData.jzzmj" />
325 </td> 325 </td>
326 </tr> 326 </tr>
327 <tr> 327 <tr>
...@@ -384,30 +384,7 @@ export default { ...@@ -384,30 +384,7 @@ export default {
384 props: {}, 384 props: {},
385 data() { 385 data() {
386 return { 386 return {
387 // rules: { 387 rules: [],
388 // hdmc: [
389 // { required: true, message: '请输入活动名称', trigger: 'blur' },
390 // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
391 // ],
392 // xzq: [
393 // { required: true, message: '请选择活行政区', trigger: 'change' }
394 // ],
395 // date1: [
396 // { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
397 // ],
398 // date2: [
399 // { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
400 // ],
401 // type: [
402 // { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
403 // ],
404 // resource: [
405 // { required: true, message: '请选择活动资源', trigger: 'change' }
406 // ],
407 // desc: [
408 // { required: true, message: '请填写活动形式', trigger: 'blur' }
409 // ]
410 // },
411 rjl:'', 388 rjl:'',
412 jzmd:'', 389 jzmd:'',
413 jzxg:'', 390 jzxg:'',
...@@ -501,6 +478,10 @@ export default { ...@@ -501,6 +478,10 @@ export default {
501 this.formData = res.result; 478 this.formData = res.result;
502 console.log(res.result,'res.result'); 479 console.log(res.result,'res.result');
503 this.getXzqData(res.result.xzqbsm,res.result.djqbsm); 480 this.getXzqData(res.result.xzqbsm,res.result.djqbsm);
481 //如果没有宗地代码,自动生成
482 if(res.result.zddm == null){
483 this.generatorCode()
484 }
504 //判断容密高是否为区间值,如果是区间值,则将校验值置为'-'并给rjl,jzmd,jzxg赋值 485 //判断容密高是否为区间值,如果是区间值,则将校验值置为'-'并给rjl,jzmd,jzxg赋值
505 this.rjl = this.isInterval(this.formData.jyrjl) ? this.formData.jyrjl : ''; 486 this.rjl = this.isInterval(this.formData.jyrjl) ? this.formData.jyrjl : '';
506 this.formData.jyrjl = this.isInterval(this.formData.jyrjl) ? '-' : this.formData.jyrjl; 487 this.formData.jyrjl = this.isInterval(this.formData.jyrjl) ? '-' : this.formData.jyrjl;
...@@ -646,10 +627,68 @@ export default { ...@@ -646,10 +627,68 @@ export default {
646 updateZDxx(formData) { 627 updateZDxx(formData) {
647 //获取权利性质数据 628 //获取权利性质数据
648 this.formData.list = this.$refs.qlxzModule.getQlxzDataList(); 629 this.formData.list = this.$refs.qlxzModule.getQlxzDataList();
630 this.$refs.qlxzModule.getRules();
631 console.log(this.$refs.qlxzModule.getRulesResult(),'this.$refs.qlxzModule.getRules()');
649 //判断容密高是否为区间值,如果是区间值,则将输入框的值赋予 632 //判断容密高是否为区间值,如果是区间值,则将输入框的值赋予
650 this.formData.jyrjl = this.isInterval(this.formData.jyrjl) ? this.rjl : this.formData.jyrjl; 633 this.formData.jyrjl = this.isInterval(this.formData.jyrjl) ? this.rjl : this.formData.jyrjl;
651 this.formData.jyjzmd = this.isInterval(this.formData.jyjzmd) ? this.jzmd : this.formData.jyjzmd; 634 this.formData.jyjzmd = this.isInterval(this.formData.jyjzmd) ? this.jzmd : this.formData.jyjzmd;
652 this.formData.jyjzxg = this.isInterval(this.formData.jyjzxg) ? this.jzxg : this.formData.jyjzxg; 635 this.formData.jyjzxg = this.isInterval(this.formData.jyjzxg) ? this.jzxg : this.formData.jyjzxg;
636 this.rules= [
637 {
638 data:this.formData.zdtzmbsm,
639 name:'宗地特征码',
640 dom:this.$refs.zdtzm,
641 rule: /^\s*$/g, //非空
642 },
643 {
644 data:this.formData.zddm,
645 name:'宗地代码',
646 dom:this.$refs.zddm,
647 rule: /^\s*$/g, //非空
648 },
649 {
650 data:this.formData.bdcdyh,
651 name:'不动产单元号',
652 dom:this.$refs.bdcdyh,
653 rule: /^\s*$/g, //非空
654 },
655 {
656 data:this.formData.zl,
657 name:'坐落',
658 dom:this.$refs.zl,
659 rule: /^\s*$/g, //非空
660 },
661 {
662 data:this.formData.zdszd,
663 name:'宗地东至',
664 dom:this.$refs.zdszd,
665 rule: /^\s*$/g, //非空
666 },
667 {
668 data:this.formData.zdszb,
669 name:'宗地北至',
670 dom:this.$refs.zdszb,
671 rule: /^\s*$/g, //非空
672 },
673 {
674 data:this.formData.zdszx,
675 name:'宗地西至',
676 dom:this.$refs.zdszx,
677 rule: /^\s*$/g, //非空
678 },
679 {
680 data:this.formData.zdszn,
681 name:'宗地南至',
682 dom:this.$refs.zdszn,
683 rule: /^\s*$/g, //非空
684 },
685 {
686 data:this.formData.zdmj,
687 name:'宗地面积',
688 dom:this.$refs.zdmj,
689 rule: /^\s*$/g, //非空
690 },
691 ]
653 //判断宗地代码和不动产单元号是否手动修改过(宗地代码和不动产单元号的前14位是否和底盘代码一致) 692 //判断宗地代码和不动产单元号是否手动修改过(宗地代码和不动产单元号的前14位是否和底盘代码一致)
654 if(this.formData.zddm.substring(0,14) != this.dpdm || this.formData.bdcdyh.substring(0,14) != this.dpdm){ 693 if(this.formData.zddm.substring(0,14) != this.dpdm || this.formData.bdcdyh.substring(0,14) != this.dpdm){
655 this.$message({ 694 this.$message({
...@@ -657,17 +696,28 @@ export default { ...@@ -657,17 +696,28 @@ export default {
657 type: "warning", 696 type: "warning",
658 }); 697 });
659 }else{ 698 }else{
660 // FIXME:表单验证错误 699 // console.log(this.rules,'rules');
661 /* this.$refs['ruleForm'].validate((valid) => { 700 let flag = true;
662 debugger 701 this.rules.forEach(item=>{
663 if (valid) { 702 if(item.rule.test(item.data) || item.data == null){
664 alert('submit!'); 703 if(item.dom.$el){
665 704 item.dom.$el.style.border = '1px solid red';
666 } else { 705 }else{
667 alert("error submit") 706 item.dom.style.border = '1px solid red';
668 return false; 707 }
708 // this.$message({
709 // // message: item.name+'不能为空',
710 // message: '不能为空',
711 // type: "warning",
712 // });
713 flag = false;
714 return false
669 } 715 }
670 });*/ 716 })
717 this.$nextTick(()=>{
718 if(flag){
719 //宗地面积处理
720 this.formData.zdmj = this.formData.zdmj.replace(/[^\d\.]/g,'')
671 updateQjZdjbxx(this.formData) 721 updateQjZdjbxx(this.formData)
672 .then((res) => { 722 .then((res) => {
673 if (res.code == 200) { 723 if (res.code == 200) {
...@@ -705,12 +755,28 @@ export default { ...@@ -705,12 +755,28 @@ export default {
705 self.updAttributes(this.$store.state.zdbsm,'zd',this.geoAttributes,function (res) { 755 self.updAttributes(this.$store.state.zdbsm,'zd',this.geoAttributes,function (res) {
706 console.log("属性保存完成!!"); 756 console.log("属性保存完成!!");
707 }); 757 });
758 }else{
759 this.$message({
760 // message: item.name+'不能为空',
761 message: '请完善表单后再继续操作',
762 type: "warning",
763 });
764 }
765 })
766
708 767
709 } 768 }
710 769
711 770
712 771
713 }, 772 },
773 inputBlur(e){
774 if(e.target.value!=''){
775 e.target.style.border=""
776 }else{
777 e.target.style.border="1px solid red"
778 }
779 },
714 //提交宗地基本信息 780 //提交宗地基本信息
715 submitZDxx(){ 781 submitZDxx(){
716 let data={ 782 let data={
......