address-client 3.2.21 → 3.2.24

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