address-client 3.1.7 → 3.1.8

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