address-client 3.2.25 → 3.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,983 +1,982 @@
1
- <template>
2
- <div class="auto" id="userAddress" style="height:80%">
3
- <validator name='v'>
4
- <p class="bg-info text-center" style="padding: 8px;">{{usertype ? '特殊地址管理' : '民用地址管理'}}</p>
5
- <div class="auto select-overspread form-horizontal">
6
- <div class="form-group" v-if="!usertype&&!model.id&&!config.hasnumber">
7
- <input type="radio" id="true" value="one" v-model="onedata">
8
- <label for="true">单户</label>
9
- <input type="radio" id="false" value="more" v-model="onedata">
10
- <label for="false">多户</label>
11
- </div>
12
- <!--单个录入-->
13
- <div v-if="onedata=='one'" class="row">
14
- <div class="col-sm-6 form-group "
15
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']" v-if="!usertype">
16
- <label class="font_normal_body">&emsp;&emsp;&nbsp;省&ensp;市&ensp;区</label>
17
- <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id"
18
- >
19
- <v-select :value.sync="model.f_pcd_id" :value-single="true"
20
- :options='pcdslist' placeholder='请选择'
21
- close-on-select search="true" @change="pcdChange" :disabled="!usertype">
22
- </v-select>
23
- </div>
24
- <div class="col-sm-6 form-group "
25
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']" v-if="usertype">
26
- <label class="font_normal_body">&emsp;&emsp;&nbsp;省&ensp;市&ensp;区</label>
27
- <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id" v-validate:f_pcd_id='{required: true }'
28
- >
29
- <v-select :value.sync="model.f_pcd_id" :value-single="true"
30
- :options='pcdslist' placeholder='请选择'
31
- close-on-select search="true" @change="pcdChange" :disabled="!usertype">
32
- </v-select>
33
- </div>
34
-
35
- <div class="col-sm-6 form-group " v-if="!usertype"
36
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
37
- <label class="font_normal_body">&emsp;&emsp;街道/乡镇</label>
38
- <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id"
39
- >
40
- <v-select :value.sync="model.f_street_id" :value-single="true"
41
- :options='streetslist' placeholder='请选择'
42
- close-on-select search="true" :disabled="!usertype">
43
- </v-select>
44
- </div>
45
- <div class="col-sm-6 form-group " v-if="usertype"
46
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
47
- <label class="font_normal_body">&emsp;&emsp;街道/乡镇</label>
48
- <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id" v-validate:f_street_id='{required: true }'
49
- >
50
- <v-select :value.sync="model.f_street_id" :value-single="true"
51
- :options='streetslist' placeholder='请选择'
52
- @change="streetChange"
53
- close-on-select search="true" :disabled="!usertype">
54
- </v-select>
55
- </div>
56
- <div class="col-sm-6 form-group " :class="[$v.slice_area1.required ? 'has-error' : 'has-success']">
57
- <label class="font_normal_body">&emsp;片区/管理站</label>
58
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
59
- v-validate:slice_area1='{required: true }'>
60
- <v-select :value.sync="model.slice_area[0].name" v-model="model.slice_area[0].name" :value-single="true"
61
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
62
- @change="sliceChange(model.slice_area)"
63
- close-on-select v-ref:slice>
64
- </v-select>
65
- </div>
66
- <div class="col-sm-6 form-group " v-if="!usertype"
67
- :class="[$v.f_residential_area_id1.required ? 'has-error' : 'has-success']">
68
- <label class="font_normal_body">&emsp;&emsp;&nbsp;小区名称</label>
69
- <input type="text" style="width:41%" v-show="false" v-model="model.f_residential_area_id"
70
- v-validate:f_residential_area_id1='{required: true }'>
71
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
72
- :options='areaschoice' placeholder='请选择'
73
- @change="areaChange"
74
- close-on-select search="true">
75
- </v-select>
76
- </div>
77
-
78
- <div class="col-sm-6 form-group " v-if="usertype">
79
- <label class="font_normal_body">&emsp;&emsp;&nbsp;小区名称</label>
80
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
81
- :options='areaschoice' placeholder='请选择'
82
- @change="areaChange"
83
- close-on-select search="true">
84
- </v-select>
85
- </div>
86
-
87
-
88
- <div class="col-sm-6 form-group " v-if="!usertype">
89
- <label class="font_normal_body">&emsp;&emsp;&nbsp;地区类型</label>
90
- <v-select
91
- :value.sync="model.f_iscity" :value-single="true"
92
- :options='iscity' placeholder='请选择'
93
- @change="changecity"
94
- close-on-select>
95
- </v-select>
96
- </div>
97
- <div v-if="!usertype" class="col-sm-6 form-group" :class="[$v.f_building_id.required ? 'has-error' : 'has-success']">
98
- <label class="font_normal_body">&emsp;&emsp;&nbsp;楼&emsp;&emsp;号</label>
99
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.f_building_id.selectedItems" v-validate:f_building_id='{required: true }'>
100
- <v-select :value.sync="model.f_building_id" v-model="model.f_building_id" :value-single="true"
101
- :options='buildingList' placeholder='楼号' close-on-select v-ref:f_building_id>
102
- </v-select>
103
- </div>
104
- <div v-if="!usertype" class="col-sm-6 form-group ">
105
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;单&emsp;&emsp;元</label>
106
- <input type="text" style="width:40%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
107
- <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
108
- />
109
- </div>
110
- <div v-if="!usertype" class="col-sm-6 form-group ">
111
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;楼&emsp;&emsp;层</label>
112
- <input type="text" style="width:40%" v-model="model.f_floor" class="input_search"
113
- placeholder="楼层" />
114
- <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
115
- />
116
- </div>
117
- <div v-if="!usertype" class="col-sm-6 form-group "
118
- :class="[$v.f_room.required ? 'has-error' : 'has-success']">
119
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;门&ensp;牌&ensp;号</label>
120
- <input type="text" style="width:40%" v-model="model.f_room" class="input_search" placeholder="门牌号"
121
- v-validate:f_room='{required: true }'/>
122
- <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
123
- />
124
- </div>
125
- <div class="col-sm-6 form-group">
126
- <label class="font_normal_body">&emsp;&emsp;&nbsp;地址状态</label>
127
- <v-select :value.sync="model.f_address_state" :value-single="true"
128
- class="select_list select"
129
- condition="f_address_state = '{}'"
130
- :options='addresstate' placeholder='地址状态'
131
- close-on-select>
132
- </v-select>
133
- </div>
134
- <div v-if="!usertype" class="col-sm-8 form-group ">
135
- <label class="font_normal_body">&emsp;&emsp;&nbsp;经&ensp;纬&ensp;度</label>
136
- <input type="text" style="width:30%" v-model="model.f_lng" class="input_search" placeholder="经度"/>
137
- <input type="text" style="width:30%" v-model="model.f_lat" class="input_search" placeholder="纬度"/>
138
- &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
139
- </div>
140
-
141
- <div v-if="usertype" class="col-sm-12 form-group "
142
- :class="[$v.f_address.required ? 'has-error' : 'has-success']">
143
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;详细地址</label>
144
- <input type="text" style="width:80%" v-model="model.f_address" class="input_search" placeholder="详细地址"
145
- v-validate:f_address='{required: true }'/>
146
- </div>
147
- <div v-if="usertype" class="col-sm-8 form-group ">
148
- <label class="font_normal_body">&emsp;&emsp;&nbsp;经&ensp;纬&ensp;度</label>
149
- <input type="text" style="width:30%" v-model="model.f_lng" class="input_search" placeholder="经度"/>
150
- <input type="text" style="width:30%" v-model="model.f_lat" class="input_search" placeholder="纬度"/>
151
- &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
152
- </div>
153
- <div class="col-sm-6 form-group " v-if="config.hasnumber"
154
- :class="[$v.f_standard_number.required ? 'has-error' : 'has-success']">
155
- <label class="font_normal_body">&emsp;&emsp;&nbsp;&nbsp;&nbsp;&nbsp;规范号</label>
156
- <input type="text" v-model="model.f_standard_number"
157
- @change="standardyanzheng"
158
- class="input_search" style="width:60%" placeholder="地址规范号"
159
- v-validate:f_standard_number='{required: true }'>
160
- </div>
161
- <div class="col-sm-6 form-group " v-if="config.hasnumber"
162
- :class="[$v.f_contracts_number.required ? 'has-error' : 'has-success']">
163
- <label class="font_normal_body">&emsp;&emsp;&nbsp;&nbsp;&nbsp;&nbsp;合同号</label>
164
- <input type="text" v-model="model.f_contracts_number"
165
- @change="contractsyanzheng"
166
- class="input_search" style="width:60%" placeholder="合同顺序号"
167
- v-validate:f_contracts_number='{required: true }'>
168
- </div>
169
- <div class="col-sm-6 form-group ">
170
- <label class="font_normal_body">&emsp;&emsp;&nbsp;入户证号</label>
171
- <input type="text" v-model="model.f_enter_number"
172
- class="input_search" style="width:60%" placeholder="入户证号">
173
- </div>
174
- <div class="col-sm-12 form-group">
175
- <label class="font_normal_body " >&emsp;&emsp;&nbsp;备&emsp;&emsp;注</label>
176
- <textarea class="input_textarea" rows="3" style="margin-top: 25px; width:80%;height: auto;" v-model="model.f_comments"></textarea>
177
- </div>
178
- <div style="text-align:right;margin-top:40px;margin-right:50px;" class="col-sm-12">
179
- <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
180
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
181
- </div>
182
-
183
- </div>
184
- <!--批量录入-->
185
- <div v-if="onedata=='more'" class="row">
186
- <div class="col-sm-6 form-group "
187
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
188
- <label class="font_normal_body">&emsp;&emsp;&nbsp;省&ensp;市&ensp;区</label>
189
- <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
190
- >
191
- <v-select :value.sync="model.f_pcd_id" :value-single="true"
192
- :options='pcdslist' placeholder='请选择'
193
- close-on-select search="true" @change="pcdChange" :disabled="!usertype">
194
- </v-select>
195
- </div>
196
- <div class="col-sm-6 form-group "
197
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
198
- <label class="font_normal_body">&emsp;&emsp;&nbsp;街&emsp;&emsp;道</label>
199
- <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
200
- >
201
- <v-select :value.sync="model.f_street_id" :value-single="true"
202
- :options='streetslist' placeholder='请选择'
203
- close-on-select search="true" :disabled="!usertype">
204
- </v-select>
205
- </div>
206
- <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
207
- <label class="font_normal_body">片区/管理站</label>
208
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
209
- v-validate:slice='{required: true }'>
210
- <v-select :value.sync="model.slice_area[0].name" v-model="model.slice_area[0].name" :value-single="true"
211
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
212
- @change="sliceChange(model.slice_area)"
213
- close-on-select v-ref:slice>
214
- </v-select>
215
- </div>
216
- <div class="col-sm-6 form-group "
217
- :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
218
- <label class="font_normal_body">&emsp;&emsp;&nbsp;小区名称</label>
219
- <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
220
- v-validate:f_residential_area_id='{required: true }'>
221
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
222
- @change="areaChange"
223
- :options='areaschoice' placeholder='请选择'
224
- close-on-select search="true">
225
- </v-select>
226
- </div>
227
-
228
-
229
- <div class="col-sm-6 form-group "
230
- :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
231
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始楼号</label>
232
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
233
- <input type="text" style="width:25%"
234
- v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
235
- v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
236
- <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"/>
237
- </div>
238
- <div class="col-sm-6 form-group "
239
- :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
240
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止楼号</label>
241
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
242
- <input type="text" style="width:25%"
243
- v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
244
- v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
245
- <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
246
- />
247
- </div>
248
- <div class="col-sm-6 form-group "
249
- :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
250
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始单元</label>
251
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
252
- <input type="text" style="width:25%"
253
- v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
254
- v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
255
- <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search" />
256
- </div>
257
- <div class="col-sm-6 form-group "
258
- :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
259
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止单元</label>
260
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
261
- <input type="text" style="width:25%"
262
- v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
263
- v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
264
- <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"/>
265
- </div>
266
- <div class="col-sm-6 form-group "
267
- :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
268
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始楼层</label>
269
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
270
- <input type="text" style="width:25%"
271
- v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
272
- v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
273
- <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
274
- </div>
275
- <div class="col-sm-6 form-group "
276
- :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']">
277
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止楼层</label>
278
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
279
- <input type="text" style="width:25%" v-model="model.f_floor_end"
280
- v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
281
- class="input_search" placeholder="楼层"/>
282
- <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
283
- </div>
284
- <div class="col-sm-6 form-group "
285
- :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
286
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始门牌</label>
287
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
288
- <input type="text" style="width:25%" v-model="model.f_room_start"
289
- class="input_search" placeholder="门牌号"
290
- v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
291
- />
292
- <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
293
- </div>
294
- <div class="col-sm-6 form-group "
295
- :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
296
- <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止门牌</label>
297
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
298
- <input type="text" style="width:25%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
299
- v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
300
- <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
301
- </div>
302
- <div class="col-sm-6 form-group">
303
- <label class="font_normal_body">&emsp;&emsp;&nbsp;地址状态</label>
304
- <v-select :value.sync="model.f_address_state" :value-single="true"
305
- class="select_list select"
306
- condition="f_address_state = '{}'"
307
- :options='addresstate' placeholder='地址状态'
308
- close-on-select>
309
- </v-select>
310
- </div>
311
- <div class="col-sm-10 form-group ">
312
- <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
313
- </div>
314
- <div class="col-sm-12 form-group">
315
- <label class="font_normal_body " style="margin-top:-20px">&emsp;&emsp;&nbsp;备&emsp;&emsp;注</label>
316
- <textarea class="input_textarea" rows="3" style="width:80%;height: auto;" v-model="model.f_comments"></textarea>
317
- </div>
318
- <div class="row">
319
- <div style="text-align:right;margin-top:20px;margin-right:50px;" class="col-sm-12">
320
- <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
321
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
322
- </div>
323
- </div>
324
- </div>
325
- </div>
326
- </validator>
327
-
328
- <modal :show.sync="isshow" large backdrop="false" :width="900">
329
- <header slot="modal-header" class="modal-header">
330
- </header>
331
- <article slot="modal-body" class="modal-body">
332
- <amap-location :islocationclearmark="false" dom="addboxmap" v-ref:positionInfo @getmylocation="getmylocation"></amap-location>
333
- </article>
334
- <footer slot="modal-footer" class="modal-footer">
335
- <button v-show="isshow" type="button" class="button_search button_spacing" @click='confirmLocation'>确认</button>
336
- <button v-show="isshow" type="button" class="button_clear button_spacing" @click='closeModal'>取消</button>
337
- </footer>
338
- </modal>
339
-
340
- </div>
341
- </template>
342
-
343
- <script>
344
- import {HttpResetClass} from 'vue-client'
345
-
346
-
347
- let getAreaConfig = async function (self) {
348
- // 获取气价里面的配置
349
- await self.$getConfig(self, 'UserAddress')
350
- console.log('原地址配置',self.config)
351
- console.log('获取地址配置',self.config)
352
- Object.assign(self.model, self.config)
353
- }
354
-
355
- export default {
356
- title: '用户地址添加',
357
- data () {
358
- return {
359
- //模态框是否显示
360
- isshow: false,
361
- //接收位置
362
- templng: '', //临时经度
363
- templat: '' , //临时纬度
364
-
365
- //初始化省市区数据
366
- pcdslist:[],
367
- //初始化街道数据
368
- streetslist:[],
369
- //初始化街道数据
370
- areaslist:[],
371
- areaschoice:[],
372
- // 楼栋数据
373
- buildingList: [],
374
- iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'},{label:'全部',value:''}],
375
- config:{
376
- hasnumber:false,
377
- f_building_suffix: '号楼',
378
- f_unit_suffix: '单元',
379
- f_floor_suffix: '',
380
- f_room_suffix: '室'
381
- },
382
- model: {
383
- f_pcd_id: '',
384
- f_street_id: '',
385
- f_comments:'',
386
- f_residential_area_id: '',
387
- f_pcd: '',
388
- f_street: '',
389
- f_residential_area: '',
390
- f_slice_area: '',
391
- slice_area:'',
392
- f_building: '',
393
- f_building_start: '',
394
- f_building_end: '',
395
- f_building_suffix: '',
396
- f_unit: '',
397
- f_unit_start: '',
398
- f_unit_end: '',
399
- f_unit_suffix: '',
400
- f_floor: '',
401
- f_floor_start: '',
402
- f_floor_end: '',
403
- f_floor_suffix: '',
404
- f_room: '',
405
- f_room_start: '',
406
- f_room_end: '',
407
- f_room_suffix: '',
408
- //详细地址
409
- f_address: '',
410
- //单位名称
411
- f_company: '',
412
- //单位地址
413
- f_company_address: '',
414
- f_lng: '', //经度
415
- f_lat: '', //纬度
416
- f_enter_number: '' //入户证号
417
- },
418
- //判读是否为单个数据录入
419
- onedata: 'one',
420
- //选中所有地址
421
- addresslist: [],
422
- usertype:false,
423
-
424
- // 公司信息
425
- curorgid: [this.$login.f.orgid],
426
-
427
- f_orgid: '',
428
-
429
- sliceArea: []
430
- }
431
- },
432
- props: ['f_filialeids', 'row','operation','usertype'],
433
- async ready(){
434
- this.initdata()
435
- getAreaConfig(this)
436
- this.model.f_building_suffix=this.config.f_building_suffix
437
- this.model.f_unit_suffix=this.config.f_unit_suffix
438
- this.model.f_floor_suffix=this.config.f_floor_suffix
439
- this.model.f_room_suffix=this.config.f_room_suffix
440
- },
441
- methods: {
442
- async sliceChange(slice){
443
- this.areaschoice=[]
444
- if(slice){
445
- this.areaslist.forEach((item)=>{
446
- if(item.data.f_slice_area==slice[0].name){
447
- this.areaschoice.push(item)
448
- }
449
- })
450
- }else{
451
- this.areaslist.forEach((item)=>{
452
- this.areaschoice.push(item)
453
- })
454
- }
455
- },
456
- async changecity(){
457
- this.areaslist = []
458
- // this.model.f_residential_area_id = null
459
- // this.model.f_residential_area = null
460
- let condition = `isnull(f_iscity,'') = isnull('${this.model.f_iscity}','') and a.f_orgid = '${this.f_filialeids}'`
461
- let req = await this.$resetpost('rs/sql/address_getresidential', {
462
- data: {
463
- condition: condition
464
- }
465
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
466
- let redata = []
467
- req.data.forEach((row) => {
468
- redata.push({
469
- label: '['+row.f_street+']'+row.f_residential_area,
470
- value: row.id,
471
- data: row,
472
- id: row.id
473
- })
474
- })
475
- this.areaslist=redata
476
- },
477
- standardyanzheng() {
478
- console.log(this.model.f_standard_number.length)
479
- if (this.model.f_standard_number.length != 2){
480
- this.$showAlert('请输入正确的位数', 'warning', 2000)
481
- this.model.f_standard_number = ''
482
- }
483
- },
484
- contractsyanzheng(){
485
- console.log(this.model.f_contracts_number.length)
486
- if (this.model.f_contracts_number.length != 5){
487
- this.$showAlert('请输入正确的位数', 'warning', 2000)
488
- this.model.f_contracts_number = ''
489
- }
490
- },
491
- async initdata(){
492
- this.model.f_address_state = '已通气'
493
- this.initAreas(this.f_filialeids)
494
- // 添加特殊地址选省市区
495
- this.initpcds(` f_orgid = '${this.f_filialeids}'`)
496
- this.initstreets(` f_orgid = '${this.f_filialeids}' `)
497
- await this.initareas(` f_orgid = '${this.f_filialeids}'`)
498
- this.areaslist.forEach((item)=>{
499
- this.areaschoice.push(item)
500
- })
501
- },
502
-
503
- // 初始化片区
504
- async initAreas (val) {
505
- if (val) {
506
- let HttpReset = new HttpResetClass()
507
- let getAllArea = await HttpReset.load('POST','/rs/search', {
508
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
509
- userid: this.$login.f.id
510
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
511
- let arr = getAllArea.data.filter((res) => {
512
- return res.parentid == val
513
- })
514
- console.log('过滤之后的片区', arr)
515
- this.sliceArea = []
516
- arr.forEach((res) => {
517
- this.sliceArea.push({label: res.name, value: res.name})
518
- })
519
- }
520
- },
521
- //初始化省市区,添加街道
522
- async initpcds(pconditon){
523
- this.pcdslist = []
524
- let HttpReset = new HttpResetClass()
525
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
526
- data: {
527
- items: '*',
528
- tablename: 't_pcd',
529
- orderitem: 'id',
530
- condition: pconditon
531
- }
532
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
533
- let redata = []
534
- req.data.forEach((row, n) => {
535
- redata[n] = {
536
- label: row.f_pcd,
537
- value: row.id,
538
- data:row,
539
- id:row.id
540
- }
541
- })
542
- this.pcdslist=redata
543
- },
544
- //初始化街道 添加小区
545
- async initstreets(pconditon){
546
- this.streetslist = []
547
- let HttpReset = new HttpResetClass()
548
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
549
- data: {
550
- items: '*',
551
- tablename: 't_street',
552
- orderitem: 'id',
553
- condition: pconditon
554
- }
555
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
556
- let redata = []
557
- req.data.forEach((row, n) => {
558
- redata[n] = {
559
- label: row.f_street,
560
- value: row.id,
561
- data:row,
562
- id:row.id
563
- }
564
- })
565
- this.streetslist=redata
566
- },
567
- //初始化小区添加小区
568
- async initareas(pconditon){
569
- // if(this.usertype){
570
- // pconditon=pconditon+` and f_special='1' `
571
- // }
572
- this.areaslist = []
573
- let HttpReset = new HttpResetClass()
574
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
575
- data: {
576
- items: '*',
577
- tablename: 't_area',
578
- orderitem: 'id',
579
- condition: pconditon
580
- }
581
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
582
- let redata = []
583
- req.data.forEach((row) => {
584
- redata.push({
585
- label: '['+row.f_street+']'+row.f_residential_area,
586
- value: row.id,
587
- data: row,
588
- id: row.id
589
- })
590
- })
591
- this.areaslist=redata
592
- },
593
- // 根据选择小区查询楼栋
594
- async getbuildingList(pconditon){
595
- this.buildingList = []
596
- let HttpReset = new HttpResetClass()
597
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
598
- data: {
599
- items: '*',
600
- tablename: 't_building',
601
- orderitem: 'id',
602
- condition: pconditon
603
- }
604
- }, {resolveMsg: null, rejectMsg: '获取楼栋失败!'})
605
- let redata = []
606
- req.data.forEach((row) => {
607
- redata.push({
608
- label: row.f_building,
609
- value: row.id,
610
- data: row,
611
- id: row.id
612
- })
613
- })
614
- this.buildingList=redata
615
- },
616
- //省/市/区变化
617
- async pcdChange(val){
618
- // 只有添加特殊地址时才级联
619
- if (!this.usertype) {
620
- return
621
- }
622
- console.log("省/市/区变化",val)
623
- if(val){
624
- //那就把[小区,街道]重新组织一下
625
- await this.initstreets(` f_pcd_id ='${val}' `)
626
- if(this.model.f_street_id){
627
- if (this.findbyid(this.streetslist,this.model.f_street_id)) {
628
- let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
629
- if(pcd_id!=val){
630
- this.model.f_street_id=''
631
- }
632
- } else {
633
- this.model.f_street_id=''
634
- }
635
-
636
- //那就把[小区,街道]重新组织一下
637
- if (this.model.f_street_id) {
638
- await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
639
- if(this.model.f_residential_area_id){
640
- if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
641
- let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
642
- if(pcd_id!=val){
643
- this.model.f_residential_area_id=''
644
- }
645
- } else {
646
- this.model.f_residential_area_id=''
647
- }
648
-
649
- }
650
- }
651
- }
652
- }
653
- this.$resetValidation()
654
- },
655
- //小区变化
656
- areaChange(val){
657
- console.log("小区变化",val)
658
- // 选择小区后级联出省市区和街道
659
- let selectArea // 选中的小区数据
660
- for (let row of this.areaslist) {
661
- if (val == row.value) {
662
- selectArea = row.data
663
- break
664
- }
665
- }
666
- if (selectArea) {
667
- this.model.f_street_id = selectArea.f_street_id
668
- this.model.f_pcd_id = selectArea.f_pcd_id
669
- this.initstreets(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_street_id}' `)
670
- this.initpcds(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_pcd_id}' `)
671
- // this.model.slice_area = selectArea.f_slice_area
672
- // 拼接地址
673
- this.model.f_address = `${selectArea.f_street}${selectArea.f_residential_area}`
674
- this.getbuildingList(`f_filialeid = '${this.f_filialeids}' and f_residential_area_id ='${selectArea.id}'`)
675
- }
676
- this.$nextTick(() => {
677
- this.$resetValidation()
678
- })
679
- },
680
- //街道变化
681
- async streetChange(val){
682
- console.log("街道变化",val)
683
- if(this.streetslist[0]) {
684
- var street=''
685
- this.streetslist.forEach((item)=>{
686
- if(item.id===val){
687
- street=item.label
688
- }
689
- })
690
- this.model.f_address = street
691
- }
692
- if(val){
693
- //那就把[小区]重新组织一下
694
- await this.initareas(` f_street_id ='${val}' `)
695
- if(this.model.f_residential_area_id){
696
- if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
697
- let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
698
- if(street_id!=val){
699
- this.model.f_residential_area_id=''
700
- }
701
- } else {
702
- this.model.f_residential_area_id=''
703
- }
704
-
705
- }
706
- }
707
- this.$resetValidation()
708
- },
709
-
710
- getorg (val) {
711
- this.f_orgid = val[0]
712
- },
713
-
714
- //处理批量地址信息
715
- dealaddlist(){
716
- try {
717
- var resultlist=[]
718
- for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
719
- for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
720
- for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
721
- for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
722
- //预备一个空的json
723
- console.log('批量', this.model)
724
- let data=Object.assign({},this.model)
725
- data.f_create_person= this.$login.f.name
726
- if ((i+'').length == 1) {
727
- data.f_building= data.f_building_prefix + '0' +i
728
- } else {
729
- data.f_building= data.f_building_prefix + '' +i
730
- }
731
- if ((j+'').length == 1) {
732
- data.f_unit= data.f_unit_prefix + '0'+j
733
- } else {
734
- data.f_unit= data.f_unit_prefix +''+ j
735
- }
736
- if ((m+'').length == 1) {
737
- data.f_floor= data.f_floor_prefix +'0'+ m
738
- } else {
739
- data.f_floor= data.f_floor_prefix +''+ m
740
- }
741
- // 目前房号都按两位处理 如: 101室 201室 110室
742
- if ((n+'').length == 1) {
743
- data.f_room = data.f_room_prefix + m + '0' + n
744
- } else {
745
- data.f_room = data.f_room_prefix + m + '' + n
746
- }
747
- data.f_filialeid = this.f_filialeids
748
- data.f_operator = this.$login.f.name
749
- data.f_operatorid = this.$login.f.id
750
- data.f_orgid = this.$login.f.orgid
751
- data.f_orgname = this.$login.f.orgs
752
- data.f_depid = this.$login.f.depids
753
- data.f_depname = this.$login.f.deps
754
- data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
755
- data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
756
- data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
757
- data.f_address = data.f_street
758
- + data.f_residential_area +
759
- data.f_building + data.f_building_suffix
760
- + data.f_unit + data.f_unit_suffix
761
- + data.f_floor + data.f_floor_suffix
762
- + data.f_room + data.f_room_suffix
763
- data.f_slice_area = data.slice_area[0]?data.slice_area[0].name:data.slice_area
764
-
765
- resultlist.push(data)
766
- }
767
- }
768
- }
769
- }
770
- this.addresslist=resultlist
771
- } catch (e) {
772
- console.log(e)
773
- this.$showAlert('输出数据有误,请检查', 'warning', 2000)
774
- }
775
- },
776
- //保存多个
777
- async confirmall(){
778
- this.dealaddlist()
779
- if(this.addresslist.length>0){
780
- let msg = {
781
- resolveMsg: '地址保存成功',
782
- rejectMsg: '地址保存失败'
783
- }
784
- this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
785
- if (res === 'confirm') {
786
- this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
787
- this.cleardara()
788
- this.$dispatch('confirm')
789
- })
790
- }
791
- })
792
- }
793
- },
794
- //保存
795
- async confirm(){
796
- if(this.onedata=='one'){
797
- await this.saveonedata()
798
- }
799
- this.cleardara()
800
- this.$dispatch('confirm')
801
- },
802
- //保存一户信息
803
- async saveonedata(){
804
- this.model.f_create_person= this.$login.f.name
805
- this.model.f_filialeid = this.f_filialeids
806
- this.model.f_operator = this.$login.f.name
807
- this.model.f_operatorid = this.$login.f.id
808
- this.model.f_orgid = this.$login.f.orgid
809
- this.model.f_orgname = this.$login.f.orgs
810
- this.model.f_depid = this.$login.f.depids
811
- this.model.f_depname = this.$login.f.deps
812
- console.log("片区:",this.model.slice_area)
813
- if (this.model.slice_area ) {
814
- if (this.model.slice_area instanceof Array) {
815
- console.log("修改",this.model.slice_area)
816
- this.model.f_slice_area = this.model.slice_area[0].name
817
- } if (this.model.slice_area instanceof Object) {
818
- console.log("修改",this.model.slice_area)
819
- this.model.f_slice_area = Object.values(this.model.slice_area)[0].name
820
- } else{
821
- console.log("保存",this.model.slice_area)
822
- this.model.f_slice_area = this.model.slice_area
823
- }
824
- }
825
- if (( this.model.f_unit+'').length == 1) {
826
- this.model.f_unit= '0'+ this.model.f_unit
827
- }
828
- if (( this.model.f_floor+'').length == 1) {
829
- this.model.f_floor= '0'+ this.model.f_floor
830
- }
831
- if (( this.model.f_room+'').length == 1) {
832
- this.model.f_room= '0'+ this.model.f_room
833
- }
834
- if (this.usertype) {
835
- //非民用
836
- this.model.f_special='1'
837
- this.model.f_building_suffix=''
838
- this.model.f_unit_suffix=''
839
- this.model.f_floor_suffix=''
840
- this.model.f_room_suffix=''
841
- this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
842
- this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
843
- this.model.f_residential_area = this.findbyid(this.areaslist,this.model.f_residential_area_id) ? this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area : ''
844
- } else {
845
- //民用
846
- this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
847
- this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
848
- this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
849
- if (( this.$refs.f_building_id.selectedItems+'').length == 1) {
850
- this.model.f_building= '0'+ this.$refs.f_building_id.selectedItems
851
- }else{
852
- this.model.f_building = this.$refs.f_building_id.selectedItems
853
- }
854
- this.model.f_building_suffix=''
855
- if (!this.model.f_building) {
856
- this.$showMessage('请选择楼栋数据!!!')
857
- return
858
- }
859
- this.model.f_address = this.model.f_street + this.model.f_residential_area + (this.model.f_building?this.model.f_building +this.model.f_building_suffix:'') + (this.model.f_unit?this.model.f_unit +this.model.f_unit_suffix:'') + (this.model.f_floor?this.model.f_floor +this.model.f_floor_suffix:'') + this.model.f_room + this.model.f_room_suffix
860
- }
861
- await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
862
- },
863
- cancel(){
864
- this.cleardara()
865
- this.$dispatch('cancel')
866
- },
867
- cleardara(){
868
- this.model= {
869
- f_pcd_id: '',
870
- f_street_id: '',
871
- f_iscity:'市区',
872
- f_residential_area_id: '',
873
- f_pcd: '',
874
- f_comments:'',
875
- f_street: '',
876
- f_residential_area: '',
877
- f_slice_area: '',
878
- slice_area: '',
879
- f_building: '',
880
- f_building_start: '',
881
- f_building_end: '',
882
- f_building_prefix: '',
883
- f_building_suffix: this.config.f_building_suffix,
884
- f_unit: '',
885
- f_unit_start: '',
886
- f_unit_end: '',
887
- f_unit_prefix: '',
888
- f_unit_suffix: this.config.f_unit_suffix,
889
- f_floor: '',
890
- f_floor_start: '',
891
- f_floor_end: '',
892
- f_floor_prefix: '',
893
- f_floor_suffix: this.config.f_floor_suffix,
894
- f_room: '',
895
- f_room_start: '',
896
- f_room_end: '',
897
- f_room_prefix: '',
898
- f_room_suffix: this.config.f_room_suffix,
899
- //详细地址
900
- f_address: '',
901
- //单位名称
902
- f_company: '',
903
- //单位地址
904
- f_company_address: '',
905
- f_lng: '',
906
- f_lat: '',
907
- f_enter_number: ''
908
- }
909
- // this.pcdslist = []
910
- // this.streetslist = []
911
- // this.areaslist = []
912
- },
913
-
914
- //根据名字找数据
915
- findbyid(list,name){
916
- var result
917
- list.forEach((row, n) => {
918
- if(name==row.value){
919
- result= row.data
920
- }
921
- })
922
- return result
923
- },
924
- openModal () {
925
- this.isshow = true
926
- },
927
- closeModal () {
928
- this.isshow = false;
929
- },
930
- getmylocation (res) {
931
- this.templng = res.position.lng
932
- this.templat = res.position.lat
933
- },
934
- confirmLocation () {
935
- this.model.f_lat = this.templat
936
- this.model.f_lng = this.templng
937
- this.isshow = false
938
- }
939
- },
940
- watch: {
941
- //分公司变化
942
- 'f_filialeids'(){
943
- if (this.model.f_filialeid) {
944
- if (this.model.f_filialeid != this.f_filialeids) {
945
- this.$dispatch('cancel')
946
- }
947
- }
948
- this.cleardara()
949
- this.initdata()
950
- },
951
- 'row'(){
952
- this.onedata='one'
953
- },
954
- 'model.id' () {
955
- this.getbuildingList(`f_filialeid = '${this.f_filialeids}' and f_residential_area_id ='${this.model.f_residential_area_id}'`)
956
- }
957
- },
958
- computed: {
959
- //地址状态下拉框
960
- addresstate() {
961
- return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
962
- }
963
- }
964
- }
965
- </script>
966
- <style lang="less">
967
- #userAddress{
968
- #addboxmap {
969
- height: 300px;
970
- }
971
- .glyphicon:hover {
972
- color: red;
973
- }
974
- .glyphicon {
975
- color: blue;
976
- cursor: pointer;
977
- }
978
- }
979
- </style>
980
-
981
-
982
-
983
-
1
+ <template>
2
+ <div class="auto" id="userAddress" style="height:80%">
3
+ <validator name='v'>
4
+ <p class="bg-info text-center" style="padding: 8px;">{{usertype ? '特殊地址管理' : '民用地址管理'}}</p>
5
+ <div class="auto select-overspread form-horizontal">
6
+ <div class="form-group" v-if="!usertype&&!model.id&&!config.hasnumber">
7
+ <input type="radio" id="true" value="one" v-model="onedata">
8
+ <label for="true">单户</label>
9
+ <input type="radio" id="false" value="more" v-model="onedata">
10
+ <label for="false">多户</label>
11
+ </div>
12
+ <!--单个录入-->
13
+ <div v-if="onedata=='one'" class="row">
14
+ <div class="col-sm-6 form-group "
15
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']" v-if="!usertype">
16
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;省&ensp;市&ensp;区</label>
17
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id"
18
+ >
19
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
20
+ :options='pcdslist' placeholder='请选择'
21
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
22
+ </v-select>
23
+ </div>
24
+ <div class="col-sm-6 form-group "
25
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']" v-if="usertype">
26
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;省&ensp;市&ensp;区</label>
27
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id" v-validate:f_pcd_id='{required: true }'
28
+ >
29
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
30
+ :options='pcdslist' placeholder='请选择'
31
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
32
+ </v-select>
33
+ </div>
34
+
35
+ <div class="col-sm-6 form-group " v-if="!usertype"
36
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
37
+ <label class="font_normal_body">&emsp;&emsp;街道/乡镇</label>
38
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id"
39
+ >
40
+ <v-select :value.sync="model.f_street_id" :value-single="true"
41
+ :options='streetslist' placeholder='请选择'
42
+ close-on-select search="true" :disabled="!usertype">
43
+ </v-select>
44
+ </div>
45
+ <div class="col-sm-6 form-group " v-if="usertype"
46
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
47
+ <label class="font_normal_body">&emsp;&emsp;街道/乡镇</label>
48
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id" v-validate:f_street_id='{required: true }'
49
+ >
50
+ <v-select :value.sync="model.f_street_id" :value-single="true"
51
+ :options='streetslist' placeholder='请选择'
52
+ @change="streetChange"
53
+ close-on-select search="true" :disabled="!usertype">
54
+ </v-select>
55
+ </div>
56
+ <div class="col-sm-6 form-group " :class="[$v.slice_area1.required ? 'has-error' : 'has-success']">
57
+ <label class="font_normal_body">&emsp;片区/管理站</label>
58
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
59
+ v-validate:slice_area1='{required: true }'>
60
+ <v-select :value.sync="model.slice_area" v-model="model.slice_area" :value-single="true"
61
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
62
+ close-on-select v-ref:slice>
63
+ </v-select>
64
+ </div>
65
+ <div class="col-sm-6 form-group " v-if="!usertype"
66
+ :class="[$v.f_residential_area_id1.required ? 'has-error' : 'has-success']">
67
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;小区名称</label>
68
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_residential_area_id"
69
+ v-validate:f_residential_area_id1='{required: true }'>
70
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
71
+ :options='areaschoice' placeholder='请选择'
72
+ @change="areaChange"
73
+ close-on-select search="true">
74
+ </v-select>
75
+ </div>
76
+
77
+ <div class="col-sm-6 form-group " v-if="usertype">
78
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;小区名称</label>
79
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
80
+ :options='areaschoice' placeholder='请选择'
81
+ @change="areaChange"
82
+ close-on-select search="true">
83
+ </v-select>
84
+ </div>
85
+
86
+
87
+ <div class="col-sm-6 form-group " v-if="!usertype">
88
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;地区类型</label>
89
+ <v-select
90
+ :value.sync="model.f_iscity" :value-single="true"
91
+ :options='iscity' placeholder='请选择'
92
+ @change="changecity"
93
+ close-on-select>
94
+ </v-select>
95
+ </div>
96
+ <div v-if="!usertype" class="col-sm-6 form-group" :class="[$v.f_building_id.required ? 'has-error' : 'has-success']">
97
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;楼&emsp;&emsp;号</label>
98
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.f_building_id.selectedItems" v-validate:f_building_id='{required: true }'>
99
+ <v-select :value.sync="model.f_building_id" v-model="model.f_building_id" :value-single="true"
100
+ :options='buildingList' placeholder='楼号' close-on-select v-ref:f_building_id>
101
+ </v-select>
102
+ </div>
103
+ <div v-if="!usertype" class="col-sm-6 form-group ">
104
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;单&emsp;&emsp;元</label>
105
+ <input type="text" style="width:40%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
106
+ <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
107
+ />
108
+ </div>
109
+ <div v-if="!usertype" class="col-sm-6 form-group ">
110
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;楼&emsp;&emsp;层</label>
111
+ <input type="text" style="width:40%" v-model="model.f_floor" class="input_search"
112
+ placeholder="楼层" />
113
+ <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
114
+ />
115
+ </div>
116
+ <div v-if="!usertype" class="col-sm-6 form-group "
117
+ :class="[$v.f_room.required ? 'has-error' : 'has-success']">
118
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;门&ensp;牌&ensp;号</label>
119
+ <input type="text" style="width:40%" v-model="model.f_room" class="input_search" placeholder="门牌号"
120
+ v-validate:f_room='{required: true }'/>
121
+ <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
122
+ />
123
+ </div>
124
+ <div class="col-sm-6 form-group">
125
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;地址状态</label>
126
+ <v-select :value.sync="model.f_address_state" :value-single="true"
127
+ class="select_list select"
128
+ condition="f_address_state = '{}'"
129
+ :options='addresstate' placeholder='地址状态'
130
+ close-on-select>
131
+ </v-select>
132
+ </div>
133
+ <div v-if="!usertype" class="col-sm-8 form-group ">
134
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;经&ensp;纬&ensp;度</label>
135
+ <input type="text" style="width:30%" v-model="model.f_lng" class="input_search" placeholder="经度"/>
136
+ <input type="text" style="width:30%" v-model="model.f_lat" class="input_search" placeholder="纬度"/>
137
+ &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
138
+ </div>
139
+
140
+ <div v-if="usertype" class="col-sm-12 form-group "
141
+ :class="[$v.f_address.required ? 'has-error' : 'has-success']">
142
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;详细地址</label>
143
+ <input type="text" style="width:80%" v-model="model.f_address" class="input_search" placeholder="详细地址"
144
+ v-validate:f_address='{required: true }'/>
145
+ </div>
146
+ <div v-if="usertype" class="col-sm-8 form-group ">
147
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;经&ensp;纬&ensp;度</label>
148
+ <input type="text" style="width:30%" v-model="model.f_lng" class="input_search" placeholder="经度"/>
149
+ <input type="text" style="width:30%" v-model="model.f_lat" class="input_search" placeholder="纬度"/>
150
+ &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
151
+ </div>
152
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
153
+ :class="[$v.f_standard_number.required ? 'has-error' : 'has-success']">
154
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;&nbsp;&nbsp;&nbsp;规范号</label>
155
+ <input type="text" v-model="model.f_standard_number"
156
+ @change="standardyanzheng"
157
+ class="input_search" style="width:60%" placeholder="地址规范号"
158
+ v-validate:f_standard_number='{required: true }'>
159
+ </div>
160
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
161
+ :class="[$v.f_contracts_number.required ? 'has-error' : 'has-success']">
162
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;&nbsp;&nbsp;&nbsp;合同号</label>
163
+ <input type="text" v-model="model.f_contracts_number"
164
+ @change="contractsyanzheng"
165
+ class="input_search" style="width:60%" placeholder="合同顺序号"
166
+ v-validate:f_contracts_number='{required: true }'>
167
+ </div>
168
+ <div class="col-sm-6 form-group ">
169
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;入户证号</label>
170
+ <input type="text" v-model="model.f_enter_number"
171
+ class="input_search" style="width:60%" placeholder="入户证号">
172
+ </div>
173
+ <div class="col-sm-12 form-group">
174
+ <label class="font_normal_body " >&emsp;&emsp;&nbsp;备&emsp;&emsp;注</label>
175
+ <textarea class="input_textarea" rows="3" style="margin-top: 25px; width:80%;height: auto;" v-model="model.f_comments"></textarea>
176
+ </div>
177
+ <div style="text-align:right;margin-top:40px;margin-right:50px;" class="col-sm-12">
178
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
179
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
180
+ </div>
181
+
182
+ </div>
183
+ <!--批量录入-->
184
+ <div v-if="onedata=='more'" class="row">
185
+ <div class="col-sm-6 form-group "
186
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
187
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;省&ensp;市&ensp;区</label>
188
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
189
+ >
190
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
191
+ :options='pcdslist' placeholder='请选择'
192
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
193
+ </v-select>
194
+ </div>
195
+ <div class="col-sm-6 form-group "
196
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
197
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;街&emsp;&emsp;道</label>
198
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
199
+ >
200
+ <v-select :value.sync="model.f_street_id" :value-single="true"
201
+ :options='streetslist' placeholder='请选择'
202
+ close-on-select search="true" :disabled="!usertype">
203
+ </v-select>
204
+ </div>
205
+ <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
206
+ <label class="font_normal_body">片区/管理站</label>
207
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
208
+ v-validate:slice='{required: true }'>
209
+ <v-select :value.sync="model.slice_area" v-model="model.slice_area" :value-single="true"
210
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
211
+
212
+ close-on-select v-ref:slice>
213
+ </v-select>
214
+ </div>
215
+ <div class="col-sm-6 form-group "
216
+ :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
217
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;小区名称</label>
218
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
219
+ v-validate:f_residential_area_id='{required: true }'>
220
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
221
+ @change="areaChange"
222
+ :options='areaschoice' placeholder='请选择'
223
+ close-on-select search="true">
224
+ </v-select>
225
+ </div>
226
+
227
+
228
+ <div class="col-sm-6 form-group "
229
+ :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
230
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始楼号</label>
231
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
232
+ <input type="text" style="width:25%"
233
+ v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
234
+ v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
235
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"/>
236
+ </div>
237
+ <div class="col-sm-6 form-group "
238
+ :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
239
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止楼号</label>
240
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
241
+ <input type="text" style="width:25%"
242
+ v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
243
+ v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
244
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
245
+ />
246
+ </div>
247
+ <div class="col-sm-6 form-group "
248
+ :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
249
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始单元</label>
250
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
251
+ <input type="text" style="width:25%"
252
+ v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
253
+ v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
254
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search" />
255
+ </div>
256
+ <div class="col-sm-6 form-group "
257
+ :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
258
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止单元</label>
259
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
260
+ <input type="text" style="width:25%"
261
+ v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
262
+ v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
263
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"/>
264
+ </div>
265
+ <div class="col-sm-6 form-group "
266
+ :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
267
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始楼层</label>
268
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
269
+ <input type="text" style="width:25%"
270
+ v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
271
+ v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
272
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
273
+ </div>
274
+ <div class="col-sm-6 form-group "
275
+ :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']">
276
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止楼层</label>
277
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
278
+ <input type="text" style="width:25%" v-model="model.f_floor_end"
279
+ v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
280
+ class="input_search" placeholder="楼层"/>
281
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
282
+ </div>
283
+ <div class="col-sm-6 form-group "
284
+ :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
285
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;起始门牌</label>
286
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
287
+ <input type="text" style="width:25%" v-model="model.f_room_start"
288
+ class="input_search" placeholder="门牌号"
289
+ v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
290
+ />
291
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
292
+ </div>
293
+ <div class="col-sm-6 form-group "
294
+ :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
295
+ <label for="f_address" class="font_normal_body">&emsp;&emsp;&nbsp;截止门牌</label>
296
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
297
+ <input type="text" style="width:25%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
298
+ v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
299
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
300
+ </div>
301
+ <div class="col-sm-6 form-group">
302
+ <label class="font_normal_body">&emsp;&emsp;&nbsp;地址状态</label>
303
+ <v-select :value.sync="model.f_address_state" :value-single="true"
304
+ class="select_list select"
305
+ condition="f_address_state = '{}'"
306
+ :options='addresstate' placeholder='地址状态'
307
+ close-on-select>
308
+ </v-select>
309
+ </div>
310
+ <div class="col-sm-10 form-group ">
311
+ <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
312
+ </div>
313
+ <div class="col-sm-12 form-group">
314
+ <label class="font_normal_body " style="margin-top:-20px">&emsp;&emsp;&nbsp;备&emsp;&emsp;注</label>
315
+ <textarea class="input_textarea" rows="3" style="width:80%;height: auto;" v-model="model.f_comments"></textarea>
316
+ </div>
317
+ <div class="row">
318
+ <div style="text-align:right;margin-top:20px;margin-right:50px;" class="col-sm-12">
319
+ <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
320
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ </div>
325
+ </validator>
326
+
327
+ <modal :show.sync="isshow" large backdrop="false" :width="900">
328
+ <header slot="modal-header" class="modal-header">
329
+ </header>
330
+ <article slot="modal-body" class="modal-body">
331
+ <amap-location :islocationclearmark="false" dom="addboxmap" v-ref:positionInfo @getmylocation="getmylocation"></amap-location>
332
+ </article>
333
+ <footer slot="modal-footer" class="modal-footer">
334
+ <button v-show="isshow" type="button" class="button_search button_spacing" @click='confirmLocation'>确认</button>
335
+ <button v-show="isshow" type="button" class="button_clear button_spacing" @click='closeModal'>取消</button>
336
+ </footer>
337
+ </modal>
338
+
339
+ </div>
340
+ </template>
341
+
342
+ <script>
343
+ import {HttpResetClass} from 'vue-client'
344
+
345
+
346
+ let getAreaConfig = async function (self) {
347
+ // 获取气价里面的配置
348
+ await self.$getConfig(self, 'UserAddress')
349
+ console.log('原地址配置',self.config)
350
+ console.log('获取地址配置',self.config)
351
+ Object.assign(self.model, self.config)
352
+ }
353
+
354
+ export default {
355
+ title: '用户地址添加',
356
+ data () {
357
+ return {
358
+ //模态框是否显示
359
+ isshow: false,
360
+ //接收位置
361
+ templng: '', //临时经度
362
+ templat: '' , //临时纬度
363
+
364
+ //初始化省市区数据
365
+ pcdslist:[],
366
+ //初始化街道数据
367
+ streetslist:[],
368
+ //初始化街道数据
369
+ areaslist:[],
370
+ areaschoice:[],
371
+ // 楼栋数据
372
+ buildingList: [],
373
+ iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'},{label:'全部',value:''}],
374
+ config:{
375
+ hasnumber:false,
376
+ f_building_suffix: '号楼',
377
+ f_unit_suffix: '单元',
378
+ f_floor_suffix: '',
379
+ f_room_suffix: ''
380
+ },
381
+ model: {
382
+ f_pcd_id: '',
383
+ f_street_id: '',
384
+ f_comments:'',
385
+ f_residential_area_id: '',
386
+ f_pcd: '',
387
+ f_street: '',
388
+ f_residential_area: '',
389
+ f_slice_area: '',
390
+ slice_area:'',
391
+ f_building: '',
392
+ f_building_start: '',
393
+ f_building_end: '',
394
+ f_building_suffix: '',
395
+ f_unit: '',
396
+ f_unit_start: '',
397
+ f_unit_end: '',
398
+ f_unit_suffix: '',
399
+ f_floor: '',
400
+ f_floor_start: '',
401
+ f_floor_end: '',
402
+ f_floor_suffix: '',
403
+ f_room: '',
404
+ f_room_start: '',
405
+ f_room_end: '',
406
+ f_room_suffix: '',
407
+ //详细地址
408
+ f_address: '',
409
+ //单位名称
410
+ f_company: '',
411
+ //单位地址
412
+ f_company_address: '',
413
+ f_lng: '', //经度
414
+ f_lat: '', //纬度
415
+ f_enter_number: '' //入户证号
416
+ },
417
+ //判读是否为单个数据录入
418
+ onedata: 'one',
419
+ //选中所有地址
420
+ addresslist: [],
421
+ usertype:false,
422
+
423
+ // 公司信息
424
+ curorgid: [this.$login.f.orgid],
425
+
426
+ f_orgid: '',
427
+
428
+ sliceArea: []
429
+ }
430
+ },
431
+ props: ['f_filialeids', 'row','operation','usertype'],
432
+ async ready(){
433
+ this.initdata()
434
+ getAreaConfig(this)
435
+ this.model.f_building_suffix=this.config.f_building_suffix
436
+ this.model.f_unit_suffix=this.config.f_unit_suffix
437
+ this.model.f_floor_suffix=this.config.f_floor_suffix
438
+ this.model.f_room_suffix=this.config.f_room_suffix
439
+ },
440
+ methods: {
441
+ async sliceChange(slice){
442
+ this.areaschoice=[]
443
+ if(slice){
444
+ this.areaslist.forEach((item)=>{
445
+ if(item.data.f_slice_area==slice[0].name){
446
+ this.areaschoice.push(item)
447
+ }
448
+ })
449
+ }else{
450
+ this.areaslist.forEach((item)=>{
451
+ this.areaschoice.push(item)
452
+ })
453
+ }
454
+ },
455
+ async changecity(){
456
+ this.areaslist = []
457
+ // this.model.f_residential_area_id = null
458
+ // this.model.f_residential_area = null
459
+ let condition = `isnull(f_iscity,'') = isnull('${this.model.f_iscity}','') and a.f_orgid = '${this.f_filialeids}'`
460
+ let req = await this.$resetpost('rs/sql/address_getresidential', {
461
+ data: {
462
+ condition: condition
463
+ }
464
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
465
+ let redata = []
466
+ req.data.forEach((row) => {
467
+ redata.push({
468
+ label: '['+row.f_street+']'+row.f_residential_area,
469
+ value: row.id,
470
+ data: row,
471
+ id: row.id
472
+ })
473
+ })
474
+ this.areaslist=redata
475
+ },
476
+ standardyanzheng() {
477
+ console.log(this.model.f_standard_number.length)
478
+ if (this.model.f_standard_number.length != 2){
479
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
480
+ this.model.f_standard_number = ''
481
+ }
482
+ },
483
+ contractsyanzheng(){
484
+ console.log(this.model.f_contracts_number.length)
485
+ if (this.model.f_contracts_number.length != 5){
486
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
487
+ this.model.f_contracts_number = ''
488
+ }
489
+ },
490
+ async initdata(){
491
+ this.model.f_address_state = '未通气'
492
+ this.initAreas(this.f_filialeids)
493
+ // 添加特殊地址选省市区
494
+ this.initpcds(` f_orgid = '${this.f_filialeids}'`)
495
+ this.initstreets(` f_orgid = '${this.f_filialeids}' `)
496
+ await this.initareas(` f_orgid = '${this.f_filialeids}'`)
497
+ this.areaslist.forEach((item)=>{
498
+ this.areaschoice.push(item)
499
+ })
500
+ },
501
+
502
+ // 初始化片区
503
+ async initAreas (val) {
504
+ if (val) {
505
+ let HttpReset = new HttpResetClass()
506
+ let getAllArea = await HttpReset.load('POST','/rs/search', {
507
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
508
+ userid: this.$login.f.id
509
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
510
+ let arr = getAllArea.data.filter((res) => {
511
+ return res.parentid == val
512
+ })
513
+ console.log('过滤之后的片区', arr)
514
+ this.sliceArea = []
515
+ arr.forEach((res) => {
516
+ this.sliceArea.push({label: res.name, value: res.name})
517
+ })
518
+ }
519
+ },
520
+ //初始化省市区,添加街道
521
+ async initpcds(pconditon){
522
+ this.pcdslist = []
523
+ let HttpReset = new HttpResetClass()
524
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
525
+ data: {
526
+ items: '*',
527
+ tablename: 't_pcd',
528
+ orderitem: 'id',
529
+ condition: pconditon
530
+ }
531
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
532
+ let redata = []
533
+ req.data.forEach((row, n) => {
534
+ redata[n] = {
535
+ label: row.f_pcd,
536
+ value: row.id,
537
+ data:row,
538
+ id:row.id
539
+ }
540
+ })
541
+ this.pcdslist=redata
542
+ },
543
+ //初始化街道 添加小区
544
+ async initstreets(pconditon){
545
+ this.streetslist = []
546
+ let HttpReset = new HttpResetClass()
547
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
548
+ data: {
549
+ items: '*',
550
+ tablename: 't_street',
551
+ orderitem: 'id',
552
+ condition: pconditon
553
+ }
554
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
555
+ let redata = []
556
+ req.data.forEach((row, n) => {
557
+ redata[n] = {
558
+ label: row.f_street,
559
+ value: row.id,
560
+ data:row,
561
+ id:row.id
562
+ }
563
+ })
564
+ this.streetslist=redata
565
+ },
566
+ //初始化小区添加小区
567
+ async initareas(pconditon){
568
+ // if(this.usertype){
569
+ // pconditon=pconditon+` and f_special='1' `
570
+ // }
571
+ this.areaslist = []
572
+ let HttpReset = new HttpResetClass()
573
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
574
+ data: {
575
+ items: '*',
576
+ tablename: 't_area',
577
+ orderitem: 'id',
578
+ condition: pconditon
579
+ }
580
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
581
+ let redata = []
582
+ req.data.forEach((row) => {
583
+ redata.push({
584
+ label: '['+row.f_street+']'+row.f_residential_area,
585
+ value: row.id,
586
+ data: row,
587
+ id: row.id
588
+ })
589
+ })
590
+ this.areaslist=redata
591
+ },
592
+ // 根据选择小区查询楼栋
593
+ async getbuildingList(pconditon){
594
+ this.buildingList = []
595
+ let HttpReset = new HttpResetClass()
596
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
597
+ data: {
598
+ items: '*',
599
+ tablename: 't_building',
600
+ orderitem: 'id',
601
+ condition: pconditon
602
+ }
603
+ }, {resolveMsg: null, rejectMsg: '获取楼栋失败!'})
604
+ let redata = []
605
+ req.data.forEach((row) => {
606
+ redata.push({
607
+ label: row.f_building,
608
+ value: row.id,
609
+ data: row,
610
+ id: row.id
611
+ })
612
+ })
613
+ this.buildingList=redata
614
+ },
615
+ //省/市/区变化
616
+ async pcdChange(val){
617
+ // 只有添加特殊地址时才级联
618
+ if (!this.usertype) {
619
+ return
620
+ }
621
+ console.log("省/市/区变化",val)
622
+ if(val){
623
+ //那就把[小区,街道]重新组织一下
624
+ await this.initstreets(` f_pcd_id ='${val}' `)
625
+ if(this.model.f_street_id){
626
+ if (this.findbyid(this.streetslist,this.model.f_street_id)) {
627
+ let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
628
+ if(pcd_id!=val){
629
+ this.model.f_street_id=''
630
+ }
631
+ } else {
632
+ this.model.f_street_id=''
633
+ }
634
+
635
+ //那就把[小区,街道]重新组织一下
636
+ if (this.model.f_street_id) {
637
+ await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
638
+ if(this.model.f_residential_area_id){
639
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
640
+ let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
641
+ if(pcd_id!=val){
642
+ this.model.f_residential_area_id=''
643
+ }
644
+ } else {
645
+ this.model.f_residential_area_id=''
646
+ }
647
+
648
+ }
649
+ }
650
+ }
651
+ }
652
+ this.$resetValidation()
653
+ },
654
+ //小区变化
655
+ areaChange(val){
656
+ console.log("小区变化",val)
657
+ // 选择小区后级联出省市区和街道
658
+ let selectArea // 选中的小区数据
659
+ for (let row of this.areaslist) {
660
+ if (val == row.value) {
661
+ selectArea = row.data
662
+ break
663
+ }
664
+ }
665
+ if (selectArea) {
666
+ this.model.f_street_id = selectArea.f_street_id
667
+ this.model.f_pcd_id = selectArea.f_pcd_id
668
+ this.initstreets(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_street_id}' `)
669
+ this.initpcds(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_pcd_id}' `)
670
+ this.model.slice_area = selectArea.f_slice_area
671
+ // 拼接地址
672
+ this.model.f_address = `${selectArea.f_street}${selectArea.f_residential_area}`
673
+ this.getbuildingList(`f_filialeid = '${this.f_filialeids}' and f_residential_area_id ='${selectArea.id}'`)
674
+ }
675
+ this.$nextTick(() => {
676
+ this.$resetValidation()
677
+ })
678
+ },
679
+ //街道变化
680
+ async streetChange(val){
681
+ console.log("街道变化",val)
682
+ if(this.streetslist[0]) {
683
+ var street=''
684
+ this.streetslist.forEach((item)=>{
685
+ if(item.id===val){
686
+ street=item.label
687
+ }
688
+ })
689
+ this.model.f_address = street
690
+ }
691
+ if(val){
692
+ //那就把[小区]重新组织一下
693
+ await this.initareas(` f_street_id ='${val}' `)
694
+ if(this.model.f_residential_area_id){
695
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
696
+ let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
697
+ if(street_id!=val){
698
+ this.model.f_residential_area_id=''
699
+ }
700
+ } else {
701
+ this.model.f_residential_area_id=''
702
+ }
703
+
704
+ }
705
+ }
706
+ this.$resetValidation()
707
+ },
708
+
709
+ getorg (val) {
710
+ this.f_orgid = val[0]
711
+ },
712
+
713
+ //处理批量地址信息
714
+ dealaddlist(){
715
+ try {
716
+ var resultlist=[]
717
+ for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
718
+ for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
719
+ for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
720
+ for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
721
+ //预备一个空的json
722
+ console.log('批量', this.model)
723
+ let data=Object.assign({},this.model)
724
+ data.f_create_person= this.$login.f.name
725
+ if ((i+'').length == 1) {
726
+ data.f_building= data.f_building_prefix + '0' +i
727
+ } else {
728
+ data.f_building= data.f_building_prefix + '' +i
729
+ }
730
+ if ((j+'').length == 1) {
731
+ data.f_unit= data.f_unit_prefix + '0'+j
732
+ } else {
733
+ data.f_unit= data.f_unit_prefix +''+ j
734
+ }
735
+ if ((m+'').length == 1) {
736
+ data.f_floor= data.f_floor_prefix +'0'+ m
737
+ } else {
738
+ data.f_floor= data.f_floor_prefix +''+ m
739
+ }
740
+ // 目前房号都按两位处理 如: 101室 201室 110室
741
+ if ((n+'').length == 1) {
742
+ data.f_room = data.f_room_prefix + m + '0' + n
743
+ } else {
744
+ data.f_room = data.f_room_prefix + m + '' + n
745
+ }
746
+ data.f_filialeid = this.f_filialeids
747
+ data.f_operator = this.$login.f.name
748
+ data.f_operatorid = this.$login.f.id
749
+ data.f_orgid = this.$login.f.orgid
750
+ data.f_orgname = this.$login.f.orgs
751
+ data.f_depid = this.$login.f.depids
752
+ data.f_depname = this.$login.f.deps
753
+ data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
754
+ data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
755
+ data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
756
+ data.f_address = data.f_street
757
+ + data.f_residential_area +
758
+ data.f_building + data.f_building_suffix
759
+ + data.f_unit + data.f_unit_suffix
760
+ + data.f_floor + data.f_floor_suffix
761
+ + data.f_room + data.f_room_suffix
762
+ data.f_slice_area = data.slice_area[0]?data.slice_area[0].name:data.slice_area
763
+
764
+ resultlist.push(data)
765
+ }
766
+ }
767
+ }
768
+ }
769
+ this.addresslist=resultlist
770
+ } catch (e) {
771
+ console.log(e)
772
+ this.$showAlert('输出数据有误,请检查', 'warning', 2000)
773
+ }
774
+ },
775
+ //保存多个
776
+ async confirmall(){
777
+ this.dealaddlist()
778
+ if(this.addresslist.length>0){
779
+ let msg = {
780
+ resolveMsg: '地址保存成功',
781
+ rejectMsg: '地址保存失败'
782
+ }
783
+ this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
784
+ if (res === 'confirm') {
785
+ this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
786
+ this.cleardara()
787
+ this.$dispatch('confirm')
788
+ })
789
+ }
790
+ })
791
+ }
792
+ },
793
+ //保存
794
+ async confirm(){
795
+ if(this.onedata=='one'){
796
+ await this.saveonedata()
797
+ }
798
+ this.cleardara()
799
+ this.$dispatch('confirm')
800
+ },
801
+ //保存一户信息
802
+ async saveonedata(){
803
+ this.model.f_create_person= this.$login.f.name
804
+ this.model.f_filialeid = this.f_filialeids
805
+ this.model.f_operator = this.$login.f.name
806
+ this.model.f_operatorid = this.$login.f.id
807
+ this.model.f_orgid = this.$login.f.orgid
808
+ this.model.f_orgname = this.$login.f.orgs
809
+ this.model.f_depid = this.$login.f.depids
810
+ this.model.f_depname = this.$login.f.deps
811
+ console.log("片区:",this.model.slice_area)
812
+ if (this.model.slice_area ) {
813
+ if (this.model.slice_area instanceof Array) {
814
+ console.log("修改",this.model.slice_area)
815
+ this.model.f_slice_area = this.model.slice_area[0].name
816
+ } if (this.model.slice_area instanceof Object) {
817
+ console.log("修改",this.model.slice_area)
818
+ this.model.f_slice_area = Object.values(this.model.slice_area)[0].name
819
+ } else{
820
+ console.log("保存",this.model.slice_area)
821
+ this.model.f_slice_area = this.model.slice_area
822
+ }
823
+ }
824
+ if (( this.model.f_unit+'').length == 1) {
825
+ this.model.f_unit= '0'+ this.model.f_unit
826
+ }
827
+ if (( this.model.f_floor+'').length == 1) {
828
+ this.model.f_floor= '0'+ this.model.f_floor
829
+ }
830
+ if (( this.model.f_room+'').length == 1) {
831
+ this.model.f_room= '0'+ this.model.f_room
832
+ }
833
+ if (this.usertype) {
834
+ //非民用
835
+ this.model.f_special='1'
836
+ this.model.f_building_suffix=''
837
+ this.model.f_unit_suffix=''
838
+ this.model.f_floor_suffix=''
839
+ this.model.f_room_suffix=''
840
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
841
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
842
+ this.model.f_residential_area = this.findbyid(this.areaslist,this.model.f_residential_area_id) ? this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area : ''
843
+ } else {
844
+ //民用
845
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
846
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
847
+ this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
848
+ if (( this.$refs.f_building_id.selectedItems+'').length == 1) {
849
+ this.model.f_building= '0'+ this.$refs.f_building_id.selectedItems
850
+ }else{
851
+ this.model.f_building = this.$refs.f_building_id.selectedItems
852
+ }
853
+ this.model.f_building_suffix=''
854
+ if (!this.model.f_building) {
855
+ this.$showMessage('请选择楼栋数据!!!')
856
+ return
857
+ }
858
+ this.model.f_address = this.model.f_street + this.model.f_residential_area + (this.model.f_building?this.model.f_building +this.model.f_building_suffix:'') + (this.model.f_unit?this.model.f_unit +this.model.f_unit_suffix:'') + (this.model.f_floor?this.model.f_floor +this.model.f_floor_suffix:'') + this.model.f_room + this.model.f_room_suffix
859
+ }
860
+ await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
861
+ },
862
+ cancel(){
863
+ this.cleardara()
864
+ this.$dispatch('cancel')
865
+ },
866
+ cleardara(){
867
+ this.model= {
868
+ f_pcd_id: '',
869
+ f_street_id: '',
870
+ f_iscity:'市区',
871
+ f_residential_area_id: '',
872
+ f_pcd: '',
873
+ f_comments:'',
874
+ f_street: '',
875
+ f_residential_area: '',
876
+ f_slice_area: '',
877
+ slice_area: '',
878
+ f_building: '',
879
+ f_building_start: '',
880
+ f_building_end: '',
881
+ f_building_prefix: '',
882
+ f_building_suffix: this.config.f_building_suffix,
883
+ f_unit: '',
884
+ f_unit_start: '',
885
+ f_unit_end: '',
886
+ f_unit_prefix: '',
887
+ f_unit_suffix: this.config.f_unit_suffix,
888
+ f_floor: '',
889
+ f_floor_start: '',
890
+ f_floor_end: '',
891
+ f_floor_prefix: '',
892
+ f_floor_suffix: this.config.f_floor_suffix,
893
+ f_room: '',
894
+ f_room_start: '',
895
+ f_room_end: '',
896
+ f_room_prefix: '',
897
+ f_room_suffix: this.config.f_room_suffix,
898
+ //详细地址
899
+ f_address: '',
900
+ //单位名称
901
+ f_company: '',
902
+ //单位地址
903
+ f_company_address: '',
904
+ f_lng: '',
905
+ f_lat: '',
906
+ f_enter_number: ''
907
+ }
908
+ // this.pcdslist = []
909
+ // this.streetslist = []
910
+ // this.areaslist = []
911
+ },
912
+
913
+ //根据名字找数据
914
+ findbyid(list,name){
915
+ var result
916
+ list.forEach((row, n) => {
917
+ if(name==row.value){
918
+ result= row.data
919
+ }
920
+ })
921
+ return result
922
+ },
923
+ openModal () {
924
+ this.isshow = true
925
+ },
926
+ closeModal () {
927
+ this.isshow = false;
928
+ },
929
+ getmylocation (res) {
930
+ this.templng = res.position.lng
931
+ this.templat = res.position.lat
932
+ },
933
+ confirmLocation () {
934
+ this.model.f_lat = this.templat
935
+ this.model.f_lng = this.templng
936
+ this.isshow = false
937
+ }
938
+ },
939
+ watch: {
940
+ //分公司变化
941
+ 'f_filialeids'(){
942
+ if (this.model.f_filialeid) {
943
+ if (this.model.f_filialeid != this.f_filialeids) {
944
+ this.$dispatch('cancel')
945
+ }
946
+ }
947
+ this.cleardara()
948
+ this.initdata()
949
+ },
950
+ 'row'(){
951
+ this.onedata='one'
952
+ },
953
+ 'model.id' () {
954
+ this.getbuildingList(`f_filialeid = '${this.f_filialeids}' and f_residential_area_id ='${this.model.f_residential_area_id}'`)
955
+ }
956
+ },
957
+ computed: {
958
+ //地址状态下拉框
959
+ addresstate() {
960
+ return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
961
+ }
962
+ }
963
+ }
964
+ </script>
965
+ <style lang="less">
966
+ #userAddress{
967
+ #addboxmap {
968
+ height: 300px;
969
+ }
970
+ .glyphicon:hover {
971
+ color: red;
972
+ }
973
+ .glyphicon {
974
+ color: blue;
975
+ cursor: pointer;
976
+ }
977
+ }
978
+ </style>
979
+
980
+
981
+
982
+