address-client 3.2.20 → 3.2.21

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