address-client 3.2.4 → 3.2.5

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