address-client 3.2.9 → 3.2.10

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