address-client 3.0.25 → 3.0.26-aode

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.
@@ -15,7 +15,7 @@
15
15
  :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
16
16
  <label class="font_normal_body">省&ensp;市&ensp;区</label>
17
17
  <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id"
18
- >
18
+ >
19
19
  <v-select :value.sync="model.f_pcd_id" :value-single="true"
20
20
  :options='pcdslist' placeholder='请选择'
21
21
  close-on-select search="true" @change="pcdChange" :disabled="!usertype">
@@ -26,7 +26,7 @@
26
26
  :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
27
27
  <label class="font_normal_body">街道名称</label>
28
28
  <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id"
29
- >
29
+ >
30
30
  <v-select :value.sync="model.f_street_id" :value-single="true"
31
31
  :options='streetslist' placeholder='请选择'
32
32
  close-on-select search="true" :disabled="!usertype">
@@ -55,16 +55,7 @@
55
55
  </v-select>
56
56
  </div>
57
57
 
58
- <div class="col-sm-6 form-group " v-if="usertype"
59
- :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
60
- <label class="font_normal_body">小区名称</label>
61
- <input type="text" style="width:41%" v-show="false" v-model="model.f_residential_area_id"
62
- v-validate:f_residential_area_id='{required: true }'>
63
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
64
- :options='areaslist' placeholder='请选择'
65
- close-on-select search="true">
66
- </v-select>
67
- </div>
58
+
68
59
 
69
60
  <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
70
61
  <label class="font_normal_body">片&emsp;&emsp;区</label>
@@ -106,27 +97,27 @@
106
97
  </div>
107
98
  <div class="col-sm-6 form-group">
108
99
  <label class="font_normal_body">地址状态</label>
109
- <v-select :value.sync="model.f_address_state" :value-single="true"
110
- class="select_list select"
111
- condition="f_address_state = '{}'"
112
- :options='addresstate' placeholder='地址状态'
113
- close-on-select>
114
- </v-select>
115
- </div>
116
- <div v-if="usertype" class="col-sm-12 form-group "
117
- :class="[$v.f_address.required ? 'has-error' : 'has-success']">
118
- <label for="f_address" class="font_normal_body">详细地址</label>
119
- <input type="text" style="width:80%" v-model="model.f_address" class="input_search" placeholder="详细地址"
120
- v-validate:f_address='{required: true }'/>
121
- </div>
122
- <div class="col-sm-12 form-group">
123
- <label class="font_normal_body " >备&emsp;&emsp;注</label>
124
- <textarea class="input_textarea" rows="3" style="margin-top: 25px; width:80%;height: auto;" v-model="model.f_comments"></textarea>
125
- </div>
126
- <div style="text-align:right;margin-top:40px;margin-right:50px;" class="col-sm-12">
127
- <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
128
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
129
- </div>
100
+ <v-select :value.sync="model.f_address_state" :value-single="true"
101
+ class="select_list select"
102
+ condition="f_address_state = '{}'"
103
+ :options='addresstate' placeholder='地址状态'
104
+ close-on-select>
105
+ </v-select>
106
+ </div>
107
+ <div v-if="usertype" class="col-sm-12 form-group "
108
+ :class="[$v.f_address.required ? 'has-error' : 'has-success']">
109
+ <label for="f_address" class="font_normal_body">详细地址</label>
110
+ <input type="text" style="width:80%" v-model="model.f_address" class="input_search" placeholder="详细地址"
111
+ v-validate:f_address='{required: true }'/>
112
+ </div>
113
+ <div class="col-sm-12 form-group">
114
+ <label class="font_normal_body " >备&emsp;&emsp;注</label>
115
+ <textarea class="input_textarea" rows="3" style="margin-top: 25px; width:80%;height: auto;" v-model="model.f_comments"></textarea>
116
+ </div>
117
+ <div style="text-align:right;margin-top:40px;margin-right:50px;" class="col-sm-12">
118
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
119
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
120
+ </div>
130
121
 
131
122
  </div>
132
123
  <!--批量录入-->
@@ -135,7 +126,7 @@
135
126
  :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
136
127
  <label class="font_normal_body">省&ensp;市&ensp;区</label>
