address-client 3.2.89 → 3.2.90

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,780 @@
1
+ <template>
2
+ <div class="span">
3
+ <validator name='v'>
4
+ <div class="form-horizontal select-overspread container-fluid" style="overflow-y: auto">
5
+ <div class="row auto">
6
+ <div class="col-sm-12 bg-info text-center" style="padding: 8px;font-size: 18px;font-weight: bold">
7
+ <span v-if="operation=='add'&&!f_specia">添加{{areatype}}</span>
8
+ <span v-if="operation=='modify'&&!f_special">修改【{{areamodel.f_residential_area}}】小区</span>
9
+ <span v-if="operation=='add'&&f_specia">添加{{areatype}}</span>
10
+ <span v-if="operation=='modify'&&f_special">修改【{{areamodel.f_residential_area}}】单位</span>
11
+ </div>
12
+ <div v-if="areatype != '楼栋'">
13
+ <!--基本小区(单位)信息-->
14
+ <div class="col-sm-6 form-group" v-if="!config.hasnumber">
15
+ <label class="font_normal_body">小区编号</label>
16
+ <input type="text" class="input_search" style="width:60%" v-model="areamodel.f_area_id"
17
+ @blur="areaidChange" placeholder="小区编号">
18
+ </div>
19
+
20
+ <div class="col-sm-6 form-group" v-if="config.hasnumber"
21
+ :class="[$v.f_area_id.required ? 'has-error' : 'has-success']">
22
+ <label class="font_normal_body">小区编号</label>
23
+ <input type="number" class="input_search" style="width:60%" v-model="areamodel.f_area_id"
24
+ v-validate:f_area_id='{required: true }'
25
+ @change="areaidChangeHasnumber" placeholder="小区编号">
26
+ </div>
27
+
28
+ <div class="col-sm-6 form-group"
29
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
30
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
31
+ <input type="text" class="input_search" class="input_search" style="width:60%" v-show="false" v-model="areamodel.f_pcd_id"
32
+ v-validate:f_pcd_id='{required: true }'>
33
+ <v-select
34
+ :value.sync="areamodel.f_pcd_id" :value-single="true"
35
+ :options='pcdslist' placeholder='请选择'
36
+ close-on-select search="true" @change="pcdChange">
37
+ </v-select>
38
+ </div>
39
+ <div class="col-sm-6 form-group"
40
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
41
+ <label class="font_normal_body">街道/乡镇</label>
42
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_street_id"
43
+ v-validate:f_street_id='{required: true }'>
44
+ <v-select
45
+ :value.sync="areamodel.f_street_id" :value-single="true"
46
+ :options='streetslist' placeholder='请选择'
47
+ close-on-select search="true" @change="streetChange">
48
+ </v-select>
49
+ </div>
50
+ <div class="col-sm-6 form-group" :class="[$v.slice.required ? 'has-error' : 'has-success']">
51
+ <label class="font_normal_body">片&emsp;&emsp;区</label>
52
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
53
+ v-validate:slice='{required: true }'>
54
+ <v-select :value.sync="areamodel.slice_area" v-model="areamodel.slice_area"
55
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
56
+ close-on-select v-ref:slice>
57
+ </v-select>
58
+ </div>
59
+ <div class="col-sm-6 form-group" :class="[$v.community.required ? 'has-error' : 'has-success']">
60
+ <label class="font_normal_body">社&emsp;&emsp;区</label>
61
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.community.selectedItems"
62
+ v-validate:community='{required: true }'>
63
+ <v-select :value.sync="areamodel.f_community_id" v-model="areamodel.f_community_id"
64
+ :options='communitys' placeholder='社区' filer-key="name" :value-single="true"
65
+ close-on-select v-ref:community>
66
+ </v-select>
67
+ </div>
68
+ <!--小区(特殊)信息-->
69
+ <div v-if="!f_special"
70
+ class="col-sm-6 form-group"
71
+ :class="[$v.f_residential_area.required ? 'has-error' : 'has-success']">
72
+ <label class="font_normal_body">小区名称</label>
73
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_residential_area"
74
+ class="form-control" placeholder="小区名称"
75
+ v-validate:f_residential_area='{required: true }'>
76
+ </div>
77
+ <div v-if="!f_special"
78
+ class="col-sm-12 form-group">
79
+ <label class="font_normal_body">小区地址</label>
80
+ <input type="text" style="width:80%" class="input_search" v-model="areamodel.f_area_address"
81
+ class="form-control" placeholder="小区地址">
82
+ </div>
83
+ <!--单位(特殊)信息-->
84
+ <div v-if="f_special"
85
+ class="col-sm-6 form-group"
86
+ :class="[$v.f_residential_area.required ? 'has-error' : 'has-success']">
87
+ <label class="font_normal_body">单位名称</label>
88
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_residential_area"
89
+ class="form-control" placeholder="单位名称"
90
+ v-validate:f_residential_area='{required: true }'>
91
+ </div>
92
+ <div v-if="f_special"
93
+ class="col-sm-12 form-group">
94
+ <label class="font_normal_body">单位地址</label>
95
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_area_address"
96
+ class="form-control" placeholder="单位地址">
97
+ </div>
98
+ <div v-if="f_special"
99
+ class="col-sm-6 form-group"
100
+ :class="[$v.f_linkname.required ? 'has-error' : 'has-success']">
101
+ <label class="font_normal_body">联&ensp;系&ensp;人</label>
102
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_linkname"
103
+ class="form-control" placeholder="联系人"
104
+ v-validate:f_linkname='{required: true }'>
105
+ </div>
106
+ <div v-if="f_special"
107
+ class="col-sm-6 form-group"
108
+ :class="[$v.f_linkphone.required ? 'has-error' : 'has-success']">
109
+ <label class="font_normal_body">联系电话</label>
110
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_linkphone"
111
+ class="form-control" placeholder="联系电话"
112
+ v-validate:f_linkphone='{required: true }'>
113
+ </div>
114
+ <div class="col-sm-12 form-group">
115
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
116
+ <textarea class="input_textarea" rows="3" style="margin-top:20px;width:80%;height: auto;" v-model="areamodel.f_comments"></textarea>
117
+ </div>
118
+ <div class="col-sm-12 form-group">
119
+ <br/>
120
+ </div>
121
+ <!--表具信息-->
122
+ <div v-if="!f_special" class="col-sm-12 bg-info text-center" style="padding: 8px;font-size: 18px;font-weight: bold">
123
+ <span >默认表具信息</span>
124
+ </div>
125
+ <div v-if="!f_special" class="row">
126
+ <div class="col-sm-6 form-group">
127
+ <label class="font_normal_body">用户类型</label>
128
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_user_type">
129
+ <v-select
130
+ :value.sync="areamodel.f_user_type" :value-single="true"
131
+ :options='usertypes' placeholder='用户类型' @change="userTypeChange"
132
+ close-on-select >
133
+ </v-select>
134
+ </div>
135
+ <div class="col-sm-6 form-group">
136
+ <label class="font_normal_body">用气性质</label>
137
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_gasproperties">
138
+ <v-select
139
+ :value.sync="areamodel.f_gasproperties" :value-single="true"
140
+ :options='gasproperties' placeholder='用气性质'
141
+ close-on-select >
142
+ </v-select>
143
+ </div>
144
+ <div class="col-sm-6 form-group">
145
+ <label class="font_normal_body">气价类型</label>
146
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_price_type">
147
+ <v-select
148
+ :value.sync="areamodel.f_price_type" :value-single="true"
149
+ :options='f_price_types' placeholder='气价类型'
150
+ close-on-select >
151
+ </v-select>
152
+ </div>
153
+ <div class="col-sm-6 form-group">
154
+ <label class="font_normal_body">气价名称</label>
155
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_price_name">
156
+ <v-select
157
+ :value.sync="areamodel.f_price_name" :value-single="true"
158
+ :options='pricenames' placeholder='气价名称'
159
+ close-on-select >
160
+ </v-select>
161
+ </div>
162
+ <div class="col-sm-6 form-group">
163
+ <label class="font_normal_body">气表品牌</label>
164
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_meter_brand">
165
+ <v-select
166
+ :value.sync="areamodel.f_meter_brand" :value-single="true"
167
+ :options='meterbrands' placeholder='气表品牌'
168
+ close-on-select >
169
+ </v-select>
170
+ </div>
171
+ <div class="col-sm-6 form-group">
172
+ <label class="font_normal_body">气表型号</label>
173
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_meter_style">
174
+ <v-select
175
+ :value.sync="areamodel.f_meter_style" :value-single="true"
176
+ :options='meterstyle' placeholder='气表型号'
177
+ close-on-select >
178
+ </v-select>
179
+ </div>
180
+ <div class="col-sm-6 form-group" :class="[$v.f_meter_type.required ? 'has-error' : 'has-success']">
181
+ <label class="font_normal_body">气表类型</label>
182
+ <input type="text" style="width:60%" class="input_search" v-show="false"
183
+ v-model="areamodel.f_meter_type">
184
+ <v-select :value.sync="areamodel.f_meter_type" :value-single="true"
185
+ :options='metertypes' placeholder='请选择'
186
+ close-on-select></v-select>
187
+ </div>
188
+ <div class="col-sm-6 form-group" v-if="isMachine">
189
+ <label class="font_normal_body">抄&ensp;表&ensp;册</label>
190
+ <input type="text" style="width:60%" class="input_search" v-show="false"
191
+ v-model="areamodel.f_meter_book">
192
+ <v-select
193
+ :value.sync="areamodel.f_meter_book" :value-single="true"
194
+ :options='meterbooks' placeholder='抄表册'
195
+ close-on-select >
196
+ </v-select>
197
+ </div>
198
+ <div class="col-sm-6 form-group" v-if="!isMachine" :class="[$v.f_meter_book.required ? 'has-error' : 'has-success']">
199
+ <label class="font_normal_body">抄&ensp;表&ensp;册</label>
200
+ <input type="text" style="width:60%" class="input_search" v-show="false"
201
+ v-model="areamodel.f_meter_book">
202
+ <v-select
203
+ :value.sync="areamodel.f_meter_book" :value-single="true"
204
+ :options='meterbooks' placeholder='抄表册'
205
+ close-on-select >
206
+ </v-select>
207
+ </div>
208
+ <div class="col-sm-6 form-group" :class="[$v.f_inputtor.required ? 'has-error' : 'has-success']">
209
+ <label class="font_normal_body">抄&ensp;表&ensp;员</label>
210
+ <input type="text" style="width:60%" class="input_search"
211
+ v-show="false" v-model="areamodel.f_inputtor">
212
+ <v-select
213
+ :value.sync="areamodel.f_inputtor" :value-single="true"
214
+ :options='inputtores' placeholder='抄表员'
215
+ close-on-select >
216
+ </v-select>
217
+ </div>
218
+ <div class="col-sm-6 form-group" :class="[$v.f_adjustable_id.required ? 'has-error' : 'has-success']">
219
+ <label class="font_normal_body">调&ensp;压&ensp;箱</label>
220
+ <input type="text" style="width:60%" class="input_search" v-show="false"
221
+ v-model="areamodel.f_adjustable_id">
222
+ <v-select
223
+ :value.sync="areamodel.f_adjustable_id" :value-single="true"
224
+ :options='adjustables' placeholder='调压箱'
225
+ close-on-select >
226
+ </v-select>
227
+ </div>
228
+ <div class="col-sm-6 form-group" :class="[$v.f_house_type.required ? 'has-error' : 'has-success']">
229
+ <label class="font_normal_body">房屋类型</label>
230
+ <input type="text" style="width:60%" class="input_search" v-show="false"
231
+ v-model="areamodel.f_house_type" >
232
+ <v-select
233
+ :value.sync="areamodel.f_house_type" :value-single="true"
234
+ :options='housetypeoptions' placeholder='房屋类型'
235
+ close-on-select >
236
+ </v-select>
237
+ </div>
238
+ <div class="col-sm-6 form-group" :class="[$v.f_position.required ? 'has-error' : 'has-success']">
239
+ <label class="font_normal_body">安装位置</label>
240
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_position" >
241
+ <v-select
242
+ :value.sync="areamodel.f_position" :value-single="true"
243
+ :options='positions' placeholder='安装位置'
244
+ close-on-select >
245
+ </v-select>
246
+ </div>
247
+ </div>
248
+ <div v-if="f_special" class="col-sm-6 form-group">
249
+ <br/>
250
+ </div>
251
+ </div>
252
+ <div v-if="areatype == '楼栋'">
253
+ <div class="col-sm-6 form-group " :class="[$v.f_residential_area_id1.required ? 'has-error' : 'has-success']">
254
+ <label class="font_normal_body">小区名称</label>
255
+ <input type="text" style="width:41%" v-show="false" v-model="buildingmodel.f_residential_area_id"
256
+ v-validate:f_residential_area_id1='{required: true }'>
257
+ <v-select :value.sync="buildingmodel.f_residential_area_id" :value-single="true" v-ref:areaselect
258
+ :options='areaslist' placeholder='请选择'
259
+ close-on-select search="true">
260
+ </v-select>
261
+ </div>
262
+ <div class="col-sm-6 form-group" :class="[$v.f_building.required ? 'has-error' : 'has-success']">
263
+ <label class="font_normal_body">楼栋名称</label>
264
+ <input type="text" class="input_search" style="width:60%" v-validate:f_building='{required: true }'
265
+ v-model="buildingmodel.f_building" placeholder="楼栋名称">
266
+ </div>
267
+ </div>
268
+ </div>
269
+ <div class="row auto" style="text-align:right;">
270
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
271
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
272
+ </div>
273
+ <div v-if="areatype == '楼栋'" class="row" style="margin-top:40px;height: 580px;">
274
+ <building-list v-ref:buildinglist @select-changed="selected" :areaslist="areaslist" :f_filialeids.sync="f_filialeids"></building-list>
275
+ </div>
276
+ </div>
277
+ </validator>
278
+ </div>
279
+ </template>
280
+
281
+ <script>
282
+ import {HttpResetClass} from 'vue-client'
283
+
284
+ let initGen = async function (self) {
285
+ await self.$getConfig(self, 'UserArea')
286
+ console.log('原地址配置',self.config)
287
+ console.log('获取地址配置',self.config)
288
+ // Object.assign(self.model, self.config)
289
+ await self.initdata()
290
+ await self.$LoadParams.loadMeterBook(self.f_filialeids)
291
+ await self.loadMeterBooks();
292
+ }
293
+ export default {
294
+ title: '小区添加',
295
+ data () {
296
+ return {
297
+ config:{
298
+ hasnumber:false,
299
+ },
300
+ //初始化省市区数据
301
+ pcdslist:[],
302
+ //初始化街道数据
303
+ streetslist:[],
304
+ communitys:[],
305
+ //小区
306
+ areamodel: {
307
+ f_area_id: '',
308
+ f_pcd_id:'',
309
+ f_linkname:'',
310
+ f_linkphone:'',
311
+ f_street_id:'',
312
+ f_slice_area:'',
313
+ f_adjustable_id:'',
314
+ f_residential_area:'',
315
+ f_user_type:'',
316
+ f_gasproperties:'',
317
+ f_meter_brand:'',
318
+ f_price_name:'',
319
+ f_area_address:'',
320
+ f_price_type:'',
321
+ f_meter_style:'',
322
+ f_position:'',
323
+ f_comments:'',
324
+ f_meter_type: ''
325
+ },
326
+ // 初始化小区数据
327
+ areaslist:[],
328
+ // 楼栋
329
+ buildingmodel: {
330
+ f_residential_area: '',
331
+ f_residential_area_id: '',
332
+ f_building: ''
333
+ },
334
+ meterbrands: [],
335
+ adjustables: [],
336
+ sliceArea: [],
337
+ gasproperties: [],
338
+ meterbooks:[{label: '全部',value: ''}],
339
+ housetypeoptions:[{label: '楼房', value: '楼房'}, {label: '自建房', value: '自建房'}],
340
+ isMachine: true
341
+ }
342
+ },
343
+ props: ['f_filialeids','f_special', 'areatype','row','operation'],
344
+ ready(){
345
+ initGen(this)
346
+ },
347
+ methods: {
348
+ loadMeterBooks(){
349
+ this.meterbooks = [...this.meterbooks, ...this.$GetSaleParam.getMeterBooks()]
350
+ },
351
+ //初始化数据
352
+ async initdata(){
353
+ // 初始化参数
354
+ await this.initParams()
355
+ if (this.areatype == '楼栋') {
356
+ this.initareas(` f_orgid = '${this.f_filialeids}'`)
357
+ }
358
+ // 初始化片区
359
+ await this.initSlice(this.f_filialeids)
360
+ await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
361
+ await this.initcommunitys(` f_filialeid = '${this.f_filialeids}'`)
362
+ },
363
+ initrow(val){
364
+ this.areamodel.f_meter_book = val.f_meter_book;
365
+ this.areamodel.f_adjustable_id = val.f_adjustable_id;
366
+ },
367
+ async initParams() {
368
+ await this.$LoadParams.loadParam(this.f_filialeids)
369
+ this.initBrands()
370
+ this.initAdjustables()
371
+ },
372
+
373
+ initBrands () {
374
+ let ret = this.$GetSaleParam.getGasbrand()
375
+ let rs = new Array()
376
+ ret.forEach((item, index) =>{
377
+ rs.push({label: item.label, value: item.value.f_meter_brand})
378
+ })
379
+ this.meterbrands = rs
380
+ },
381
+
382
+ initAdjustables () {
383
+ let filter = this.$login.f.orgid
384
+ let ret = this.$GetSaleParam.getAdjustable(filter)
385
+ let arr = new Array()
386
+ ret.forEach((item, index) => {
387
+ arr.push({label: `[${item.value.f_adjustable_id}]-${item.label}`, value: item.value.id})
388
+ })
389
+ this.adjustables = arr
390
+ },
391
+
392
+ async initSlice (val) {
393
+ if (val) {
394
+ let getAllArea = await this.$resetpost('/rs/search', {
395
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
396
+ userid: this.$login.f.id
397
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
398
+
399
+ let arr = getAllArea.data.filter((res) => {
400
+ return res.parentid == val
401
+ })
402
+ this.sliceArea = []
403
+ arr.forEach((res) => {
404
+ this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
405
+ })
406
+ }
407
+ },
408
+ //初始化小区添加小区
409
+ async initareas(pconditon){
410
+ // if(this.usertype){
411
+ // pconditon=pconditon+` and f_special='1' `
412
+ // }
413
+ this.areaslist = []
414
+ let HttpReset = new HttpResetClass()
415
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy?pageNo=1&pageSize=9999999', {
416
+ data: {
417
+ items: '*',
418
+ tablename: 't_area',
419
+ orderitem: 'id',
420
+ condition: pconditon
421
+ }
422
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
423
+ let redata = []
424
+ req.data.forEach((row) => {
425
+ redata.push({
426
+ label: '['+row.f_street+']'+row.f_residential_area,
427
+ value: row.id,
428
+ data: row,
429
+ id: row.id
430
+ })
431
+ })
432
+ this.areaslist=redata
433
+ },
434
+
435
+ //初始化省市区,添加街道
436
+ async initpcds(pconditon){
437
+ this.pcdslist = []
438
+ let HttpReset = new HttpResetClass()
439
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
440
+ data: {
441
+ items: '*',
442
+ tablename: 't_pcd',
443
+ orderitem: 'id',
444
+ condition: pconditon
445
+ }
446
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
447
+ let redata = []
448
+ req.data.forEach((row, n) => {
449
+ redata[n] = {
450
+ label: row.f_pcd,
451
+ value: row.id,
452
+ data:row,
453
+ id:row.id
454
+ }
455
+ })
456
+ this.pcdslist=redata
457
+
458
+ },
459
+ //初始化社区
460
+ async initcommunitys(conditon){
461
+ this.communitys = []
462
+ let HttpReset = new HttpResetClass()
463
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
464
+ data: {
465
+ items: 'id,f_community_name',
466
+ tablename: 't_community',
467
+ orderitem: 'id',
468
+ condition: conditon
469
+ }
470
+ }, {resolveMsg: null, rejectMsg: '获取社区失败!'})
471
+ let redata = []
472
+ req.data.forEach((row, n) => {
473
+ redata[n] = {
474
+ label: row.f_community_name,
475
+ value: row.id,
476
+ data:row,
477
+ id:row.id
478
+ }
479
+ })
480
+ this.communitys=redata
481
+ },
482
+ //初始化街道 添加小区
483
+ async initstreets(pconditon){
484
+ this.streetslist = []
485
+ let HttpReset = new HttpResetClass()
486
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
487
+ data: {
488
+ items: '*',
489
+ tablename: 't_street',
490
+ orderitem: 'id',
491
+ condition: pconditon
492
+ }
493
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
494
+ let redata = []
495
+ req.data.forEach((row, n) => {
496
+ redata[n] = {
497
+ label: row.f_street,
498
+ value: row.id,
499
+ data:row,
500
+ id:row.id
501
+ }
502
+ })
503
+ this.streetslist=redata
504
+ },
505
+ async areaidChangeHasnumber(){
506
+ console.log(this.areamodel.f_area_id.length)
507
+ if (this.areamodel.f_area_id.length != 2){
508
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
509
+ this.areamodel.f_area_id = ''
510
+ }else{
511
+ let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
512
+ data: {
513
+ items: '*',
514
+ tablename: 't_area',
515
+ orderitem: 'id',
516
+ condition: `f_area_id = '${this.areamodel.f_area_id}' and f_orgid = '${this.$login.f.orgid}'`
517
+ }
518
+ }, {resolveMsg: null, rejectMsg: null})
519
+ if (res.data.length>0){
520
+ if (res.data[0].id != this.areamodel.id) {
521
+ this.$showAlert('当前编号已存在', 'warning', 2000)
522
+ this.areamodel.f_area_id = ''
523
+ }
524
+ }
525
+ }
526
+ },
527
+ async areaidChange () {
528
+ // 验证小区编号是否已存在
529
+
530
+ let param = {
531
+ id: this.areamodel.id,
532
+ f_area_id: this.areamodel.f_area_id,
533
+ f_filialeid: this.f_filialeids
534
+ }
535
+
536
+ let res = await this.$resetpost('rs/logic/address_validateAreaID', param, {resolveMsg: null,rejectMsg: '小区编号验证失败!!'})
537
+ console.log('验证小区是否存在', res)
538
+ if (res.data) {
539
+ this.$showAlert('这个小区编号已存在!!!请核实', 'warning', 3000)
540
+ this.areamodel.f_area_id = ''
541
+ }
542
+
543
+ },
544
+
545
+
546
+ //根据名字找数据
547
+ findbyid(list,name){
548
+ var result
549
+ list.forEach((row, n) => {
550
+ if(name==row.id){
551
+ result= row.data
552
+ }
553
+ })
554
+ return result
555
+ },
556
+ userTypeChange () {
557
+ this.gasproperties = []
558
+ if (this.areamodel.f_user_type) {
559
+ this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
560
+ }
561
+ },
562
+
563
+ //省/市/区变化
564
+ async pcdChange(val){
565
+ if(val){
566
+ //那就把街道数据重新组织一下
567
+ await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
568
+ if(this.areamodel.f_street_id){
569
+ if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
570
+ let pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
571
+ if(pcd_id!=val){
572
+ this.areamodel.f_street_id=''
573
+ }
574
+ } else {
575
+ this.areamodel.f_street_id=''
576
+ }
577
+
578
+ }
579
+ }
580
+ this.$resetValidation()
581
+ },
582
+ //街道变化
583
+ streetChange(val){
584
+ if(val&&this.operation=='add'){
585
+ // if(this.areamodel.f_pcd_id.length==0){
586
+ if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
587
+ this.areamodel.f_pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
588
+ }
589
+ // }
590
+ }
591
+ this.$resetValidation()
592
+ },
593
+ //保存
594
+ async confirm(){
595
+ if(this.areatype=='楼栋'){
596
+ await this.savebuilding()
597
+ } else {
598
+ await this.savearea()
599
+ this.cleardara()
600
+ this.$dispatch('confirm')
601
+ }
602
+ },
603
+ // 保存楼栋
604
+ async savebuilding () {
605
+ this.buildingmodel.f_residential_area = this.$refs.areaselect.selectedItems
606
+ this.buildingmodel.f_filialeid = this.f_filialeids
607
+ this.buildingmodel.f_operator = this.$login.f.name
608
+ this.buildingmodel.f_operatorid = this.$login.f.id
609
+ this.buildingmodel.f_orgid = this.$login.f.orgid
610
+ this.buildingmodel.f_orgname = this.$login.f.orgs
611
+ this.buildingmodel.f_depid = this.$login.f.depids
612
+ this.buildingmodel.f_depname = this.$login.f.deps
613
+ await this.$resetpost('rs/logic/address_savebuilding', this.buildingmodel)
614
+ this.$refs.buildinglist.search()
615
+ },
616
+ //保存小区
617
+ async savearea(){
618
+ if(this.f_special){
619
+ this.areamodel.f_special='1'
620
+ }
621
+ this.areamodel.f_filialeid = this.f_filialeids
622
+ this.areamodel.f_operator = this.$login.f.name
623
+ this.areamodel.f_operatorid = this.$login.f.id
624
+ this.areamodel.f_orgid = this.$login.f.orgid
625
+ this.areamodel.f_orgname = this.$login.f.orgs
626
+ this.areamodel.f_depid = this.$login.f.depids
627
+ this.areamodel.f_depname = this.$login.f.deps
628
+ if (this.areamodel.slice_area) {
629
+ if (this.areamodel.slice_area.length > 0) {
630
+ this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
631
+ this.areamodel.f_area_code = this.areamodel.slice_area[0].code
632
+ }
633
+ }
634
+ this.areamodel.f_pcd=this.findbyid(this.pcdslist,this.areamodel.f_pcd_id).f_pcd
635
+ if (this.findbyid(this.communitys,this.areamodel.f_community_id)) {
636
+ this.areamodel.f_community=this.findbyid(this.communitys,this.areamodel.f_community_id).f_community_name
637
+ }
638
+ this.areamodel.f_street=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_street
639
+
640
+ await this.$resetpost('rs/logic/address_updatearea', this.areamodel)
641
+ },
642
+ cleardara(){
643
+ this.areamodel= {
644
+ f_area_id: '',
645
+ f_pcd_id:'',
646
+ f_street_id:'',
647
+ f_slice_area:'',
648
+ f_linkname:'',
649
+ f_linkphone:'',
650
+ f_adjustable_id:'',
651
+ f_residential_area:'',
652
+ f_user_type:'',
653
+ f_gasproperties:'',
654
+ f_area_address:'',
655
+ f_meter_brand:'',
656
+ f_price_name:'',
657
+ f_price_type:'',
658
+ f_meter_style:'',
659
+ f_position:'',
660
+ f_comments:'',
661
+ f_meter_type: ''
662
+ }
663
+ },
664
+ cancel(){
665
+ this.cleardara()
666
+ this.$dispatch('cancel')
667
+ },
668
+ },
669
+ watch: {
670
+ 'areamodel.f_meter_type' (val) {
671
+ if (val === '机表')
672
+ this.isMachine = false
673
+ },
674
+ 'areatype'(){
675
+ this.initdata()
676
+ },
677
+ 'areamodel.f_pcd_id'(){
678
+ if(this.areamodel.f_pcd_id&&this.areamodel.f_street_id){
679
+ if (this.findbyid(this.pcdslist,this.areamodel.f_pcd_id) && this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
680
+ this.areamodel.f_area_address = this.findbyid(this.pcdslist,this.areamodel.f_pcd_id).f_pcd + this.findbyid(this.streetslist,this.areamodel.f_street_id).f_street
681
+ }
682
+ }
683
+ },
684
+ 'areamodel.f_street_id'(){
685
+ if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
686
+ if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
687
+ this.areamodel.f_area_address = this.findbyid(this.pcdslist, this.areamodel.f_pcd_id).f_pcd + this.findbyid(this.streetslist, this.areamodel.f_street_id).f_street
688
+ }
689
+ }
690
+ },
691
+ 'f_filialeids'(){
692
+ if (this.areamodel.f_filialeid) {
693
+ if (this.areamodel.f_filialeid != this.f_filialeids) {
694
+ this.$dispatch('cancel')
695
+ }
696
+ }
697
+ this.cleardara()
698
+ this.initdata()
699
+ }
700
+ },
701
+ computed: {
702
+ metertypes() {
703
+ return this.$appdata.getParam('气表类型')
704
+ },
705
+ usertypes () {
706
+ return this.$appdata.getParam('用户类型')
707
+ },
708
+ f_price_types () {
709
+ return this.$appdata.getParam('气价类型')
710
+ },
711
+ meterstyle () {
712
+ let ret = this.$GetSaleParam.getGasbrand()
713
+ let rs = new Array()
714
+ if(this.areamodel.f_meter_brand) {
715
+ ret.forEach((item, index) => {
716
+ if(this.areamodel.f_meter_brand == item.value.f_meter_brand) {
717
+ item.value.gasmodel.forEach((item1, index) =>{
718
+ rs.push({label: item1.label, value:item1.label})
719
+ })
720
+ }
721
+ })
722
+ }
723
+ return rs
724
+ },
725
+ pricenames () {
726
+ let rs = new Array()
727
+ if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
728
+ let params = {
729
+ f_user_type: this.areamodel.f_user_type,
730
+ f_gasproperties: this.areamodel.f_gasproperties,
731
+ f_price_type: this.areamodel.f_price_type,
732
+ filter: this.f_filialeids
733
+ }
734
+ let ret = this.$GetSaleParam.getPrice(params)
735
+ ret.forEach((item, index) => {
736
+ rs.push({label: item.label, value: item.value.f_price_name})
737
+ })
738
+ }
739
+ if (rs.length == 0) {
740
+ this.areamodel.f_price_name = ''
741
+ }
742
+ return rs
743
+ },
744
+ positions () {
745
+ return this.$appdata.getParam('安装位置')
746
+ },
747
+ inputtores () {
748
+ // 获取抄表员
749
+ let rs = new Array()
750
+ if (this.$login.f.f_gasman.length > 0) {
751
+ for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
752
+ let temp = {
753
+ label: this.$login.f.f_gasman[i].name,
754
+ value: this.$login.f.f_gasman[i].name
755
+ }
756
+ rs.push(temp)
757
+ }
758
+ }
759
+ return rs
760
+ }
761
+ }
762
+ }
763
+ </script>
764
+ <style>
765
+ .box {
766
+ width: 727px;
767
+ height: 175px;
768
+ border-radius: 2px;
769
+ background-color: #fafafa;
770
+ border: 1px solid #999999;
771
+ margin-top: 13px;
772
+ }
773
+ .datapanel {
774
+ color: #333;
775
+ background-color: white;
776
+ box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
777
+ padding: 10px 30px 10px 30px;
778
+ border-radius:15px;
779
+ }
780
+ </style>