address-client 3.0.19-dev3 → 3.0.19-wsd

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,559 +1,560 @@
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 "
14
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
15
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;省市区</label>
16
- <input type="text" class="input_search" class="input_search" style="width:60%" v-show="false" v-model="areamodel.f_pcd_id"
17
- v-validate:f_pcd_id='{required: true }'>
18
- <v-select
19
- :value.sync="areamodel.f_pcd_id" :value-single="true"
20
- :options='pcdslist' placeholder='请选择'
21
- close-on-select search="true" @change="pcdChange">
22
- </v-select>
23
- </div>
24
- <div class="col-sm-6 "
25
- :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
26
- <label class="font_normal_body">街道名称</label>
27
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_street_id"
28
- v-validate:f_street_id='{required: true }'>
29
- <v-select
30
- :value.sync="areamodel.f_street_id" :value-single="true"
31
- :options='streetslist' placeholder='请选择'
32
- close-on-select search="true" @change="streetChange">
33
- </v-select>
34
- </div>
35
- <div class="col-sm-6 " :class="[$v.slice.required ? 'has-error' : 'has-success']">
36
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;片区&nbsp;&nbsp;&nbsp;</label>
37
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems">
38
- <v-select :value.sync="areamodel.slice_area" v-model="areamodel.slice_area"
39
- :options='sliceArea' placeholder='片区/管理站' filer-key="name"
40
- close-on-select v-ref:slice>
41
- </v-select>
42
- </div>
43
- <!--小区(特殊)信息-->
44
- <div v-if="!f_special"
45
- class="col-sm-6 "
46
- :class="[$v.f_residential_area.required ? 'has-error' : 'has-success']">
47
- <label class="font_normal_body">小区名称</label>
48
- <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_residential_area"
49
- class="form-control" placeholder="小区名称"
50
- v-validate:f_residential_area='{required: true }'>
51
- </div>
52
- <div v-if="!f_special"
53
- class="col-sm-12 ">
54
- <label class="font_normal_body">小区地址</label>
55
- <input type="text" style="width:80%" class="input_search" v-model="areamodel.f_area_address"
56
- class="form-control" placeholder="小区地址">
57
- </div>
58
- <!--单位(特殊)信息-->
59
- <div v-if="f_special"
60
- class="col-sm-6 "
61
- :class="[$v.f_residential_area.required ? 'has-error' : 'has-success']">
62
- <label class="font_normal_body">单位名称</label>
63
- <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_residential_area"
64
- class="form-control" placeholder="单位名称"
65
- v-validate:f_residential_area='{required: true }'>
66
- </div>
67
- <div v-if="f_special"
68
- class="col-sm-12 ">
69
- <label class="font_normal_body">单位地址</label>
70
- <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_area_address"
71
- class="form-control" placeholder="单位地址">
72
- </div>
73
- <div v-if="f_special"
74
- class="col-sm-6 "
75
- :class="[$v.f_linkname.required ? 'has-error' : 'has-success']">
76
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;联系人</label>
77
- <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_linkname"
78
- class="form-control" placeholder="联系人"
79
- v-validate:f_linkname='{required: true }'>
80
- </div>
81
- <div v-if="f_special"
82
- class="col-sm-6 "
83
- :class="[$v.f_linkphone.required ? 'has-error' : 'has-success']">
84
- <label class="font_normal_body">联系电话</label>
85
- <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_linkphone"
86
- class="form-control" placeholder="联系电话"
87
- v-validate:f_linkphone='{required: true }'>
88
- </div>
89
- <div class="col-sm-12">
90
- <br/>
91
- </div>
92
- <!--表具信息-->
93
- <div v-if="!f_special" class="col-sm-12 bg-info text-center" style="padding: 8px;font-size: 18px;font-weight: bold">
94
- <span >默认表具信息</span>
95
- </div>
96
- <div v-if="!f_special">
97
- <div class="col-sm-6 ">
98
- <label class="font_normal_body">用户类型</label>
99
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_user_type"
100
- >
101
- <v-select
102
- :value.sync="areamodel.f_user_type" :value-single="true"
103
- :options='usertypes' placeholder='用户类型' @change="userTypeChange"
104
- close-on-select >
105
- </v-select>
106
- </div>
107
- <div class="col-sm-6 "
108
- >
109
- <label class="font_normal_body">用气性质</label>
110
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_gasproperties"
111
- >
112
- <v-select
113
- :value.sync="areamodel.f_gasproperties" :value-single="true"
114
- :options='gasproperties' placeholder='用气性质'
115
- close-on-select >
116
- </v-select>
117
- </div>
118
- <div class="col-sm-6 "
119
- >
120
- <label class="font_normal_body">气价类型</label>
121
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_price_type"
122
- >
123
- <v-select
124
- :value.sync="areamodel.f_price_type" :value-single="true"
125
- :options='f_price_types' placeholder='气价类型'
126
- close-on-select >
127
- </v-select>
128
- </div>
129
- <div class="col-sm-6 "
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_price_name"
133
- >
134
- <v-select
135
- :value.sync="areamodel.f_price_name" :value-single="true"
136
- :options='pricenames' placeholder='气价名称'
137
- close-on-select >
138
- </v-select>
139
- </div>
140
- <div class="col-sm-6 "
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_meter_brand"
144
- >
145
- <v-select
146
- :value.sync="areamodel.f_meter_brand" :value-single="true"
147
- :options='meterbrands' placeholder='气表品牌'
148
- close-on-select >
149
- </v-select>
150
- </div>
151
- <div class="col-sm-6 "
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_meter_style"
155
- >
156
- <v-select
157
- :value.sync="areamodel.f_meter_style" :value-single="true"
158
- :options='meterstyle' placeholder='气表型号'
159
- close-on-select >
160
- </v-select>
161
- </div>
162
- <div class="col-sm-6 ">
163
- <label class="font_normal_body">安装位置</label>
164
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_position">
165
- <v-select
166
- :value.sync="areamodel.f_position" :value-single="true"
167
- :options='positions' placeholder='安装位置'
168
- close-on-select >
169
- </v-select>
170
- </div>
171
- <div class="col-sm-6 ">
172
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;抄表员</label>
173
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_inputtor">
174
- <v-select
175
- :value.sync="areamodel.f_inputtor" :value-single="true"
176
- :options='inputtores' placeholder='抄表员'
177
- close-on-select >
178
- </v-select>
179
- </div>
180
- <div class="col-sm-6 ">
181
- <label class="font_normal_body">&nbsp;&nbsp;&nbsp;调压箱</label>
182
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_adjustable_id">
183
- <v-select
184
- :value.sync="areamodel.f_adjustable_id" :value-single="true"
185
- :options='adjustables' placeholder='调压箱'
186
- close-on-select >
187
- </v-select>
188
- </div>
189
- </div>
190
- <div v-if="f_special" class="col-sm-6">
191
- <br/>
192
- </div>
193
- </div>
194
- <div class="row auto" style="text-align:right;">
195
- <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
196
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
197
- </div>
198
- </div>
199
- </validator>
200
- </div>
201
- </template>
202
-
203
- <script>
204
- import {HttpResetClass} from 'vue-client'
205
-
206
-
207
- let initGen = async function (self) {
208
- await self.initdata()
209
- }
210
-
211
- export default {
212
- title: '小区添加',
213
- data () {
214
- return {
215
- //初始化省市区数据
216
- pcdslist:[],
217
- //初始化街道数据
218
- streetslist:[],
219
- //小区
220
- areamodel: {
221
- f_pcd_id:'',
222
- f_linkname:'',
223
- f_linkphone:'',
224
- f_street_id:'',
225
- f_slice_area:'',
226
- f_adjustable_id:'',
227
- f_residential_area:'',
228
- f_user_type:'',
229
- f_gasproperties:'',
230
- f_meter_brand:'',
231
- f_price_name:'',
232
- f_area_address:'',
233
- f_price_type:'',
234
- f_meter_style:'',
235
- f_position:'',
236
- },
237
-
238
- meterbrands: [],
239
- adjustables: [],
240
- sliceArea: [],
241
-
242
- gasproperties: []
243
- }
244
- },
245
- props: ['f_filialeids','f_special', 'areatype','row','operation'],
246
- ready(){
247
- initGen(this)
248
- },
249
- methods: {
250
-
251
- //初始化数据
252
- async initdata(){
253
- // 初始化参数
254
- await this.initParams()
255
- // 初始化片区
256
- await this.initSlice(this.f_filialeids)
257
- await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
258
- // await this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
259
- },
260
-
261
- async initParams() {
262
- await this.$LoadParams.loadParam(this.f_filialeids)
263
- this.initBrands()
264
- this.initAdjustables()
265
- },
266
-
267
- initBrands () {
268
- let ret = this.$GetSaleParam.getGasbrand()
269
- let rs = new Array()
270
- ret.forEach((item, index) =>{
271
- rs.push({label: item.label, value: item.value.f_meter_brand})
272
- })
273
- this.meterbrands = rs
274
- },
275
-
276
- initAdjustables () {
277
- let filter = this.$login.f.orgid
278
- let ret = this.$GetSaleParam.getAdjustable(filter)
279
- let arr = new Array()
280
- ret.forEach((item, index) => {
281
- arr.push({label: `[${item.value.f_adjustable_id}]-${item.label}`, value: item.value.id})
282
- })
283
- this.adjustables = arr
284
- },
285
-
286
- async initSlice (val) {
287
- if (val) {
288
- let getAllArea = await this.$resetpost('/rs/search', {
289
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
290
- userid: this.$login.f.id
291
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
292
-
293
- let arr = getAllArea.data.filter((res) => {
294
- return res.parentid == val
295
- })
296
- this.sliceArea = []
297
- arr.forEach((res) => {
298
- this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
299
- })
300
- }
301
- },
302
-
303
- //初始化省市区,添加街道
304
- async initpcds(pconditon){
305
- this.pcdslist = []
306
- let HttpReset = new HttpResetClass()
307
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
308
- data: {
309
- items: '*',
310
- tablename: 't_pcd',
311
- orderitem: 'id',
312
- condition: pconditon
313
- }
314
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
315
- let redata = []
316
- req.data.forEach((row, n) => {
317
- redata[n] = {
318
- label: row.f_pcd,
319
- value: row.id,
320
- data:row,
321
- id:row.id
322
- }
323
- })
324
- this.pcdslist=redata
325
-
326
- },
327
- //初始化街道 添加小区
328
- async initstreets(pconditon){
329
- this.streetslist = []
330
- let HttpReset = new HttpResetClass()
331
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
332
- data: {
333
- items: '*',
334
- tablename: 't_street',
335
- orderitem: 'id',
336
- condition: pconditon
337
- }
338
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
339
- let redata = []
340
- req.data.forEach((row, n) => {
341
- redata[n] = {
342
- label: row.f_street,
343
- value: row.id,
344
- data:row,
345
- id:row.id
346
- }
347
- })
348
- this.streetslist=redata
349
- },
350
-
351
- //根据名字找数据
352
- findbyid(list,name){
353
- var result
354
- list.forEach((row, n) => {
355
- if(name==row.id){
356
- result= row.data
357
- }
358
- })
359
- return result
360
- },
361
- userTypeChange () {
362
- this.gasproperties = []
363
- if (this.areamodel.f_user_type) {
364
- this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
365
- }
366
- },
367
-
368
- //省/市/区变化
369
- async pcdChange(val){
370
- if(val){
371
- //那就把街道数据重新组织一下
372
- await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
373
- if(this.areamodel.f_street_id){
374
- if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
375
- let pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
376
- if(pcd_id!=val){
377
- this.areamodel.f_street_id=''
378
- }
379
- } else {
380
- this.areamodel.f_street_id=''
381
- }
382
-
383
- }
384
- }
385
- this.$resetValidation()
386
- },
387
- //街道变化
388
- streetChange(val){
389
- if(val&&this.operation=='add'){
390
- if(this.areamodel.f_pcd_id.length==0){
391
- if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
392
- this.areamodel.f_pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
393
- }
394
- }
395
- }
396
- this.$resetValidation()
397
- },
398
- //保存
399
- async confirm(){
400
- await this.savearea()
401
- this.cleardara()
402
- this.$dispatch('confirm')
403
- },
404
- //保存小区
405
- async savearea(){
406
- if(this.f_special){
407
- this.areamodel.f_special='1'
408
- }
409
- this.areamodel.f_filialeid = this.f_filialeids
410
- this.areamodel.f_operator = this.$login.f.name
411
- this.areamodel.f_operatorid = this.$login.f.id
412
- this.areamodel.f_orgid = this.$login.f.orgid
413
- this.areamodel.f_orgname = this.$login.f.orgs
414
- this.areamodel.f_depid = this.$login.f.depids
415
- this.areamodel.f_depname = this.$login.f.deps
416
- if (this.areamodel.slice_area) {
417
- if (this.areamodel.slice_area.length > 0) {
418
- this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
419
- this.areamodel.f_area_code = this.areamodel.slice_area[0].code
420
- }
421
- }
422
- this.areamodel.f_pcd=this.findbyid(this.pcdslist,this.areamodel.f_pcd_id).f_pcd
423
- this.areamodel.f_street=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_street
424
-
425
- await this.$resetpost('rs/logic/address_updatearea', this.areamodel)
426
- },
427
- cleardara(){
428
- this.areamodel= {
429
- f_pcd_id:'',
430
- f_street_id:'',
431
- f_slice_area:'',
432
- f_linkname:'',
433
- f_linkphone:'',
434
- f_adjustable_id:'',
435
- f_residential_area:'',
436
- f_user_type:'',
437
- f_gasproperties:'',
438
- f_area_address:'',
439
- f_meter_brand:'',
440
- f_price_name:'',
441
- f_price_type:'',
442
- f_meter_style:'',
443
- f_position:'',
444
- }
445
- },
446
- cancel(){
447
- this.cleardara()
448
- this.$dispatch('cancel')
449
- },
450
- },
451
- watch: {
452
- 'areatype'(){
453
- this.initdata()
454
- },
455
- 'areamodel.f_pcd_id'(){
456
- if (!this.areamodel.f_area_address) {
457
- if(this.areamodel.f_pcd_id&&this.areamodel.f_street_id){
458
- if (this.findbyid(this.pcdslist,this.areamodel.f_pcd_id) && this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
459
- 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
460
- }
461
- }
462
- }
463
- },
464
- 'areamodel.f_street_id'(){
465
- if (!this.areamodel.f_area_address) {
466
- if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
467
- if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
468
- 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
469
- }
470
- }
471
- }
472
- },
473
- 'f_filialeids'(){
474
- if (this.areamodel.f_filialeid) {
475
- if (this.areamodel.f_filialeid != this.f_filialeids) {
476
- this.$dispatch('cancel')
477
- }
478
- }
479
- this.cleardara()
480
- this.initdata()
481
- }
482
- },
483
- computed: {
484
- usertypes () {
485
- return this.$appdata.getParam('用户类型')
486
- },
487
- f_price_types () {
488
- return this.$appdata.getParam('气价类型')
489
- },
490
- meterstyle () {
491
- let ret = this.$GetSaleParam.getGasbrand()
492
- let rs = new Array()
493
- if(this.areamodel.f_meter_brand) {
494
- ret.forEach((item, index) => {
495
- if(this.areamodel.f_meter_brand == item.value.f_meter_brand) {
496
- item.value.gasmodel.forEach((item1, index) =>{
497
- rs.push({label: item1.label, value:item1.label})
498
- })
499
- }
500
- })
501
- }
502
- return rs
503
- },
504
- pricenames () {
505
- let rs = new Array()
506
- if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
507
- let params = {
508
- f_user_type: this.areamodel.f_user_type,
509
- f_gasproperties: this.areamodel.f_gasproperties,
510
- f_price_type: this.areamodel.f_price_type,
511
- filter: this.f_filialeids
512
- }
513
- let ret = this.$GetSaleParam.getPrice(params)
514
- ret.forEach((item, index) => {
515
- rs.push({label: item.label, value: item.value.f_price_name})
516
- })
517
- }
518
- if (rs.length == 0) {
519
- this.areamodel.f_price_name = ''
520
- }
521
- return rs
522
- },
523
- positions () {
524
- return this.$appdata.getParam('安装位置')
525
- },
526
- inputtores () {
527
- // 获取抄表员
528
- let rs = new Array()
529
- if (this.$login.f.f_gasman.length > 0) {
530
- for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
531
- let temp = {
532
- label: this.$login.f.f_gasman[i].name,
533
- value: this.$login.f.f_gasman[i].name
534
- }
535
- rs.push(temp)
536
- }
537
- }
538
- return rs
539
- },
540
- },
541
- }
542
- </script>
543
- <style>
544
- .box {
545
- width: 727px;
546
- height: 175px;
547
- border-radius: 2px;
548
- background-color: #fafafa;
549
- border: 1px solid #999999;
550
- margin-top: 13px;
551
- }
552
- .datapanel {
553
- color: #333;
554
- background-color: white;
555
- box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
556
- padding: 10px 30px 10px 30px;
557
- border-radius:15px;
558
- }
559
- </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 "
14
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
15
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;省市区</label>
16
+ <input type="text" class="input_search" class="input_search" style="width:60%" v-show="false" v-model="areamodel.f_pcd_id"
17
+ v-validate:f_pcd_id='{required: true }'>
18
+ <v-select
19
+ :value.sync="areamodel.f_pcd_id" :value-single="true"
20
+ :options='pcdslist' placeholder='请选择'
21
+ close-on-select search="true" @change="pcdChange">
22
+ </v-select>
23
+ </div>
24
+ <div class="col-sm-6 "
25
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
26
+ <label class="font_normal_body">街道名称</label>
27
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_street_id"
28
+ v-validate:f_street_id='{required: true }'>
29
+ <v-select
30
+ :value.sync="areamodel.f_street_id" :value-single="true"
31
+ :options='streetslist' placeholder='请选择'
32
+ close-on-select search="true" @change="streetChange">
33
+ </v-select>
34
+ </div>
35
+ <div class="col-sm-6 " :class="[$v.slice.required ? 'has-error' : 'has-success']">
36
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;片区&nbsp;&nbsp;&nbsp;</label>
37
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"
38
+ v-validate:slice='{required: true }'>
39
+ <v-select :value.sync="areamodel.slice_area" v-model="areamodel.slice_area"
40
+ :options='sliceArea' placeholder='片区/管理站' filer-key="name"
41
+ close-on-select v-ref:slice>
42
+ </v-select>
43
+ </div>
44
+ <!--小区(特殊)信息-->
45
+ <div v-if="!f_special"
46
+ class="col-sm-6 "
47
+ :class="[$v.f_residential_area.required ? 'has-error' : 'has-success']">
48
+ <label class="font_normal_body">小区名称</label>
49
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_residential_area"
50
+ class="form-control" placeholder="小区名称"
51
+ v-validate:f_residential_area='{required: true }'>
52
+ </div>
53
+ <div v-if="!f_special"
54
+ class="col-sm-12 ">
55
+ <label class="font_normal_body">小区地址</label>
56
+ <input type="text" style="width:80%" class="input_search" v-model="areamodel.f_area_address"
57
+ class="form-control" placeholder="小区地址">
58
+ </div>
59
+ <!--单位(特殊)信息-->
60
+ <div v-if="f_special"
61
+ class="col-sm-6 "
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 ">
70
+ <label class="font_normal_body">单位地址</label>
71
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_area_address"
72
+ class="form-control" placeholder="单位地址">
73
+ </div>
74
+ <div v-if="f_special"
75
+ class="col-sm-6 "
76
+ :class="[$v.f_linkname.required ? 'has-error' : 'has-success']">
77
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;联系人</label>
78
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_linkname"
79
+ class="form-control" placeholder="联系人"
80
+ v-validate:f_linkname='{required: true }'>
81
+ </div>
82
+ <div v-if="f_special"
83
+ class="col-sm-6 "
84
+ :class="[$v.f_linkphone.required ? 'has-error' : 'has-success']">
85
+ <label class="font_normal_body">联系电话</label>
86
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_linkphone"
87
+ class="form-control" placeholder="联系电话"
88
+ v-validate:f_linkphone='{required: true }'>
89
+ </div>
90
+ <div class="col-sm-12">
91
+ <br/>
92
+ </div>
93
+ <!--表具信息-->
94
+ <div v-if="!f_special" class="col-sm-12 bg-info text-center" style="padding: 8px;font-size: 18px;font-weight: bold">
95
+ <span >默认表具信息</span>
96
+ </div>
97
+ <div v-if="!f_special">
98
+ <div class="col-sm-6 ">
99
+ <label class="font_normal_body">用户类型</label>
100
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_user_type"
101
+ >
102
+ <v-select
103
+ :value.sync="areamodel.f_user_type" :value-single="true"
104
+ :options='usertypes' placeholder='用户类型' @change="userTypeChange"
105
+ close-on-select >
106
+ </v-select>
107
+ </div>
108
+ <div class="col-sm-6 "
109
+ >
110
+ <label class="font_normal_body">用气性质</label>
111
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_gasproperties"
112
+ >
113
+ <v-select
114
+ :value.sync="areamodel.f_gasproperties" :value-single="true"
115
+ :options='gasproperties' placeholder='用气性质'
116
+ close-on-select >
117
+ </v-select>
118
+ </div>
119
+ <div class="col-sm-6 "
120
+ >
121
+ <label class="font_normal_body">气价类型</label>
122
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_price_type"
123
+ >
124
+ <v-select
125
+ :value.sync="areamodel.f_price_type" :value-single="true"
126
+ :options='f_price_types' placeholder='气价类型'
127
+ close-on-select >
128
+ </v-select>
129
+ </div>
130
+ <div class="col-sm-6 "
131
+ >
132
+ <label class="font_normal_body">气价名称</label>
133
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_price_name"
134
+ >
135
+ <v-select
136
+ :value.sync="areamodel.f_price_name" :value-single="true"
137
+ :options='pricenames' placeholder='气价名称'
138
+ close-on-select >
139
+ </v-select>
140
+ </div>
141
+ <div class="col-sm-6 "
142
+ >
143
+ <label class="font_normal_body">气表品牌</label>
144
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_meter_brand"
145
+ >
146
+ <v-select
147
+ :value.sync="areamodel.f_meter_brand" :value-single="true"
148
+ :options='meterbrands' placeholder='气表品牌'
149
+ close-on-select >
150
+ </v-select>
151
+ </div>
152
+ <div class="col-sm-6 "
153
+ >
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_style"
156
+ >
157
+ <v-select
158
+ :value.sync="areamodel.f_meter_style" :value-single="true"
159
+ :options='meterstyle' placeholder='气表型号'
160
+ close-on-select >
161
+ </v-select>
162
+ </div>
163
+ <div class="col-sm-6 ">
164
+ <label class="font_normal_body">安装位置</label>
165
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_position">
166
+ <v-select
167
+ :value.sync="areamodel.f_position" :value-single="true"
168
+ :options='positions' placeholder='安装位置'
169
+ close-on-select >
170
+ </v-select>
171
+ </div>
172
+ <div class="col-sm-6 ">
173
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;抄表员</label>
174
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_inputtor">
175
+ <v-select
176
+ :value.sync="areamodel.f_inputtor" :value-single="true"
177
+ :options='inputtores' placeholder='抄表员'
178
+ close-on-select >
179
+ </v-select>
180
+ </div>
181
+ <div class="col-sm-6 ">
182
+ <label class="font_normal_body">&nbsp;&nbsp;&nbsp;调压箱</label>
183
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_adjustable_id">
184
+ <v-select
185
+ :value.sync="areamodel.f_adjustable_id" :value-single="true"
186
+ :options='adjustables' placeholder='调压箱'
187
+ close-on-select >
188
+ </v-select>
189
+ </div>
190
+ </div>
191
+ <div v-if="f_special" class="col-sm-6">
192
+ <br/>
193
+ </div>
194
+ </div>
195
+ <div class="row auto" style="text-align:right;">
196
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
197
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
198
+ </div>
199
+ </div>
200
+ </validator>
201
+ </div>
202
+ </template>
203
+
204
+ <script>
205
+ import {HttpResetClass} from 'vue-client'
206
+
207
+
208
+ let initGen = async function (self) {
209
+ await self.initdata()
210
+ }
211
+
212
+ export default {
213
+ title: '小区添加',
214
+ data () {
215
+ return {
216
+ //初始化省市区数据
217
+ pcdslist:[],
218
+ //初始化街道数据
219
+ streetslist:[],
220
+ //小区
221
+ areamodel: {
222
+ f_pcd_id:'',
223
+ f_linkname:'',
224
+ f_linkphone:'',
225
+ f_street_id:'',
226
+ f_slice_area:'',
227
+ f_adjustable_id:'',
228
+ f_residential_area:'',
229
+ f_user_type:'',
230
+ f_gasproperties:'',
231
+ f_meter_brand:'',
232
+ f_price_name:'',
233
+ f_area_address:'',
234
+ f_price_type:'',
235
+ f_meter_style:'',
236
+ f_position:'',
237
+ },
238
+
239
+ meterbrands: [],
240
+ adjustables: [],
241
+ sliceArea: [],
242
+
243
+ gasproperties: []
244
+ }
245
+ },
246
+ props: ['f_filialeids','f_special', 'areatype','row','operation'],
247
+ ready(){
248
+ initGen(this)
249
+ },
250
+ methods: {
251
+
252
+ //初始化数据
253
+ async initdata(){
254
+ // 初始化参数
255
+ await this.initParams()
256
+ // 初始化片区
257
+ await this.initSlice(this.f_filialeids)
258
+ await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
259
+ // await this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
260
+ },
261
+
262
+ async initParams() {
263
+ await this.$LoadParams.loadParam(this.f_filialeids)
264
+ this.initBrands()
265
+ this.initAdjustables()
266
+ },
267
+
268
+ initBrands () {
269
+ let ret = this.$GetSaleParam.getGasbrand()
270
+ let rs = new Array()
271
+ ret.forEach((item, index) =>{
272
+ rs.push({label: item.label, value: item.value.f_meter_brand})
273
+ })
274
+ this.meterbrands = rs
275
+ },
276
+
277
+ initAdjustables () {
278
+ let filter = this.$login.f.orgid
279
+ let ret = this.$GetSaleParam.getAdjustable(filter)
280
+ let arr = new Array()
281
+ ret.forEach((item, index) => {
282
+ arr.push({label: `[${item.value.f_adjustable_id}]-${item.label}`, value: item.value.id})
283
+ })
284
+ this.adjustables = arr
285
+ },
286
+
287
+ async initSlice (val) {
288
+ if (val) {
289
+ let getAllArea = await this.$resetpost('/rs/search', {
290
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
291
+ userid: this.$login.f.id
292
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
293
+
294
+ let arr = getAllArea.data.filter((res) => {
295
+ return res.parentid == val
296
+ })
297
+ this.sliceArea = []
298
+ arr.forEach((res) => {
299
+ this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
300
+ })
301
+ }
302
+ },
303
+
304
+ //初始化省市区,添加街道
305
+ async initpcds(pconditon){
306
+ this.pcdslist = []
307
+ let HttpReset = new HttpResetClass()
308
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
309
+ data: {
310
+ items: '*',
311
+ tablename: 't_pcd',
312
+ orderitem: 'id',
313
+ condition: pconditon
314
+ }
315
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
316
+ let redata = []
317
+ req.data.forEach((row, n) => {
318
+ redata[n] = {
319
+ label: row.f_pcd,
320
+ value: row.id,
321
+ data:row,
322
+ id:row.id
323
+ }
324
+ })
325
+ this.pcdslist=redata
326
+
327
+ },
328
+ //初始化街道 添加小区
329
+ async initstreets(pconditon){
330
+ this.streetslist = []
331
+ let HttpReset = new HttpResetClass()
332
+ let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
333
+ data: {
334
+ items: '*',
335
+ tablename: 't_street',
336
+ orderitem: 'id',
337
+ condition: pconditon
338
+ }
339
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
340
+ let redata = []
341
+ req.data.forEach((row, n) => {
342
+ redata[n] = {
343
+ label: row.f_street,
344
+ value: row.id,
345
+ data:row,
346
+ id:row.id
347
+ }
348
+ })
349
+ this.streetslist=redata
350
+ },
351
+
352
+ //根据名字找数据
353
+ findbyid(list,name){
354
+ var result
355
+ list.forEach((row, n) => {
356
+ if(name==row.id){
357
+ result= row.data
358
+ }
359
+ })
360
+ return result
361
+ },
362
+ userTypeChange () {
363
+ this.gasproperties = []
364
+ if (this.areamodel.f_user_type) {
365
+ this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
366
+ }
367
+ },
368
+
369
+ //省/市/区变化
370
+ async pcdChange(val){
371
+ if(val){
372
+ //那就把街道数据重新组织一下
373
+ await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
374
+ if(this.areamodel.f_street_id){
375
+ if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
376
+ let pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
377
+ if(pcd_id!=val){
378
+ this.areamodel.f_street_id=''
379
+ }
380
+ } else {
381
+ this.areamodel.f_street_id=''
382
+ }
383
+
384
+ }
385
+ }
386
+ this.$resetValidation()
387
+ },
388
+ //街道变化
389
+ streetChange(val){
390
+ if(val&&this.operation=='add'){
391
+ if(this.areamodel.f_pcd_id.length==0){
392
+ if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
393
+ this.areamodel.f_pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
394
+ }
395
+ }
396
+ }
397
+ this.$resetValidation()
398
+ },
399
+ //保存
400
+ async confirm(){
401
+ await this.savearea()
402
+ this.cleardara()
403
+ this.$dispatch('confirm')
404
+ },
405
+ //保存小区
406
+ async savearea(){
407
+ if(this.f_special){
408
+ this.areamodel.f_special='1'
409
+ }
410
+ this.areamodel.f_filialeid = this.f_filialeids
411
+ this.areamodel.f_operator = this.$login.f.name
412
+ this.areamodel.f_operatorid = this.$login.f.id
413
+ this.areamodel.f_orgid = this.$login.f.orgid
414
+ this.areamodel.f_orgname = this.$login.f.orgs
415
+ this.areamodel.f_depid = this.$login.f.depids
416
+ this.areamodel.f_depname = this.$login.f.deps
417
+ if (this.areamodel.slice_area) {
418
+ if (this.areamodel.slice_area.length > 0) {
419
+ this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
420
+ this.areamodel.f_area_code = this.areamodel.slice_area[0].code
421
+ }
422
+ }
423
+ this.areamodel.f_pcd=this.findbyid(this.pcdslist,this.areamodel.f_pcd_id).f_pcd
424
+ this.areamodel.f_street=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_street
425
+
426
+ await this.$resetpost('rs/logic/address_updatearea', this.areamodel)
427
+ },
428
+ cleardara(){
429
+ this.areamodel= {
430
+ f_pcd_id:'',
431
+ f_street_id:'',
432
+ f_slice_area:'',
433
+ f_linkname:'',
434
+ f_linkphone:'',
435
+ f_adjustable_id:'',
436
+ f_residential_area:'',
437
+ f_user_type:'',
438
+ f_gasproperties:'',
439
+ f_area_address:'',
440
+ f_meter_brand:'',
441
+ f_price_name:'',
442
+ f_price_type:'',
443
+ f_meter_style:'',
444
+ f_position:'',
445
+ }
446
+ },
447
+ cancel(){
448
+ this.cleardara()
449
+ this.$dispatch('cancel')
450
+ },
451
+ },
452
+ watch: {
453
+ 'areatype'(){
454
+ this.initdata()
455
+ },
456
+ 'areamodel.f_pcd_id'(){
457
+ if (!this.areamodel.f_area_address) {
458
+ if(this.areamodel.f_pcd_id&&this.areamodel.f_street_id){
459
+ if (this.findbyid(this.pcdslist,this.areamodel.f_pcd_id) && this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
460
+ 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
461
+ }
462
+ }
463
+ }
464
+ },
465
+ 'areamodel.f_street_id'(){
466
+ if (!this.areamodel.f_area_address) {
467
+ if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
468
+ if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
469
+ 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
470
+ }
471
+ }
472
+ }
473
+ },
474
+ 'f_filialeids'(){
475
+ if (this.areamodel.f_filialeid) {
476
+ if (this.areamodel.f_filialeid != this.f_filialeids) {
477
+ this.$dispatch('cancel')
478
+ }
479
+ }
480
+ this.cleardara()
481
+ this.initdata()
482
+ }
483
+ },
484
+ computed: {
485
+ usertypes () {
486
+ return this.$appdata.getParam('用户类型')
487
+ },
488
+ f_price_types () {
489
+ return this.$appdata.getParam('气价类型')
490
+ },
491
+ meterstyle () {
492
+ let ret = this.$GetSaleParam.getGasbrand()
493
+ let rs = new Array()
494
+ if(this.areamodel.f_meter_brand) {
495
+ ret.forEach((item, index) => {
496
+ if(this.areamodel.f_meter_brand == item.value.f_meter_brand) {
497
+ item.value.gasmodel.forEach((item1, index) =>{
498
+ rs.push({label: item1.label, value:item1.label})
499
+ })
500
+ }
501
+ })
502
+ }
503
+ return rs
504
+ },
505
+ pricenames () {
506
+ let rs = new Array()
507
+ if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
508
+ let params = {
509
+ f_user_type: this.areamodel.f_user_type,
510
+ f_gasproperties: this.areamodel.f_gasproperties,
511
+ f_price_type: this.areamodel.f_price_type,
512
+ filter: this.f_filialeids
513
+ }
514
+ let ret = this.$GetSaleParam.getPrice(params)
515
+ ret.forEach((item, index) => {
516
+ rs.push({label: item.label, value: item.value.f_price_name})
517
+ })
518
+ }
519
+ if (rs.length == 0) {
520
+ this.areamodel.f_price_name = ''
521
+ }
522
+ return rs
523
+ },
524
+ positions () {
525
+ return this.$appdata.getParam('安装位置')
526
+ },
527
+ inputtores () {
528
+ // 获取抄表员
529
+ let rs = new Array()
530
+ if (this.$login.f.f_gasman.length > 0) {
531
+ for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
532
+ let temp = {
533
+ label: this.$login.f.f_gasman[i].name,
534
+ value: this.$login.f.f_gasman[i].name
535
+ }
536
+ rs.push(temp)
537
+ }
538
+ }
539
+ return rs
540
+ },
541
+ },
542
+ }
543
+ </script>
544
+ <style>
545
+ .box {
546
+ width: 727px;
547
+ height: 175px;
548
+ border-radius: 2px;
549
+ background-color: #fafafa;
550
+ border: 1px solid #999999;
551
+ margin-top: 13px;
552
+ }
553
+ .datapanel {
554
+ color: #333;
555
+ background-color: white;
556
+ box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
557
+ padding: 10px 30px 10px 30px;
558
+ border-radius:15px;
559
+ }
560
+ </style>