address-client 3.2.8 → 3.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,932 @@
1
+ <template>
2
+ <div class="auto" id="userAddress" 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&&!config.hasnumber">
7
+ <input type="radio" id="true" value="one" v-model="onedata">
8
+ <label for="true">单户</label>
9
+ <input type="radio" id="false" value="more" v-model="onedata">
10
+ <label for="false">多户</label>
11
+ </div>
12
+ <!--单个录入-->
13
+ <div v-if="onedata=='one'" class="row">
14
+ <div class="col-sm-6 form-group "
15
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']" v-if="!usertype">
16
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
17
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id"
18
+ >
19
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
20
+ :options='pcdslist' placeholder='请选择'
21
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
22
+ </v-select>
23
+ </div>
24
+ <div class="col-sm-6 form-group "
25
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']" v-if="usertype">
26
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
27
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_pcd_id" v-validate:f_pcd_id='{required: true }'
28
+ >
29
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
30
+ :options='pcdslist' placeholder='请选择'
31
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
32
+ </v-select>
33
+ </div>
34
+
35
+ <div class="col-sm-6 form-group " v-if="!usertype"
36
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
37
+ <label class="font_normal_body">街道/乡镇</label>
38
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id"
39
+ >
40
+ <v-select :value.sync="model.f_street_id" :value-single="true"
41
+ :options='streetslist' placeholder='请选择'
42
+ close-on-select search="true" :disabled="!usertype">
43
+ </v-select>
44
+ </div>
45
+ <div class="col-sm-6 form-group " v-if="usertype"
46
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
47
+ <label class="font_normal_body">街道/乡镇</label>
48
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_street_id" v-validate:f_street_id='{required: true }'
49
+ >
50
+ <v-select :value.sync="model.f_street_id" :value-single="true"
51
+ :options='streetslist' placeholder='请选择'
52
+ @change="streetChange"
53
+ close-on-select search="true" :disabled="!usertype">
54
+ </v-select>
55
+ </div>
56
+ <div class="col-sm-6 form-group " v-if="!usertype"
57
+ :class="[$v.f_residential_area_id1.required ? 'has-error' : 'has-success']">
58
+ <label class="font_normal_body">小区名称</label>
59
+ <input type="text" style="width:41%" v-show="false" v-model="model.f_residential_area_id"
60
+ v-validate:f_residential_area_id1='{required: true }'>
61
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
62
+ :options='areaslist' placeholder='请选择'
63
+ @change="areaChange"
64
+ close-on-select search="true">
65
+ </v-select>
66
+ </div>
67
+
68
+ <div class="col-sm-6 form-group " v-if="usertype">
69
+ <label class="font_normal_body">小区名称</label>
70
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
71
+ :options='areaslist' placeholder='请选择'
72
+ @change="areaChange"
73
+ close-on-select search="true">
74
+ </v-select>
75
+ </div>
76
+
77
+ <div class="col-sm-6 form-group " :class="[$v.slice_area1.required ? 'has-error' : 'has-success']">
78
+ <label class="font_normal_body">片&emsp;&emsp;区</label>
79
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
80
+ v-validate:slice_area1='{required: true }'>
81
+ <v-select :value.sync="model.slice_area[0].name" v-model="model.slice_area[0].name" :value-single="true"
82
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
83
+ close-on-select v-ref:slice>
84
+ </v-select>
85
+ </div>
86
+ <div class="col-sm-6 form-group " v-if="!usertype">
87
+ <label class="font_normal_body">地区类型</label>
88
+ <v-select
89
+ :value.sync="model.f_iscity" :value-single="true"
90
+ :options='iscity' placeholder='请选择'
91
+ @change="changecity"
92
+ close-on-select>
93
+ </v-select>
94
+ </div>
95
+ <div v-if="!usertype" class="col-sm-6 form-group" :class="[$v.f_building_id.required ? 'has-error' : 'has-success']">
96
+ <label class="font_normal_body">楼&emsp;&emsp;号</label>
97
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.f_building_id.selectedItems" v-validate:f_building_id='{required: true }'>
98
+ <v-select :value.sync="model.f_building_id" v-model="model.f_building_id" :value-single="true"
99
+ :options='buildingList' placeholder='楼号' close-on-select v-ref:f_building_id>
100
+ </v-select>
101
+ </div>
102
+ <div v-if="!usertype" class="col-sm-6 form-group ">
103
+ <label for="f_address" class="font_normal_body">单&emsp;&emsp;元</label>
104
+ <input type="text" style="width:40%" v-model="model.f_unit" class="input_search" placeholder="单元"/>
105
+ <input type="text" style="width:20%" v-model="model.f_unit_suffix" class="input_search"
106
+ />
107
+ </div>
108
+ <div v-if="!usertype" class="col-sm-6 form-group ">
109
+ <label for="f_address" class="font_normal_body">楼&emsp;&emsp;层</label>
110
+ <input type="text" style="width:40%" v-model="model.f_floor" class="input_search"
111
+ placeholder="楼层" />
112
+ <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
113
+ />
114
+ </div>
115
+ <div v-if="!usertype" class="col-sm-6 form-group "
116
+ :class="[$v.f_room.required ? 'has-error' : 'has-success']">
117
+ <label for="f_address" class="font_normal_body">门&ensp;牌&ensp;号</label>
118
+ <input type="text" style="width:40%" v-model="model.f_room" class="input_search" placeholder="门牌号"
119
+ v-validate:f_room='{required: true }'/>
120
+ <input type="text" style="width:20%" v-model="model.f_room_suffix" class="input_search"
121
+ />
122
+ </div>
123
+ <div class="col-sm-6 form-group">
124
+ <label class="font_normal_body">地址状态</label>
125
+ <v-select :value.sync="model.f_address_state" :value-single="true"
126
+ class="select_list select"
127
+ condition="f_address_state = '{}'"
128
+ :options='addresstate' placeholder='地址状态'
129
+ close-on-select>
130
+ </v-select>
131
+ </div>
132
+ <div v-if="!usertype" class="col-sm-8 form-group ">
133
+ <label class="font_normal_body">经&ensp;纬&ensp;度</label>
134
+ <input type="text" style="width:30%" v-model="model.f_lng" class="input_search" placeholder="经度"/>
135
+ <input type="text" style="width:30%" v-model="model.f_lat" class="input_search" placeholder="纬度"/>
136
+ &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
137
+ </div>
138
+
139
+ <div v-if="usertype" class="col-sm-12 form-group "
140
+ :class="[$v.f_address.required ? 'has-error' : 'has-success']">
141
+ <label for="f_address" class="font_normal_body">详细地址</label>
142
+ <input type="text" style="width:80%" v-model="model.f_address" class="input_search" placeholder="详细地址"
143
+ v-validate:f_address='{required: true }'/>
144
+ </div>
145
+ <div v-if="usertype" class="col-sm-8 form-group ">
146
+ <label class="font_normal_body">经&ensp;纬&ensp;度</label>
147
+ <input type="text" style="width:30%" v-model="model.f_lng" class="input_search" placeholder="经度"/>
148
+ <input type="text" style="width:30%" v-model="model.f_lat" class="input_search" placeholder="纬度"/>
149
+ &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
150
+ </div>
151
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
152
+ :class="[$v.f_standard_number.required ? 'has-error' : 'has-success']">
153
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;规范号</label>
154
+ <input type="text" v-model="model.f_standard_number"
155
+ @change="standardyanzheng"
156
+ class="input_search" style="width:60%" placeholder="地址规范号"
157
+ v-validate:f_standard_number='{required: true }'>
158
+ </div>
159
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
160
+ :class="[$v.f_contracts_number.required ? 'has-error' : 'has-success']">
161
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;合同号</label>
162
+ <input type="text" v-model="model.f_contracts_number"
163
+ @change="contractsyanzheng"
164
+ class="input_search" style="width:60%" placeholder="合同顺序号"
165
+ v-validate:f_contracts_number='{required: true }'>
166
+ </div>
167
+ <div class="col-sm-12 form-group">
168
+ <label class="font_normal_body " >备&emsp;&emsp;注</label>
169
+ <textarea class="input_textarea" rows="3" style="margin-top: 25px; width:80%;height: auto;" v-model="model.f_comments"></textarea>
170
+ </div>
171
+ <div style="text-align:right;margin-top:40px;margin-right:50px;" class="col-sm-12">
172
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
173
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
174
+ </div>
175
+
176
+ </div>
177
+ <!--批量录入-->
178
+ <div v-if="onedata=='more'" class="row">
179
+ <div class="col-sm-6 form-group "
180
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
181
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
182
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_pcd_id"
183
+ >
184
+ <v-select :value.sync="model.f_pcd_id" :value-single="true"
185
+ :options='pcdslist' placeholder='请选择'
186
+ close-on-select search="true" @change="pcdChange" :disabled="!usertype">
187
+ </v-select>
188
+ </div>
189
+ <div class="col-sm-6 form-group "
190
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
191
+ <label class="font_normal_body">街&emsp;&emsp;道</label>
192
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_street_id"
193
+ >
194
+ <v-select :value.sync="model.f_street_id" :value-single="true"
195
+ :options='streetslist' placeholder='请选择'
196
+ close-on-select search="true" :disabled="!usertype">
197
+ </v-select>
198
+ </div>
199
+ <div class="col-sm-6 form-group "
200
+ :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
201
+ <label class="font_normal_body">小区名称</label>
202
+ <input type="text" style="width:60%" v-show="false" v-model="model.f_residential_area_id"
203
+ v-validate:f_residential_area_id='{required: true }'>
204
+ <v-select :value.sync="model.f_residential_area_id" :value-single="true"
205
+ @change="areaChange"
206
+ :options='areaslist' placeholder='请选择'
207
+ close-on-select search="true">
208
+ </v-select>
209
+ </div>
210
+ <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">
211
+ <label class="font_normal_body">片&emsp;&emsp;区</label>
212
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
213
+ v-validate:slice='{required: true }'>
214
+ <v-select :value.sync="model.slice_area[0].name" v-model="model.slice_area[0].name" :value-single="true"
215
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
216
+ close-on-select v-ref:slice>
217
+ </v-select>
218
+ </div>
219
+
220
+ <div class="col-sm-6 form-group "
221
+ :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
222
+ <label for="f_address" class="font_normal_body">起始楼号</label>
223
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
224
+ <input type="text" style="width:25%"
225
+ v-validate:f_building_start='{integernum: true ,dctest: [model.f_building_end, "<=" ]}'
226
+ v-model="model.f_building_start" class="input_search" placeholder="楼号"/>
227
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"/>
228
+ </div>
229
+ <div class="col-sm-6 form-group "
230
+ :class="[$v.f_building_end.integernum ||$v.f_building_end.dctest ? 'has-error' : 'has-success']">
231
+ <label for="f_address" class="font_normal_body">截止楼号</label>
232
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_building_prefix" class="input_search"/>
233
+ <input type="text" style="width:25%"
234
+ v-validate:f_building_end='{integernum: true ,dctest: [model.f_building_start, ">=" ]}'
235
+ v-model="model.f_building_end" class="input_search" placeholder="楼号"/>
236
+ <input type="text" style="width:17%" v-model="model.f_building_suffix" class="input_search"
237
+ />
238
+ </div>
239
+ <div class="col-sm-6 form-group "
240
+ :class="[$v.f_unit_start.integernum || $v.f_unit_start.dctest ? 'has-error' : 'has-success']">
241
+ <label for="f_address" class="font_normal_body">起始单元</label>
242
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
243
+ <input type="text" style="width:25%"
244
+ v-validate:f_unit_start='{integernum: true ,dctest: [model.f_unit_end, "<=" ]}'
245
+ v-model="model.f_unit_start" class="input_search" placeholder="单元"/>
246
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search" />
247
+ </div>
248
+ <div class="col-sm-6 form-group "
249
+ :class="[$v.f_unit_end.integernum ||$v.f_unit_end.dctest ? 'has-error' : 'has-success']">
250
+ <label for="f_address" class="font_normal_body">截止单元</label>
251
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_unit_prefix" class="input_search" />
252
+ <input type="text" style="width:25%"
253
+ v-validate:f_unit_end='{integernum: true ,dctest: [model.f_unit_start, ">="]}'
254
+ v-model="model.f_unit_end" class="input_search" placeholder="单元"/>
255
+ <input type="text" style="width:17%" v-model="model.f_unit_suffix" class="input_search"/>
256
+ </div>
257
+ <div class="col-sm-6 form-group "
258
+ :class="[$v.f_floor_start.integernum || $v.f_floor_start.dctest ? 'has-error' : 'has-success']">
259
+ <label for="f_address" class="font_normal_body">起始楼层</label>
260
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
261
+ <input type="text" style="width:25%"
262
+ v-validate:f_floor_start='{integernum: true,dctest: [model.f_floor_end, "<=" ] }'
263
+ v-model="model.f_floor_start" class="input_search" placeholder="楼层"/>
264
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
265
+ </div>
266
+ <div class="col-sm-6 form-group "
267
+ :class="[$v.f_floor_end.integernum ||$v.f_floor_end.dctest ? 'has-error' : 'has-success']">
268
+ <label for="f_address" class="font_normal_body">截止楼层</label>
269
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_floor_prefix" class="input_search"/>
270
+ <input type="text" style="width:25%" v-model="model.f_floor_end"
271
+ v-validate:f_floor_end='{integernum: true,dctest: [model.f_floor_start, ">=" ] }'
272
+ class="input_search" placeholder="楼层"/>
273
+ <input type="text" style="width:17%" v-model="model.f_floor_suffix" class="input_search"/>
274
+ </div>
275
+ <div class="col-sm-6 form-group "
276
+ :class="[$v.f_room_start.integernum || $v.f_room_start.dctest ? 'has-error' : 'has-success']">
277
+ <label for="f_address" class="font_normal_body">起始门牌</label>
278
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
279
+ <input type="text" style="width:25%" v-model="model.f_room_start"
280
+ class="input_search" placeholder="门牌号"
281
+ v-validate:f_room_start='{integernum: true ,dctest: [model.f_room_end, "<=" ]}'
282
+ />
283
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
284
+ </div>
285
+ <div class="col-sm-6 form-group "
286
+ :class="[$v.f_room_end.integernum ||$v.f_room_end.dctest ? 'has-error' : 'has-success']">
287
+ <label for="f_address" class="font_normal_body">截止门牌</label>
288
+ <input type="text" style="width:15%" placeholder="前缀" v-model="model.f_room_prefix" class="input_search"/>
289
+ <input type="text" style="width:25%" v-model="model.f_room_end" class="input_search" placeholder="门牌号"
290
+ v-validate:f_room_end='{integernum: true ,dctest: [model.f_room_start, ">=" ]}'/>
291
+ <input type="text" style="width:17%" v-model="model.f_room_suffix" class="input_search"/>
292
+ </div>
293
+ <div class="col-sm-6 form-group">
294
+ <label class="font_normal_body">地址状态</label>
295
+ <v-select :value.sync="model.f_address_state" :value-single="true"
296
+ class="select_list select"
297
+ condition="f_address_state = '{}'"
298
+ :options='addresstate' placeholder='地址状态'
299
+ close-on-select>
300
+ </v-select>
301
+ </div>
302
+ <div class="col-sm-10 form-group ">
303
+ <p class="navbar-text" style="margin-left: 10%">说明: 层数输入1,门牌号输入001。产生的最终门牌号显示1001</p>
304
+ </div>
305
+ <div class="col-sm-12 form-group">
306
+ <label class="font_normal_body " style="margin-top:-20px">备&emsp;&emsp;注</label>
307
+ <textarea class="input_textarea" rows="3" style="width:80%;height: auto;" v-model="model.f_comments"></textarea>
308
+ </div>
309
+ <div class="row">
310
+ <div style="text-align:right;margin-top:20px;margin-right:50px;" class="col-sm-12">
311
+ <button class="button_search button_spacing" @click="confirmall()" :disabled='!$v.valid'>保存</button>
312
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ </div>
317
+ </validator>
318
+
319
+ <modal :show.sync="isshow" large backdrop="false" :width="900">
320
+ <header slot="modal-header" class="modal-header">
321
+ </header>
322
+ <article slot="modal-body" class="modal-body">
323
+ <amap-location :islocationclearmark="false" dom="addboxmap" v-ref:positionInfo @getmylocation="getmylocation"></amap-location>
324
+ </article>
325
+ <footer slot="modal-footer" class="modal-footer">
326
+ <button v-show="isshow" type="button" class="button_search button_spacing" @click='confirmLocation'>确认</button>
327
+ <button v-show="isshow" type="button" class="button_clear button_spacing" @click='closeModal'>取消</button>
328
+ </footer>
329
+ </modal>
330
+
331
+ </div>
332
+ </template>
333
+
334
+ <script>
335
+ import {HttpResetClass} from 'vue-client'
336
+
337
+
338
+ let getAreaConfig = async function (self) {
339
+ // 获取气价里面的配置
340
+ await self.$getConfig(self, 'UserAddress')
341
+ console.log('原地址配置',self.config)
342
+ console.log('获取地址配置',self.config)
343
+ Object.assign(self.model, self.config)
344
+ }
345
+
346
+ export default {
347
+ title: '用户地址添加',
348
+ data () {
349
+ return {
350
+ //模态框是否显示
351
+ isshow: false,
352
+ //接收位置
353
+ templng: '', //临时经度
354
+ templat: '' , //临时纬度
355
+
356
+ //初始化省市区数据
357
+ pcdslist:[],
358
+ //初始化街道数据
359
+ streetslist:[],
360
+ //初始化街道数据
361
+ areaslist:[],
362
+ // 楼栋数据
363
+ buildingList: [],
364
+ iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'},{label:'全部',value:''}],
365
+ config:{
366
+ hasnumber:false,
367
+ f_building_suffix: '号楼',
368
+ f_unit_suffix: '单元',
369
+ f_floor_suffix: '层',
370
+ f_room_suffix: '室'
371
+ },
372
+ model: {
373
+ f_pcd_id: '',
374
+ f_street_id: '',
375
+ f_comments:'',
376
+ f_residential_area_id: '',
377
+ f_pcd: '',
378
+ f_street: '',
379
+ f_residential_area: '',
380
+ f_slice_area: '',
381
+ slice_area:'',
382
+ f_building: '',
383
+ f_building_start: '',
384
+ f_building_end: '',
385
+ f_building_suffix: '',
386
+ f_unit: '',
387
+ f_unit_start: '',
388
+ f_unit_end: '',
389
+ f_unit_suffix: '',
390
+ f_floor: '',
391
+ f_floor_start: '',
392
+ f_floor_end: '',
393
+ f_floor_suffix: '',
394
+ f_room: '',
395
+ f_room_start: '',
396
+ f_room_end: '',
397
+ f_room_suffix: '',
398
+ //详细地址
399
+ f_address: '',
400
+ //单位名称
401
+ f_company: '',
402
+ //单位地址
403
+ f_company_address: '',
404
+ f_lng: '', //经度
405
+ f_lat: '' //纬度
406
+ },
407
+ //判读是否为单个数据录入
408
+ onedata: 'one',
409
+ //选中所有地址
410
+ addresslist: [],
411
+ usertype:false,
412
+
413
+ // 公司信息
414
+ curorgid: [this.$login.f.orgid],
415
+
416
+ f_orgid: '',
417
+
418
+ sliceArea: []
419
+ }
420
+ },
421
+ props: ['f_filialeids', 'row','operation','usertype'],
422
+ ready(){
423
+ this.initdata()
424
+ getAreaConfig(this)
425
+ this.model.f_building_suffix=this.config.f_building_suffix
426
+ this.model.f_unit_suffix=this.config.f_unit_suffix
427
+ this.model.f_floor_suffix=this.config.f_floor_suffix
428
+ this.model.f_room_suffix=this.config.f_room_suffix
429
+ },
430
+ methods: {
431
+ async changecity(){
432
+ this.areaslist = []
433
+ // this.model.f_residential_area_id = null
434
+ // this.model.f_residential_area = null
435
+ let condition = `isnull(f_iscity,'') = isnull('${this.model.f_iscity}','') and a.f_orgid = '${this.f_filialeids}'`
436
+ let req = await this.$resetpost('rs/sql/address_getresidential', {
437
+ data: {
438
+ condition: condition
439
+ }
440
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
441
+ let redata = []
442
+ req.data.forEach((row) => {
443
+ redata.push({
444
+ label: row.f_residential_area,
445
+ value: row.id,
446
+ data: row,
447
+ id: row.id
448
+ })
449
+ })
450
+ this.areaslist=redata
451
+ },
452
+ standardyanzheng() {
453
+ console.log(this.model.f_standard_number.length)
454
+ if (this.model.f_standard_number.length != 2){
455
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
456
+ this.model.f_standard_number = ''
457
+ }
458
+ },
459
+ contractsyanzheng(){
460
+ console.log(this.model.f_contracts_number.length)
461
+ if (this.model.f_contracts_number.length != 5){
462
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
463
+ this.model.f_contracts_number = ''
464
+ }
465
+ },
466
+ async initdata(){
467
+ this.model.f_address_state = '已通气'
468
+ this.initAreas(this.f_filialeids)
469
+ // 添加特殊地址选省市区
470
+ this.initpcds(` f_orgid = '${this.f_filialeids}'`)
471
+ this.initstreets(` f_orgid = '${this.f_filialeids}' `)
472
+ this.initareas(` f_orgid = '${this.f_filialeids}'`)
473
+
474
+ this.buildingList = []
475
+ },
476
+
477
+ // 初始化片区
478
+ async initAreas (val) {
479
+ if (val) {
480
+ let getAllArea = await this.$resetpost('/rs/search', {
481
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
482
+ userid: this.$login.f.id
483
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
484
+ let arr = getAllArea.data.filter((res) => {
485
+ return res.parentid == val
486
+ })
487
+ console.log('过滤之后的片区', arr)
488
+ this.sliceArea = []
489
+ arr.forEach((res) => {
490
+ this.sliceArea.push({label: res.name, value: res.name})
491
+ })
492
+ }
493
+ },
494
+ //初始化省市区,添加街道
495
+ async initpcds(pconditon){
496
+ this.pcdslist = []
497
+ let HttpReset = new HttpResetClass()
498
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
499
+ data: {
500
+ items: '*',
501
+ tablename: 't_pcd',
502
+ orderitem: 'id',
503
+ condition: pconditon
504
+ }
505
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
506
+ let redata = []
507
+ req.data.forEach((row, n) => {
508
+ redata[n] = {
509
+ label: row.f_pcd,
510
+ value: row.id,
511
+ data:row,
512
+ id:row.id
513
+ }
514
+ })
515
+ this.pcdslist=redata
516
+ },
517
+ //初始化街道 添加小区
518
+ async initstreets(pconditon){
519
+ this.streetslist = []
520
+ let HttpReset = new HttpResetClass()
521
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
522
+ data: {
523
+ items: '*',
524
+ tablename: 't_street',
525
+ orderitem: 'id',
526
+ condition: pconditon
527
+ }
528
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
529
+ let redata = []
530
+ req.data.forEach((row, n) => {
531
+ redata[n] = {
532
+ label: row.f_street,
533
+ value: row.id,
534
+ data:row,
535
+ id:row.id
536
+ }
537
+ })
538
+ this.streetslist=redata
539
+ },
540
+ //初始化小区添加小区
541
+ async initareas(pconditon){
542
+ // if(this.usertype){
543
+ // pconditon=pconditon+` and f_special='1' `
544
+ // }
545
+ this.areaslist = []
546
+ let HttpReset = new HttpResetClass()
547
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
548
+ data: {
549
+ items: '*',
550
+ tablename: 't_area',
551
+ orderitem: 'id',
552
+ condition: pconditon
553
+ }
554
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
555
+ let redata = []
556
+ req.data.forEach((row) => {
557
+ redata.push({
558
+ label: row.f_residential_area,
559
+ value: row.id,
560
+ data: row,
561
+ id: row.id
562
+ })
563
+ })
564
+ this.areaslist=redata
565
+ },
566
+ // 根据选择小区查询楼栋
567
+ async getbuildingList(pconditon){
568
+ this.buildingList = []
569
+ let HttpReset = new HttpResetClass()
570
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
571
+ data: {
572
+ items: '*',
573
+ tablename: 't_building',
574
+ orderitem: 'id',
575
+ condition: pconditon
576
+ }
577
+ }, {resolveMsg: null, rejectMsg: '获取楼栋失败!'})
578
+ let redata = []
579
+ req.data.forEach((row) => {
580
+ redata.push({
581
+ label: row.f_building,
582
+ value: row.id,
583
+ data: row,
584
+ id: row.id
585
+ })
586
+ })
587
+ this.buildingList=redata
588
+ },
589
+ //省/市/区变化
590
+ async pcdChange(val){
591
+ // 只有添加特殊地址时才级联
592
+ if (!this.usertype) {
593
+ return
594
+ }
595
+ console.log("省/市/区变化",val)
596
+ if(val){
597
+ //那就把[小区,街道]重新组织一下
598
+ await this.initstreets(` f_pcd_id ='${val}' `)
599
+ if(this.model.f_street_id){
600
+ if (this.findbyid(this.streetslist,this.model.f_street_id)) {
601
+ let pcd_id=this.findbyid(this.streetslist,this.model.f_street_id).f_pcd_id
602
+ if(pcd_id!=val){
603
+ this.model.f_street_id=''
604
+ }
605
+ } else {
606
+ this.model.f_street_id=''
607
+ }
608
+
609
+ //那就把[小区,街道]重新组织一下
610
+ if (this.model.f_street_id) {
611
+ await this.initareas(` f_street_id ='${this.model.f_street_id}' `)
612
+ if(this.model.f_residential_area_id){
613
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
614
+ let pcd_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_pcd_id
615
+ if(pcd_id!=val){
616
+ this.model.f_residential_area_id=''
617
+ }
618
+ } else {
619
+ this.model.f_residential_area_id=''
620
+ }
621
+
622
+ }
623
+ }
624
+ }
625
+ }
626
+ this.$resetValidation()
627
+ },
628
+ //小区变化
629
+ areaChange(val){
630
+ console.log("小区变化",val)
631
+ // 选择小区后级联出省市区和街道
632
+ let selectArea // 选中的小区数据
633
+ for (let row of this.areaslist) {
634
+ if (val == row.value) {
635
+ selectArea = row.data
636
+ break
637
+ }
638
+ }
639
+ if (selectArea) {
640
+ this.model.f_street_id = selectArea.f_street_id
641
+ this.model.f_pcd_id = selectArea.f_pcd_id
642
+ this.initstreets(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_street_id}' `)
643
+ this.initpcds(` f_filialeid = '${this.f_filialeids}' and id ='${selectArea.f_pcd_id}' `)
644
+ this.model.slice_area = selectArea.f_slice_area
645
+ // 拼接地址
646
+ this.model.f_address = `${selectArea.f_street}${selectArea.f_residential_area}`
647
+ this.getbuildingList(`f_filialeid = '${this.f_filialeids}' and f_residential_area_id ='${selectArea.id}'`)
648
+ }
649
+ this.$nextTick(() => {
650
+ this.$resetValidation()
651
+ })
652
+ },
653
+ //街道变化
654
+ async streetChange(val){
655
+ console.log("街道变化",val)
656
+ if(this.streetslist[0]) {
657
+ var street=''
658
+ this.streetslist.forEach((item)=>{
659
+ if(item.id===val){
660
+ street=item.label
661
+ }
662
+ })
663
+ this.model.f_address = street
664
+ }
665
+ if(val){
666
+ //那就把[小区]重新组织一下
667
+ await this.initareas(` f_street_id ='${val}' `)
668
+ if(this.model.f_residential_area_id){
669
+ if (this.findbyid(this.areaslist,this.model.f_residential_area_id)) {
670
+ let street_id=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_street_id
671
+ if(street_id!=val){
672
+ this.model.f_residential_area_id=''
673
+ }
674
+ } else {
675
+ this.model.f_residential_area_id=''
676
+ }
677
+
678
+ }
679
+ }
680
+ this.$resetValidation()
681
+ },
682
+
683
+ getorg (val) {
684
+ this.f_orgid = val[0]
685
+ },
686
+
687
+ //处理批量地址信息
688
+ dealaddlist(){
689
+ try {
690
+ var resultlist=[]
691
+ for (var i = parseInt(this.model.f_building_start); i <= parseInt(this.model.f_building_end); i++) {
692
+ for (var j = parseInt(this.model.f_unit_start); j <= parseInt(this.model.f_unit_end); j++) {
693
+ for (var m = parseInt(this.model.f_floor_start); m <= parseInt(this.model.f_floor_end); m++) {
694
+ for (var n = parseInt(this.model.f_room_start); n <= parseInt(this.model.f_room_end); n++) {
695
+ //预备一个空的json
696
+ console.log('批量', this.model)
697
+ let data=Object.assign({},this.model)
698
+ data.f_create_person= this.$login.f.name
699
+ data.f_building= data.f_building_prefix + i
700
+ data.f_unit= data.f_unit_prefix + j
701
+ data.f_floor= data.f_floor_prefix + m
702
+ // 目前房号都按两位处理 如: 101室 201室 110室
703
+ if ((n+'').length == 1) {
704
+ data.f_room = data.f_room_prefix + m + '0' + n
705
+ } else {
706
+ data.f_room = data.f_room_prefix + m + '' + n
707
+ }
708
+ data.f_filialeid = this.f_filialeids
709
+ data.f_operator = this.$login.f.name
710
+ data.f_operatorid = this.$login.f.id
711
+ data.f_orgid = this.$login.f.orgid
712
+ data.f_orgname = this.$login.f.orgs
713
+ data.f_depid = this.$login.f.depids
714
+ data.f_depname = this.$login.f.deps
715
+ data.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
716
+ data.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
717
+ data.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
718
+ data.f_address = data.f_street
719
+ + data.f_residential_area +
720
+ data.f_building + data.f_building_suffix
721
+ + data.f_unit + data.f_unit_suffix
722
+ + data.f_floor + data.f_floor_suffix
723
+ + data.f_room + data.f_room_suffix
724
+ if (this.model.slice_area) {
725
+ data.f_slice_area = this.model.slice_area
726
+
727
+ }
728
+ resultlist.push(data)
729
+ }
730
+ }
731
+ }
732
+ }
733
+ this.addresslist=resultlist
734
+ } catch (e) {
735
+ console.log(e)
736
+ this.$showAlert('输出数据有误,请检查', 'warning', 2000)
737
+ }
738
+ },
739
+ //保存多个
740
+ async confirmall(){
741
+ this.dealaddlist()
742
+ if(this.addresslist.length>0){
743
+ let msg = {
744
+ resolveMsg: '地址保存成功',
745
+ rejectMsg: '地址保存失败'
746
+ }
747
+ this.$showMessage('确定要批量添加'+this.addresslist.length+'户地址吗?,如有已经存在的,将会重复添加!!!', ['confirm', 'cancel']).then((res) => {
748
+ if (res === 'confirm') {
749
+ this.$resetpost('rs/logic/address_adduserlist',{data: {addlist:this.addresslist}},msg).then((req) => {
750
+ this.cleardara()
751
+ this.$dispatch('confirm')
752
+ })
753
+ }
754
+ })
755
+ }
756
+ },
757
+ //保存
758
+ async confirm(){
759
+ if(this.onedata=='one'){
760
+ await this.saveonedata()
761
+ }
762
+ this.cleardara()
763
+ this.$dispatch('confirm')
764
+ },
765
+ //保存一户信息
766
+ async saveonedata(){
767
+ this.model.f_create_person= this.$login.f.name
768
+ this.model.f_filialeid = this.f_filialeids
769
+ this.model.f_operator = this.$login.f.name
770
+ this.model.f_operatorid = this.$login.f.id
771
+ this.model.f_orgid = this.$login.f.orgid
772
+ this.model.f_orgname = this.$login.f.orgs
773
+ this.model.f_depid = this.$login.f.depids
774
+ this.model.f_depname = this.$login.f.deps
775
+ console.log("片区:",this.model.slice_area)
776
+ if (this.model.slice_area ) {
777
+ if (this.model.slice_area instanceof Array) {
778
+ console.log("修改",this.model.slice_area)
779
+ this.model.f_slice_area = this.model.slice_area[0].name
780
+ } if (this.model.slice_area instanceof Object) {
781
+ console.log("修改",this.model.slice_area)
782
+ this.model.f_slice_area = Object.values(this.model.slice_area)[0].name
783
+ } else{
784
+ console.log("保存",this.model.slice_area)
785
+ this.model.f_slice_area = this.model.slice_area
786
+ }
787
+ }
788
+ if (this.usertype) {
789
+ //非民用
790
+ this.model.f_special='1'
791
+ this.model.f_building_suffix=''
792
+ this.model.f_unit_suffix=''
793
+ this.model.f_floor_suffix=''
794
+ this.model.f_room_suffix=''
795
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
796
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
797
+ this.model.f_residential_area = this.findbyid(this.areaslist,this.model.f_residential_area_id) ? this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area : ''
798
+ } else {
799
+ //民用
800
+ this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
801
+ this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
802
+ this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
803
+ this.model.f_building = this.$refs.f_building_id.selectedItems
804
+ this.model.f_building_suffix=''
805
+ if (!this.model.f_building) {
806
+ this.$showMessage('请选择楼栋数据!!!')
807
+ return
808
+ }
809
+ 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
810
+ }
811
+ await this.$resetpost('rs/logic/address_updateuseraddress', this.model)
812
+ },
813
+ cancel(){
814
+ this.cleardara()
815
+ this.$dispatch('cancel')
816
+ },
817
+ cleardara(){
818
+ this.model= {
819
+ f_pcd_id: '',
820
+ f_street_id: '',
821
+ f_iscity:'市区',
822
+ f_residential_area_id: '',
823
+ f_pcd: '',
824
+ f_comments:'',
825
+ f_street: '',
826
+ f_residential_area: '',
827
+ f_slice_area: '',
828
+ slice_area: '',
829
+ f_building: '',
830
+ f_building_start: '',
831
+ f_building_end: '',
832
+ f_building_prefix: '',
833
+ f_building_suffix: this.config.f_building_suffix,
834
+ f_unit: '',
835
+ f_unit_start: '',
836
+ f_unit_end: '',
837
+ f_unit_prefix: '',
838
+ f_unit_suffix: this.config.f_unit_suffix,
839
+ f_floor: '',
840
+ f_floor_start: '',
841
+ f_floor_end: '',
842
+ f_floor_prefix: '',
843
+ f_floor_suffix: this.config.f_floor_suffix,
844
+ f_room: '',
845
+ f_room_start: '',
846
+ f_room_end: '',
847
+ f_room_prefix: '',
848
+ f_room_suffix: this.config.f_room_suffix,
849
+ //详细地址
850
+ f_address: '',
851
+ //单位名称
852
+ f_company: '',
853
+ //单位地址
854
+ f_company_address: '',
855
+ f_lng: '',
856
+ f_lat: ''
857
+ }
858
+ // this.pcdslist = []
859
+ // this.streetslist = []
860
+ // this.areaslist = []
861
+ },
862
+
863
+ //根据名字找数据
864
+ findbyid(list,name){
865
+ var result
866
+ list.forEach((row, n) => {
867
+ if(name==row.value){
868
+ result= row.data
869
+ }
870
+ })
871
+ return result
872
+ },
873
+ openModal () {
874
+ this.isshow = true
875
+ },
876
+ closeModal () {
877
+ this.isshow = false;
878
+ },
879
+ getmylocation (res) {
880
+ this.templng = res.position.lng
881
+ this.templat = res.position.lat
882
+ },
883
+ confirmLocation () {
884
+ this.model.f_lat = this.templat
885
+ this.model.f_lng = this.templng
886
+ this.isshow = false
887
+ }
888
+ },
889
+ watch: {
890
+ //分公司变化
891
+ 'f_filialeids'(){
892
+ if (this.model.f_filialeid) {
893
+ if (this.model.f_filialeid != this.f_filialeids) {
894
+ this.$dispatch('cancel')
895
+ }
896
+ }
897
+ this.cleardara()
898
+ this.initdata()
899
+ },
900
+ 'row'(){
901
+ this.onedata='one'
902
+ },
903
+ 'model.id' () {
904
+ this.getbuildingList(`f_filialeid = '${this.f_filialeids}' and f_residential_area_id ='${this.model.f_residential_area_id}'`)
905
+ }
906
+ },
907
+ computed: {
908
+ //地址状态下拉框
909
+ addresstate() {
910
+ return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
911
+ }
912
+ }
913
+ }
914
+ </script>
915
+ <style lang="less">
916
+ #userAddress{
917
+ #addboxmap {
918
+ height: 300px;
919
+ }
920
+ .glyphicon:hover {
921
+ color: red;
922
+ }
923
+ .glyphicon {
924
+ color: blue;
925
+ cursor: pointer;
926
+ }
927
+ }
928
+ </style>
929
+
930
+
931
+
932
+