address-client 3.2.101 → 3.2.103

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