address-client 3.0.26-aode → 3.0.26-qtx

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