address-client 3.2.20 → 3.2.21

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,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[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
- this.buildingList = []
502
- },
503
-
504
- // 初始化片区
505
- async initAreas (val) {
506
- if (val) {
507
- let getAllArea = await this.$resetpost('/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[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
+ this.buildingList = []
502
+ },
503
+
504
+ // 初始化片区
505
+ async initAreas (val) {
506
+ if (val) {
507
+ let getAllArea = await this.$resetpost('/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
+