address-client 4.0.2 → 4.0.3

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,765 @@
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|| !this.validateCanSave()'>保存</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
+ canSave: true,
299
+ config: {
300
+ hasnumber: false,
301
+ },
302
+ //初始化省市区数据
303
+ pcdslist: [],
304
+ //初始化街道数据
305
+ streetslist: [],
306
+ //小区
307
+ areamodel: {
308
+ f_area_id: '',
309
+ f_pcd_id: '',
310
+ f_linkname: '',
311
+ f_linkphone: '',
312
+ f_street_id: '',
313
+ f_slice_area: '',
314
+ f_adjustable_id: '',
315
+ f_residential_area: '',
316
+ f_user_type: '',
317
+ f_gasproperties: '',
318
+ f_meter_brand: '',
319
+ f_price_name: '',
320
+ f_area_address: '',
321
+ f_price_type: '',
322
+ f_meter_style: '',
323
+ f_position: '',
324
+ f_comments: '',
325
+ f_meter_type: ''
326
+ },
327
+ // 初始化小区数据
328
+ areaslist: [],
329
+ // 楼栋
330
+ buildingmodel: {
331
+ f_residential_area: '',
332
+ f_residential_area_id: '',
333
+ f_building: ''
334
+ },
335
+ meterbrands: [],
336
+ adjustables: [],
337
+ sliceArea: [],
338
+ gasproperties: [],
339
+ meterbooks: [{label: '全部', value: ''}],
340
+ housetypeoptions: [{label: '楼房', value: '楼房'}, {label: '自建房', value: '自建房'}],
341
+ isMachine: true
342
+ }
343
+ },
344
+ props: ['f_filialeids', 'f_special', 'areatype', 'row', 'operation'],
345
+ ready() {
346
+ initGen(this)
347
+ },
348
+ methods: {
349
+ validateCanSave() {
350
+ this.canSave = this.$login.r.includes('地址修改权限')
351
+ if (!this.canSave) {
352
+ this.$showAlert('您没有权限进行保存操作', 'warning', 1500)
353
+ }
354
+ return this.canSave
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_id}]-${item.label}`, value: item.value.id})
395
+ })
396
+ this.adjustables = arr
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', 'api/af-revenue/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', 'api/af-revenue/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', 'api/af-revenue/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('api/af-revenue/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('api/af-revenue/logic/address_validateAreaID', param, {
521
+ resolveMsg: null,
522
+ rejectMsg: '小区编号验证失败!!'
523
+ })
524
+ console.log('验证小区是否存在', res)
525
+ if (res.data) {
526
+ this.$showAlert('这个小区编号已存在!!!请核实', 'warning', 3000)
527
+ this.areamodel.f_area_id = ''
528
+ }
529
+
530
+ },
531
+
532
+
533
+ //根据名字找数据
534
+ findbyid(list, name) {
535
+ var result
536
+ list.forEach((row, n) => {
537
+ if (name == row.id) {
538
+ result = row.data
539
+ }
540
+ })
541
+ return result
542
+ },
543
+ userTypeChange() {
544
+ this.gasproperties = []
545
+ if (this.areamodel.f_user_type) {
546
+ this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
547
+ }
548
+ },
549
+
550
+ //省/市/区变化
551
+ async pcdChange(val) {
552
+ if (val) {
553
+ //那就把街道数据重新组织一下
554
+ await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
555
+ if (this.areamodel.f_street_id) {
556
+ if (this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
557
+ let pcd_id = this.findbyid(this.streetslist, this.areamodel.f_street_id).f_pcd_id
558
+ if (pcd_id != val) {
559
+ this.areamodel.f_street_id = ''
560
+ }
561
+ } else {
562
+ this.areamodel.f_street_id = ''
563
+ }
564
+
565
+ }
566
+ }
567
+ this.$resetValidation()
568
+ },
569
+ //街道变化
570
+ streetChange(val) {
571
+ if (val && this.operation == 'add') {
572
+ // if(this.areamodel.f_pcd_id.length==0){
573
+ if (this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
574
+ this.areamodel.f_pcd_id = this.findbyid(this.streetslist, this.areamodel.f_street_id).f_pcd_id
575
+ }
576
+ // }
577
+ }
578
+ this.$resetValidation()
579
+ },
580
+ //保存
581
+ async confirm() {
582
+ if (this.areatype == '楼栋') {
583
+ await this.savebuilding()
584
+ } else {
585
+ await this.savearea()
586
+ this.cleardara()
587
+ this.$dispatch('confirm')
588
+ }
589
+ },
590
+ // 保存楼栋
591
+ async savebuilding() {
592
+ this.buildingmodel.f_residential_area = this.$refs.areaselect.selectedItems
593
+ this.buildingmodel.f_filialeid = this.f_filialeids
594
+ this.buildingmodel.f_operator = this.$login.f.name
595
+ this.buildingmodel.f_operatorid = this.$login.f.id
596
+ this.buildingmodel.f_orgid = this.$login.f.orgid
597
+ this.buildingmodel.f_orgname = this.$login.f.orgs
598
+ this.buildingmodel.f_depid = this.$login.f.depids
599
+ this.buildingmodel.f_depname = this.$login.f.deps
600
+ await this.$resetpost('api/af-revenue/logic/address_savebuilding', this.buildingmodel)
601
+ this.$refs.buildinglist.search()
602
+ },
603
+ //保存小区
604
+ async savearea() {
605
+ if (this.f_special) {
606
+ this.areamodel.f_special = '1'
607
+ }
608
+ this.areamodel.f_filialeid = this.f_filialeids
609
+ this.areamodel.f_operator = this.$login.f.name
610
+ this.areamodel.f_operatorid = this.$login.f.id
611
+ this.areamodel.f_orgid = this.$login.f.orgid
612
+ this.areamodel.f_orgname = this.$login.f.orgs
613
+ this.areamodel.f_depid = this.$login.f.depids
614
+ this.areamodel.f_depname = this.$login.f.deps
615
+ if (this.areamodel.slice_area) {
616
+ if (this.areamodel.slice_area.length > 0) {
617
+ this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
618
+ this.areamodel.f_area_code = this.areamodel.slice_area[0].code
619
+ }
620
+ }
621
+ this.areamodel.f_pcd = this.findbyid(this.pcdslist, this.areamodel.f_pcd_id).f_pcd
622
+ this.areamodel.f_street = this.findbyid(this.streetslist, this.areamodel.f_street_id).f_street
623
+
624
+ await this.$resetpost('api/af-revenue/logic/address_updatearea', this.areamodel)
625
+ },
626
+ cleardara() {
627
+ this.areamodel = {
628
+ f_area_id: '',
629
+ f_pcd_id: '',
630
+ f_street_id: '',
631
+ f_slice_area: '',
632
+ f_linkname: '',
633
+ f_linkphone: '',
634
+ f_adjustable_id: '',
635
+ f_residential_area: '',
636
+ f_user_type: '',
637
+ f_gasproperties: '',
638
+ f_area_address: '',
639
+ f_meter_brand: '',
640
+ f_price_name: '',
641
+ f_price_type: '',
642
+ f_meter_style: '',
643
+ f_position: '',
644
+ f_comments: '',
645
+ f_meter_type: ''
646
+ }
647
+ },
648
+ cancel() {
649
+ this.cleardara()
650
+ this.$dispatch('cancel')
651
+ },
652
+ },
653
+ watch: {
654
+ 'areamodel.f_meter_type'(val) {
655
+ if (val === '机表')
656
+ this.isMachine = false
657
+ },
658
+ 'areatype'() {
659
+ this.initdata()
660
+ },
661
+ 'areamodel.f_pcd_id'() {
662
+ if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
663
+ if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
664
+ 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
665
+ }
666
+ }
667
+ },
668
+ 'areamodel.f_street_id'() {
669
+ if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
670
+ if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
671
+ 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
672
+ }
673
+ }
674
+ },
675
+ 'f_filialeids'() {
676
+ if (this.areamodel.f_filialeid) {
677
+ if (this.areamodel.f_filialeid != this.f_filialeids) {
678
+ this.$dispatch('cancel')
679
+ }
680
+ }
681
+ this.cleardara()
682
+ this.initdata()
683
+ }
684
+ },
685
+ computed: {
686
+ metertypes() {
687
+ return this.$appdata.getParam('气表类型')
688
+ },
689
+ usertypes() {
690
+ return this.$appdata.getParam('用户类型')
691
+ },
692
+ f_price_types() {
693
+ return this.$appdata.getParam('气价类型')
694
+ },
695
+ meterstyle() {
696
+ let ret = this.$GetSaleParam.getGasbrand()
697
+ let rs = new Array()
698
+ if (this.areamodel.f_meter_brand) {
699
+ ret.forEach((item, index) => {
700
+ if (this.areamodel.f_meter_brand == item.value.f_meter_brand) {
701
+ item.value.gasmodel.forEach((item1, index) => {
702
+ rs.push({label: item1.label, value: item1.label})
703
+ })
704
+ }
705
+ })
706
+ }
707
+ return rs
708
+ },
709
+ pricenames() {
710
+ let rs = new Array()
711
+ if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
712
+ let params = {
713
+ f_user_type: this.areamodel.f_user_type,
714
+ f_gasproperties: this.areamodel.f_gasproperties,
715
+ f_price_type: this.areamodel.f_price_type,
716
+ filter: this.f_filialeids
717
+ }
718
+ let ret = this.$GetSaleParam.getPrice(params)
719
+ ret.forEach((item, index) => {
720
+ rs.push({label: item.label, value: item.value.f_price_name})
721
+ })
722
+ }
723
+ if (rs.length == 0) {
724
+ this.areamodel.f_price_name = ''
725
+ }
726
+ return rs
727
+ },
728
+ positions() {
729
+ return this.$appdata.getParam('安装位置')
730
+ },
731
+ inputtores() {
732
+ // 获取抄表员
733
+ let rs = new Array()
734
+ if (this.$login.f.f_gasman.length > 0) {
735
+ for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
736
+ let temp = {
737
+ label: this.$login.f.f_gasman[i].name,
738
+ value: this.$login.f.f_gasman[i].name
739
+ }
740
+ rs.push(temp)
741
+ }
742
+ }
743
+ return rs
744
+ }
745
+ }
746
+ }
747
+ </script>
748
+ <style>
749
+ .box {
750
+ width: 727px;
751
+ height: 175px;
752
+ border-radius: 2px;
753
+ background-color: #fafafa;
754
+ border: 1px solid #999999;
755
+ margin-top: 13px;
756
+ }
757
+
758
+ .datapanel {
759
+ color: #333;
760
+ background-color: white;
761
+ box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px;
762
+ padding: 10px 30px 10px 30px;
763
+ border-radius: 15px;
764
+ }
765
+ </style>