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