address-client 3.0.41-aodeToV4 → 3.0.42-aodeToV4

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.
@@ -57,14 +57,57 @@
57
57
  v-validate:f_residential_area='{required: true }'>
58
58
  </div>
59
59
  <div v-if="!f_special" class="col-sm-6 form-group">
60
- <label class="font_normal_body">网&nbsp;格&nbsp;员</label>
61
- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_gridman">
60
+ <label class="font_normal_body">安检网格员</label>
61
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_check_gridman">
62
62
  <v-select
63
- :value.sync="areamodel.f_gridman" :value-single="true"
64
- :options='gridmans' placeholder='请选择网格员'
65
- close-on-select >
63
+ :value.sync="areamodel.f_check_gridman" :value-single="true"
64
+ :options='gridmans' placeholder='请选择'
65
+ close-on-select @change="onCheckGridmanChange">
66
66
  </v-select>
67
67
  </div>
68
+ <div v-if="!f_special" class="col-sm-6 form-group" v-show="false">
69
+ <label class="font_normal_body">安检网格员电话</label>
70
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_check_phone" placeholder="安检网格员电话">
71
+ </div>
72
+ <div v-if="!f_special" class="col-sm-6 form-group">
73
+ <label class="font_normal_body">置换网格员</label>
74
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_replace_gridman">
75
+ <v-select
76
+ :value.sync="areamodel.f_replace_gridman" :value-single="true"
77
+ :options='gridmans1' placeholder='请选择'
78
+ close-on-select @change="onReplaceGridmanChange">
79
+ </v-select>
80
+ </div>
81
+ <div v-if="!f_special" class="col-sm-6 form-group" v-show="false">
82
+ <label class="font_normal_body">置换网格员电话</label>
83
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_replace_phone" placeholder="置换网格员电话">
84
+ </div>
85
+ <div v-if="!f_special" class="col-sm-6 form-group">
86
+ <label class="font_normal_body">维修网格员</label>
87
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_repair_gridman">
88
+ <v-select
89
+ :value.sync="areamodel.f_repair_gridman" :value-single="true"
90
+ :options='gridmans2' placeholder='请选择'
91
+ close-on-select @change="onRepairGridmanChange">
92
+ </v-select>
93
+ </div>
94
+ <div v-if="!f_special" class="col-sm-6 form-group" v-show="false">
95
+ <label class="font_normal_body">维修网格员电话</label>
96
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_repair_phone" placeholder="维修网格员电话">
97
+ </div>
98
+ <div v-if="!f_special" class="col-sm-6 form-group">
99
+ <label class="font_normal_body">工商业网格员</label>
100
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_industry_gridman">
101
+ <v-select
102
+ :value.sync="areamodel.f_industry_gridman" :value-single="true"
103
+ :options='gridmans3' placeholder='请选择'
104
+ close-on-select @change="onIndustryGridmanChange">
105
+ </v-select>
106
+ </div>
107
+ <div v-if="!f_special" class="col-sm-6 form-group" v-show="false">
108
+ <label class="font_normal_body">工商业网格员电话</label>
109
+ <input type="text" style="width:60%" class="input_search" v-model="areamodel.f_industry_phone" placeholder="工商业网格员电话">
110
+ </div>
68
111
  <div v-if="!f_special"
69
112
  class="col-sm-12 form-group">
70
113
  <label class="font_normal_body">小区地址</label>
@@ -221,415 +264,579 @@
221
264
  </template>
222
265
 
223
266
  <script>
224
- import {HttpResetClass} from 'vue-client'
267
+ import {HttpResetClass} from 'vue-client'
225
268
 
226
269
 
227
- let initGen = async function (self) {
228
- await self.initdata()
229
- }
270
+ let initGen = async function (self) {
271
+ await self.initdata()
272
+ }
230
273
 
