whychdw
2019-12-09 064c6d5b84fd6ddbbe4c20c41d139f7371460985
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
<template>
    <div class="new-home">
        <Form ref="newHome" :model="home" :rules="rules">
            <Row :gutter="8">
                <i-col span="6">
                    <FormItem label="机房编号">
                        <i-input type="text" v-model.trim="home.StationId" placeholder="机房编号" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="省" prop="StationName1">
                        <Select 
                        v-model="home.StationName1" 
                        @on-change="searchCity" 
                        class="black">
                            <Option 
                            v-for="item in linkage.province" 
                            :key="item" 
                            :value="item">{{item}}</Option>
                            <Option value="-100">其他</Option>
                        </Select>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="市" prop="StationName2">
                        <Select v-model="home.StationName2" @on-change="searchCounty" class="black">
                            <Option 
                            v-for="item in linkage.city" 
                            :key="item" 
                            :value="item">{{item}}</Option>
                            <Option value="-100">其他</Option>
                        </Select>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="区县" prop="StationName5">
                        <Select v-model="home.StationName5" @on-change="handleCounty" class="black">
                            <Option 
                            v-for="item in linkage.county" 
                            :key="item" 
                            :value="item">{{item}}</Option>
                            <Option value="-100">其他</Option>
                        </Select>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="机房名称" prop="StationName3">
                        <i-input type="text" v-model.trim="home.StationName3" placeholder="机房名称"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="机房IP">
                        <i-input type="text" v-model.trim="home.StationIp" placeholder="机房IP"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="设备名称">
                        <i-input type="text" v-model.trim="home.StationName4" placeholder="设备名称"></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="FBS设备ID" prop="FBSDeviceId">
                        <i-input type="text" v-model.trim="home.FBSDeviceId" placeholder="FBS设备ID"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="FBS设备IP">
                        <i-input type="text" v-model.trim="home.FbsDeviceIp" placeholder="FBS设备IP"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="子网掩码">
                        <i-input type="text" v-model.trim="home.FbsDeviceIp_YM" placeholder="子网掩码"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="网关">
                        <i-input type="text" v-model.trim="home.FbsDeviceIp_WG" placeholder="网关"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="FBS设备名称">
                        <i-input type="text" v-model.trim="home.FBSDeviceName" placeholder="FBS设备名称"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="FBS设备索引">
                        <i-input type="text" v-model.trim="home.GroupIndexInFBSDevice" placeholder="FBS设备索引"></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="电池组ID" prop="BattGroupId">
                        <i-input type="text" v-model.trim="home.BattGroupId" placeholder="电池组ID"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="机房内电池组组数">
                        <i-input type="text" v-model.trim="home.BattGroupNum" placeholder="机房内电池组组数"></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="电池组名称" prop="BattGroupName">
                        <i-input type="text" v-model.trim="home.BattGroupName" placeholder="电池组名称"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="浮充电压阀值" prop="FloatVolLevel">
                        <i-input type="text" v-model.trim="home.FloatVolLevel" placeholder="浮充电压阀值" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="离线电压阀值" prop="OfflineVolLevel">
                        <i-input type="text" v-model.trim="home.OfflineVolLevel" placeholder="离线电压阀值" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="浮充阀值" prop="BattFloatCurrent">
                        <i-input type="text" v-model.trim="home.BattFloatCurrent" placeholder="浮充阀值"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="单体数量" prop="MonCount">
                        <i-input type="number" @on-change="handleVol" v-model.trim="home.MonCount" placeholder="单体数量"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="标称容量" prop="MonCapStd">
                        <i-input type="text" v-model.trim="home.MonCapStd" placeholder="标称容量"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="标称单体电压" prop="MonVolStd">
                        <i-input type="text" @on-change="handleVol" v-model.trim="home.MonVolStd" placeholder="标称单体电压"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="标称单体内阻">
                        <i-input type="text" v-model.trim="home.MonResStd" placeholder="标称单体内阻"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="标称单体电导">
                        <i-input type="text" v-model.trim="home.MonSerStd" placeholder="标称单体电导"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="单体电压次低偏移量">
                        <i-input type="text" v-model.trim="home.MonVolLowToAvg" placeholder="单体电压次低偏移量"></i-input>
                    </FormItem>
                </i-col> -->
                <!-- <i-col span="6">
                    <FormItem label="负载电流">
                        <i-input type="text" v-model.trim="home.Load_curr" placeholder="负载电流"></i-input>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="最大核容电流" prop="DisCurrMax">
                        <i-input type="text" v-model.trim="home.DisCurrMax" placeholder="最大核容电流"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="基站手机号码" prop="station_phone">
                        <i-input type="text" v-model.trim="home.station_phone" placeholder="基站手机号码"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="电池品牌" prop="BattProducer">
                        <i-input type="text" v-model.trim="home.BattProducer" placeholder="电池品牌"></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="电池型号" prop="BattModel">
                        <i-input type="text" v-model.trim="home.BattModel" placeholder="电池型号"></i-input>
                    </FormItem>
                </i-col>
                <!-- <i-col span="6">
                    <FormItem label="电池生产日期">
                        <DatePicker type="date" v-model.trim="home.productDate" placeholder="电池生产日期"></DatePicker>
                    </FormItem>
                </i-col> -->
                <i-col span="6">
                    <FormItem label="投入使用日期" prop="BattInUseDate">
                        <DatePicker type="date" v-model.trim="home.BattInUseDate" placeholder="投入使用日期"></DatePicker>
                    </FormItem>
                </i-col>
            </Row>
        </Form>
        <div style="text-align:right; background-color: #FFFFFF;">
            <Button :loading="enLoading" type="primary" @click="handleNewHome">确认添加</Button>
        </div>
        <Modal
        v-model="other.provinceShow"
        title="省"
        class-name="vertical-center-modal"
        @on-ok="handleOk('province')"
        @on-cancel="handleCancel('province')">
            <Select v-model="other.province" class="black">
                <Option 
                v-for="item in other.provinces" 
                :key="item.key" 
                :value="item.name">{{item.name}}</Option>
            </Select>
        </Modal>
        <Modal
        v-model="other.cityShow"
        title="市"
        class-name="vertical-center-modal"
        @on-ok="handleOk('city')"
        @on-cancel="handleCancel('city')">
            <Select v-model="other.city" class="black">
                <Option 
                v-for="item in other.cities" 
                :key="item.key" 
                :value="item.name">{{item.name}}</Option>
            </Select>
        </Modal>
        <Modal
        v-model="other.countyShow"
        title="区县"
        class-name="vertical-center-modal"
        @on-ok="handleOk('county')"
        @on-cancel="handleCancel('county')">
            <Select v-model="other.county" class="black">
                <Option 
                v-for="item in other.counties"
                :key="item.key" 
                :value="item.name">{{item.name}}</Option>
            </Select>
        </Modal>
    </div>
