address-client 3.2.29 → 3.2.30

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