231
- export default {
232
- title: '小区添加',
233
- data () {
234
- return {
235
- //初始化省市区数据
236
- pcdslist:[],
237
- //初始化街道数据
238
- streetslist:[],
239
- //小区
240
- areamodel: {
241
- f_area_id: '',
242
- f_pcd_id:'',
243
- f_linkname:'',
244
- f_linkphone:'',
245
- f_street_id:'',
246
- f_slice_area:'',
247
- f_adjustable_id:'',
248
- f_residential_area:'',
249
- f_gridman:'',
250
- f_user_type:'',
251
- f_gasproperties:'',
252
- f_meter_brand:'',
253
- f_price_name:'',
254
- f_area_address:'',
255
- f_price_type:'',
256
- f_meter_style:'',
257
- f_position:'',
258
- f_comments:''
259
- },
274
+ export default {
275
+ title: '小区添加',
276
+ data () {
277
+ return {
278
+ //初始化省市区数据
279
+ pcdslist:[],
280
+ //初始化街道数据
281
+ streetslist:[],
282
+ //小区
283
+ areamodel: {
284
+ f_area_id: '',
285
+ f_pcd_id:'',
286
+ f_linkname:'',
287
+ f_linkphone:'',
288
+ f_street_id:'',
289
+ f_slice_area:'',
290
+ f_adjustable_id:'',
291
+ f_residential_area:'',
292
+ f_check_gridman:'',
293
+ f_replace_gridman:'',
294
+ f_repair_gridman:'',
295
+ f_industry_gridman:'',
296
+ f_check_phone:'',
297
+ f_replace_phone:'',
298
+ f_repair_phone:'',
299
+ f_industry_phone:'',
300
+ f_user_type:'',
301
+ f_gasproperties:'',
302
+ f_meter_brand:'',
303
+ f_price_name:'',
304
+ f_area_address:'',
305
+ f_price_type:'',
306
+ f_meter_style:'',
307
+ f_position:'',
308
+ f_comments:''
309
+ },
260
310
 
261
- meterbrands: [],
262
- adjustables: [],
263
- sliceArea: [],
264
- gridmans: [],
265
- gasproperties: []
266
- }
267
- },
268
- props: ['f_filialeids','f_special', 'areatype','row','operation'],
269
- ready(){
270
- initGen(this)
271
- },
272
- methods: {
311
+ meterbrands: [],
312
+ adjustables: [],
313
+ sliceArea: [],
314
+ gridmans: [],
315
+ gridmans1: [],
316
+ gridmans2: [],
317
+ gridmans3: [],
318
+ // 网格员 name → phone 映射
319
+ gridmanPhoneMap: {},
320
+ gridmanPhoneMap1: {},
321
+ gridmanPhoneMap2: {},
322
+ gridmanPhoneMap3: {},
323
+ gasproperties: []
324
+ }
325
+ },
326
+ props: ['f_filialeids','f_special', 'areatype','row','operation'],
327
+ ready(){
328
+ initGen(this)
329
+ },
330
+ methods: {
273
331
 
274
- //初始化数据
275
- async initdata(){
276
- // 初始化参数
277
- await this.initParams()
278
- // 初始化片区
279
- await this.initSlice(this.f_filialeids)
280
- await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
281
- // await this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
282
- await this.initGridmans()
283
- },
332
+ //初始化数据
333
+ async initdata () {
334
+ // 初始化参数
335
+ await this.initParams()
336
+ // 初始化片区
337
+ await this.initSlice(this.f_filialeids)
338
+ await this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
339
+ // await this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
340
+ await this.initGridmans()
341
+ },
284
342
 
285
- async initGridmans () {
286
- try {
287
- let http = new HttpResetClass()
288
- let param = {
289
- tablename: 'AFV4_System.dbo.system_users',
290
- condition: `roles like '%网格员%' and org_id = '${this.$login.f.orgid}'`
343
+ pickRowPhone (row) {
344
+ if (!row) return ''
345
+ const p = row.phone != null && row.phone !== '' ? row.phone
346
+ : (row.f_phone != null && row.f_phone !== '' ? row.f_phone
347
+ : (row.mobile != null && row.mobile !== '' ? row.mobile : (row.tel || '')))
348
+ return String(p).trim()
349
+ },
350
+ rowsFromRes (res) {
351
+ if (!res || !res.data) return []
352
+ const d = res.data
353
+ if (Array.isArray(d)) return d
354
+ if (d.rows && Array.isArray(d.rows)) return d.rows
355
+ return []
356
+ },
357
+ async initGridmans () {
358
+ console.log('132456', this.f_filialeids)
359
+ console.log('999999', this.$login.f.orgid)
360
+ this.gridmanPhoneMap = {}
361
+ this.gridmanPhoneMap1 = {}
362
+ this.gridmanPhoneMap2 = {}
363
+ this.gridmanPhoneMap3 = {}
364
+ try {
365
+ let http = new HttpResetClass()
366
+ let param = {
367
+ tablename: 'AFV4_System.dbo.system_users',
368
+ condition: `roles like '%安检网格员%' and org_id = '${this.$login.f.orgid}'`
369
+ }
370
+ let param1 = {
371
+ tablename: 'AFV4_System.dbo.system_users',
372
+ condition: `roles like '%置换网格员%' and org_id = '${this.$login.f.orgid}'`
373
+ }
374
+ let param2 = {
375
+ tablename: 'AFV4_System.dbo.system_users',
376
+ condition: `roles like '%维修网格员%' and org_id = '${this.$login.f.orgid}'`
377
+ }
378
+ let param3 = {
379
+ tablename: 'AFV4_System.dbo.system_users',
380
+ condition: `roles like '%工商业网格员%' and org_id = '${this.$login.f.orgid}'`
381
+ }
382
+ let res = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
383
+ data: param
384
+ }, {
385
+ resolveMsg: null,
386
+ rejectMsg: '获取安检网格员失败!'
387
+ })
388
+ let res1 = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
389
+ data: param1
390
+ }, {
391
+ resolveMsg: null,
392
+ rejectMsg: '获取置换网格员失败!'
393
+ })
394
+ let res2 = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
395
+ data: param2
396
+ }, {
397
+ resolveMsg: null,
398
+ rejectMsg: '获取维修网格员失败!'
399
+ })
400
+ let res3 = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
401
+ data: param3
402
+ }, {
403
+ resolveMsg: null,
404
+ rejectMsg: '获取工商业网格员失败!'
405
+ })
406
+ let arr = []
407
+ let arr1 = []
408
+ let arr2 = []
409
+ let arr3 = []
410
+ const list0 = this.rowsFromRes(res)
411
+ const list1 = this.rowsFromRes(res1)
412
+ const list2 = this.rowsFromRes(res2)
413
+ const list3 = this.rowsFromRes(res3)
414
+ list0.forEach(row => {
415
+ if (row && row.name != null && String(row.name).trim() !== '') {
416
+ const nm = String(row.name).trim()
417
+ arr.push({label: nm, value: nm})
418
+ const ph = this.pickRowPhone(row)
419
+ if (ph) this.gridmanPhoneMap[nm] = ph
291
420
  }
292
- let res = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
293
- data: param
294
- }, {
295
- resolveMsg: null,
296
- rejectMsg: '获取网格员失败!'
297
- })
298
- let arr = []
299
- if (res && res.data && res.data.length > 0) {
300
- res.data.forEach(row => {
301
- arr.push({label: row.name, value: row.name})
302
- })
421
+ })
422
+ list1.forEach(row => {
423
+ if (row && row.name != null && String(row.name).trim() !== '') {
424
+ const nm = String(row.name).trim()
425
+ arr1.push({label: nm, value: nm})
426
+ const ph = this.pickRowPhone(row)
427
+ if (ph) this.gridmanPhoneMap1[nm] = ph
303
428
  }
304
- this.gridmans = arr
305
- } catch (e) {
306
- this.gridmans = []
307
- }
308
- },
309
-
310
- async initParams() {
311
- await this.$LoadParams.loadParam(this.f_filialeids)
312
- this.initBrands()
313
- this.initAdjustables()
314
- },
315
-
316
- initBrands () {
317
- let ret = this.$GetSaleParam.getGasbrand()
318
- let rs = new Array()
319
- ret.forEach((item, index) =>{
320
- rs.push({label: item.label, value: item.value.f_meter_brand})
321
429
  })
322
- this.meterbrands = rs
323
- },
324
-
325
- initAdjustables () {
326
- let filter = this.$login.f.orgid
327
- let ret = this.$GetSaleParam.getAdjustable(filter)
328
- let arr = new Array()
329
- ret.forEach((item, index) => {
330
- arr.push({label: `[${item.value.f_adjustable_id}]-${item.label}`, value: item.value.id})
430
+ list2.forEach(row => {
431
+ if (row && row.name != null && String(row.name).trim() !== '') {
432
+ const nm = String(row.name).trim()
433
+ arr2.push({label: nm, value: nm})
434
+ const ph = this.pickRowPhone(row)
435
+ if (ph) this.gridmanPhoneMap2[nm] = ph
436
+ }
331
437
  })
332
- this.adjustables = arr
333
- },
438
+ list3.forEach(row => {
439
+ if (row && row.name != null && String(row.name).trim() !== '') {
440
+ const nm = String(row.name).trim()
441
+ arr3.push({label: nm, value: nm})
442
+ const ph = this.pickRowPhone(row)
443
+ if (ph) this.gridmanPhoneMap3[nm] = ph
444
+ }
445
+ })
446
+ this.gridmans = arr
447
+ this.gridmans1 = arr1
448
+ this.gridmans2 = arr2
449
+ this.gridmans3 = arr3
450
+ this.syncGridmanPhonesFromModel()
451
+ } catch (e) {
452
+ this.gridmans = []
453
+ this.gridmans1 = []
454
+ this.gridmans2 = []
455
+ this.gridmans3 = []
456
+ this.gridmanPhoneMap = {}
457
+ this.gridmanPhoneMap1 = {}
458
+ this.gridmanPhoneMap2 = {}
459
+ this.gridmanPhoneMap3 = {}
460
+ }
461
+ },
462
+ // 选中网格员后自动填入对应电话(Vue1 模板不能用箭头函数 @change,需用下面具名方法)
463
+ normalizeGridmanName (val) {
464
+ if (val == null || val === '') return ''
465
+ if (typeof val === 'object') {
466
+ const v = val.value != null ? val.value : (val.label != null ? val.label : val.name)
467
+ return v != null ? String(v).trim() : ''
468
+ }
469
+ return String(val).trim()
470
+ },
471
+ onGridmanChange (type, val) {
472
+ const map = { check: 'gridmanPhoneMap', replace: 'gridmanPhoneMap1', repair: 'gridmanPhoneMap2', industry: 'gridmanPhoneMap3' }
473
+ const phoneKey = { check: 'f_check_phone', replace: 'f_replace_phone', repair: 'f_repair_phone', industry: 'f_industry_phone' }
474
+ const mapKey = map[type]
475
+ const phoneField = phoneKey[type]
476
+ const name = this.normalizeGridmanName(val)
477
+ if (mapKey && this[mapKey] && name) {
478
+ this.areamodel[phoneField] = this[mapKey][name] || ''
479
+ } else {
480
+ this.areamodel[phoneField] = ''
481
+ }
482
+ },
483
+ onCheckGridmanChange (val) {
484
+ this.onGridmanChange('check', val)
485
+ },
486
+ onReplaceGridmanChange (val) {
487
+ this.onGridmanChange('replace', val)
488
+ },
489
+ onRepairGridmanChange (val) {
490
+ this.onGridmanChange('repair', val)
491
+ },
492
+ onIndustryGridmanChange (val) {
493
+ this.onGridmanChange('industry', val)
494
+ },
495
+ syncGridmanPhonesFromModel () {
496
+ this.onGridmanChange('check', this.areamodel.f_check_gridman)
497
+ this.onGridmanChange('replace', this.areamodel.f_replace_gridman)
498
+ this.onGridmanChange('repair', this.areamodel.f_repair_gridman)
499
+ this.onGridmanChange('industry', this.areamodel.f_industry_gridman)
500
+ },
334
501
 
