address-client 3.2.86 → 3.2.88-1

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