address-client 3.2.83 → 3.2.85

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