address-client 3.2.65 → 3.2.67

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