</template>
<script>
import $ from 'jquery';
import LinkAge from '../assets/json/province-city-county'
import {ajax, LinkagePlus} from '../libs/common'
import { setTimeout } from 'timers';
export default {
    data(){
        return {
            home: {
                StationId: '42000064',      // 机房编号
                StationName1: '',   // 省 
                StationName2: '',   // 市
                StationName5: '',   // 区县
                StationName3: '',   // 机房名称
                StationName4: 'LD-9',   // 设备名称
                StationName: '',    // 全称(省+市+区县+机房名称+设备名称)
                StationIp: '192.168.0.5',      // 机房IP
                FBSDeviceId: '401900227',    // FBS设备ID(重要)
                FbsDeviceIp: '192.168.0.88',    // FBS设备IP(重要)
                FbsDeviceIp_YM: '255.255.255.0', // 子网掩码
                FbsDeviceIp_WG: '192.168.0.1', // 网关
                FBSDeviceName: 'LD-9',  // FBS设备名称
                GroupIndexInFBSDevice: '0', // FBS设备索引
                BattGroupId: '1000131',    // 电池组ID
                BattGroupNum: '1',   // 机房内电池组组数
                BattGroupName: '电池组1',  // 电池组名称
                FloatVolLevel: '120.6',  // 浮充电压阀值
                OfflineVolLevel: '115.9', // 离线电压阀值
                BattFloatCurrent: '0.6', // 浮充阀值
                MonCount: '9',   // 单体数量
                MonCapStd: '40',  // 标称容量
                MonVolStd: '12',  // 标称单体电压
                MonResStd: '0.2',  // 标称单体内阻
                MonSerStd: '5000',  // 标称单体电导
                MonVolLowToAvg: '0.05', // 单体电压次低偏移量
                Load_curr: '10',  // 负载电流
                DisCurrMax: '4', // 最大核容电流
                station_phone: '',  // 基站手机号码
                BattProducer: '',   // 电池品牌
                BattModel: '',      // 电池型号
                BattProductDate: '2006-07-06',    // 电池生产日期
                BattInUseDate: '2019-11-28',        // 投入使用日期
                // 分割线
                Vol_grade: '0',      // 电压等级(kV)
                Manufacturers: '',  // 生产厂家
                Assetequipment: '', // 是否资产级设备
                Deviceclasspath: '',    // 设备分类全路径
                Deviceoperationdepartment: '',  // 设备运维部门
                PropertyRightUnit: '',  // 产权单位
                PropertyAttribute: '',  // 产权属性
                FactoryNumber: '',      // 出厂编号
                OperationTeam: '',      // 运维(保管)班组
                DeviceIdentityCode: '', // 设备身份编码
                ProjectType: '',        // 项目类型
                BatteryApplicationType: '',     // 蓄电池应用类型
                SingleRatedVoltage: '0',     // 单电压额定电压
                RemoteMonitor: '',      // 是否实现远程监控
                BatttIndependentPlaced: '',     // 是否独立蓄电池室放置
                JunChargeVoltageValue: '0',      // 均充电压设定值
            },
            rules: {
                StationName1: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                StationName2: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                StationName5: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                StationName3: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                FBSDeviceId: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"integer", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                BattGroupId: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"integer", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                BattGroupName:[
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                FloatVolLevel: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                OfflineVolLevel: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                BattFloatCurrent: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                MonCount: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"integer", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                MonCapStd: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                MonVolStd: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                DisCurrMax: [
                    { required: true, message: '不能为空', trigger: 'blur',transform(value) {
                        return value.toString();
                    }},
                    { type:"number", message: '请输入数字格式', trigger: 'blur',transform(value) {
                        return Number(value);
                    }},
                ],
                station_phone: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                BattProducer: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                BattModel: [
                    { required: true, message: '不能为空', trigger: 'blur',},
                ],
                BattInUseDate: [
                    { type: 'date', required: true, message: '不能为空', trigger: 'blur',},
                ]
            },
            linkage: {
                province: [],
                city: [],
                county: []
            },
            other: {
                linkage: new LinkagePlus(),
                province: '',
                provinceShow: false,
                city: '',
                cityShow: false,
                county: '',
                countyShow: false,
                provinces: [],
                cities: [],
                counties: []
            },
            enLoading: false
        }
    },
    methods: {
        handleNewHome: function() {
            this.$refs.newHome.validate((valid) => {
                if(valid) {
                    this.addHome();
                }else {
                    this.$Message.error('存在格式不合法数据!');
                }
            });
        },
        searchProvince: function() {        // 省
            var self = this;
            // 请求后台
            ajax({
                url: 'BattInfAction!serchAllStationName1',
                data: null,
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    var data = [];
                    var first = "";
                    if(rs.code == 1) {
                        data = rs.data;
                        first = data[0];
                    }
                    // console.log(data);
                    // 设置省
                    self.home.StationName1 = first;
                    self.linkage.province = data;
                },
                complete: function() {
                    self.searchCity();
                }
            });
        },
        searchCity: function() {        // 市
            var self = this;
            // 构造查询对象
            var searchParams = {
                StationName1: this.home.StationName1
            };
            // 对StationName1=-100进行处理
            if(this.home.StationName1 == -100) {
                this.other.provinces = this.other.linkage.getProvince();
                this.other.province = this.other.provinces[0].name;
                this.other.provinceShow = true;
            }
            // 请求后台
            ajax({
                url: 'BattInfAction!serchAllStationName2',
                data: 'json='+JSON.stringify(searchParams),
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    var data = [];
                    var first = '';
                    if(rs.code == 1) {
                        data = rs.data;
                        first = data[0];
                    }
                    // console.log(data);
                    // 设置市
                    self.home.StationName2 = first;
                    self.linkage.city = data;
                },
                complete: function() {
                    self.searchCounty();
                }
            });
        },
        searchCounty: function() {        // 区县
            var self = this;
            // 构造查询对象
            var searchParams = {
                StationName1: this.home.StationName1,
                StationName2: this.home.StationName2
            };
            // 对StationName2=-100进行处理
            if(this.home.StationName2 == -100) {
                if(this.home.StationName1 != undefined) {
                    var rs = this.other.linkage.getCity(this.home.StationName1);
                    // console.log(rs);
                    if(rs.code == 1) {
                        this.other.cities = rs.data;
                        this.other.city = this.other.cities[0].name;
                        this.other.cityShow = true;
                    }else {
                        this.$Message.warning(rs.msg);
                        this.home.StationName2 = "";
                    }
                }else {
                    this.$Message.warning("请先选择省!");
                }
            }
            // 请求后台
            ajax({
                url: 'BattInfAction!serchAllStationName5',
                data: 'json='+JSON.stringify(searchParams),
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    var data = [];
                    var first = "";
                    if(rs.code == 1) {
                        data = rs.data;
                        first = data[0]
                    }
                    // console.log(data);
                    // 设置市
                    self.home.StationName5 = first;
                    self.linkage.county = data;
                }
            });
        },
        handleCounty: function() {
            // 对StationName2=-100进行处理
            if(this.home.StationName5 == -100) {
                if(this.home.StationName1 != undefined && this.home.StationName2 != undefined) {
                    var rs = this.other.linkage.getCounty(this.home.StationName1, this.home.StationName2);
                    console.log(rs);
                    if(rs.code == 1) {
                        this.other.counties = rs.data;
                        this.other.county = this.other.counties[0].name;
                        this.other.countyShow = true;
                    }else {
                        this.$Message.warning(rs.msg);
                        this.home.StationName5 = "";
                    }
                }else {
                    this.$Message.warning("请先选择省和市!");
                }
            }
        },
        handleVol: function() {
            var monCount = this.home.MonCount;
            var vol = this.home.MonVolStd;
            var chargeVol = (vol*1.117*monCount).toFixed(1);
            var outlineVol = (vol*1.073*monCount).toFixed(1);
            this.home.FloatVolLevel = chargeVol;
            this.home.OfflineVolLevel = outlineVol;
        },
        addHome: function() {
            var self = this;
            var home = Object.assign({}, this.home);
            // 省-市-区县-机房名称-设备名称
            home.StationName = home.StationName1+'-'+home.StationName2+'-'+home.StationName5+'-'+
                                home.StationName3+'-'+home.StationName4;
            home.BattProductDate = new Date(home.BattProductDate).format("yyyy-MM-dd");
            home.BattInUseDate = new Date(home.BattInUseDate).format("yyyy-MM-dd");
            // 构造查询条件
            var searchParams = [home];
            // 加载等待框
            this.enLoading = true;
            // 请求后台添加
            ajax({
                url: 'BattInfAction!add',
                data: 'json='+JSON.stringify(searchParams),
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    if(rs.code == 1) {
                        self.$emit('ensure', true);
                        self.$Message.success('添加成功!');
                    }else {
                        self.$Message.error('添加失败!');
                    }
                },
                error: function() {
                    self.$Message.error('添加失败!');
                },
                complete: function() {
                    // 关闭按钮的等待框
                    self.enLoading = false;
                }
            });
        },
        getMaxId: function() {
            var self = this;
            // 请求后台获取最大id
            ajax({
                url: "BattInfAction!searchMaxId",
                data: null,
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    if(rs.code == 1) {
                        var data = rs.data;
                        self.home.BattGroupId = data[0]+1;
                        self.home.StationId = data[1]+1;
                        self.home.FBSDeviceId = data[2]+1;
                    }
                }
            });
        },
        handleOk: function(type) {      // 处理联动确定事件
            switch(type) {
                case 'province':
                    if(!this.checkValInArr(this.other.province, this.linkage.province)) {
                        this.linkage.province.push(this.other.province);
                    }
                    this.home.StationName1 = this.other.province;
                    // 查询市
                    this.searchCity();
                break;
                case 'city':
                    if(!this.checkValInArr(this.other.city, this.linkage.city)) {
                        this.linkage.city.push(this.other.city);
                    }
                    this.home.StationName2 = this.other.city;
                    // 查询区县
                    this.searchCounty();
                break;
                case 'county':
                    if(!this.checkValInArr(this.other.county, this.linkage.county)) {
                        this.linkage.county.push(this.other.county);
                    }
                    this.home.StationName5 = this.other.county;
                break;
            }
        },
        handleCancel: function(type) {
            switch(type) {
                case 'province':
                    this.home.StationName1 = "";
                    // 查询市
                    this.searchCity();
                break;
                case 'city':
                    this.home.StationName2 = "";
                    // 查询区县
                    this.searchCounty();
                break;
                case 'county':
                    this.home.StationName5 = "";
                break;
            }
        },
        checkValInArr: function(val, arr) {
            var rs = false;
            // 遍历arr
            for(var i=0; i<arr.length; i++) {
                var _arr = arr[i];
                if(val == _arr) {
                    rs = true;
                    break;
                }
            }
            return rs;
        }
    },
    mounted: function() {
        // 获取今天的日期
        var today = new Date().format('yyyy-MM-dd');
        this.home.BattInUseDate = today;
        // 读取所有已有省
        this.searchProvince();
        // 读取最大值
        this.getMaxId();
        // 设置其他的省-市-区县联动
        this.other.linkage.setData(LinkAge);
    }
}
</script>