137
128
  <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
138
- >
129
+ >
139
130
  <v-select :value.sync="model.f_pcd_id" :value-single="true"
140
131
  :options='pcdslist' placeholder='请选择'
141
132
  close-on-select search="true" @change="pcdChange" :disabled="!usertype">
@@ -145,7 +136,7 @@
145
136
  :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
146
137
  <label class="font_normal_body">街&emsp;&emsp;道</label>
147
138
  <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
148
- >
139
+ >
149
140
  <v-select :value.sync="model.f_street_id" :value-single="true"
150
141
  :options='streetslist' placeholder='请选择'
151
142
  close-on-select search="true" :disabled="!usertype">
@@ -345,186 +336,137 @@
345
336
  },
346
337
  methods: {
347
338
  async initdata(){
348
- this.model.f_address_state = ['已通气']
349
- this.initAreas(this.f_filialeids)
350
- // 添加特殊地址选省市区
351
-
352
- this.initpcds(` f_orgid = '${this.f_filialeids}'`)
353
- this.initstreets(` f_orgid = '${this.f_filialeids}' `)
354
- this.initareas(` f_orgid = '${this.f_filialeids}'`)
339
+ this.model.f_address_state = ['已通气']
340
+ this.initAreas(this.f_filialeids)
341
+ // 添加特殊地址选省市区
355
342
 
356
- },
343
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
344
+ this.initstreets(` f_filialeid = '${this.f_filialeids}' `)
345
+ this.initareas(` f_filialeid = '${this.f_filialeids}'`)
357
346
 
358
- // 初始化片区
359
- async initAreas (val) {
360
- if (val) {
361
- let getAllArea = await this.$resetpost('/rs/search', {
362
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
363
- userid: this.$login.f.id
364
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
347
+ },
365
348
 
366
- let arr = getAllArea.data.filter((res) => {
367
- return res.parentid == val
368
- })
369
- console.log('过滤之后的片区', arr)
370
- this.sliceArea = []
371
- arr.forEach((res) => {
372
- this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
373
- })
349
+ // 初始化片区
350
+ async initAreas (val) {
351
+ if (val) {
352
+ this.sliceArea = [];
353
+ let getAllArea = await this.$resetpost('/rs/sql/address_singleTableOrderBy', {
354
+ data:{
355
+ items: '*',
356
+ tablename: 't_zone',
357
+ orderitem: 'id',
358
+ condition: ` parentid = ${val}`
374
359
  }
375
- },
376
- //初始化省市区,添加街道
377
- async initpcds(pconditon){
378
- this.pcdslist = []
379
- let HttpReset = new HttpResetClass()
380
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
381
- data: {
382
- items: '*',
383
- tablename: 't_pcd',
384
- orderitem: 'id',
385
- condition: pconditon
386
- }
387
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
388
- let redata = []
389
- req.data.forEach((row, n) => {
390
- redata[n] = {
391
- label: row.f_pcd,
392
- value: row.id,
393
- data:row,
394
- id:row.id
395
- }
396
- })
397
- this.pcdslist=redata
398
- },
399
- //初始化街道 添加小区
400
- async initstreets(pconditon){
401
- this.streetslist = []
402
- let HttpReset = new HttpResetClass()
403
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
404
- data: {
405
- items: '*',
406
- tablename: 't_street',
407
- orderitem: 'id',
408
- condition: pconditon
409
- }
410
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
411
- let redata = []
412
- req.data.forEach((row, n) => {
413
- redata[n] = {
414
- label: row.f_street,
415
- value: row.id,
416
- data:row,
417
- id:row.id
418
- }
360
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
361
+
362
+ if(getAllArea.data){
363
+ getAllArea.data.forEach((res) => {
364
+ this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
419
365
  })
420
- this.streetslist=redata
421
- },
422
- //初始化小区添加小区
423
- async initareas(pconditon){
424
- // if(this.usertype){
425
- // pconditon=pconditon+` and f_special='1' `
426
- // }
427
- this.areaslist = []
428
- let HttpReset = new HttpResetClass()
429
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
430
- data: {
431
- items: '*',
432
- tablename: 't_area',
433
- orderitem: 'id',
434
- condition: pconditon
366
+ }
367
+ }
368
+ },
369
+ //初始化省市区,添加街道
370
+ async initpcds(pconditon){
371
+ this.pcdslist = []
372
+ let HttpReset = new HttpResetClass()
373
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
374
+ data: {
375
+ items: '*',
376
+ tablename: 't_pcd',
377
+ orderitem: 'id',
378
+ condition: pconditon
379
+ }
380
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
381
+ let redata = []
382
+ req.data.forEach((row, n) => {
383
+ redata[n] = {
384
+ label: row.f_pcd,
385
+ value: row.id,
386
+ data:row,
387
+ id:row.id
388
+ }
389
+ })
390
+ this.pcdslist=redata
391
+ },
392
+ //初始化街道 添加小区
393
+ async initstreets(pconditon){
394
+ this.streetslist = []
395
+ let HttpReset = new HttpResetClass()
396
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
397
+ data: {
398
+ items: '*',
399
+ tablename: 't_street',
400
+ orderitem: 'id',
401
+ condition: pconditon
402
+ }
403
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
404
+ let redata = []
405
+ req.data.forEach((row, n) => {
406
+ redata[n] = {
407
+ label: row.f_street,
408
+ value: row.id,
409
+ data:row,
410
+ id:row.id
411
+ }
412
+ })
413
+ this.streetslist=redata
414
+ },
415
+ //初始化小区添加小区
416
+ async initareas(pconditon){
417
+ // if(this.usertype){
418
+ // pconditon=pconditon+` and f_special='1' `
419
+ // }
420
+ this.areaslist = []
421
+ let HttpReset = new HttpResetClass()
422
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
423
+ data: {
424
+ items: '*',
425
+ tablename: 't_area',
426
+ orderitem: 'id',
427
+ condition: pconditon
428
+ }
429
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
430
+ let redata = []
431
+ req.data.forEach((row) => {
432
+ redata.push({
433
+ label: row.f_residential_area,
434
+ value: row.id,
435
+ data: row,
436
+ id: row.id
437
+ })
438
+ })
439
+ this.areaslist=redata
440
+ },
441
+ //省/市/区变化
442
+ async pcdChange(val){
443
+ // 只有添加特殊地址时才级联
444
+ if (!this.usertype) {
445
+ return
446
+ }else{
447
+ this.model.f_address=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
448
+ }
449
+ console.log("省/市/区变化",val)
450
+ if(val){
451
+ //那就把[小区,街道]重新组织一下
452
+ await this.initstreets(` f_pcd_id ='${val}' `)
453
+ if(this.model.f_street_id){
454
+ if (this.findbyid(this.streetslist,this.model.f_street_id)) {
455
+ let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
456
+ if(pcd_id!=val){
457
+ this.model.f_street_id=''
435
458
  }
436
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
437
- let redata = []
438
- req.data.forEach((row) => {
439
- redata.push({
440
- label: row.f_residential_area,
441
- value: row.id,
442
- data: row,
443
- id: row.id
444
- })
445
- })
446
- this.areaslist=redata
447
- },
448
- //省/市/区变化
449
- async pcdChange(val){
450
- // 只有添加特殊地址时才级联
451
- if (!this.usertype) {
452
- return
459
+ } else {
460
+ this.model.f_street_id=''
453
461
  }
454
- console.log("省/市/区变化",val)
455
- if(val){
456
- //那就把[小区,街道]重新组织一下
457
- await this.initstreets(` f_pcd_id ='${val}' `)
458
- if(this.model.f_street_id){
459
- if (this.findbyid(this.streetslist,this.model.f_street_id)) {
460
- let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
461
- if(pcd_id!=val){
462
- this.model.f_street_id=''
463
- }
464
- } else {
465
- this.model.f_street_id=''
466
- }
467
-
468
- //那就把[小区,街道]重新组织一下
469
- if (this.model.f_street_id) {
470
- await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
471
- if(this.model.f_residential_area_id){
472
- if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
473
- let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
474
- if(pcd_id!=val){
475
- this.model.f_residential_area_id=''
476
- }
477
- } else {
478
- this.model.f_residential_area_id=''
479
- }
480
462
 
481
- }
482
- }
483
- }
484
- }
485
- this.$resetValidation()
486
- },
487
- //小区变化
488
- areaChange(val){
489
- console.log("小区变化",val)
490
- // 选择小区后级联出省市区和街道
491
- let selectArea // 选中的小区数据
492
- for (let row of this.areaslist) {
493
- if (val == row.value) {
494
- selectArea = row.data
495
- break
496
- }
497
- }
498
- if (selectArea) {
499
- this.model.f_street_id = selectArea.f_street_id
500
- this.model.f_pcd_id = selectArea.f_pcd_id
501
- this.initstreets(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_street_id}' `)
502
- this.initpcds(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_pcd_id}' `)
503
- this.model.slice_area = [{name: selectArea.f_slice_area, code: selectArea.f_area_code}]
504
- }
505
- this.$nextTick(() => {
506
- this.$resetValidation()
507
- })
508
- },
509
- //街道变化
510
- async streetChange(val){
511
- console.log("街道变化",val)
512
- if(this.streetslist[0]) {
513
- var street=''
514
- this.streetslist.forEach((item)=>{
515
- if(item.id===val){
516
- street=item.label
517
- }
518
- })
519
- this.model.f_address = street
520
- }
521
- if(val){
522
- //那就把[小区]重新组织一下
523
- await this.initareas(` f_street_id ='${val}' `)
463
+ //那就把[小区,街道]重新组织一下
464
+ if (this.model.f_street_id) {
465
+ await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
524
466
  if(this.model.f_residential_area_id){
525
467
  if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
526
- let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
527
- if(street_id!=val){
468
+ let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
469
+ if(pcd_id!=val){
528
470
  this.model.f_residential_area_id=''
529
471
  }
530
472
  } else {
@@ -533,205 +475,264 @@
533
475
 
534
476
  }
535
477
  }
536
- this.$resetValidation()
537
- },
478
+ }
479
+ }
480
+ this.$resetValidation()
481
+ },
482
+ //小区变化
483
+ areaChange(val){
484
+ console.log("小区变化",val)
538
485
 
539
- getorg (val) {
540
- this.f_orgid = val[0]
541
- },
486
+ // 选择小区后级联出省市区和街道
487
+ let selectArea // 选中的小区数据
488
+ for (let row of this.areaslist) {
489
+ if (val == row.value) {
490
+ selectArea = row.data
542
491
 
543
- //处理批量地址信息
544
- dealaddlist(){
545
- try {
546
- var resultlist=[]
547
- for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
548
- for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
549
- for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
550
- for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
551
- //预备一个空的json
552
- console.log('批量', this.model)
553
- let data=Object.assign({},this.model)
554
- data.f_create_person= this.$login.f.name
555
- data.f_building= data.f_building_prefix + i
556
- data.f_unit= data.f_unit_prefix + j
557
- data.f_floor= data.f_floor_prefix + m
558
- // 目前房号都按两位处理 如: 101室 201室 110室
559
- if ((n+'').length == 1) {
560
- data.f_room = data.f_room_prefix + m + '0' + n
561
- } else {
562
- data.f_room = data.f_room_prefix + m + '' + n
563
- }
564
- data.f_filialeid = this.f_filialeids
565
- data.f_operator = this.$login.f.name
566
- data.f_operatorid = this.$login.f.id
567
- data.f_orgid = this.$login.f.orgid
568
- data.f_orgname = this.$login.f.orgs
569
- data.f_depid = this.$login.f.depids
570
- data.f_depname = this.$login.f.deps
571
- data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
572
- data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
573
- data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
574
- data.f_address = data.f_street
575
- + data.f_residential_area +
576
- data.f_building + data.f_building_suffix
577
- + data.f_unit + data.f_unit_suffix
578
- + data.f_floor + data.f_floor_suffix
579
- + data.f_room + data.f_room_suffix
580
- if (this.model.slice_area) {
581
- if (this.model.slice_area.length > 0) {
582
- data.f_slice_area = this.model.slice_area[0].name
583
- data.f_area_code = this.model.slice_area[0].code
584
- }
585
- }
586
- resultlist.push(data)
587
- }
588
- }
589
- }
590
- }
591
- this.addresslist=resultlist
592
- } catch (e) {
593
- console.log(e)
594
- this.$showAlert('输出数据有误,请检查', 'warning', 2000)
595
- }
596
- },
597
- //保存多个
598
- async confirmall(){
599
- this.dealaddlist()
600
- if(this.addresslist.length>0){
601
- let msg = {
602
- resolveMsg: '地址保存成功',
603
- rejectMsg: '地址保存失败'
604
- }
605
- this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
606
- if (res === 'confirm') {
607
- this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
608
- this.cleardara()
609
- this.$dispatch('confirm')
610
- })
611
- }
612
- })
613
- }
614
- },
615
- //保存
616
- async confirm(){
617
- if(this.onedata=='one'){
618
- await this.saveonedata()
619
- }
620
- this.cleardara()
621
- this.$dispatch('confirm')
622
- },
623
- //保存一户信息
624
- async saveonedata(){
625
- this.model.f_create_person= this.$login.f.name
626
- this.model.f_filialeid = this.f_filialeids
627
- this.model.f_operator = this.$login.f.name
628
- this.model.f_operatorid = this.$login.f.id
629
- this.model.f_orgid = this.$login.f.orgid
630
- this.model.f_orgname = this.$login.f.orgs
631
- this.model.f_depid = this.$login.f.depids
632
- this.model.f_depname = this.$login.f.deps
633
- if (this.model.slice_area) {
634
- if (this.model.slice_area.length > 0) {
635
- this.model.f_slice_area = this.model.slice_area[0].name
636
- this.model.f_area_code = this.model.slice_area[0].code
492
+ break
493
+ }
494
+ }
495
+ if (selectArea) {
496
+ this.model.f_street_id = selectArea.f_street_id
497
+ this.model.f_pcd_id = selectArea.f_pcd_id
498
+ this.initstreets(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_street_id}' `)
499
+ this.initpcds(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_pcd_id}' `)
500
+ this.model.slice_area = [{name: selectArea.f_slice_area, code: selectArea.f_area_code}]
501
+ }
502
+ this.$nextTick(() => {
503
+ this.$resetValidation()
504
+ })
505
+ },
506
+ //街道变化
507
+ async streetChange(val){
508
+ console.log("街道变化",val)
509
+ if(this.streetslist[0]) {
510
+ var street=''
511
+ this.streetslist.forEach((item)=>{
512
+ if(item.id===val){
513
+ street=item.label
514
+ }
515
+ })
516
+ if(this.usertype && this.findbyid(this.pcdslist,this.model.f_pcd_id)!= null){
517
+ this.model.f_address =this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd+street
518
+ }else{
519
+ this.model.f_address = street
520
+ }
521
+
522
+ }
523
+ if(val){
524
+ //那就把[小区]重新组织一下
525
+ await this.initareas(` f_street_id ='${val}' `)
526
+ if(this.model.f_residential_area_id){
527
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
528
+ let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
529
+ if(street_id!=val){
530
+ this.model.f_residential_area_id=''
637
531
  }
638
- }
639
- if (this.usertype) {
640
- //非民用
641
- this.model.f_special='1'
642
- this.model.f_building_suffix=''
643
- this.model.f_unit_suffix=''
644
- this.model.f_floor_suffix=''
645
- this.model.f_room_suffix=''
646
- this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
647
- this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
648
- this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
649
532
  } else {
650
- //民用
651
- this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
652
- this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
653
- this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
654
- 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
533
+ this.model.f_residential_area_id=''
655
534
  }
656
- await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
657
- },
658
- cancel(){
659
- this.cleardara()
660
- this.$dispatch('cancel')
661
- },
662
- cleardara(){
663
- this.model= {
664
- f_pcd_id: '',
665
- f_street_id: '',
666
- f_residential_area_id: '',
667
- f_pcd: '',
668
- f_comments:'',
669
- f_street: '',
670
- f_residential_area: '',
671
- f_slice_area: '',
672
- f_building: '',
673
- f_building_start: '',
674
- f_building_end: '',
675
- f_building_prefix: '',
676
- f_building_suffix: this.config.f_building_suffix,
677
- f_unit: '',
678
- f_unit_start: '',
679
- f_unit_end: '',
680
- f_unit_prefix: '',
681
- f_unit_suffix: this.config.f_unit_suffix,
682
- f_floor: '',
683
- f_floor_start: '',
684
- f_floor_end: '',
685
- f_floor_prefix: '',
686
- f_floor_suffix: this.config.f_floor_suffix,
687
- f_room: '',
688
- f_room_start: '',
689
- f_room_end: '',
690
- f_room_prefix: '',
691
- f_room_suffix: this.config.f_room_suffix,
692
- //详细地址
693
- f_address: '',
694
- //单位名称
695
- f_company: '',
696
- //单位地址
697
- f_company_address: '',
698
- }
699
- // this.pcdslist = []
700
- // this.streetslist = []
701
- // this.areaslist = []
702
- },
703
535
 
704
- //根据名字找数据
705
- findbyid(list,name){
706
- var result
707
- list.forEach((row, n) => {
708
- if(name==row.value){
709
- result= row.data
536
+ }
537
+ }
538
+ this.$resetValidation()
539
+ },
540
+
541
+ getorg (val) {
542
+ this.f_orgid = val[0]
543
+ },
544
+
545
+ //处理批量地址信息
546
+ dealaddlist(){
547
+ try {
548
+ var resultlist=[]
549
+ for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
550
+ for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
551
+ for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
552
+ for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
553
+ //预备一个空的json
554
+ console.log('批量', this.model)
555
+ let data=Object.assign({},this.model)
556
+ data.f_create_person= this.$login.f.name
557
+ data.f_building= data.f_building_prefix + i
558
+ data.f_unit= data.f_unit_prefix + j
559
+ data.f_floor= data.f_floor_prefix + m
560
+ // 目前房号都按两位处理 如: 101室 201室 110室
561
+ if ((n+'').length == 1) {
562
+ data.f_room = data.f_room_prefix + m + '0' + n
563
+ } else {
564
+ data.f_room = data.f_room_prefix + m + '' + n
565
+ }
566
+ data.f_filialeid = this.f_filialeids
567
+ data.f_operator = this.$login.f.name
568
+ data.f_operatorid = this.$login.f.id
569
+ data.f_orgid = this.$login.f.orgid
570
+ data.f_orgname = this.$login.f.orgs
571
+ data.f_depid = this.$login.f.depids
572
+ data.f_depname = this.$login.f.deps
573
+ data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
574
+ data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
575
+ data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
576
+ data.f_address = data.f_street
577
+ + data.f_residential_area +
578
+ data.f_building + data.f_building_suffix
579
+ + data.f_unit + data.f_unit_suffix
580
+ + data.f_floor + data.f_floor_suffix
581
+ + data.f_room + data.f_room_suffix
582
+ if (this.model.slice_area) {
583
+ if (this.model.slice_area.length > 0) {
584
+ data.f_slice_area = this.model.slice_area[0].name
585
+ data.f_area_code = this.model.slice_area[0].code
586
+ }
587
+ }
588
+ resultlist.push(data)
589
+ }
710
590
  }
591
+ }
592
+ }
593
+ this.addresslist=resultlist
594
+ } catch (e) {
595
+ console.log(e)
596
+ this.$showAlert('输出数据有误,请检查', 'warning', 2000)
597
+ }
598
+ },
599
+ //保存多个
600
+ async confirmall(){
601
+ this.dealaddlist()
602
+ if(this.addresslist.length>0){
603
+ let msg = {
604
+ resolveMsg: '地址保存成功',
605
+ rejectMsg: '地址保存失败'
606
+ }
607
+ this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
608
+ if (res === 'confirm') {
609
+ this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
610
+ this.cleardara()
611
+ this.$dispatch('confirm')
711
612
  })
712
- return result
713
- },
714
- },
715
- watch: {
716
- //分公司变化
717
- 'f_filialeids'(){
718
- if (this.model.f_filialeid) {
719
- if (this.model.f_filialeid != this.f_filialeids) {
720
- this.$dispatch('cancel')
721
- }
613
+ }
614
+ })
615
+ }
616
+ },
617
+ //保存
618
+ async confirm(){
619
+ if(this.onedata=='one'){
620
+ await this.saveonedata()
621
+ }
622
+ this.cleardara()
623
+ this.$dispatch('confirm')
624
+ },
625
+ //保存一户信息
626
+ async saveonedata(){
627
+ this.model.f_create_person= this.$login.f.name
628
+ this.model.f_filialeid = this.f_filialeids
629
+ this.model.f_operator = this.$login.f.name
630
+ this.model.f_operatorid = this.$login.f.id
631
+ this.model.f_orgid = this.$login.f.orgid
632
+ this.model.f_orgname = this.$login.f.orgs
633
+ this.model.f_depid = this.$login.f.depids
634
+ this.model.f_depname = this.$login.f.deps
635
+ if (this.model.slice_area) {
636
+ if (this.model.slice_area.length > 0) {
637
+ this.model.f_slice_area = this.model.slice_area[0].name
638
+ this.model.f_area_code = this.model.slice_area[0].code
639
+ }
640
+ }
641
+ if (this.usertype) {
642
+ //非民用
643
+ this.model.f_special='1'
644
+ this.model.f_building_suffix=''
645
+ this.model.f_unit_suffix=''
646
+ this.model.f_floor_suffix=''
647
+ this.model.f_room_suffix=''
648
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
649
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
650
+ } else {
651
+ //民用
652
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
653
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
654
+ this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
655
+ 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
656
+ }
657
+ await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
658
+ },
659
+ cancel(){
660
+ this.cleardara()
661
+ this.$dispatch('cancel')
662
+ },
663
+ cleardara(){
664
+ this.model= {
665
+ f_pcd_id: '',
666
+ f_street_id: '',
667
+ f_residential_area_id: '',
668
+ f_pcd: '',
669
+ f_comments:'',
670
+ f_street: '',
671
+ f_residential_area: '',
672
+ f_slice_area: '',
673
+ f_building: '',
674
+ f_building_start: '',
675
+ f_building_end: '',
676
+ f_building_prefix: '',
677
+ f_building_suffix: this.config.f_building_suffix,
678
+ f_unit: '',
679
+ f_unit_start: '',
680
+ f_unit_end: '',
681
+ f_unit_prefix: '',
682
+ f_unit_suffix: this.config.f_unit_suffix,
683
+ f_floor: '',
684
+ f_floor_start: '',
685
+ f_floor_end: '',
686
+ f_floor_prefix: '',
687
+ f_floor_suffix: this.config.f_floor_suffix,
688
+ f_room: '',
689
+ f_room_start: '',
690
+ f_room_end: '',
691
+ f_room_prefix: '',
692
+ f_room_suffix: this.config.f_room_suffix,
693
+ //详细地址
694
+ f_address: '',
695
+ //单位名称
696
+ f_company: '',
697
+ //单位地址
698
+ f_company_address: '',
699
+ }
700
+ // this.pcdslist = []
701
+ // this.streetslist = []
702
+ // this.areaslist = []
703
+ },
704
+
705
+ //根据名字找数据
706
+ findbyid(list,name){
707
+ var result
708
+ list.forEach((row, n) => {
709
+ if(name==row.value){
710
+ result= row.data
711
+ }
712
+ })
713
+ return result
714
+ },
715
+ },
716
+ watch: {
717
+ //分公司变化
718
+ 'f_filialeids'(){
719
+ if (this.model.f_filialeid) {
720
+ if (this.model.f_filialeid != this.f_filialeids) {
721
+ this.$dispatch('cancel')
722
722
  }
723
- this.cleardara()
724
- this.initdata()
725
- },
726
- 'row'(){
727
- this.onedata='one'
728
723
  }
724
+ this.cleardara()
725
+ this.initdata()
729
726
  },
730
- computed: {
731
- //地址状态下拉框
732
- addresstate() {
733
- return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
734
- }
727
+ 'row'(){
728
+ this.onedata='one'
735
729
  }
730
+ },
731
+ computed: {
732
+ //地址状态下拉框
733
+ addresstate() {
734
+ return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
735
+ }
736
+ }
736
737
  }
737
738
  </script>