d73031b0 by 杨威

引导页新建宗地表单验证

1 parent 27385376
......@@ -7,9 +7,9 @@
class="eltabs"
@tab-click="handleClick">
<el-tab-pane class="eltabspane" label="宗地" name="zd">
<el-form :inline="true" class="demo-form-inline">
<el-form-item label="行政区划">
<el-select v-model="xzqValue" style="width:100px;" value-key="xzqbsm" placeholder="行政区" @change="changeXzq(xzqValue)">
<el-form :inline="true" :rules="rules" :model="ruleForm" ref="ruleForm" class="demo-form-inline">
<el-form-item label="行政区划" required prop="xzqbsm">
<el-select v-model="ruleForm.xzqbsm" style="width:100px;" value-key="xzqbsm" placeholder="行政区" @change="changeXzq(ruleForm.xzqbsm)">
<el-option
v-for="item in xzq"
:key="item.xzqbsm"
......@@ -18,8 +18,8 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item >
<el-select v-model="djqValue" style="width:130px;" placeholder="地籍区" @change="changeDjq(djqValue)">
<el-form-item prop="djqbsm">
<el-select v-model="ruleForm.djqbsm" style="width:130px;" placeholder="地籍区" @change="changeDjq(ruleForm.djqbsm)">
<el-option
v-for="item in djq"
:key="item.bsm"
......@@ -28,8 +28,8 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item >
<el-select v-model="djzqValue" style="width:150px;" placeholder="地籍子区">
<el-form-item prop="djzqbsm">
<el-select v-model="ruleForm.djzqbsm" style="width:150px;" placeholder="地籍子区">
<el-option
v-for="item in djzq"
:key="item.bsm"
......@@ -38,18 +38,17 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="项目名称">
<el-form-item label="项目名称" required prop="xmmc">
<el-input
v-model="zdProjectName"
v-model="ruleForm.xmmc"
placeholder="项目名称"
style="width:400px;"
></el-input>
</el-form-item>
<el-form-item label="所有权类型">
<el-form-item label="所有权类型" required prop="syqlxbsm">
<el-select
v-model="syqlx.value"
v-model="ruleForm.syqlxbsm"
placeholder="所有权类型"
@change="changeSyqlx(syqlx.value)"
style="width:300px;"
>
<el-option
......@@ -61,9 +60,9 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="特征码">
<el-form-item label="特征码" required prop="zdtzmbsm">
<el-select
v-model="tzmCode"
v-model="ruleForm.zdtzmbsm"
placeholder="宗地特征码"
style="width:200px;"
>
......@@ -76,7 +75,12 @@
</el-option>
</el-select>
</el-form-item>
<div>
<el-form-item class="handleBtn">
<el-button type="primary">导入图形</el-button>
<el-button type="primary" @click="newZd">创建</el-button>
<el-button type="primary" @click="close">取消</el-button>
</el-form-item>
<!-- <div>
<el-form-item style="margin-left:300px;">
<el-button type="primary">导入图形</el-button>
</el-form-item>
......@@ -86,7 +90,7 @@
<el-form-item>
<el-button type="primary" @click="close">取消</el-button>
</el-form-item>
</div>
</div> -->
</el-form>
</el-tab-pane>
<el-tab-pane class="eltabspane" label="宗海" name="zh">宗海</el-tab-pane>
......@@ -137,16 +141,39 @@ export default {
tabPosition: "left",
//默认第一个选项卡
activeName: "zd",
zdProjectName: "",
zrzProjectName: "",
tzmCode: "",
syqlxCode: "",
xzqValue: "",
djqValue: "",
djzqValue: "",
xzq: [],
djq: [],
djzq: [],
ruleForm:{
"djqbsm": "",
"djzqbsm": "",
"syqlxbsm": "",
"userbsm": "",
"xmmc": "",
"xzqbsm": "",
"zdtzmbsm": ""
},
rules: {
xzqbsm: [
{ required: true, message: '请选择行政区', trigger: 'change' }
],
djqbsm: [
{ required: true, message: '请选择地籍区', trigger: 'change' }
],
djzqbsm: [
{ required: true, message: '请选择地籍子区', trigger: 'change' }
],
xmmc: [
{ required: true, message: '请输入项目名称', trigger: 'blur' },
],
syqlxbsm: [
{ required: true, message: '请选择所有权类型', trigger: 'change' }
],
zdtzmbsm: [
{ required: true, message: '请选择宗地特征码', trigger: 'change' }
]
},
syqlx: [
{
label: "国家所有",
......@@ -173,31 +200,30 @@ export default {
console.log(tab.name);
},
newZd() {
var data = {
xzqbsm: this.xzqValue,
djqbsm: this.djqValue,
djzqbsm: this.djzqValue,
syqlxbsm: this.syqlxCode,
xmmc: this.zdProjectName,
zdtzmbsm: this.tzmCode,
};
insertQjZdjbxx(data)
.then((res) => {
console.log(res.result);
if (res.code == "200") {
this.$message({
message: "创建成功!",
type: "success",
});
this.$store.state.zdbsm = res.result;
//todo 跳转到宗地基本信息内容表页面 (预留)
this.close();
this.$router.push("/zd");
} else {
this.$message.error(res.message);
}
})
.catch((error) => {});
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
insertQjZdjbxx(this.ruleForm)
.then((res) => {
console.log(res.result);
if (res.code == "200") {
this.$message({
message: "创建成功!",
type: "success",
});
this.$store.state.zdbsm = res.result;
//todo 跳转到宗地基本信息内容表页面 (预留)
this.close();
this.$router.push("/zd");
} else {
this.$message.error(res.message);
}
})
.catch((error) => {});
} else {
console.log('error submit!!');
return false;
}
});
},
newZrz() {
//todo 在新增时,如果是点击顶部新建里面的自然幢则不传zdbsm 如果是点击右键里面的添加定着物则传zdbsm
......@@ -216,10 +242,9 @@ export default {
});
//todo 跳转到自然幢基本信息内容表页面 (预留)
this.close();
this.$store.zdbsm=res.result.zdbsm;
this.$store.zrzbsm=res.result.bsm;
this.$store.xmmc=res.result.xmmc;
localStorage.setItem("zrzbsm",res.result.bsm)
this.$store.state.zdbsm=res.result.zdbsm;
this.$store.state.zrzbsm=res.result.bsm;
this.$store.state.xmmc=res.result.xmmc;
this.$router.push({
path: '/zrz', query:{
source: 1,
......@@ -244,8 +269,8 @@ export default {
changeXzq(id) {
this.djq = [];
this.djzq = [];
this.djqValue = "";
this.djzqValue = "";
this.ruleForm.djqbsm = "";
this.ruleForm.djzqbsm = "";
getListByXzqbsm(id)
.then((res) => {
if (res.result == null) {
......@@ -259,7 +284,7 @@ export default {
},
changeDjq(item) {
this.djzq = [];
this.djzqValue = "";
this.ruleForm.djzqbsm = "";
if (item == null) {
console.log("llllllllllasdas");
} else {
......@@ -277,10 +302,6 @@ export default {
.catch((error) => {});
}
},
changeSyqlx(id) {
this.syqlxCode = id;
console.log(this.syqlxCode);
},
close() {
this.$emit("closeDialog");
},
......@@ -289,7 +310,7 @@ export default {
watch: {},
};
</script>
<style>
<style lang="less">
.eltabs {
height: 366px;
width: 100%;
......@@ -298,6 +319,15 @@ export default {
height: 100%;
width: 100%;
padding: 20px;
.el-form-item{
margin-bottom: 20px;
}
.handleBtn{
width: 90%;
.el-form-item__content{
float: right;
}
}
}
#tabs .el-tabs__item {
......@@ -310,4 +340,7 @@ export default {
.zrzProject {
margin-top: 80px;
}
.el-form--inline .el-form-item__label{
width: 100px;
}
</style>
......