address-client 3.2.23 → 3.2.26

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