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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
| <template>
| <div class='other_add'>
| <v-header title="新增建筑"></v-header>
| <div class="fm">
| <section class="sec">
| <p class="label">建筑名称:</p>
| <article>
| <el-input
| size="small"
| placeholder="请输入名称"
| v-model="os.name"
| ></el-input>
| </article>
| </section>
| <section class="sec">
| <p class="label">建筑类型:</p>
| <article>
| <el-select
| v-model="os.typeId"
| placeholder="请选择"
| size="small"
| >
| <el-option
| v-for="(item,s) in tp"
| :key="s+'--tp'"
| :label="item.name"
| :value="item.id"
| >
| </el-option>
| </el-select>
| </article>
| </section>
| <section class="sec">
| <p class="label">建筑面积:</p>
| <article>
| <el-input
| size="small"
| placeholder="平方米"
| v-model="os.square"
| ></el-input>
| </article>
| </section>
| <section class="sec">
| <p class="label">建筑地址:</p>
| <article>
| <el-input
| size="small"
| v-model="os.address"
| ></el-input>
| </article>
| </section>
| <section class="sec">
| <p class="label">建筑状态:</p>
| <article>
| <el-select
| v-model="os.state"
| placeholder="请选择"
| size="small"
| >
| <el-option
| v-for="item in ts"
| :key="item.value"
| :label="item.label"
| :value="item.value"
| >
| </el-option>
| </el-select>
| </article>
| </section>
| <section class="sec">
| <p class="label">楼层类型:</p>
| <article>
| <el-select
| v-model="os.layerType"
| placeholder="请选择"
| size="small"
| >
| <el-option
| v-for="(item,s) in door"
| :key="s+'--door'"
| :label="item.label"
| :value="item.value"
| >
| </el-option>
| </el-select>
| </article>
| </section>
| </div>
| <div class="btn">
| <el-button
| type="primary"
| size="small"
| @click="sub"
| >确认</el-button>
| <el-button
| type="small"
| @click="close"
| >取消</el-button>
| </div>
| </div>
| </template>
|
| <script>
| export default {
| props: {},
| components: {},
| data() {
| return {
| options: [],
| value: "",
| tp: [],
| ts: [],
| door: [],
| os: {
| address: "",
| buileTypeName: "",
| layerType: "",
| name: "",
| square: "",
| state: "",
| typeId: "",
| },
| };
| },
| watch: {
| "os.typeId"(n) {
| if (n) {
| this.os.buileTypeName = this.tp.filter((r) => {
| return r.id === n;
| })[0].name;
| }
| },
| },
| methods: {
| sub() {
| let x = this.$js.validate.addBuild(this.os);
| if (!x.code) {
| demo.toast(x.err);
| return 0;
| }
| this.$api.post("communitymanager/otherbuild", x.data, (e) => {
| demo.toast("添加成功");
| this.reset();
| });
| },
| close() {
| this.reset();
| },
| reset() {
| for (let i in this.os) {
| this.os[i] = "";
| }
| this.$nextTick(() => {
| this.$router.go(-1);
| });
| },
| onDefault() {
| // 建筑类型 30min 更新一次
| let tp = demo.$session.get("man-bui-tp") || {};
| if (tp.time + 1000 * 60 * 30 > Date.now()) {
| this.tp = tp.list;
| } else {
| this.$api.get("communitymanager/listbuildtype", {}, (e) => {
| this.tp = e;
| demo.$session.set("man-bui-tp", { time: Date.now(), list: e });
| });
| }
| // 建筑状态
| this.ts = [
| { value: "1", label: "建筑中" },
| { value: "2", label: "使用中" },
| ];
| // 楼层类型
| this.door = [
| { value: "高层", label: "高层" },
| { value: "中层", label: "中层" },
| { value: "底层", label: "底层" },
| ];
| },
| },
| mounted() {
| this.onDefault();
| },
| };
| </script>
| <style lang='less' scoped>
| .other_add {
| .fm {
| margin-bottom: 10px;
| width: 400px;
| article {
| box-sizing: border-box;
| padding-left: 10px;
| .el-input {
| width: 100%;
| }
| }
| }
| .btn {
| padding-left: 20px;
| }
| }
| </style>
|
|