335
- async initSlice (val) {
336
- if (val) {
337
- this.sliceArea = [];
338
- let getAllArea = await this.$resetpost('/api/af-revenue/sql/address_singleTableOrderBy', {
339
- data:{
340
- items: '*',
341
- tablename: 't_zone',
342
- orderitem: 'id',
343
- condition: ` parentid = ${val}`
344
- }
345
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
502
+ async initParams () {
503
+ await this.$LoadParams.loadParam(this.f_filialeids)
504
+ this.initBrands()
505
+ this.initAdjustables()
506
+ },
346
507
 
347
- if(getAllArea.data){
348
- getAllArea.data.forEach((res) => {
349
- this.sliceArea.push({label: res.name, value: {name: res.name, code:res.number}})
350
- })
351
- }
508
+ initBrands () {
509
+ let ret = this.$GetSaleParam.getGasbrand()
510
+ let rs = new Array()
511
+ ret.forEach((item, index) => {
512
+ rs.push({label: item.label, value: item.value.f_meter_brand})
513
+ })
514
+ this.meterbrands = rs
515
+ },
352
516
 
353
- }
354
- },
517
+ initAdjustables () {
518
+ let filter = this.$login.f.orgid
519
+ let ret = this.$GetSaleParam.getAdjustable(filter)
520
+ let arr = new Array()
521
+ ret.forEach((item, index) => {
522
+ arr.push({label: `[${item.value.f_adjustable_id}]-${item.label}`, value: item.value.id})
523
+ })
524
+ this.adjustables = arr
525
+ },
355
526
 
356
- //初始化省市区,添加街道
357
- async initpcds(pconditon){
358
- this.pcdslist = []
359
- let HttpReset = new HttpResetClass()
360
- let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
527
+ async initSlice (val) {
528
+ if (val) {
529
+ this.sliceArea = [];
530
+ let getAllArea = await this.$resetpost('/api/af-revenue/sql/address_singleTableOrderBy', {
361
531
  data: {
362
532
  items: '*',
363
- tablename: 't_pcd',
533
+ tablename: 't_zone',
364
534
  orderitem: 'id',
365
- condition: pconditon
366
- }
367
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
368
- let redata = []
369
- req.data.forEach((row, n) => {
370
- redata[n] = {
371
- label: row.f_pcd,
372
- value: row.id,
373
- data:row,
374
- id:row.id
535
+ condition: ` parentid = ${val}`
375
536
  }
376
- })
377
- this.pcdslist=redata
537
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
378
538
 
379
- },
380
- //初始化街道 添加小区
381
- async initstreets(pconditon){
382
- this.streetslist = []
383
- let HttpReset = new HttpResetClass()
384
- let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
385
- data: {
386
- items: '*',
387
- tablename: 't_street',
388
- orderitem: 'id',
389
- condition: pconditon
390
- }
391
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
392
- let redata = []
393
- req.data.forEach((row, n) => {
394
- redata[n] = {
395
- label: row.f_street,
396
- value: row.id,
397
- data:row,
398
- id:row.id
399
- }
400
- })
401
- this.streetslist=redata
402
- },
539
+ if (getAllArea.data) {
540
+ getAllArea.data.forEach((res) => {
541
+ this.sliceArea.push({label: res.name, value: {name: res.name, code: res.number}})
542
+ })
543
+ }
403
544
 
404
- async areaidChange () {
405
- // 验证小区编号是否已存在
545
+ }
546
+ },
406
547
 
407
- let param = {
408
- id: this.areamodel.id,
409
- f_area_id: this.areamodel.f_area_id,
410
- f_filialeid: this.f_filialeids
548
+ //初始化省市区,添加街道
549
+ async initpcds (pconditon) {
550
+ this.pcdslist = []
551
+ let HttpReset = new HttpResetClass()
552
+ let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
553
+ data: {
554
+ items: '*',
555
+ tablename: 't_pcd',
556
+ orderitem: 'id',
557
+ condition: pconditon
558
+ }
559
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
560
+ let redata = []
561
+ req.data.forEach((row, n) => {
562
+ redata[n] = {
563
+ label: row.f_pcd,
564
+ value: row.id,
565
+ data: row,
566
+ id: row.id
411
567
  }
568
+ })
569
+ this.pcdslist = redata
412
570
 
413
- let res = await this.$resetpost('api/af-revenue/logic/address_validateAreaID', param, {resolveMsg: null,rejectMsg: '小区编号验证失败!!'})
414
- console.log('验证小区是否存在', res)
415
- if (res.data) {
416
- this.$showAlert('这个小区编号已存在!!!请核实', 'warning', 3000)
417
- this.areamodel.f_area_id = ''
571
+ },
572
+ //初始化街道 添加小区
573
+ async initstreets (pconditon) {
574
+ this.streetslist = []
575
+ let HttpReset = new HttpResetClass()
576
+ let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
577
+ data: {
578
+ items: '*',
579
+ tablename: 't_street',
580
+ orderitem: 'id',
581
+ condition: pconditon
582
+ }
583
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
584
+ let redata = []
585
+ req.data.forEach((row, n) => {
586
+ redata[n] = {
587
+ label: row.f_street,
588
+ value: row.id,
589
+ data: row,
590
+ id: row.id
418
591
  }
592
+ })
593
+ this.streetslist = redata
594
+ },
419
595
 
420
- },
596
+ async areaidChange () {
597
+ // 验证小区编号是否已存在
421
598
 
599
+ let param = {
600
+ id: this.areamodel.id,
601
+ f_area_id: this.areamodel.f_area_id,
602
+ f_filialeid: this.f_filialeids
603
+ }
422
604
 
423
- //根据名字找数据
424
- findbyid(list,name){
425
- var result
426
- list.forEach((row, n) => {
427
- if(name==row.id){
428
- result= row.data
429
- }
430
- })
431
- return result
432
- },
433
- userTypeChange () {
434
- this.gasproperties = []
435
- if (this.areamodel.f_user_type) {
436
- this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
437
- }
438
- },
605
+ let res = await this.$resetpost('api/af-revenue/logic/address_validateAreaID', param, {
606
+ resolveMsg: null,
607
+ rejectMsg: '小区编号验证失败!!'
608
+ })
609
+ console.log('验证小区是否存在', res)
610
+ if (res.data) {
611
+ this.$showAlert('这个小区编号已存在!!!请核实', 'warning', 3000)
612
+ this.areamodel.f_area_id = ''
613
+ }
439
614
 
440
- //省/市/区变化
441
- async pcdChange(val){
442
- if(val){
443
- //那就把街道数据重新组织一下
444
- await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
445
- if(this.areamodel.f_street_id){
446
- if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
447
- let pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
448
- if(pcd_id!=val){
449
- this.areamodel.f_street_id=''
450
- }
451
- } else {
452
- this.areamodel.f_street_id=''
453
- }
615
+ },
454
616
 
455
- }
617
+ //根据名字找数据
618
+ findbyid (list, name) {
619
+ var result
620
+ list.forEach((row, n) => {
621
+ if (name == row.id) {
622
+ result = row.data
456
623
  }
457
- this.$resetValidation()
458
- },
459
- //街道变化
460
- streetChange(val){
461
- if(val&&this.operation=='add'){
462
- // if(this.areamodel.f_pcd_id.length==0){
463
- if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
464
- console.log("aa",this.findbyid(this.streetslist,this.areamodel.f_street_id))
465
- console.log("bbb",this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id)
466
- this.areamodel.f_pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
624
+ })
625
+ return result
626
+ },
627
+ userTypeChange () {
628
+ this.gasproperties = []
629
+ if (this.areamodel.f_user_type) {
630
+ this.gasproperties = this.$appdata.getParam(this.areamodel.f_user_type)
631
+ }
632
+ },
633
+
634
+ //省/市/区变化
635
+ async pcdChange (val) {
636
+ if (val) {
637
+ //那就把街道数据重新组织一下
638
+ await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
639
+ if (this.areamodel.f_street_id) {
640
+ if (this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
641
+ let pcd_id = this.findbyid(this.streetslist, this.areamodel.f_street_id).f_pcd_id
642
+ if (pcd_id != val) {
643
+ this.areamodel.f_street_id = ''
467
644
  }
468
- // }
645
+ } else {
646
+ this.areamodel.f_street_id = ''
647
+ }
648
+
469
649
  }
470
- this.$resetValidation()
471
- },
472
- //保存
473
- async confirm(){
474
- await this.savearea()
475
- this.cleardara()
476
- this.$dispatch('confirm')
477
- },
478
- //保存小区
479
- async savearea(){
480
- if(this.f_special){
481
- this.areamodel.f_special='1'
650
+ }
651
+ this.$resetValidation()
652
+ },
653
+ //街道变化
654
+ streetChange (val) {
655
+ if (val && this.operation == 'add') {
656
+ // if(this.areamodel.f_pcd_id.length==0){
657
+ if (this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
658
+ console.log("aa", this.findbyid(this.streetslist, this.areamodel.f_street_id))
659
+ console.log("bbb", this.findbyid(this.streetslist, this.areamodel.f_street_id).f_pcd_id)
660
+ this.areamodel.f_pcd_id = this.findbyid(this.streetslist, this.areamodel.f_street_id).f_pcd_id
482
661
  }
483
- this.areamodel.f_filialeid = this.f_filialeids
484
- this.areamodel.f_operator = this.$login.f.name
485
- this.areamodel.f_operatorid = this.$login.f.id
486
- this.areamodel.f_orgid = this.$login.f.orgid
487
- this.areamodel.f_orgname = this.$login.f.orgs
488
- this.areamodel.f_depid = this.$login.f.depids
489
- this.areamodel.f_depname = this.$login.f.deps
490
- if (this.areamodel.slice_area) {
491
- if (this.areamodel.slice_area.length > 0) {
492
- this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
493
- this.areamodel.f_area_code = this.areamodel.slice_area[0].code
494
- }
662
+ // }
663
+ }
664
+ this.$resetValidation()
665
+ },
666
+ //保存
667
+ async confirm () {
668
+ await this.savearea()
669
+ this.cleardara()
670
+ this.$dispatch('confirm')
671
+ },
672
+ //保存小区
673
+ async savearea () {
674
+ if (this.f_special) {
675
+ this.areamodel.f_special = '1'
676
+ }
677
+ this.areamodel.f_filialeid = this.f_filialeids
678
+ this.areamodel.f_operator = this.$login.f.name
679
+ this.areamodel.f_operatorid = this.$login.f.id
680
+ this.areamodel.f_orgid = this.$login.f.orgid
681
+ this.areamodel.f_orgname = this.$login.f.orgs
682
+ this.areamodel.f_depid = this.$login.f.depids
683
+ this.areamodel.f_depname = this.$login.f.deps
684
+ if (this.areamodel.slice_area) {
685
+ if (this.areamodel.slice_area.length > 0) {
686
+ this.areamodel.f_slice_area = this.areamodel.slice_area[0].name
687
+ this.areamodel.f_area_code = this.areamodel.slice_area[0].code
495
688
  }
496
- this.areamodel.f_pcd=this.findbyid(this.pcdslist,this.areamodel.f_pcd_id).f_pcd
497
- this.areamodel.f_street=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_street
689
+ }
690
+ this.areamodel.f_pcd = this.findbyid(this.pcdslist, this.areamodel.f_pcd_id).f_pcd
691
+ this.areamodel.f_street = this.findbyid(this.streetslist, this.areamodel.f_street_id).f_street
498
692
 
499
- await this.$resetpost('api/af-revenue/logic/address_updatearea', this.areamodel)
500
- },
501
- cleardara(){
502
- this.areamodel= {
503
- f_area_id: '',
504
- f_pcd_id:'',
505
- f_street_id:'',
506
- f_slice_area:'',
507
- f_linkname:'',
508
- f_linkphone:'',
509
- f_adjustable_id:'',
510
- f_residential_area:'',
511
- f_user_type:'',
512
- f_gasproperties:'',
513
- f_area_address:'',
514
- f_meter_brand:'',
515
- f_price_name:'',
516
- f_price_type:'',
517
- f_meter_style:'',
518
- f_position:'',
519
- f_comments:''
693
+ await this.$resetpost('api/af-revenue/logic/address_updatearea', this.areamodel)
694
+ },
695
+ cleardara () {
696
+ this.areamodel = {
697
+ f_area_id: '',
698
+ f_pcd_id: '',
699
+ f_street_id: '',
700
+ f_slice_area: '',
701
+ f_linkname: '',
702
+ f_linkphone: '',
703
+ f_adjustable_id: '',
704
+ f_residential_area: '',
705
+ f_user_type: '',
706
+ f_gasproperties: '',
707
+ f_area_address: '',
708
+ f_meter_brand: '',
709
+ f_price_name: '',
710
+ f_price_type: '',
711
+ f_meter_style: '',
712
+ f_position: '',
713
+ f_comments: ''
714
+ }
715
+ },
716
+ cancel () {
717
+ this.cleardara()
718
+ this.$dispatch('cancel')
719
+ },
720
+ },
721
+ watch: {
722
+ 'areatype' () {
723
+ this.initdata()
724
+ },
725
+ 'areamodel.f_pcd_id' () {
726
+ // if (!this.areamodel.f_area_address) {
727
+ if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
728
+ if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
729
+ 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
520
730
  }
521
- },
522
- cancel(){
523
- this.cleardara()
524
- this.$dispatch('cancel')
525
- },
731
+ }
732
+ // }
526
733
  },
527
- watch: {
528
- 'areatype'(){
529
- this.initdata()
530
- },
531
- 'areamodel.f_pcd_id'(){
532
- // if (!this.areamodel.f_area_address) {
533
- if(this.areamodel.f_pcd_id&&this.areamodel.f_street_id){
534
- if (this.findbyid(this.pcdslist,this.areamodel.f_pcd_id) && this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
535
- 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
536
- }
537
- }
538
- // }
539
- },
540
- 'areamodel.f_street_id'(){
541
- // if (!this.areamodel.f_area_address) {
542
- if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
543
- if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
544
- 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
545
- }
546
- }
547
- // }
548
- },
549
- 'f_filialeids'(){
550
- if (this.areamodel.f_filialeid) {
551
- if (this.areamodel.f_filialeid != this.f_filialeids) {
552
- this.$dispatch('cancel')
553
- }
734
+ 'areamodel.f_street_id' () {
735
+ // if (!this.areamodel.f_area_address) {
736
+ if (this.areamodel.f_pcd_id && this.areamodel.f_street_id) {
737
+ if (this.findbyid(this.pcdslist, this.areamodel.f_pcd_id) && this.findbyid(this.streetslist, this.areamodel.f_street_id)) {
738
+ 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
554
739
  }
555
- this.cleardara()
556
- this.initdata()
557
740
  }
741
+ // }
558
742
  },
559
- computed: {
560
- usertypes () {
561
- return this.$appdata.getParam('用户类型')
562
- },
563
- f_price_types () {
564
- return this.$appdata.getParam('气价类型')
565
- },
566
- meterstyle () {
567
- let ret = this.$GetSaleParam.getGasbrand()
568
- let rs = new Array()
569
- if(this.areamodel.f_meter_brand) {
570
- ret.forEach((item, index) => {
571
- if(this.areamodel.f_meter_brand == item.value.f_meter_brand) {
572
- item.value.gasmodel.forEach((item1, index) =>{
573
- rs.push({label: item1.label, value:item1.label})
574
- })
575
- }
576
- })
743
+ 'f_filialeids' () {
744
+ if (this.areamodel.f_filialeid) {
745
+ if (this.areamodel.f_filialeid != this.f_filialeids) {
746
+ this.$dispatch('cancel')
577
747
  }
578
- return rs
579
- },
580
- pricenames () {
581
- let rs = new Array()
582
- if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
583
- let params = {
584
- f_user_type: this.areamodel.f_user_type,
585
- f_gasproperties: this.areamodel.f_gasproperties,
586
- f_price_type: this.areamodel.f_price_type,
587
- filter: this.f_filialeids
748
+ }
749
+ this.cleardara()
750
+ this.initdata()
751
+ },
752
+ 'areamodel.f_check_gridman' (v) {
753
+ this.onGridmanChange('check', v)
754
+ },
755
+ 'areamodel.f_replace_gridman' (v) {
756
+ this.onGridmanChange('replace', v)
757
+ },
758
+ 'areamodel.f_repair_gridman' (v) {
759
+ this.onGridmanChange('repair', v)
760
+ },
761
+ 'areamodel.f_industry_gridman' (v) {
762
+ this.onGridmanChange('industry', v)
763
+ }
764
+ },
765
+ computed: {
766
+ usertypes () {
767
+ return this.$appdata.getParam('用户类型')
768
+ },
769
+ f_price_types () {
770
+ return this.$appdata.getParam('气价类型')
771
+ },
772
+ meterstyle () {
773
+ let ret = this.$GetSaleParam.getGasbrand()
774
+ let rs = new Array()
775
+ if (this.areamodel.f_meter_brand) {
776
+ ret.forEach((item, index) => {
777
+ if (this.areamodel.f_meter_brand == item.value.f_meter_brand) {
778
+ item.value.gasmodel.forEach((item1, index) => {
779
+ rs.push({label: item1.label, value: item1.label})
780
+ })
588
781
  }
589
- let ret = this.$GetSaleParam.getPrice(params)
590
- ret.forEach((item, index) => {
591
- rs.push({label: item.label, value: item.value.f_price_name})
592
- })
593
- }
594
- if (rs.length == 0) {
595
- this.areamodel.f_price_name = ''
782
+ })
783
+ }
784
+ return rs
785
+ },
786
+ pricenames () {
787
+ let rs = new Array()
788
+ if (this.areamodel.f_user_type && this.areamodel.f_gasproperties && this.areamodel.f_price_type) {
789
+ let params = {
790
+ f_user_type: this.areamodel.f_user_type,
791
+ f_gasproperties: this.areamodel.f_gasproperties,
792
+ f_price_type: this.areamodel.f_price_type,
793
+ filter: this.f_filialeids
596
794
  }
597
- return rs
598
- },
599
- positions () {
600
- return this.$appdata.getParam('安装位置')
601
- },
602
- inputtores () {
603
- // 获取抄表员
604
- let rs = new Array()
605
- if (this.$login.f.f_gasman.length > 0) {
606
- for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
607
- let temp = {
608
- label: this.$login.f.f_gasman[i].name,
609
- value: this.$login.f.f_gasman[i].name
610
- }
611
- rs.push(temp)
795
+ let ret = this.$GetSaleParam.getPrice(params)
796
+ ret.forEach((item, index) => {
797
+ rs.push({label: item.label, value: item.value.f_price_name})
798
+ })
799
+ }
800
+ if (rs.length == 0) {
801
+ this.areamodel.f_price_name = ''
802
+ }
803
+ return rs
804
+ },
805
+ positions () {
806
+ return this.$appdata.getParam('安装位置')
807
+ },
808
+ inputtores () {
809
+ // 获取抄表员
810
+ let rs = new Array()
811
+ if (this.$login.f.f_gasman.length > 0) {
812
+ for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
813
+ let temp = {
814
+ label: this.$login.f.f_gasman[i].name,
815
+ value: this.$login.f.f_gasman[i].name
612
816
  }
817
+ rs.push(temp)
613
818
  }
614
- return rs
615
- },
819
+ }
820
+ return rs
616
821
  },
617
- }
822
+ },
823
+ }
618
824
  </script>
619
825
  <style>
620
- .box {
621
- width: 727px;
622
- height: 175px;
623
- border-radius: 2px;
624
- background-color: #fafafa;
625
- border: 1px solid #999999;
626
- margin-top: 13px;
627
- }
628
- .datapanel {
629
- color: #333;
630
- background-color: white;
631
- box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
632
- padding: 10px 30px 10px 30px;
633
- border-radius:15px;
634
- }
826
+ .box {
827
+ width: 727px;
828
+ height: 175px;
829
+ border-radius: 2px;
830
+ background-color: #fafafa;
831
+ border: 1px solid #999999;
832
+ margin-top: 13px;
833
+ }
834
+
835
+ .datapanel {
836
+ color: #333;
837
+ background-color: white;
838
+ box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px;
839
+ padding: 10px 30px 10px 30px;
840
+ border-radius: 15px;
841
+ }
635
842
  </style>