address-client 3.2.31 → 3.2.33-1

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