address-client 1.3.55 → 1.3.57-2

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