address-client 4.0.14 → 4.0.16

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