f(zddcb):表单验证1
Showing
1 changed file
with
74 additions
and
33 deletions
... | @@ -21,19 +21,23 @@ | ... | @@ -21,19 +21,23 @@ |
21 | <tr> | 21 | <tr> |
22 | <td colspan="2">行政区</td> | 22 | <td colspan="2">行政区</td> |
23 | <td colspan="2"> | 23 | <td colspan="2"> |
24 | <el-select | 24 | <el-form :rules="rules" ref="ruleForm" :inline="true" > |
25 | class="formSelect" | 25 | <el-form-item prop="xzq"> |
26 | v-model="formData.xzqbsm" | 26 | <el-select |
27 | @change="changeXzq(formData.xzqbsm)" | 27 | class="formSelect" |
28 | > | 28 | v-model="formData.xzqbsm" |
29 | <el-option | 29 | @change="changeXzq(formData.xzqbsm)" |
30 | v-for="item in $store.state.xzqList" | 30 | > |
31 | :key="item.bsm" | 31 | <el-option |
32 | :label="item.mc" | 32 | v-for="item in $store.state.xzqList" |
33 | :value="item.bsm" | 33 | :key="item.bsm" |
34 | > | 34 | :label="item.mc" |
35 | </el-option> | 35 | :value="item.bsm" |
36 | </el-select> | 36 | > |
37 | </el-option> | ||
38 | </el-select> | ||
39 | </el-form-item> | ||
40 | </el-form> | ||
37 | </td> | 41 | </td> |
38 | <td colspan="2">地籍区</td> | 42 | <td colspan="2">地籍区</td> |
39 | <td colspan="2"> | 43 | <td colspan="2"> |
... | @@ -337,7 +341,7 @@ | ... | @@ -337,7 +341,7 @@ |
337 | </table> | 341 | </table> |
338 | 342 | ||
339 | <div style="min-height: 40px;text-align: center;margin-top: 10px"> | 343 | <div style="min-height: 40px;text-align: center;margin-top: 10px"> |
340 | <el-button type="success" @click="updateZDxx">保存</el-button> | 344 | <el-button type="success" @click="updateZDxx()">保存</el-button> |
341 | <el-button type="primary" @click="submitZDxx">提交</el-button> | 345 | <el-button type="primary" @click="submitZDxx">提交</el-button> |
342 | </div> | 346 | </div> |
343 | </div> | 347 | </div> |
... | @@ -369,6 +373,30 @@ export default { | ... | @@ -369,6 +373,30 @@ export default { |
369 | props: {}, | 373 | props: {}, |
370 | data() { | 374 | data() { |
371 | return { | 375 | return { |
376 | rules: { | ||
377 | hdmc: [ | ||
378 | { required: true, message: '请输入活动名称', trigger: 'blur' }, | ||
379 | { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' } | ||
380 | ], | ||
381 | xzq: [ | ||
382 | { required: true, message: '请选择活行政区', trigger: 'change' } | ||
383 | ], | ||
384 | date1: [ | ||
385 | { type: 'date', required: true, message: '请选择日期', trigger: 'change' } | ||
386 | ], | ||
387 | date2: [ | ||
388 | { type: 'date', required: true, message: '请选择时间', trigger: 'change' } | ||
389 | ], | ||
390 | type: [ | ||
391 | { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' } | ||
392 | ], | ||
393 | resource: [ | ||
394 | { required: true, message: '请选择活动资源', trigger: 'change' } | ||
395 | ], | ||
396 | desc: [ | ||
397 | { required: true, message: '请填写活动形式', trigger: 'blur' } | ||
398 | ] | ||
399 | }, | ||
372 | rjl:'', | 400 | rjl:'', |
373 | jzmd:'', | 401 | jzmd:'', |
374 | jzxg:'', | 402 | jzxg:'', |
... | @@ -442,31 +470,43 @@ export default { | ... | @@ -442,31 +470,43 @@ export default { |
442 | .catch((error) => {}); | 470 | .catch((error) => {}); |
443 | }, | 471 | }, |
444 | //修改宗地基本信息 | 472 | //修改宗地基本信息 |
445 | updateZDxx() { | 473 | updateZDxx(formData) { |
446 | //获取权利性质数据 | 474 | //获取权利性质数据 |
447 | this.formData.list = this.$refs.qlxzModule.getQlxzDataList(); | 475 | this.formData.list = this.$refs.qlxzModule.getQlxzDataList(); |
448 | //判断容密高是否为区间值,如果是区间值,则将输入框的值赋予 | 476 | //判断容密高是否为区间值,如果是区间值,则将输入框的值赋予 |
449 | this.formData.jyrjl = this.isInterval(this.formData.jyrjl) ? this.rjl : this.formData.jyrjl; | 477 | this.formData.jyrjl = this.isInterval(this.formData.jyrjl) ? this.rjl : this.formData.jyrjl; |
450 | this.formData.jyjzmd = this.isInterval(this.formData.jyjzmd) ? this.jzmd : this.formData.jyjzmd; | 478 | this.formData.jyjzmd = this.isInterval(this.formData.jyjzmd) ? this.jzmd : this.formData.jyjzmd; |
451 | this.formData.jyjzxg = this.isInterval(this.formData.jyjzxg) ? this.jzxg : this.formData.jyjzxg; | 479 | this.formData.jyjzxg = this.isInterval(this.formData.jyjzxg) ? this.jzxg : this.formData.jyjzxg; |
452 | updateQjZdjbxx(this.formData) | 480 | |
453 | .then((res) => { | 481 | |
454 | if (res.code == 200) { | 482 | this.$refs['ruleForm'].validate((valid) => { |
455 | console.log(res); | 483 | debugger |
456 | this.$message({ | 484 | if (valid) { |
457 | message: '保存成功', | 485 | alert('submit!'); |
458 | type: "success", | 486 | updateQjZdjbxx(this.formData) |
459 | }); | 487 | .then((res) => { |
460 | // 保存成功再次查询 | 488 | if (res.code == 200) { |
461 | this.getZdjbxxData(); | 489 | console.log(res); |
462 | } else { | 490 | this.$message({ |
463 | this.$message({ | 491 | message: '保存成功', |
464 | message: res.message, | 492 | type: "success", |
465 | type: "warning", | 493 | }); |
466 | }); | 494 | // 保存成功再次查询 |
467 | } | 495 | this.getZdjbxxData(); |
468 | }) | 496 | } else { |
469 | .catch((error) => {}); | 497 | this.$message({ |
498 | message: res.message, | ||
499 | type: "warning", | ||
500 | }); | ||
501 | } | ||
502 | }) | ||
503 | .catch((error) => {}); | ||
504 | } else { | ||
505 | alert("error submit") | ||
506 | return false; | ||
507 | } | ||
508 | }); | ||
509 | |||
470 | }, | 510 | }, |
471 | //提交宗地基本信息 | 511 | //提交宗地基本信息 |
472 | submitZDxx(){ | 512 | submitZDxx(){ |
... | @@ -475,6 +515,7 @@ export default { | ... | @@ -475,6 +515,7 @@ export default { |
475 | status:1, | 515 | status:1, |
476 | type:"zd" | 516 | type:"zd" |
477 | } | 517 | } |
518 | |||
478 | submit(data).then((res)=>{ | 519 | submit(data).then((res)=>{ |
479 | if(res.code===200){ | 520 | if(res.code===200){ |
480 | this.$message.success("提交完成!") | 521 | this.$message.success("提交完成!") | ... | ... |
-
Please register or sign in to post a comment