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