address-client 3.2.42 → 3.2.44

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