index.vue
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
<div class="zdy-content">
<el-form :model="form" :rules="rules" ref="form" label-width="110px" size="small">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="幢单元号" prop="zdyh">
<el-input v-model="form.zdyh"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" prop="zdymc">
<el-input v-model="form.zdymc"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="地上层数" prop="dscs">
<el-input v-model.number="form.dscs" type="number"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地下层数" prop="dxcs">
<el-input v-model.number="form.dxcs" type="number"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="总层数" prop="zcs">
<el-input v-model.number="form.zcs" type="number"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.bz"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item>
<el-button type="primary" @click="submitForm('form')">立即创建</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
export default {
name: "index",
components: {},
data(){
return{
form:{
zdyh:'',
zdymc:'',
dscs:'',
dxcs:'',
zcs:'',
bz:'',
},
rules:{
zdyh: [
{ required: true, message: '幢单元号不能为空', trigger: 'blur' },
{ min: 5, max: 50, message: '长度最少 5 个字符', trigger: 'blur' }
],
zdymc: [
{ required: true, message: '名称不能为空', trigger: 'change' }
],
dscs: [
{ required: true, message: '地上层数不能为空', trigger: 'blur' },
{type: 'number' , message: '必须是数字',trigger:'blur'}
],
dxcs: [
{ required: true, message: '地下层数不能为空', trigger: 'blur' },
{type: 'number' , message: '必须是数字'}
],
zcs: [
{ required: true, message: '名称不能为空', trigger: 'change' }
]
}
}
},
methods:{
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
}
}
</script>
<style scoped>
/deep/.el-input__inner{
width: 100%;
}
</style>