address-client 1.3.55 → 1.3.57-2

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