8c030a19 by 杨威

引导页新建自然幢表单验证

1 parent e0ea3a26
...@@ -95,26 +95,19 @@ ...@@ -95,26 +95,19 @@
95 </el-tab-pane> 95 </el-tab-pane>
96 <el-tab-pane class="eltabspane" label="宗海" name="zh">宗海</el-tab-pane> 96 <el-tab-pane class="eltabspane" label="宗海" name="zh">宗海</el-tab-pane>
97 <el-tab-pane class="eltabspane" label="自然幢" name="zrz"> 97 <el-tab-pane class="eltabspane" label="自然幢" name="zrz">
98 <el-form :inline="true" class="zrzProject"> 98 <el-form :inline="true" :rules="rules1" :model="ruleForm1" ref="ruleForm1" class="zrzProject">
99 <el-form-item label="项目名称"> 99 <el-form-item label="项目名称" prop="xmmc">
100 <el-input 100 <el-input
101 v-model="zrzProjectName" 101 v-model="ruleForm1.xmmc"
102 placeholder="项目名称" 102 placeholder="项目名称"
103 style="width:400px;" 103 style="width:400px;"
104 ></el-input> 104 ></el-input>
105 </el-form-item> 105 </el-form-item>
106 106 <el-form-item class="handleBtn">
107 <div> 107 <el-button type="primary">导入图形</el-button>
108 <el-form-item style="margin-left:300px;"> 108 <el-button type="primary" @click="newZrz">创建</el-button>
109 <el-button type="primary">导入图形</el-button> 109 <el-button type="primary" @click="close">取消</el-button>
110 </el-form-item> 110 </el-form-item>
111 <el-form-item>
112 <el-button type="primary" @click="newZrz">创建</el-button>
113 </el-form-item>
114 <el-form-item>
115 <el-button type="primary" @click="close">取消</el-button>
116 </el-form-item>
117 </div>
118 </el-form> 111 </el-form>
119 </el-tab-pane> 112 </el-tab-pane>
120 <el-tab-pane class="eltabspane" label="多幢" name="dz">多幢</el-tab-pane> 113 <el-tab-pane class="eltabspane" label="多幢" name="dz">多幢</el-tab-pane>
...@@ -154,6 +147,11 @@ export default { ...@@ -154,6 +147,11 @@ export default {
154 "xzqbsm": "", 147 "xzqbsm": "",
155 "zdtzmbsm": "" 148 "zdtzmbsm": ""
156 }, 149 },
150 ruleForm1:{
151 zdbsm:'',
152 xmmc:'',
153 userbsm:''
154 },
157 rules: { 155 rules: {
158 xzqbsm: [ 156 xzqbsm: [
159 { required: true, message: '请选择行政区', trigger: 'change' } 157 { required: true, message: '请选择行政区', trigger: 'change' }
...@@ -174,6 +172,11 @@ export default { ...@@ -174,6 +172,11 @@ export default {
174 { required: true, message: '请选择宗地特征码', trigger: 'change' } 172 { required: true, message: '请选择宗地特征码', trigger: 'change' }
175 ] 173 ]
176 }, 174 },
175 rules1: {
176 xmmc: [
177 { required: true, message: '请输入项目名称', trigger: 'blur' },
178 ],
179 },
177 syqlx: [ 180 syqlx: [
178 { 181 {
179 label: "国家所有", 182 label: "国家所有",
...@@ -227,35 +230,37 @@ export default { ...@@ -227,35 +230,37 @@ export default {
227 }, 230 },
228 newZrz() { 231 newZrz() {
229 //todo 在新增时,如果是点击顶部新建里面的自然幢则不传zdbsm 如果是点击右键里面的添加定着物则传zdbsm 232 //todo 在新增时,如果是点击顶部新建里面的自然幢则不传zdbsm 如果是点击右键里面的添加定着物则传zdbsm
230 var data = { 233 this.$refs['ruleForm1'].validate((valid) => {
231 userbsm: "", 234 if (valid) {
232 xmmc: this.zrzProjectName, 235 insertZrzjbxx(this.ruleForm1)
233 zdbsm: "", 236 .then((res) => {
234 }; 237 if (res.code == "200") {
235 console.log(data); 238 this.$message({
236 insertZrzjbxx(data) 239 message: "创建成功!",
237 .then((res) => { 240 type: "success",
238 if (res.code == "200") { 241 });
239 this.$message({ 242 //todo 跳转到自然幢基本信息内容表页面 (预留)
240 message: "创建成功!", 243 this.close();
241 type: "success", 244 this.$store.state.zdbsm=res.result.zdbsm;
242 }); 245 this.$store.state.zrzbsm=res.result.bsm;
243 //todo 跳转到自然幢基本信息内容表页面 (预留) 246 this.$store.state.xmmc=res.result.xmmc;
244 this.close(); 247 this.$router.push({
245 this.$store.state.zdbsm=res.result.zdbsm; 248 path: '/zrz', query:{
246 this.$store.state.zrzbsm=res.result.bsm; 249 source: 1,
247 this.$store.state.xmmc=res.result.xmmc; 250 bsm:res.result.bsm
248 this.$router.push({ 251 }
249 path: '/zrz', query:{ 252 });
250 source: 1, 253 } else {
251 bsm:res.result.bsm 254 this.$message.error("创建失败!");
252 } 255 }
253 }); 256 })
254 } else { 257 .catch((error) => {});
255 this.$message.error("创建失败!"); 258 } else {
256 } 259 console.log('error submit!!');
257 }) 260 return false;
258 .catch((error) => {}); 261 }
262 });
263
259 }, 264 },
260 getXzqList() { 265 getXzqList() {
261 getAllList() 266 getAllList()
...@@ -319,6 +324,9 @@ export default { ...@@ -319,6 +324,9 @@ export default {
319 height: 100%; 324 height: 100%;
320 width: 100%; 325 width: 100%;
321 padding: 20px; 326 padding: 20px;
327 .el-form--inline .el-form-item__label{
328 width: 100px;
329 }
322 .el-form-item{ 330 .el-form-item{
323 margin-bottom: 20px; 331 margin-bottom: 20px;
324 } 332 }
...@@ -340,7 +348,4 @@ export default { ...@@ -340,7 +348,4 @@ export default {
340 .zrzProject { 348 .zrzProject {
341 margin-top: 80px; 349 margin-top: 80px;
342 } 350 }
343 .el-form--inline .el-form-item__label{
344 width: 100px;
345 }
346 </style> 351 </style>
......