address-client 3.0.24 → 3.0.25-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.
@@ -1,737 +1,738 @@
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']">
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']">
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']">
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 " v-if="!usertype"
47
- :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
48
- <label class="font_normal_body">小区名称</label>
49
- <input type="text" style="width:41%" v-show="false" v-model="model.f_residential_area_id"
50
- v-validate:f_residential_area_id='{required: true }'>
51
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
52
- :options='areaslist' placeholder='请选择'
53
- @change="areaChange"
54
- close-on-select search="true">
55
- </v-select>
56
- </div>
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>
68
-
69
- <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
70
- <label class="font_normal_body">片&emsp;&emsp;区</label>
71
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
72
- v-validate:slice='{required: true }'>
73
- <v-select :value.sync="model.slice_area" v-model="model.slice_area"
74
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
75
- close-on-select v-ref:slice>
76
- </v-select>
77
- </div>
78
- <div v-if="!usertype" class="col-sm-6 form-group ">
79
- <label for="f_address" class="font_normal_body">楼&emsp;&emsp;号</label>
80
- <input type="text" style="width:40%" v-model="model.f_building" class="input_search"
81
- placeholder="楼号"/>
82
- <input type="text" style="width:20%" v-model="model.f_building_suffix" class="input_search"
83
- />
84
-
85
- </div>
86
- <div v-if="!usertype" class="col-sm-6 form-group ">
87
- <label for="f_address" class="font_normal_body">单&emsp;&emsp;元</label>
88
- <input type="text" style="width:40%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
89
- <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
90
- />
91
- </div>
92
- <div v-if="!usertype" class="col-sm-6 form-group ">
93
- <label for="f_address" class="font_normal_body">楼&emsp;&emsp;层</label>
94
- <input type="text" style="width:40%" v-model="model.f_floor" class="input_search"
95
- placeholder="楼层" />
96
- <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
97
- />
98
- </div>
99
- <div v-if="!usertype" class="col-sm-6 form-group "
100
- :class="[$v.f_room.required ? 'has-error' : 'has-success']">
101
- <label for="f_address" class="font_normal_body">门&ensp;牌&ensp;号</label>
102
- <input type="text" style="width:40%" v-model="model.f_room" class="input_search" placeholder="门牌号"
103
- v-validate:f_room='{required: true }'/>
104
- <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
105
- />
106
- </div>
107
- <div class="col-sm-6 form-group">
108
- <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>
130
-
131
- </div>
132
- <!--批量录入-->
133
- <div v-if="onedata=='more'" class="row">
134
- <div class="col-sm-6 form-group "
135
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
136
- <label class="font_normal_body">省&ensp;市&ensp;区</label>
137
- <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
138
- >
139
- <v-select :value.sync="model.f_pcd_id" :value-single="true"
140
- :options='pcdslist' placeholder='请选择'
141
- close-on-select search="true" @change="pcdChange" :disabled="!usertype">
142
- </v-select>
143
- </div>
144
- <div class="col-sm-6 form-group "
145
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
146
- <label class="font_normal_body">街&emsp;&emsp;道</label>
147
- <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
148
- >
149
- <v-select :value.sync="model.f_street_id" :value-single="true"
150
- :options='streetslist' placeholder='请选择'
151
- close-on-select search="true" :disabled="!usertype">
152
- </v-select>
153
- </div>
154
- <div class="col-sm-6 form-group "
155
- :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
156
- <label class="font_normal_body">小区名称</label>
157
- <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
158
- v-validate:f_residential_area_id='{required: true }'>
159
- <v-select :value.sync="model.f_residential_area_id" :value-single="true"
160
- @change="areaChange"
161
- :options='areaslist' placeholder='请选择'
162
- close-on-select search="true">
163
- </v-select>
164
- </div>
165
- <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
166
- <label class="font_normal_body">片&emsp;&emsp;区</label>
167
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
168
- v-validate:slice='{required: true }'>
169
- <v-select :value.sync="model.slice_area" v-model="model.slice_area"
170
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
171
- close-on-select v-ref:slice>
172
- </v-select>
173
- </div>
174
-
175
- <div class="col-sm-6 form-group "
176
- :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
177
- <label for="f_address" class="font_normal_body">起始楼号</label>
178
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
179
- <input type="text" style="width:25%"
180
- v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
181
- v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
182
- <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"/>
183
- </div>
184
- <div class="col-sm-6 form-group "
185
- :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
186
- <label for="f_address" class="font_normal_body">截止楼号</label>
187
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
188
- <input type="text" style="width:25%"
189
- v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
190
- v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
191
- <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
192
- />
193
- </div>
194
- <div class="col-sm-6 form-group "
195
- :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
196
- <label for="f_address" class="font_normal_body">起始单元</label>
197
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
198
- <input type="text" style="width:25%"
199
- v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
200
- v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
201
- <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search" />
202
- </div>
203
- <div class="col-sm-6 form-group "
204
- :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
205
- <label for="f_address" class="font_normal_body">截止单元</label>
206
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
207
- <input type="text" style="width:25%"
208
- v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
209
- v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
210
- <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"/>
211
- </div>
212
- <div class="col-sm-6 form-group "
213
- :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
214
- <label for="f_address" class="font_normal_body">起始楼层</label>
215
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
216
- <input type="text" style="width:25%"
217
- v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
218
- v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
219
- <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
220
- </div>
221
- <div class="col-sm-6 form-group "
222
- :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']">
223
- <label for="f_address" class="font_normal_body">截止楼层</label>
224
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
225
- <input type="text" style="width:25%" v-model="model.f_floor_end"
226
- v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
227
- class="input_search" placeholder="楼层"/>
228
- <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
229
- </div>
230
- <div class="col-sm-6 form-group "
231
- :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
232
- <label for="f_address" class="font_normal_body">起始门牌</label>
233
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
234
- <input type="text" style="width:25%" v-model="model.f_room_start"
235
- class="input_search" placeholder="门牌号"
236
- v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
237
- />
238
- <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
239
- </div>
240
- <div class="col-sm-6 form-group "
241
- :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
242
- <label for="f_address" class="font_normal_body">截止门牌</label>
243
- <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
244
- <input type="text" style="width:25%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
245
- v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
246
- <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
247
- </div>
248
- <div class="col-sm-10 form-group ">
249
- <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
250
- </div>
251
- <div class="col-sm-12 form-group">
252
- <label class="font_normal_body " style="margin-top:-20px">备&emsp;&emsp;注</label>
253
- <textarea class="input_textarea" rows="3" style="width:80%;height: auto;" v-model="model.f_comments"></textarea>
254
- </div>
255
- <div class="row">
256
- <div style="text-align:right;margin-top:20px;margin-right:50px;" class="col-sm-12">
257
- <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
258
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
259
- </div>
260
- </div>
261
- </div>
262
- </div>
263
- </validator>
264
- </div>
265
- </template>
266
-
267
- <script>
268
- import {HttpResetClass} from 'vue-client'
269
-
270
-
271
- let getAreaConfig = async function (self) {
272
- // 获取气价里面的配置
273
- await self.$getConfig(self, 'UserAddress')
274
- console.log('原地址配置',self.config)
275
- console.log('获取地址配置',self.config)
276
- Object.assign(self.model, self.config)
277
- }
278
-
279
- export default {
280
- title: '用户地址添加',
281
- data () {
282
- return {
283
- //初始化省市区数据
284
- pcdslist:[],
285
- //初始化街道数据
286
- streetslist:[],
287
- //初始化街道数据
288
- areaslist:[],
289
- config:{
290
- f_building_suffix: '号楼',
291
- f_unit_suffix: '单元',
292
- f_floor_suffix: '',
293
- f_room_suffix: ''
294
- },
295
- model: {
296
- f_pcd_id: '',
297
- f_street_id: '',
298
- f_comments:'',
299
- f_residential_area_id: '',
300
- f_pcd: '',
301
- f_street: '',
302
- f_residential_area: '',
303
- f_slice_area: '',
304
- f_building: '',
305
- f_building_start: '',
306
- f_building_end: '',
307
- f_building_suffix: '',
308
- f_unit: '',
309
- f_unit_start: '',
310
- f_unit_end: '',
311
- f_unit_suffix: '',
312
- f_floor: '',
313
- f_floor_start: '',
314
- f_floor_end: '',
315
- f_floor_suffix: '',
316
- f_room: '',
317
- f_room_start: '',
318
- f_room_end: '',
319
- f_room_suffix: '',
320
- //详细地址
321
- f_address: '',
322
- //单位名称
323
- f_company: '',
324
- //单位地址
325
- f_company_address: '',
326
- },
327
- //判读是否为单个数据录入
328
- onedata: 'one',
329
- //选中所有地址
330
- addresslist: [],
331
- usertype:false,
332
-
333
- // 公司信息
334
- curorgid: [this.$login.f.orgid],
335
-
336
- f_orgid: '',
337
-
338
- sliceArea: []
339
- }
340
- },
341
- props: ['f_filialeids', 'row','operation','usertype'],
342
- ready(){
343
- this.initdata()
344
- getAreaConfig(this)
345
- },
346
- methods: {
347
- 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}'`)
355
-
356
- },
357
-
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: '获取片区出错!!!'})
365
-
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
- })
374
- }
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
- }
419
- })
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
435
- }
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
453
- }
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
-
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}' `)
524
- if(this.model.f_residential_area_id){
525
- 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){
528
- this.model.f_residential_area_id=''
529
- }
530
- } else {
531
- this.model.f_residential_area_id=''
532
- }
533
-
534
- }
535
- }
536
- this.$resetValidation()
537
- },
538
-
539
- getorg (val) {
540
- this.f_orgid = val[0]
541
- },
542
-
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
637
- }
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
- } 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
655
- }
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
-
704
- //根据名字找数据
705
- findbyid(list,name){
706
- var result
707
- list.forEach((row, n) => {
708
- if(name==row.value){
709
- result= row.data
710
- }
711
- })
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
- }
722
- }
723
- this.cleardara()
724
- this.initdata()
725
- },
726
- 'row'(){
727
- this.onedata='one'
728
- }
729
- },
730
- computed: {
731
- //地址状态下拉框
732
- addresstate() {
733
- return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
734
- }
735
- }
736
- }
737
- </script>
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']">
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']">
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']">
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 " v-if="!usertype"
47
+ :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
48
+ <label class="font_normal_body">小区名称</label>
49
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_residential_area_id"
50
+ v-validate:f_residential_area_id='{required: true }'>
51
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
52
+ :options='areaslist' placeholder='请选择'
53
+ @change="areaChange"
54
+ close-on-select search="true">
55
+ </v-select>
56
+ </div>
57
+
58
+
59
+
60
+ <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
61
+ <label class="font_normal_body">片&emsp;&emsp;区</label>
62
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
63
+ v-validate:slice='{required: true }'>
64
+ <v-select :value.sync="model.slice_area" v-model="model.slice_area"
65
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
66
+ close-on-select v-ref:slice>
67
+ </v-select>
68
+ </div>
69
+ <div v-if="!usertype" class="col-sm-6 form-group ">
70
+ <label for="f_address" class="font_normal_body">楼&emsp;&emsp;号</label>
71
+ <input type="text" style="width:40%" v-model="model.f_building" class="input_search"
72
+ placeholder="楼号"/>
73
+ <input type="text" style="width:20%" v-model="model.f_building_suffix" class="input_search"
74
+ />
75
+
76
+ </div>
77
+ <div v-if="!usertype" class="col-sm-6 form-group ">
78
+ <label for="f_address" class="font_normal_body">单&emsp;&emsp;元</label>
79
+ <input type="text" style="width:40%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
80
+ <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
81
+ />
82
+ </div>
83
+ <div v-if="!usertype" class="col-sm-6 form-group ">
84
+ <label for="f_address" class="font_normal_body">楼&emsp;&emsp;层</label>
85
+ <input type="text" style="width:40%" v-model="model.f_floor" class="input_search"
86
+ placeholder="楼层" />
87
+ <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
88
+ />
89
+ </div>
90
+ <div v-if="!usertype" class="col-sm-6 form-group "
91
+ :class="[$v.f_room.required ? 'has-error' : 'has-success']">
92
+ <label for="f_address" class="font_normal_body">门&ensp;牌&ensp;号</label>
93
+ <input type="text" style="width:40%" v-model="model.f_room" class="input_search" placeholder="门牌号"
94
+ v-validate:f_room='{required: true }'/>
95
+ <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
96
+ />
97
+ </div>
98
+ <div class="col-sm-6 form-group">
99
+ <label class="font_normal_body">地址状态</label>
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>
121
+
122
+ </div>
123
+ <!--批量录入-->
124
+ <div v-if="onedata=='more'" class="row">
125
+ <div class="col-sm-6 form-group "
126
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
127
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
128
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
129
+ >
130
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
131
+ :options='pcdslist' placeholder='请选择'
132
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
133
+ </v-select>
134
+ </div>
135
+ <div class="col-sm-6 form-group "
136
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
137
+ <label class="font_normal_body">街&emsp;&emsp;道</label>
138
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
139
+ >
140
+ <v-select :value.sync="model.f_street_id" :value-single="true"
141
+ :options='streetslist' placeholder='请选择'
142
+ close-on-select search="true" :disabled="!usertype">
143
+ </v-select>
144
+ </div>
145
+ <div class="col-sm-6 form-group "
146
+ :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
147
+ <label class="font_normal_body">小区名称</label>
148
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
149
+ v-validate:f_residential_area_id='{required: true }'>
150
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
151
+ @change="areaChange"
152
+ :options='areaslist' placeholder='请选择'
153
+ close-on-select search="true">
154
+ </v-select>
155
+ </div>
156
+ <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
157
+ <label class="font_normal_body">片&emsp;&emsp;区</label>
158
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
159
+ v-validate:slice='{required: true }'>
160
+ <v-select :value.sync="model.slice_area" v-model="model.slice_area"
161
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
162
+ close-on-select v-ref:slice>
163
+ </v-select>
164
+ </div>
165
+
166
+ <div class="col-sm-6 form-group "
167
+ :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
168
+ <label for="f_address" class="font_normal_body">起始楼号</label>
169
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
170
+ <input type="text" style="width:25%"
171
+ v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
172
+ v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
173
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"/>
174
+ </div>
175
+ <div class="col-sm-6 form-group "
176
+ :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
177
+ <label for="f_address" class="font_normal_body">截止楼号</label>
178
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
179
+ <input type="text" style="width:25%"
180
+ v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
181
+ v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
182
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
183
+ />
184
+ </div>
185
+ <div class="col-sm-6 form-group "
186
+ :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
187
+ <label for="f_address" class="font_normal_body">起始单元</label>
188
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
189
+ <input type="text" style="width:25%"
190
+ v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
191
+ v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
192
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search" />
193
+ </div>
194
+ <div class="col-sm-6 form-group "
195
+ :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
196
+ <label for="f_address" class="font_normal_body">截止单元</label>
197
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
198
+ <input type="text" style="width:25%"
199
+ v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
200
+ v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
201
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"/>
202
+ </div>
203
+ <div class="col-sm-6 form-group "
204
+ :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
205
+ <label for="f_address" class="font_normal_body">起始楼层</label>
206
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
207
+ <input type="text" style="width:25%"
208
+ v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
209
+ v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
210
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
211
+ </div>
212
+ <div class="col-sm-6 form-group "
213
+ :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']">
214
+ <label for="f_address" class="font_normal_body">截止楼层</label>
215
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
216
+ <input type="text" style="width:25%" v-model="model.f_floor_end"
217
+ v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
218
+ class="input_search" placeholder="楼层"/>
219
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
220
+ </div>
221
+ <div class="col-sm-6 form-group "
222
+ :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
223
+ <label for="f_address" class="font_normal_body">起始门牌</label>
224
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
225
+ <input type="text" style="width:25%" v-model="model.f_room_start"
226
+ class="input_search" placeholder="门牌号"
227
+ v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
228
+ />
229
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
230
+ </div>
231
+ <div class="col-sm-6 form-group "
232
+ :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
233
+ <label for="f_address" class="font_normal_body">截止门牌</label>
234
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
235
+ <input type="text" style="width:25%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
236
+ v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
237
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
238
+ </div>
239
+ <div class="col-sm-10 form-group ">
240
+ <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
241
+ </div>
242
+ <div class="col-sm-12 form-group">
243
+ <label class="font_normal_body " style="margin-top:-20px">备&emsp;&emsp;注</label>
244
+ <textarea class="input_textarea" rows="3" style="width:80%;height: auto;" v-model="model.f_comments"></textarea>
245
+ </div>
246
+ <div class="row">
247
+ <div style="text-align:right;margin-top:20px;margin-right:50px;" class="col-sm-12">
248
+ <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
249
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
250
+ </div>
251
+ </div>
252
+ </div>
253
+ </div>
254
+ </validator>
255
+ </div>
256
+ </template>
257
+
258
+ <script>
259
+ import {HttpResetClass} from 'vue-client'
260
+
261
+
262
+ let getAreaConfig = async function (self) {
263
+ // 获取气价里面的配置
264
+ await self.$getConfig(self, 'UserAddress')
265
+ console.log('原地址配置',self.config)
266
+ console.log('获取地址配置',self.config)
267
+ Object.assign(self.model, self.config)
268
+ }
269
+
270
+ export default {
271
+ title: '用户地址添加',
272
+ data () {
273
+ return {
274
+ //初始化省市区数据
275
+ pcdslist:[],
276
+ //初始化街道数据
277
+ streetslist:[],
278
+ //初始化街道数据
279
+ areaslist:[],
280
+ config:{
281
+ f_building_suffix: '号楼',
282
+ f_unit_suffix: '单元',
283
+ f_floor_suffix: '层',
284
+ f_room_suffix: '室'
285
+ },
286
+ model: {
287
+ f_pcd_id: '',
288
+ f_street_id: '',
289
+ f_comments:'',
290
+ f_residential_area_id: '',
291
+ f_pcd: '',
292
+ f_street: '',
293
+ f_residential_area: '',
294
+ f_slice_area: '',
295
+ f_building: '',
296
+ f_building_start: '',
297
+ f_building_end: '',
298
+ f_building_suffix: '',
299
+ f_unit: '',
300
+ f_unit_start: '',
301
+ f_unit_end: '',
302
+ f_unit_suffix: '',
303
+ f_floor: '',
304
+ f_floor_start: '',
305
+ f_floor_end: '',
306
+ f_floor_suffix: '',
307
+ f_room: '',
308
+ f_room_start: '',
309
+ f_room_end: '',
310
+ f_room_suffix: '',
311
+ //详细地址
312
+ f_address: '',
313
+ //单位名称
314
+ f_company: '',
315
+ //单位地址
316
+ f_company_address: '',
317
+ },
318
+ //判读是否为单个数据录入
319
+ onedata: 'one',
320
+ //选中所有地址
321
+ addresslist: [],
322
+ usertype:false,
323
+
324
+ // 公司信息
325
+ curorgid: [this.$login.f.orgid],
326
+
327
+ f_orgid: '',
328
+
329
+ sliceArea: []
330
+ }
331
+ },
332
+ props: ['f_filialeids', 'row','operation','usertype'],
333
+ ready(){
334
+ this.initdata()
335
+ getAreaConfig(this)
336
+ },
337
+ methods: {
338
+ async initdata(){
339
+ this.model.f_address_state = ['已通气']
340
+ this.initAreas(this.f_filialeids)
341
+ // 添加特殊地址选省市区
342
+
343
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
344
+ this.initstreets(` f_filialeid = '${this.f_filialeids}' `)
345
+ this.initareas(` f_filialeid = '${this.f_filialeids}'`)
346
+
347
+ },
348
+
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}`
359
+ }
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}})
365
+ })
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=''
458
+ }
459
+ } else {
460
+ this.model.f_street_id=''
461
+ }
462
+
463
+ //那就把[小区,街道]重新组织一下
464
+ if (this.model.f_street_id) {
465
+ await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
466
+ if(this.model.f_residential_area_id){
467
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
468
+ let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
469
+ if(pcd_id!=val){
470
+ this.model.f_residential_area_id=''
471
+ }
472
+ } else {
473
+ this.model.f_residential_area_id=''
474
+ }
475
+
476
+ }
477
+ }
478
+ }
479
+ }
480
+ this.$resetValidation()
481
+ },
482
+ //小区变化
483
+ areaChange(val){
484
+ console.log("小区变化",val)
485
+
486
+ // 选择小区后级联出省市区和街道
487
+ let selectArea // 选中的小区数据
488
+ for (let row of this.areaslist) {
489
+ if (val == row.value) {
490
+ selectArea = row.data
491
+
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=''
531
+ }
532
+ } else {
533
+ this.model.f_residential_area_id=''
534
+ }
535
+
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
+ }
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')
612
+ })
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
+ }
723
+ }
724
+ this.cleardara()
725
+ this.initdata()
726
+ },
727
+ 'row'(){
728
+ this.onedata='one'
729
+ }
730
+ },
731
+ computed: {
732
+ //地址状态下拉框
733
+ addresstate() {
734
+ return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
735
+ }
736
+ }
737
+ }
738
+ </script>