address-client 3.0.17 → 3.0.19-wsd

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,662 +1,662 @@
1
- <template>
2
- <div class="span">
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">
7
- <input type="radio" id="true" value="one" v-model="onedata">
8
- <label for="one">单户</label>
9
- <input type="radio" id="false" value="more" v-model="onedata">
10
- <label for="more">多户</label>
11
- </div>
12
- <!--单个录入-->
13
- <div v-if="onedata=='one'">
14
- <div class="col-sm-6 "
15
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
16
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;省市区</label>
17
- <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id"
18
- v-validate:f_pcd_id='{required: true }'>
19
- <v-select :value.sync="model.f_pcd_id" :value-single="true"
20
- :options='pcdslist' placeholder='请选择'
21
- close-on-select search="true" @change="pcdChange">
22
- </v-select>
23
- </div>
24
-
25
- <div class="col-sm-6 "
26
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
27
- <label class="font_normal_body">街道名称</label>
28
- <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id"
29
- v-validate:f_street_id='{required: true }'>
30
- <v-select :value.sync="model.f_street_id" :value-single="true"
31
- :options='streetslist' placeholder='请选择'
32
- close-on-select search="true" @change="streetChange">
33
- </v-select>
34
- </div>
35
- <div v-if="!usertype" class="col-sm-6 "
36
- :class="[$v.f_residential_area_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_residential_area_id"
39
- v-validate:f_residential_area_id='{required: true }'>
40
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
41
- :options='areaslist' placeholder='请选择'
42
- @change="areaChange"
43
- close-on-select search="true">
44
- </v-select>
45
- </div>
46
- <div class="col-sm-6 " :class="[$v.slice.required ? 'has-error' : 'has-success']">
47
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;片区&nbsp;&nbsp;&nbsp;</label>
48
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
49
- v-validate:slice='{required: true }'>
50
- <v-select :value.sync="model.slice_area" v-model="model.slice_area"
51
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
52
- close-on-select v-ref:slice>
53
- </v-select>
54
- </div>
55
- <div v-if="!usertype" class="col-sm-6 ">
56
- <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;楼号&nbsp;&nbsp;&nbsp;</label>
57
- <input type="text" style="width:38%" v-model="model.f_building" class="input_search"
58
- placeholder="楼号"/>
59
- <input type="text" style="width:20%" v-model="model.f_building_suffix" class="input_search"
60
- />
61
-
62
- </div>
63
- <div v-if="!usertype" class="col-sm-6 ">
64
- <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;单元&nbsp;&nbsp;&nbsp;</label>
65
- <input type="text" style="width:38%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
66
- <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
67
- />
68
- </div>
69
- <div v-if="!usertype" class="col-sm-6 ">
70
- <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;楼层&nbsp;&nbsp;&nbsp;</label>
71
- <input type="text" style="width:38%" v-model="model.f_floor" class="input_search"
72
- placeholder="楼层" />
73
- <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
74
- />
75
- </div>
76
- <div v-if="!usertype" class="col-sm-6 "
77
- :class="[$v.f_room.required ? 'has-error' : 'has-success']">
78
- <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;门牌号</label>
79
- <input type="text" style="width:38%" v-model="model.f_room" class="input_search" placeholder="门牌号"
80
- v-validate:f_room='{required: true }'/>
81
- <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
82
- />
83
- </div>
84
- <div v-if="usertype" class="col-sm-6 "
85
- :class="[$v.f_address.required ? 'has-error' : 'has-success']">
86
- <label for="f_address" class="font_normal_body">详细地址</label>
87
- <input type="text" style="width:60%" v-model="model.f_address" class="input_search" placeholder="详细地址"
88
- v-validate:f_address='{required: true }'/>
89
- </div>
90
-
91
- <div style="text-align:right;margin-top:6px;margin-right:50px;" class="col-sm-12">
92
- <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
93
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
94
- </div>
95
-
96
- </div>
97
- <!--批量录入-->
98
- <div v-if="onedata=='more'">
99
- <div class="col-sm-6 "
100
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
101
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;省市区</label>
102
- <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
103
- v-validate:f_pcd_id='{required: true }'>
104
- <v-select :value.sync="model.f_pcd_id" :value-single="true"
105
- :options='pcdslist' placeholder='请选择'
106
- close-on-select search="true" @change="pcdChange">
107
- </v-select>
108
- </div>
109
- <div class="col-sm-6 "
110
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
111
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;街道&nbsp;&nbsp;&nbsp;</label>
112
- <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
113
- v-validate:f_street_id='{required: true }'>
114
- <v-select :value.sync="model.f_street_id" :value-single="true"
115
- :options='streetslist' placeholder='请选择'
116
- close-on-select search="true" @change="streetChange">
117
- </v-select>
118
- </div>
119
- <div class="col-sm-6 "
120
- :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
121
- <label class="font_normal_body">小区名称</label>
122
- <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
123
- v-validate:f_residential_area_id='{required: true }'>
124
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
125
- @change="areaChange"
126
- :options='areaslist' placeholder='请选择'
127
- close-on-select search="true">
128
- </v-select>
129
- </div>
130
- <div class="col-sm-6 " :class="[$v.slice.required ? 'has-error' : 'has-success']">
131
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;片区&nbsp;&nbsp;&nbsp;</label>
132
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
133
- v-validate:slice='{required: true }'>
134
- <v-select :value.sync="model.slice_area" v-model="model.slice_area"
135
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
136
- close-on-select v-ref:slice>
137
- </v-select>
138
- </div>
139
-
140
- <div class="col-sm-6 "
141
- :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
142
- <label for="f_address" class="font_normal_body">起始楼号</label>
143
- <input type="text" style="width:41%"
144
- v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
145
- v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
146
- <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
147
- />
148
- </div>
149
- <div class="col-sm-6 "
150
- :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
151
- <label for="f_address" class="font_normal_body">截止楼号</label>
152
- <input type="text" style="width:41%"
153
- v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
154
- v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
155
- <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
156
- />
157
- </div>
158
- <div class="col-sm-6 "
159
- :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
160
- <label for="f_address" class="font_normal_body">起始单元</label>
161
- <input type="text" style="width:41%"
162
- v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
163
- v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
164
- <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"
165
- />
166
- </div>
167
- <div class="col-sm-6 "
168
- :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
169
- <label for="f_address" class="font_normal_body">截止单元</label>
170
- <input type="text" style="width:41%"
171
- v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
172
- v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
173
- <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"
174
- />
175
- </div>
176
- <div class="col-sm-6 "
177
- :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
178
- <label for="f_address" class="font_normal_body">起始楼层</label>
179
- <input type="text" style="width:41%"
180
- v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
181
- v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
182
- <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"
183
- />
184
- </div>
185
- <div class="col-sm-6 "
186
- :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']"
187
- >
188
- <label for="f_address" class="font_normal_body">截止楼层</label>
189
- <input type="text" style="width:41%" v-model="model.f_floor_end"
190
- v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
191
- class="input_search" placeholder="楼层"/>
192
- <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"
193
- />
194
- </div>
195
- <div class="col-sm-6 "
196
- :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
197
- <label for="f_address" class="font_normal_body">起始门牌</label>
198
- <input type="text" style="width:41%" v-model="model.f_room_start"
199
- class="input_search" placeholder="门牌号"
200
- v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
201
- />
202
- <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"
203
- />
204
- </div>
205
- <div class="col-sm-6 "
206
- :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
207
- <label for="f_address" class="font_normal_body">截止门牌</label>
208
- <input type="text" style="width:41%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
209
- v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
210
- <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"
211
- />
212
- </div>
213
- <div class="col-sm-10 ">
214
- <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
215
- </div>
216
-
217
- <div style="text-align:right;margin-top:6px;margin-right:50px;" class="col-sm-12">
218
- <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
219
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
220
- </div>
221
- </div>
222
- </div>
223
- </validator>
224
- </div>
225
- </template>
226
-
227
- <script>
228
- import {HttpResetClass} from 'vue-client'
229
-
230
-
231
- let getAreaConfig = async function (self) {
232
- // 获取气价里面的配置
233
- await self.$getConfig(self, 'UserAddress')
234
- console.log('原地址配置',self.config)
235
- console.log('获取地址配置',self.config)
236
- Object.assign(self.model, self.config)
237
- }
238
-
239
- export default {
240
- title: '用户地址添加',
241
- data () {
242
- return {
243
- //初始化省市区数据
244
- pcdslist:[],
245
- //初始化街道数据
246
- streetslist:[],
247
- //初始化街道数据
248
- areaslist:[],
249
- config:{
250
- f_building_suffix: '栋',
251
- f_unit_suffix: '单元',
252
- f_floor_suffix: '层',
253
- f_room_suffix: '室'
254
- },
255
- model: {
256
- f_pcd_id: '',
257
- f_street_id: '',
258
- f_residential_area_id: '',
259
- f_pcd: '',
260
- f_street: '',
261
- f_residential_area: '',
262
- f_slice_area: '',
263
- f_building: '',
264
- f_building_start: '',
265
- f_building_end: '',
266
- f_building_suffix: '',
267
- f_unit: '',
268
- f_unit_start: '',
269
- f_unit_end: '',
270
- f_unit_suffix: '',
271
- f_floor: '',
272
- f_floor_start: '',
273
- f_floor_end: '',
274
- f_floor_suffix: '',
275
- f_room: '',
276
- f_room_start: '',
277
- f_room_end: '',
278
- f_room_suffix: '',
279
- //详细地址
280
- f_address: '',
281
- //单位名称
282
- f_company: '',
283
- //单位地址
284
- f_company_address: '',
285
- },
286
- //判读是否为单个数据录入
287
- onedata: 'one',
288
- //选中所有地址
289
- addresslist: [],
290
- usertype:false,
291
-
292
- // 公司信息
293
- curorgid: [this.$login.f.orgid],
294
-
295
- f_orgid: '',
296
-
297
- sliceArea: []
298
- }
299
- },
300
- props: ['f_filialeids', 'row','operation','usertype'],
301
- ready(){
302
- this.initdata()
303
- getAreaConfig(this)
304
- },
305
- methods: {
306
- async initdata(){
307
- this.initAreas(this.f_filialeids)
308
- await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
309
- // this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
310
- // this.initareas(` f_filialeid = '${this.f_filialeids}'`)
311
- },
312
-
313
- // 初始化片区
314
- async initAreas (val) {
315
- if (val) {
316
- let getAllArea = await this.$resetpost('/rs/search', {
317
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
318
- userid: this.$login.f.id
319
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
320
-
321
- let arr = getAllArea.data.filter((res) => {
322
- return res.parentid == val
323
- })
324
- console.log('过滤之后的片区', arr)
325
- this.sliceArea = []
326
- arr.forEach((res) => {
327
- this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
328
- })
329
- }
330
- },
331
-
332
- //初始化省市区,添加街道
333
- async initpcds(pconditon){
334
- this.pcdslist = []
335
- let HttpReset = new HttpResetClass()
336
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
337
- data: {
338
- items: '*',
339
- tablename: 't_pcd',
340
- orderitem: 'id',
341
- condition: pconditon
342
- }
343
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
344
- let redata = []
345
- req.data.forEach((row, n) => {
346
- redata[n] = {
347
- label: row.f_pcd,
348
- value: row.id,
349
- data:row,
350
- id:row.id
351
- }
352
- })
353
- this.pcdslist=redata
354
- },
355
- //初始化街道 添加小区
356
- async initstreets(pconditon){
357
- this.streetslist = []
358
- let HttpReset = new HttpResetClass()
359
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
360
- data: {
361
- items: '*',
362
- tablename: 't_street',
363
- orderitem: 'id',
364
- condition: pconditon
365
- }
366
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
367
- let redata = []
368
- req.data.forEach((row, n) => {
369
- redata[n] = {
370
- label: row.f_street,
371
- value: row.id,
372
- data:row,
373
- id:row.id
374
- }
375
- })
376
- this.streetslist=redata
377
- },
378
- //初始化小区添加小区
379
- async initareas(pconditon){
380
- if(this.usertype){
381
- pconditon=pconditon+` and f_special='1' `
382
- }
383
- this.areaslist = []
384
- let HttpReset = new HttpResetClass()
385
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
386
- data: {
387
- items: '*',
388
- tablename: 't_area',
389
- orderitem: 'id',
390
- condition: pconditon
391
- }
392
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
393
- let redata = []
394
- req.data.forEach((row) => {
395
- redata.push({
396
- label: row.f_residential_area,
397
- value: row.id,
398
- data: row,
399
- id: row.id
400
- })
401
- })
402
- this.areaslist=redata
403
- },
404
- //省/市/区变化
405
- async pcdChange(val){
406
- console.log("省/市/区变化",val)
407
- if(val){
408
- //那就把[小区,街道]重新组织一下
409
- await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
410
- if(this.model.f_street_id){
411
- if (this.findbyid(this.streetslist,this.model.f_street_id)) {
412
- let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
413
- if(pcd_id!=val){
414
- this.model.f_street_id=''
415
- }
416
- } else {
417
- this.model.f_street_id=''
418
- }
419
-
420
- //那就把[小区,街道]重新组织一下
421
- if (this.model.f_street_id) {
422
- await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
423
- if(this.model.f_residential_area_id){
424
- if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
425
- let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
426
- if(pcd_id!=val){
427
- this.model.f_residential_area_id=''
428
- }
429
- } else {
430
- this.model.f_residential_area_id=''
431
- }
432
-
433
- }
434
- }
435
- }
436
- }
437
- this.$resetValidation()
438
- },
439
- //小区变化
440
- areaChange(val){
441
- console.log("小区变化",val, this.model)
442
- if(val){
443
- let getArea = this.areaslist.filter((res) => {
444
- return res.id = this.model.f_residential_area_id
445
- })
446
- if (getArea.length > 0) {
447
- console.log('获取小区数据', getArea[0].data)
448
- this.model.slice_area = [{name: getArea[0].data.f_slice_area, code: getArea[0].data.f_area_code}]
449
- }
450
- }
451
- this.$resetValidation()
452
- },
453
-
454
- //街道变化
455
- async streetChange(val){
456
- console.log("街道变化",val)
457
- if(val){
458
- //那就把[小区]重新组织一下
459
- await this.initareas(` f_street_id ='${val}' `)
460
- if(this.model.f_residential_area_id){
461
- if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
462
- let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
463
- if(street_id!=val){
464
- this.model.f_residential_area_id=''
465
- }
466
- } else {
467
- this.model.f_residential_area_id=''
468
- }
469
-
470
- }
471
- }
472
- this.$resetValidation()
473
- },
474
-
475
- getorg (val) {
476
- this.f_orgid = val[0]
477
- },
478
-
479
- //处理批量地址信息
480
- dealaddlist(){
481
- try {
482
- var resultlist=[]
483
- for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
484
- for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
485
- for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
486
- for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
487
- //预备一个空的json
488
- console.log('批量', this.model)
489
- let data=Object.assign({},this.model)
490
- data.f_create_person= this.$login.f.name
491
- data.f_building=i
492
- data.f_unit=j
493
- data.f_floor=m
494
- // 目前房号都按两位处理 如: 101室 201室 110室
495
- if ((n+'').length == 1) {
496
- data.f_room = m + '0' + n
497
- } else {
498
- data.f_room = m + '' + n
499
- }
500
- data.f_filialeid = this.f_filialeids
501
- data.f_operator = this.$login.f.name
502
- data.f_operatorid = this.$login.f.id
503
- data.f_orgid = this.$login.f.orgid
504
- data.f_orgname = this.$login.f.orgs
505
- data.f_depid = this.$login.f.depids
506
- data.f_depname = this.$login.f.deps
507
- data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
508
- data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
509
- data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
510
- data.f_address = data.f_street
511
- + data.f_residential_area +
512
- i + data.f_building_suffix
513
- + j + data.f_unit_suffix
514
- + m + data.f_floor_suffix
515
- + data.f_room + data.f_room_suffix
516
- if (this.model.slice_area) {
517
- if (this.model.slice_area.length > 0) {
518
- data.f_slice_area = this.model.slice_area[0].name
519
- data.f_area_code = this.model.slice_area[0].code
520
- }
521
- }
522
- resultlist.push(data)
523
- }
524
- }
525
- }
526
- }
527
- this.addresslist=resultlist
528
- } catch (e) {
529
- console.log(e)
530
- this.$showAlert('输出数据有误,请检查', 'warning', 2000)
531
- }
532
- },
533
- //保存多个
534
- async confirmall(){
535
- this.dealaddlist()
536
- if(this.addresslist.length>0){
537
- let msg = {
538
- resolveMsg: '地址保存成功',
539
- rejectMsg: '地址保存失败'
540
- }
541
- this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
542
- if (res === 'confirm') {
543
- this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
544
- this.cleardara()
545
- this.$dispatch('confirm')
546
- })
547
- }
548
- })
549
- }
550
- },
551
- //保存
552
- async confirm(){
553
- if(this.onedata=='one'){
554
- await this.saveonedata()
555
- }
556
- this.cleardara()
557
- this.$dispatch('confirm')
558
- },
559
- //保存一户信息
560
- async saveonedata(){
561
- this.model.f_create_person= this.$login.f.name
562
- this.model.f_filialeid = this.f_filialeids
563
- this.model.f_operator = this.$login.f.name
564
- this.model.f_operatorid = this.$login.f.id
565
- this.model.f_orgid = this.$login.f.orgid
566
- this.model.f_orgname = this.$login.f.orgs
567
- this.model.f_depid = this.$login.f.depids
568
- this.model.f_depname = this.$login.f.deps
569
- if (this.model.slice_area) {
570
- if (this.model.slice_area.length > 0) {
571
- this.model.f_slice_area = this.model.slice_area[0].name
572
- this.model.f_area_code = this.model.slice_area[0].code
573
- }
574
- }
575
- if (this.usertype) {
576
- //非民用
577
- this.model.f_special='1'
578
- this.model.f_building_suffix=''
579
- this.model.f_unit_suffix=''
580
- this.model.f_floor_suffix=''
581
- this.model.f_room_suffix=''
582
- this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
583
- this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
584
- this.model.f_address = this.model.f_street + this.model.f_address
585
- } else {
586
- //民用
587
- this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
588
- this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
589
- this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
590
- 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
591
- }
592
- await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
593
- },
594
- cancel(){
595
- this.cleardara()
596
- this.$dispatch('cancel')
597
- },
598
- cleardara(){
599
- this.model= {
600
- f_pcd_id: '',
601
- f_street_id: '',
602
- f_residential_area_id: '',
603
- f_pcd: '',
604
- f_street: '',
605
- f_residential_area: '',
606
- f_slice_area: '',
607
- f_building: '',
608
- f_building_start: '',
609
- f_building_end: '',
610
- f_building_suffix: this.config.f_building_suffix,
611
- f_unit: '',
612
- f_unit_start: '',
613
- f_unit_end: '',
614
- f_unit_suffix: this.config.f_unit_suffix,
615
- f_floor: '',
616
- f_floor_start: '',
617
- f_floor_end: '',
618
- f_floor_suffix: this.config.f_floor_suffix,
619
- f_room: '',
620
- f_room_start: '',
621
- f_room_end: '',
622
- f_room_suffix: this.config.f_room_suffix,
623
- //详细地址
624
- f_address: '',
625
- //单位名称
626
- f_company: '',
627
- //单位地址
628
- f_company_address: '',
629
- }
630
- // this.pcdslist = []
631
- // this.streetslist = []
632
- // this.areaslist = []
633
- },
634
-
635
- //根据名字找数据
636
- findbyid(list,name){
637
- var result
638
- list.forEach((row, n) => {
639
- if(name==row.value){
640
- result= row.data
641
- }
642
- })
643
- return result
644
- },
645
- },
646
- watch: {
647
- //分公司变化
648
- 'f_filialeids'(){
649
- if (this.model.f_filialeid) {
650
- if (this.model.f_filialeid != this.f_filialeids) {
651
- this.$dispatch('cancel')
652
- }
653
- }
654
- this.cleardara()
655
- this.initdata()
656
- },
657
- 'row'(){
658
- this.onedata='one'
659
- }
660
- }
661
- }
662
- </script>
1
+ <template>
2
+ <div class="span">
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">
7
+ <input type="radio" id="true" value="one" v-model="onedata">
8
+ <label for="one">单户</label>
9
+ <input type="radio" id="false" value="more" v-model="onedata">
10
+ <label for="more">多户</label>
11
+ </div>
12
+ <!--单个录入-->
13
+ <div v-if="onedata=='one'">
14
+ <div class="col-sm-6 "
15
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
16
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;省市区</label>
17
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id"
18
+ v-validate:f_pcd_id='{required: true }'>
19
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
20
+ :options='pcdslist' placeholder='请选择'
21
+ close-on-select search="true" @change="pcdChange">
22
+ </v-select>
23
+ </div>
24
+
25
+ <div class="col-sm-6 "
26
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
27
+ <label class="font_normal_body">街道名称</label>
28
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id"
29
+ v-validate:f_street_id='{required: true }'>
30
+ <v-select :value.sync="model.f_street_id" :value-single="true"
31
+ :options='streetslist' placeholder='请选择'
32
+ close-on-select search="true" @change="streetChange">
33
+ </v-select>
34
+ </div>
35
+ <div v-if="!usertype" class="col-sm-6 "
36
+ :class="[$v.f_residential_area_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_residential_area_id"
39
+ v-validate:f_residential_area_id='{required: true }'>
40
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
41
+ :options='areaslist' placeholder='请选择'
42
+ @change="areaChange"
43
+ close-on-select search="true">
44
+ </v-select>
45
+ </div>
46
+ <div class="col-sm-6 " :class="[$v.slice.required ? 'has-error' : 'has-success']">
47
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;片区&nbsp;&nbsp;&nbsp;</label>
48
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
49
+ v-validate:slice='{required: true }'>
50
+ <v-select :value.sync="model.slice_area" v-model="model.slice_area"
51
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
52
+ close-on-select v-ref:slice>
53
+ </v-select>
54
+ </div>
55
+ <div v-if="!usertype" class="col-sm-6 ">
56
+ <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;楼号&nbsp;&nbsp;&nbsp;</label>
57
+ <input type="text" style="width:38%" v-model="model.f_building" class="input_search"
58
+ placeholder="楼号"/>
59
+ <input type="text" style="width:20%" v-model="model.f_building_suffix" class="input_search"
60
+ />
61
+
62
+ </div>
63
+ <div v-if="!usertype" class="col-sm-6 ">
64
+ <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;单元&nbsp;&nbsp;&nbsp;</label>
65
+ <input type="text" style="width:38%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
66
+ <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
67
+ />
68
+ </div>
69
+ <div v-if="!usertype" class="col-sm-6 ">
70
+ <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;楼层&nbsp;&nbsp;&nbsp;</label>
71
+ <input type="text" style="width:38%" v-model="model.f_floor" class="input_search"
72
+ placeholder="楼层" />
73
+ <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
74
+ />
75
+ </div>
76
+ <div v-if="!usertype" class="col-sm-6 "
77
+ :class="[$v.f_room.required ? 'has-error' : 'has-success']">
78
+ <label for="f_address" class="font_normal_body">&nbsp;&nbsp;&nbsp;门牌号</label>
79
+ <input type="text" style="width:38%" v-model="model.f_room" class="input_search" placeholder="门牌号"
80
+ v-validate:f_room='{required: true }'/>
81
+ <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
82
+ />
83
+ </div>
84
+ <div v-if="usertype" class="col-sm-6 "
85
+ :class="[$v.f_address.required ? 'has-error' : 'has-success']">
86
+ <label for="f_address" class="font_normal_body">详细地址</label>
87
+ <input type="text" style="width:60%" v-model="model.f_address" class="input_search" placeholder="详细地址"
88
+ v-validate:f_address='{required: true }'/>
89
+ </div>
90
+
91
+ <div style="text-align:right;margin-top:6px;margin-right:50px;" class="col-sm-12">
92
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
93
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
94
+ </div>
95
+
96
+ </div>
97
+ <!--批量录入-->
98
+ <div v-if="onedata=='more'">
99
+ <div class="col-sm-6 "
100
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
101
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;省市区</label>
102
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
103
+ v-validate:f_pcd_id='{required: true }'>
104
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
105
+ :options='pcdslist' placeholder='请选择'
106
+ close-on-select search="true" @change="pcdChange">
107
+ </v-select>
108
+ </div>
109
+ <div class="col-sm-6 "
110
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
111
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;街道&nbsp;&nbsp;&nbsp;</label>
112
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
113
+ v-validate:f_street_id='{required: true }'>
114
+ <v-select :value.sync="model.f_street_id" :value-single="true"
115
+ :options='streetslist' placeholder='请选择'
116
+ close-on-select search="true" @change="streetChange">
117
+ </v-select>
118
+ </div>
119
+ <div class="col-sm-6 "
120
+ :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
121
+ <label class="font_normal_body">小区名称</label>
122
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
123
+ v-validate:f_residential_area_id='{required: true }'>
124
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
125
+ @change="areaChange"
126
+ :options='areaslist' placeholder='请选择'
127
+ close-on-select search="true">
128
+ </v-select>
129
+ </div>
130
+ <div class="col-sm-6 " :class="[$v.slice.required ? 'has-error' : 'has-success']">
131
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;片区&nbsp;&nbsp;&nbsp;</label>
132
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
133
+ v-validate:slice='{required: true }'>
134
+ <v-select :value.sync="model.slice_area" v-model="model.slice_area"
135
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
136
+ close-on-select v-ref:slice>
137
+ </v-select>
138
+ </div>
139
+
140
+ <div class="col-sm-6 "
141
+ :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
142
+ <label for="f_address" class="font_normal_body">起始楼号</label>
143
+ <input type="text" style="width:41%"
144
+ v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
145
+ v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
146
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
147
+ />
148
+ </div>
149
+ <div class="col-sm-6 "
150
+ :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
151
+ <label for="f_address" class="font_normal_body">截止楼号</label>
152
+ <input type="text" style="width:41%"
153
+ v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
154
+ v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
155
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
156
+ />
157
+ </div>
158
+ <div class="col-sm-6 "
159
+ :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
160
+ <label for="f_address" class="font_normal_body">起始单元</label>
161
+ <input type="text" style="width:41%"
162
+ v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
163
+ v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
164
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"
165
+ />
166
+ </div>
167
+ <div class="col-sm-6 "
168
+ :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
169
+ <label for="f_address" class="font_normal_body">截止单元</label>
170
+ <input type="text" style="width:41%"
171
+ v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
172
+ v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
173
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"
174
+ />
175
+ </div>
176
+ <div class="col-sm-6 "
177
+ :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
178
+ <label for="f_address" class="font_normal_body">起始楼层</label>
179
+ <input type="text" style="width:41%"
180
+ v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
181
+ v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
182
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"
183
+ />
184
+ </div>
185
+ <div class="col-sm-6 "
186
+ :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']"
187
+ >
188
+ <label for="f_address" class="font_normal_body">截止楼层</label>
189
+ <input type="text" style="width:41%" v-model="model.f_floor_end"
190
+ v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
191
+ class="input_search" placeholder="楼层"/>
192
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"
193
+ />
194
+ </div>
195
+ <div class="col-sm-6 "
196
+ :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
197
+ <label for="f_address" class="font_normal_body">起始门牌</label>
198
+ <input type="text" style="width:41%" v-model="model.f_room_start"
199
+ class="input_search" placeholder="门牌号"
200
+ v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
201
+ />
202
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"
203
+ />
204
+ </div>
205
+ <div class="col-sm-6 "
206
+ :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
207
+ <label for="f_address" class="font_normal_body">截止门牌</label>
208
+ <input type="text" style="width:41%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
209
+ v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
210
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"
211
+ />
212
+ </div>
213
+ <div class="col-sm-10 ">
214
+ <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
215
+ </div>
216
+
217
+ <div style="text-align:right;margin-top:6px;margin-right:50px;" class="col-sm-12">
218
+ <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
219
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
220
+ </div>
221
+ </div>
222
+ </div>
223
+ </validator>
224
+ </div>
225
+ </template>
226
+
227
+ <script>
228
+ import {HttpResetClass} from 'vue-client'
229
+
230
+
231
+ let getAreaConfig = async function (self) {
232
+ // 获取气价里面的配置
233
+ await self.$getConfig(self, 'UserAddress')
234
+ console.log('原地址配置',self.config)
235
+ console.log('获取地址配置',self.config)
236
+ Object.assign(self.model, self.config)
237
+ }
238
+
239
+ export default {
240
+ title: '用户地址添加',
241
+ data () {
242
+ return {
243
+ //初始化省市区数据
244
+ pcdslist:[],
245
+ //初始化街道数据
246
+ streetslist:[],
247
+ //初始化街道数据
248
+ areaslist:[],
249
+ config:{
250
+ f_building_suffix: '栋',
251
+ f_unit_suffix: '单元',
252
+ f_floor_suffix: '层',
253
+ f_room_suffix: '室'
254
+ },
255
+ model: {
256
+ f_pcd_id: '',
257
+ f_street_id: '',
258
+ f_residential_area_id: '',
259
+ f_pcd: '',
260
+ f_street: '',
261
+ f_residential_area: '',
262
+ f_slice_area: '',
263
+ f_building: '',
264
+ f_building_start: '',
265
+ f_building_end: '',
266
+ f_building_suffix: '',
267
+ f_unit: '',
268
+ f_unit_start: '',
269
+ f_unit_end: '',
270
+ f_unit_suffix: '',
271
+ f_floor: '',
272
+ f_floor_start: '',
273
+ f_floor_end: '',
274
+ f_floor_suffix: '',
275
+ f_room: '',
276
+ f_room_start: '',
277
+ f_room_end: '',
278
+ f_room_suffix: '',
279
+ //详细地址
280
+ f_address: '',
281
+ //单位名称
282
+ f_company: '',
283
+ //单位地址
284
+ f_company_address: '',
285
+ },
286
+ //判读是否为单个数据录入
287
+ onedata: 'one',
288
+ //选中所有地址
289
+ addresslist: [],
290
+ usertype:false,
291
+
292
+ // 公司信息
293
+ curorgid: [this.$login.f.orgid],
294
+
295
+ f_orgid: '',
296
+
297
+ sliceArea: []
298
+ }
299
+ },
300
+ props: ['f_filialeids', 'row','operation','usertype'],
301
+ ready(){
302
+ this.initdata()
303
+ getAreaConfig(this)
304
+ },
305
+ methods: {
306
+ async initdata(){
307
+ this.initAreas(this.f_filialeids)
308
+ await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
309
+ // this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
310
+ // this.initareas(` f_filialeid = '${this.f_filialeids}'`)
311
+ },
312
+
313
+ // 初始化片区
314
+ async initAreas (val) {
315
+ if (val) {
316
+ let getAllArea = await this.$resetpost('/rs/search', {
317
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
318
+ userid: this.$login.f.id
319
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
320
+
321
+ let arr = getAllArea.data.filter((res) => {
322
+ return res.parentid == val
323
+ })
324
+ console.log('过滤之后的片区', arr)
325
+ this.sliceArea = []
326
+ arr.forEach((res) => {
327
+ this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
328
+ })
329
+ }
330
+ },
331
+
332
+ //初始化省市区,添加街道
333
+ async initpcds(pconditon){
334
+ this.pcdslist = []
335
+ let HttpReset = new HttpResetClass()
336
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
337
+ data: {
338
+ items: '*',
339
+ tablename: 't_pcd',
340
+ orderitem: 'id',
341
+ condition: pconditon
342
+ }
343
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
344
+ let redata = []
345
+ req.data.forEach((row, n) => {
346
+ redata[n] = {
347
+ label: row.f_pcd,
348
+ value: row.id,
349
+ data:row,
350
+ id:row.id
351
+ }
352
+ })
353
+ this.pcdslist=redata
354
+ },
355
+ //初始化街道 添加小区
356
+ async initstreets(pconditon){
357
+ this.streetslist = []
358
+ let HttpReset = new HttpResetClass()
359
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
360
+ data: {
361
+ items: '*',
362
+ tablename: 't_street',
363
+ orderitem: 'id',
364
+ condition: pconditon
365
+ }
366
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
367
+ let redata = []
368
+ req.data.forEach((row, n) => {
369
+ redata[n] = {
370
+ label: row.f_street,
371
+ value: row.id,
372
+ data:row,
373
+ id:row.id
374
+ }
375
+ })
376
+ this.streetslist=redata
377
+ },
378
+ //初始化小区添加小区
379
+ async initareas(pconditon){
380
+ if(this.usertype){
381
+ pconditon=pconditon+` and f_special='1' `
382
+ }
383
+ this.areaslist = []
384
+ let HttpReset = new HttpResetClass()
385
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
386
+ data: {
387
+ items: '*',
388
+ tablename: 't_area',
389
+ orderitem: 'id',
390
+ condition: pconditon
391
+ }
392
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
393
+ let redata = []
394
+ req.data.forEach((row) => {
395
+ redata.push({
396
+ label: row.f_residential_area,
397
+ value: row.id,
398
+ data: row,
399
+ id: row.id
400
+ })
401
+ })
402
+ this.areaslist=redata
403
+ },
404
+ //省/市/区变化
405
+ async pcdChange(val){
406
+ console.log("省/市/区变化",val)
407
+ if(val){
408
+ //那就把[小区,街道]重新组织一下
409
+ await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
410
+ if(this.model.f_street_id){
411
+ if (this.findbyid(this.streetslist,this.model.f_street_id)) {
412
+ let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
413
+ if(pcd_id!=val){
414
+ this.model.f_street_id=''
415
+ }
416
+ } else {
417
+ this.model.f_street_id=''
418
+ }
419
+
420
+ //那就把[小区,街道]重新组织一下
421
+ if (this.model.f_street_id) {
422
+ await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
423
+ if(this.model.f_residential_area_id){
424
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
425
+ let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
426
+ if(pcd_id!=val){
427
+ this.model.f_residential_area_id=''
428
+ }
429
+ } else {
430
+ this.model.f_residential_area_id=''
431
+ }
432
+
433
+ }
434
+ }
435
+ }
436
+ }
437
+ this.$resetValidation()
438
+ },
439
+ //小区变化
440
+ areaChange(val){
441
+ console.log("小区变化",val, this.model)
442
+ if(val){
443
+ let getArea = this.areaslist.filter((res) => {
444
+ return res.id = this.model.f_residential_area_id
445
+ })
446
+ if (getArea.length > 0) {
447
+ console.log('获取小区数据', getArea[0].data)
448
+ this.model.slice_area = [{name: getArea[0].data.f_slice_area, code: getArea[0].data.f_area_code}]
449
+ }
450
+ }
451
+ this.$resetValidation()
452
+ },
453
+
454
+ //街道变化
455
+ async streetChange(val){
456
+ console.log("街道变化",val)
457
+ if(val){
458
+ //那就把[小区]重新组织一下
459
+ await this.initareas(` f_street_id ='${val}' `)
460
+ if(this.model.f_residential_area_id){
461
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
462
+ let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
463
+ if(street_id!=val){
464
+ this.model.f_residential_area_id=''
465
+ }
466
+ } else {
467
+ this.model.f_residential_area_id=''
468
+ }
469
+
470
+ }
471
+ }
472
+ this.$resetValidation()
473
+ },
474
+
475
+ getorg (val) {
476
+ this.f_orgid = val[0]
477
+ },
478
+
479
+ //处理批量地址信息
480
+ dealaddlist(){
481
+ try {
482
+ var resultlist=[]
483
+ for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
484
+ for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
485
+ for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
486
+ for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
487
+ //预备一个空的json
488
+ console.log('批量', this.model)
489
+ let data=Object.assign({},this.model)
490
+ data.f_create_person= this.$login.f.name
491
+ data.f_building=i
492
+ data.f_unit=j
493
+ data.f_floor=m
494
+ // 目前房号都按两位处理 如: 101室 201室 110室
495
+ if ((n+'').length == 1) {
496
+ data.f_room = m + '0' + n
497
+ } else {
498
+ data.f_room = m + '' + n
499
+ }
500
+ data.f_filialeid = this.f_filialeids
501
+ data.f_operator = this.$login.f.name
502
+ data.f_operatorid = this.$login.f.id
503
+ data.f_orgid = this.$login.f.orgid
504
+ data.f_orgname = this.$login.f.orgs
505
+ data.f_depid = this.$login.f.depids
506
+ data.f_depname = this.$login.f.deps
507
+ data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
508
+ data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
509
+ data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
510
+ data.f_address = data.f_street
511
+ + data.f_residential_area +
512
+ i + data.f_building_suffix
513
+ + j + data.f_unit_suffix
514
+ + m + data.f_floor_suffix
515
+ + data.f_room + data.f_room_suffix
516
+ if (this.model.slice_area) {
517
+ if (this.model.slice_area.length > 0) {
518
+ data.f_slice_area = this.model.slice_area[0].name
519
+ data.f_area_code = this.model.slice_area[0].code
520
+ }
521
+ }
522
+ resultlist.push(data)
523
+ }
524
+ }
525
+ }
526
+ }
527
+ this.addresslist=resultlist
528
+ } catch (e) {
529
+ console.log(e)
530
+ this.$showAlert('输出数据有误,请检查', 'warning', 2000)
531
+ }
532
+ },
533
+ //保存多个
534
+ async confirmall(){
535
+ this.dealaddlist()
536
+ if(this.addresslist.length>0){
537
+ let msg = {
538
+ resolveMsg: '地址保存成功',
539
+ rejectMsg: '地址保存失败'
540
+ }
541
+ this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
542
+ if (res === 'confirm') {
543
+ this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
544
+ this.cleardara()
545
+ this.$dispatch('confirm')
546
+ })
547
+ }
548
+ })
549
+ }
550
+ },
551
+ //保存
552
+ async confirm(){
553
+ if(this.onedata=='one'){
554
+ await this.saveonedata()
555
+ }
556
+ this.cleardara()
557
+ this.$dispatch('confirm')
558
+ },
559
+ //保存一户信息
560
+ async saveonedata(){
561
+ this.model.f_create_person= this.$login.f.name
562
+ this.model.f_filialeid = this.f_filialeids
563
+ this.model.f_operator = this.$login.f.name
564
+ this.model.f_operatorid = this.$login.f.id
565
+ this.model.f_orgid = this.$login.f.orgid
566
+ this.model.f_orgname = this.$login.f.orgs
567
+ this.model.f_depid = this.$login.f.depids
568
+ this.model.f_depname = this.$login.f.deps
569
+ if (this.model.slice_area) {
570
+ if (this.model.slice_area.length > 0) {
571
+ this.model.f_slice_area = this.model.slice_area[0].name
572
+ this.model.f_area_code = this.model.slice_area[0].code
573
+ }
574
+ }
575
+ if (this.usertype) {
576
+ //非民用
577
+ this.model.f_special='1'
578
+ this.model.f_building_suffix=''
579
+ this.model.f_unit_suffix=''
580
+ this.model.f_floor_suffix=''
581
+ this.model.f_room_suffix=''
582
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
583
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
584
+ this.model.f_address = this.model.f_street + this.model.f_address
585
+ } else {
586
+ //民用
587
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
588
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
589
+ this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
590
+ 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
591
+ }
592
+ await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
593
+ },
594
+ cancel(){
595
+ this.cleardara()
596
+ this.$dispatch('cancel')
597
+ },
598
+ cleardara(){
599
+ this.model= {
600
+ f_pcd_id: '',
601
+ f_street_id: '',
602
+ f_residential_area_id: '',
603
+ f_pcd: '',
604
+ f_street: '',
605
+ f_residential_area: '',
606
+ f_slice_area: '',
607
+ f_building: '',
608
+ f_building_start: '',
609
+ f_building_end: '',
610
+ f_building_suffix: this.config.f_building_suffix,
611
+ f_unit: '',
612
+ f_unit_start: '',
613
+ f_unit_end: '',
614
+ f_unit_suffix: this.config.f_unit_suffix,
615
+ f_floor: '',
616
+ f_floor_start: '',
617
+ f_floor_end: '',
618
+ f_floor_suffix: this.config.f_floor_suffix,
619
+ f_room: '',
620
+ f_room_start: '',
621
+ f_room_end: '',
622
+ f_room_suffix: this.config.f_room_suffix,
623
+ //详细地址
624
+ f_address: '',
625
+ //单位名称
626
+ f_company: '',
627
+ //单位地址
628
+ f_company_address: '',
629
+ }
630
+ // this.pcdslist = []
631
+ // this.streetslist = []
632
+ // this.areaslist = []
633
+ },
634
+
635
+ //根据名字找数据
636
+ findbyid(list,name){
637
+ var result
638
+ list.forEach((row, n) => {
639
+ if(name==row.value){
640
+ result= row.data
641
+ }
642
+ })
643
+ return result
644
+ },
645
+ },
646
+ watch: {
647
+ //分公司变化
648
+ 'f_filialeids'(){
649
+ if (this.model.f_filialeid) {
650
+ if (this.model.f_filialeid != this.f_filialeids) {
651
+ this.$dispatch('cancel')
652
+ }
653
+ }
654
+ this.cleardara()
655
+ this.initdata()
656
+ },
657
+ 'row'(){
658
+ this.onedata='one'
659
+ }
660
+ }
661
+ }
662
+ </script>