address-client 3.0.17 → 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,562 +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-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
- console.log('过滤之后的片区', arr)
298
- this.sliceArea = []
299
- arr.forEach((res) => {
300
- this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
301
- })
302
- }
303
- },
304
-
305
- //初始化省市区,添加街道
306
- async initpcds(pconditon){
307
- console.log("省市区准备")
308
- this.pcdslist = []
309
- let HttpReset = new HttpResetClass()
310
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
311
- data: {
312
- items: '*',
313
- tablename: 't_pcd',
314
- orderitem: 'id',
315
- condition: pconditon
316
- }
317
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
318
- let redata = []
319
- req.data.forEach((row, n) => {
320
- redata[n] = {
321
- label: row.f_pcd,
322
- value: row.id,
323
- data:row,
324
- id:row.id
325
- }
326
- })
327
- this.pcdslist=redata
328
-
329
- },
330
- //初始化街道 添加小区
331
- async initstreets(pconditon){
332
- console.log("街道数据准备", pconditon)
333
- this.streetslist = []
334
- let HttpReset = new HttpResetClass()
335
- let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
336
- data: {
337
- items: '*',
338
- tablename: 't_street',
339
- orderitem: 'id',
340
- condition: pconditon
341
- }
342
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
343
- let redata = []
344
- req.data.forEach((row, n) => {
345
- redata[n] = {
346
- label: row.f_street,
347
- value: row.id,
348
- data:row,
349
- id:row.id
350
- }
351
- })
352
- this.streetslist=redata
353
- },
354
-
355
- //根据名字找数据
356
- findbyid(list,name){
357
- var result
358
- list.forEach((row, n) => {
359
- if(name==row.id){
360
- result= row.data
361
- }
362
- })
363
- return result
364
- },
365
- userTypeChange () {
366
- this.gasproperties = []
367
- if (this.areamodel.f_user_type) {
368
- this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
369
- }
370
- },
371
-
372
- //省/市/区变化
373
- async pcdChange(val){
374
- if(val){
375
- //那就把街道数据重新组织一下
376
- await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
377
- if(this.areamodel.f_street_id){
378
- if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
379
- let pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
380
- if(pcd_id!=val){
381
- this.areamodel.f_street_id=''
382
- }
383
- } else {
384
- this.areamodel.f_street_id=''
385
- }
386
-
387
- }
388
- }
389
- this.$resetValidation()
390
- },
391
- //街道变化
392
- streetChange(val){
393
- console.log("街道变化",val)
394
- if(val&&this.operation=='add'){
395
- if(this.areamodel.f_pcd_id.length==0){
396
- if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
397
- this.areamodel.f_pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
398
- }
399
- }
400
- }
401
- this.$resetValidation()
402
- },
403
- //保存
404
- async confirm(){
405
- await this.savearea()
406
- this.cleardara()
407
- this.$dispatch('confirm')
408
- },
409
- //保存小区
410
- async savearea(){
411
- if(this.f_special){
412
- this.areamodel.f_special='1'
413
- }
414
- this.areamodel.f_filialeid = this.f_filialeids
415
- this.areamodel.f_operator = this.$login.f.name
416
- this.areamodel.f_operatorid = this.$login.f.id
417
- this.areamodel.f_orgid = this.$login.f.orgid
418
- this.areamodel.f_orgname = this.$login.f.orgs
419
- this.areamodel.f_depid = this.$login.f.depids
420
- this.areamodel.f_depname = this.$login.f.deps
421
- if (this.areamodel.slice_area) {
422
- if (this.areamodel.slice_area.length > 0) {
423
- this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
424
- this.areamodel.f_area_code = this.areamodel.slice_area[0].code
425
- }
426
- }
427
- this.areamodel.f_pcd=this.findbyid(this.pcdslist,this.areamodel.f_pcd_id).f_pcd
428
- this.areamodel.f_street=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_street
429
-
430
- await this.$resetpost('rs/logic/address_updatearea', this.areamodel)
431
- },
432
- cleardara(){
433
- this.areamodel= {
434
- f_pcd_id:'',
435
- f_street_id:'',
436
- f_slice_area:'',
437
- f_linkname:'',
438
- f_linkphone:'',
439
- f_adjustable_id:'',
440
- f_residential_area:'',
441
- f_user_type:'',
442
- f_gasproperties:'',
443
- f_area_address:'',
444
- f_meter_brand:'',
445
- f_price_name:'',
446
- f_price_type:'',
447
- f_meter_style:'',
448
- f_position:'',
449
- }
450
- },
451
- cancel(){
452
- this.cleardara()
453
- this.$dispatch('cancel')
454
- },
455
- },
456
- watch: {
457
- 'areatype'(){
458
- this.initdata()
459
- },
460
- 'areamodel.f_pcd_id'(){
461
- if(this.areamodel.f_pcd_id&&this.areamodel.f_street_id){
462
- if (this.findbyid(this.pcdslist,this.areamodel.f_pcd_id) && this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
463
- 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
464
- }
465
- }
466
- },
467
- 'areamodel.f_street_id'(){
468
- if(this.areamodel.f_pcd_id&&this.areamodel.f_street_id) {
469
- if (this.findbyid(this.pcdslist,this.areamodel.f_pcd_id) && this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
470
- 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
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
- console.log("气表型号ret: ", ret)
494
- let rs = new Array()
495
- if(this.areamodel.f_meter_brand) {
496
- ret.forEach((item, index) => {
497
- if(this.areamodel.f_meter_brand == item.value.f_meter_brand) {
498
- item.value.gasmodel.forEach((item1, index) =>{
499
- rs.push({label: item1.label, value:item1.label})
500
- })
501
- }
502
- })
503
- }
504
- console.log("气表型号rs: ", rs)
505
- return rs
506
- },
507
- pricenames () {
508
- let rs = new Array()
509
- if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
510
- let params = {
511
- f_user_type: this.areamodel.f_user_type,
512
- f_gasproperties: this.areamodel.f_gasproperties,
513
- f_price_type: this.areamodel.f_price_type,
514
- filter: this.f_filialeids
515
- }
516
- let ret = this.$GetSaleParam.getPrice(params)
517
- ret.forEach((item, index) => {
518
- rs.push({label: item.label, value: item.value.f_price_name})
519
- })
520
- }
521
- if (rs.length == 0) {
522
- this.areamodel.f_price_name = ''
523
- }
524
- return rs
525
- },
526
- positions () {
527
- return this.$appdata.getParam('安装位置')
528
- },
529
- inputtores () {
530
- // 获取抄表员
531
- let rs = new Array()
532
- if (this.$login.f.f_gasman.length > 0) {
533
- for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
534
- let temp = {
535
- label: this.$login.f.f_gasman[i].name,
536
- value: this.$login.f.f_gasman[i].name
537
- }
538
- rs.push(temp)
539
- }
540
- }
541
- return rs
542
- },
543
- },
544
- }
545
- </script>
546
- <style>
547
- .box {
548
- width: 727px;
549
- height: 175px;
550
- border-radius: 2px;
551
- background-color: #fafafa;
552
- border: 1px solid #999999;
553
- margin-top: 13px;
554
- }
555
- .datapanel {
556
- color: #333;
557
- background-color: white;
558
- box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
559
- padding: 10px 30px 10px 30px;
560
- border-radius:15px;
561
- }
562
- </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>