whychdw
2019-12-09 064c6d5b84fd6ddbbe4c20c41d139f7371460985
电池信息配置
3个文件已修改
4个文件已添加
7448 ■■■■■ 已修改文件
src/assets/css/common.css 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/json/province-city-county.json 5015 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/EidtBatt.vue 407 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/NewBatt.vue 430 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/NewHome.vue 670 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/libs/common.js 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/batt/info.vue 749 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/common.css
@@ -169,6 +169,9 @@
.science-page .ivu-select {
    color: #FFFFFF;
}
.science-page .ivu-select.black {
    color: #000000;
}
.science-page .ivu-select-selection {
    background-color: rgba(0, 0, 0, 0);
    border: 1px solid #1495E7;
@@ -179,6 +182,9 @@
.science-page .ivu-select-arrow {
    color: #FFFFFF;
}
.science-page .ivu-select.black .ivu-select-arrow {
    color: #000000;
}
.science-page .ivu-tree-title {
    color: #FFFFFF;
}
@@ -187,6 +193,9 @@
}
.science-page .ivu-tree-title:hover {
    color: #1495E7;
}
.ivu-input[disabled], fieldset[disabled] .ivu-input {
    color: #131313;
}
.main-menu .ivu-drawer-body {
    padding: 0 !important;
@@ -264,4 +273,30 @@
.ivu-table .table-tmp-low-cell {
    background-color: #19be6b;
    color: #fff;
}
/* modal */
.vertical-center-modal{
    display: flex;
    align-items: center;
    justify-content: center;
}
.vertical-center-modal .ivu-modal{
    top: 0;
}
.page-view {
    height: 100%;
}
/* flex layout */
.flex-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.flex-body {
    flex: 1;
}
.flex-body .flex-body-inner {
    height: 100%;
    overflow-y: auto;
}
src/assets/json/province-city-county.json
New file
Diff too large
src/components/EidtBatt.vue
New file
@@ -0,0 +1,407 @@
<template>
    <div class="new-home">
        <Form ref="newBatt" :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">
                        <i-input type="text" v-model.trim="home.StationName1" placeholder="省" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="市" prop="StationName2">
                        <i-input type="text" v-model.trim="home.StationName2" placeholder="市" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="区县" prop="StationName5">
                        <i-input type="text" v-model.trim="home.StationName5" placeholder="区县" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="机房名称" prop="StationName3">
                        <i-input type="text" v-model.trim="home.StationName3" placeholder="机房名称" disabled></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" disabled></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设备索引">
                        <Select v-model="home.GroupIndexInFBSDevice" class="black">
                            <Option :value="0">0</Option>
                            <Option :value="1">1</Option>
                            <Option :value="2">2</Option>
                            <Option :value="3">3</Option>
                        </Select>
                    </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="电池组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="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="handleEditBatt">确认修改</Button>
        </div>
    </div>
</template>
<script>
import {ajax} from '../libs/common'
export default {
    props: {
        info: {
            type: [Number, Object],
            default: function() {
                return -1;
            }
        }
    },
    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: '',  // 电池组名称
                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',},
                ]
            },
            enLoading: false
        }
    },
    methods: {
        init: function() {
            if(typeof(this.info) == 'object') {
                Object.assign(this.home, this.info);
            }
        },
        handleEditBatt: function() {
            this.$refs.newBatt.validate((valid) => {
                if(valid) {
                    this.editBatt();
                }else {
                    this.$Message.error('存在格式不合法数据!');
                }
            });
        },
        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;
        },
        editBatt: 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!update',
                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.$emit('ensure', false);
                        self.$Message.success('修改失败!');
                    }
                },
                complete: function() {
                    // 关闭按钮的等待框
                    self.enLoading = false;
                }
            });
        },
    },
    mounted: function() {
        // 初始化信息
        this.init();
    }
}
</script>
src/components/NewBatt.vue
New file
@@ -0,0 +1,430 @@
<template>
    <div class="new-home">
        <Form ref="newBatt" :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">
                        <i-input type="text" v-model.trim="home.StationName1" placeholder="省" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="市" prop="StationName2">
                        <i-input type="text" v-model.trim="home.StationName2" placeholder="市" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="区县" prop="StationName5">
                        <i-input type="text" v-model.trim="home.StationName5" placeholder="区县" disabled></i-input>
                    </FormItem>
                </i-col>
                <i-col span="6">
                    <FormItem label="机房名称" prop="StationName3">
                        <i-input type="text" v-model.trim="home.StationName3" placeholder="机房名称" disabled></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" disabled></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设备索引">
                        <Select v-model="home.GroupIndexInFBSDevice" class="black">
                            <Option :value="0">0</Option>
                            <Option :value="1">1</Option>
                            <Option :value="2">2</Option>
                            <Option :value="3">3</Option>
                        </Select>
                    </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="电池组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="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="handleNewBatt">确认添加</Button>
        </div>
    </div>
</template>
<script>
import {ajax} from '../libs/common'
export default {
    props: {
        info: {
            type: [Number, Object],
            default: function() {
                return -1;
            }
        }
    },
    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: '',  // 电池组名称
                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',},
                ]
            },
            enLoading: false
        }
    },
    methods: {
        init: function() {
            if(typeof(this.info) == 'object') {
                Object.assign(this.home, this.info);
            }
        },
        handleNewBatt: function() {
            this.$refs.newBatt.validate((valid) => {
                if(valid) {
                    this.addBatt();
                }else {
                    this.$Message.error('存在格式不合法数据!');
                }
            });
        },
        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;
        },
        addBatt: 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.$emit('ensure', false);
                        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;
                    }
                }
            });
        },
    },
    mounted: function() {
        // 初始化信息
        this.init();
        // 获取今天的日期
        var today = new Date().format('yyyy-MM-dd');
        this.home.BattInUseDate = today;
        // 读取最大值
        this.getMaxId();
    }
}
</script>
src/components/NewHome.vue
New file
@@ -0,0 +1,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>
src/libs/common.js
@@ -447,6 +447,147 @@
    return result;
}
//省-市-区县联动
function LinkagePlus() {
    this.data=[];
    this.provinces = [];
}
LinkagePlus.prototype.setData = function(data) {
    this.data = data;
    this._setProvinces(data);
};
// 设置所有的省
LinkagePlus.prototype._setProvinces = function(data) {
    var result = [];
    Object.keys(data).forEach(function(key){
        var temp = {};
        temp.key = key;
        temp.name = data[key].name;
        result.push(temp);
    });
    this.provinces =  result;
};
// 获取指定省的编号
LinkagePlus.prototype._getProvinceKey = function(province) {
    var result = {
        code: 0,
        province: province,
        key: 0,
        msg: '未查询到"'+province+'"的编号'
    };
    var provinces = this.provinces;
    for(var i=0; i<provinces.length; i++) {
        var _province = provinces[i];
        if(_province.name == province) {
            result.code=1;
            result.key = _province.key;
            result.msg = '获取"'+province+'"的编号成功';
        }
    }
    return result;
};
// 获取指定市的编号
LinkagePlus.prototype._getCityKey = function(province, city) {
    var result = {
        code: 0,
        province: province,
        provinceKey: 0,
        city: city,
        key: 0,
        msg: '未查询到"'+province+'-'+city+'"的编号'
    };
    var provinceKey = this._getProvinceKey(province);
    result.provinceKey = provinceKey.key;
    if(provinceKey.code == 1) {
        var cities = this.data[provinceKey.key].child;
        Object.keys(cities).forEach(function(key) {
            var _city = cities[key];
            if(_city.name == city || _city.name=='市辖区') {
                result.code = 1;
                result.key = key;
                result.city = _city.name;
                result.msg = '获取"'+province+'-'+_city.name+'"的编号成功';
            }
        });
    }else {
        result = $.extend({}, result, provinceKey);
    }
    return result;
};
// 获取省列表
LinkagePlus.prototype.getProvince = function() {
    return this.provinces;
};
// 获取市列表
LinkagePlus.prototype.getCity = function(province) {
    var result = {
        code: 0,
        province: province,
        data: [],
        msg:'未获取到"'+province+'"的市'
    };
    var provinceKey = this._getProvinceKey(province);
    if(provinceKey.code == 1) {
        var cities = this.data[provinceKey.key].child;
        result.code = 1;
        result.data = this._formatCity(cities);
        result.msg = '获取"'+province+'"的市成功';
    }
    return result;
};
// 格式化获取到的数据
LinkagePlus.prototype._formatCity = function(data) {
    var result = [];
    Object.keys(data).forEach(function(key){
        var temp = {};
        temp.key = key;
        temp.name = data[key].name;
        result.push(temp);
    });
    return result;
};
// 获取市区县
LinkagePlus.prototype.getCounty = function(province, city) {
    var result = {
        code: 0,
        province: province,
        city: city,
        data: [],
        msg:'未获取到"'+province+'-'+city+'"的区县'
    };
    var cityKey = this._getCityKey(province, city);
    if(cityKey.code == 1) {
        var cities = this.data[cityKey.provinceKey].child;
        var counties = cities[cityKey.key].child;
        result.code = 1;
        result.data = this._formatCounty(counties);
        result.city = cityKey.city;
        result.msg = '获取"'+province+'-'+cityKey.city+'"的区县成功';
    }else {
        result = $.extend({}, result, cityKey);
    }
    return result;
};
// 格式化获取到的数据
LinkagePlus.prototype._formatCounty = function(data) {
    var result = [];
    Object.keys(data).forEach(function(key){
        if(data[key] != '市辖区') {
            var temp = {};
            temp.key = key;
            temp.name = data[key];
            if(data[key])
            result.push(temp);
        }
    });
    return result;
};
export {
    CORS,           //  跨域请求内容
    Interval,       // 计时器
@@ -461,4 +602,5 @@
    formatTime1,    // 续航时长
    GetMonomerCap,  // 剩余容量
    GetHourRate,    // 放电小时率
    LinkagePlus,    // 省-市-区县
}
src/views/batt/info.vue
@@ -1,116 +1,665 @@
<template>
    <Table border :columns="columns7" :data="data6"></Table>
    <div class="flex-layout">
        <div class="flex-header">
            <Row>
                <i-col span="12" class="white">维护区</i-col>
                <i-col span="12" class="white">机房名称</i-col>
                <i-col span="12">
                    <Select
                    v-model="linkage.StationName1.value"
                    style="width: 80%"
                    @on-change="searchStationName"
                    filterable
                    clearable>
                        <Option value="-1">全部(共{{linkage.StationName1.data.length}})</Option>
                        <Option v-for="item in linkage.StationName1.data" :value="item.StationName1" :key="item.StationName1">{{ item.StationName1 }}</Option>
                    </Select>
                </i-col>
                <i-col span="12">
                    <Select
                    v-model="linkage.StationName.value"
                    style="width: 80%"
                    @on-change="handleStationNameChange"
                    filterable
                    clearable>
                        <Option value="-1">全部(共{{linkage.StationName.data.length}})</Option>
                        <Option v-for="item in linkage.StationName.data" :value="item.StationName" :key="item.StationName">{{ item.StationName }}</Option>
                    </Select>
                </i-col>
            </Row>
            <br>
        </div>
        <div class="tbl-tools">
            <div class="tbl-tools-inner">
                <Row>
                    <i-col span="12">
                        <Button type="primary" @click="searchBatt" icon="md-search" size="small">查询</Button>
                        <Button type="primary" @click="newHome.show=true" icon="md-home" size="small">新建机房</Button>
                        <Button type="primary" @click="showNewBattModal" icon="md-battery-charging" size="small">新建电池组</Button>
                        <Button type="primary" @click="showEditBattModal" icon="md-brush" size="small">编辑</Button>
                        <Button type="error" @click="delBattConfirm" icon="ios-trash" size="small">删除</Button>
                    </i-col>
                </Row>
                <!-- <Button type="success" icon="md-refresh" size="small">刷新</Button> -->
            </div>
        </div>
        <div class="flex-body" ref="main">
            <Table
            highlight-row
            :height="tbl.height"
            :loading="tbl.loading"
            border
            :columns="tbl.columns"
            :data="tbl.data"
            size="small"
            @on-row-click="handleTblClick">
                <!-- <template slot-scope="{ row, index }" slot="action">
                    <Button type="primary" size="small" style="margin-right: 5px">编辑</Button>
                    <Button type="error" size="small">删除</Button>
                </template> -->
            </Table>
        </div>
        <div class="flex-footer">
            <div class="flex-footer-inner">
                <Page
                size="small"
                :total="page.pageAll"
                :page-size="page.pageSize"
                @on-change="handlePageChange"
                @on-page-size-change="handlePageSizeChange"
                show-sizer/>
            </div>
        </div>
        <Modal
        v-model="newHome.show"
        :width="960"
        title="新建机房"
        footer-hide
        :mask-closable="false">
            <new-home v-if="newHome.show" @ensure="newHomeEnsure"></new-home>
        </Modal>
        <Modal
        v-model="newBatt.show"
        :width="960"
        title="新建电池组"
        footer-hide
        :mask-closable="false">
            <new-batt v-if="newBatt.show" :info="tbl.active"  @ensure="newBattEnsure"></new-batt>
        </Modal>
        <Modal
        v-model="editBatt.show"
        :width="960"
        title="修改电池组"
        footer-hide
        :mask-closable="false">
            <edit-batt v-if="editBatt.show" :info="tbl.active"  @ensure="eidtBattEnsure"></edit-batt>
        </Modal>
    </div>
</template>
<script>
import NewHome from '../../components/NewHome'
import NewBatt from '../../components/NewBatt'
import EditBatt from '../../components/EidtBatt'
import {ajax} from '../../libs/common'
export default {
    components: {
        NewHome,    // 新建机房
        NewBatt,    // 新建电池组
        EditBatt,   // 修改电池组信息
    },
    data () {
        return {
            columns7: [
                {
                    title: 'Name',
                    key: 'name',
                    render: (h, params) => {
                        var data = this.data6[params.index];
                        if(data.isEdit) {
                            return h('Input', {
                                props: {
                                    value: data.name
                                },
                                on: {
                                    'on-change': function(event) {
                                        data.name = event.target.value
                                    }
                                }
                            });
                        }else {
                            return h('div', [
                                h('Icon', {
                                    props: {
                                        type: 'person'
                                    }
                                }),
                                h('strong', params.row.name)
                            ]);
                        }
            tbl: {
                height: 300,
                loading: true,
                columns: [
                    {
                        title: '机房编号',
                        key: 'StationId',
                        align: "center",
                        width: 120,
                    },
                    {
                        title: '省',
                        key: 'StationName1',
                        align: "center",
                        width: 100
                    },
                    {
                        title: '市',
                        key: 'StationName2',
                        align: "center",
                        width: 100
                    },
                    {
                        title: '区县',
                        key: 'StationName5',
                        align: "center",
                        width: 100
                    },
                    {
                        title: '机房名称',
                        key: 'StationName3',
                        align: "center",
                        width: 360
                    },
                    {
                        title: '设备名称',
                        key: 'StationName4',
                        align: "center",
                        width: 160
                    },
                    {
                        title: '机房ip',
                        key: 'StationIp',
                        align: "center",
                        width: 160
                    },
                    {
                        title: 'FBS设备ID(重要)',
                        key: 'FBSDeviceId',
                        align: "center",
                        width: 160
                    },
                    {
                        title: 'FBS设备IP(重要)',
                        key: 'FbsDeviceIp',
                        align: "center",
                        width: 160
                    },
                    {
                        title: '子网掩码',
                        key: 'FbsDeviceIp_YM',
                        align: "center",
                        width: 160
                    },
                    {
                        title: '网关',
                        key: 'FbsDeviceIp_WG',
                        align: "center",
                        width: 160
                    },
                    {
                        title: 'FBS设备名称',
                        key: 'FBSDeviceName',
                        align: "center",
                        width: 160
                    },
                    {
                        title: 'FBS设备索引',
                        key: 'GroupIndexInFBSDevice',
                        align: "center",
                        width: 160
                    },
                    {
                        title: '电池组ID',
                        key: 'BattGroupId',
                        align: "center",
                        width: 160,
                    },
                    {
                        title: '机房内电池组组数',
                        key: 'BattGroupNum',
                        align: "center",
                        width: 160,
                    },
                    {
                        title: '电池组名称',
                        key: 'BattGroupName',
                        align: "center",
                        width: 160,
                    },
                    {
                        title: '浮充电压阀值',
                        key: 'FloatVolLevel',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'OfflineVolLevel',
                        title: '离线电压阀值',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'BattFloatCurrent',
                        title: '浮充阀值',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'MonCount',
                        title: '单体数量',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'MonCapStd',
                        title: '标称容量',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'MonVolStd',
                        title: '标称单体电压',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'MonResStd',
                        title: '标称单体内阻',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'MonSerStd',
                        title: '标称单体电导',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'MonVolLowToAvg',
                        title: '单体电压次低偏移量',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'Load_curr',
                        title: '负载电流',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'DisCurrMax',
                        title: '最大核容电流',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'station_phone',
                        title: '基站手机号码',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'BattProducer',
                        title: '电池品牌',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'BattModel',
                        title: '电池型号',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'BattProductDate',
                        title: '电池生产日期',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'BattInUseDate',
                        title: '投入使用日期',
                        align: "center",
                        width: 160,
                    },
                    {
                        key: 'Vol_grade',
                        title: '电压等级(kV)',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'Manufacturers',
                        title: '生产厂家',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'Assetequipment',
                        title: '是否资产级设备',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'Deviceclasspath',
                        title: '设备分类全路径',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'Deviceoperationdepartment',
                        title: '设备运维部门',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'PropertyRightUnit',
                        title: '产权单位',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'PropertyAttribute',
                        title: '产权属性',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'FactoryNumber',
                        title: '出厂编号',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'OperationTeam',
                        title: '运维(保管)班组',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'DeviceIdentityCode',
                        title: '设备身份编码',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'ProjectType',
                        title: '项目类型',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'BatteryApplicationType',
                        title: '蓄电池应用类型',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'SingleRatedVoltage',
                        title: '单电压额定电压',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'RemoteMonitor',
                        title: '是否实现远程监控',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'BatttIndependentPlaced',
                        title: '是否独立蓄电池室放置',
                        align: 'center',
                        width: 160
                    },
                    {
                        key: 'JunChargeVoltageValue',
                        title: '均充电压设定值',
                        align: 'center',
                        width: 160
                    }
                ],
                data: [],
                active: -1
            },
            page: {
                pageCurr:1,
                pageSize:20,
                pageAll:0,
            },
            linkage: {
                StationName1: {
                    value: '-1',
                    data: []
                },
                {
                    title: 'Age',
                    key: 'age'
                StationName: {
                    value: '-1',
                    data: []
                },
                {
                    title: 'Address',
                    key: 'address'
                },
                {
                    title: 'Action',
                    key: 'action',
                    width: 150,
                    align: 'center',
                    render: (h, params) => {
                        return h('div', [
                            h('Button', {
                                props: {
                                    type: 'primary',
                                    size: 'small'
                                },
                                style: {
                                    marginRight: '5px'
                                },
                                on: {
                                    click: () => {
                                        this.show(params.index)
                                    }
                                }
                            }, '编辑'),
                            h('Button', {
                                props: {
                                    type: 'error',
                                    size: 'small'
                                },
                                on: {
                                    click: () => {
                                        this.remove(params.index)
                                    }
                                }
                            }, '取消')
                        ]);
                    }
                }
            ],
            data6: [
                {
                    name: 'John Brown',
                    age: 18,
                    address: 'New York No. 1 Lake Park',
                    isEdit: false,
                },
                {
                    name: 'Jim Green',
                    age: 24,
                    address: 'London No. 1 Lake Park'
                },
                {
                    name: 'Joe Black',
                    age: 30,
                    address: 'Sydney No. 1 Lake Park'
                },
                {
                    name: 'Jon Snow',
                    age: 26,
                    address: 'Ottawa No. 2 Lake Park'
                }
            ]
            },
            newHome: {
                show: false
            },
            newBatt: {
                show: false
            },
            editBatt: {
                show: false
            }
        }
    },
    methods: {
        show (index) {
            this.data6[index].isEdit = true;
        searchStationName1() {  // 查询维护区
            var self = this;
            // 请求后台
            ajax({
                url: 'BattInfAction_serchByStation',
                data: null,
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    var data = [];
                    if(rs.code == 1) {
                        data = rs.data;
                    }
                    // 设置StationName1.data的值
                    self.linkage.StationName1.data = data;
                },
                complete: function() {
                    self.searchStationName();
                }
            });
        },
        remove (index) {
            this.data6[index].isEdit = false;
        }
        searchStationName() {   // 查询机房名称
            var self = this;
            // StationName1.value == undefined 不执行查询
            if(this.linkage.StationName1.value == undefined) {
                return;
            }
            // 构造查询条件
            var StationName1 = this.linkage.StationName1.value == -1?"":this.linkage.StationName1.value;
            // 请求后台
            ajax({
                url: 'BattInfAction_serchByStationName',
                data: 'bif.StationName1='+StationName1,
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    var data = [];
                    if(rs.code == 1) {
                        data = rs.data;
                    }
                    // 初始化StationName.value的值
                    self.linkage.StationName.value = '-1';
                    // 设置StationName.data的值
                    self.linkage.StationName.data = data;
                },
                complete: function() {
                    // 初始化分页信息
                    self.page.pageCurr = 1;
                    // 查询电池信息
                    self.searchBatt();
                }
            });
        },
        handleStationNameChange: function() {
            // 初始化分页信息
            this.page.pageCurr = 1;
            // 查询电池信息
            this.searchBatt();
        },
        searchBatt: function() {
            var self = this;
            // StationName1.value == undefined不执行查询
            if(this.linkage.StationName1.value == undefined) {
                return;
            }
            // StationName.value == undefined不执行查询
            if(this.linkage.StationName.value == undefined) {
                return;
            }
            // 开启等待框
            this.tbl.loading = true;
            // 设置维护区和机房名称
            var StationName1 = this.linkage.StationName1.value==-1?"":this.linkage.StationName1.value;
            var StationName = this.linkage.StationName.value==-1?"":this.linkage.StationName.value;
            // 构造查询对象
            var searchParams = {
                binf:{
                    StationName: StationName,
                    StationName1: StationName1,
                },
                page: this.page,
            };
            // 初始化active
            this.tbl.active = -1;
            // 请求后台
            ajax({
                url: 'BattInfAction!searchInform',
                data: 'json='+JSON.stringify(searchParams),
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    var data = [];
                    var pageAll = 0;
                    if(rs.code == 1) {
                        data = rs.data;
                        pageAll = data[data.length-1].num;
                    }
                    self.page.pageAll = pageAll;
                    self.tbl.data = data;
                },
                complete: function() {
                    // 关闭等待框
                    self.tbl.loading = false;
                }
            });
        },
        handleTblClick: function(data, index) {
            // 设置被点击行的数据
            this.tbl.active = data;
        },
        handlePageChange: function(curr) {
            this.page.pageCurr = curr;
            // 查询电池信息
            this.searchBatt();
        },
        handlePageSizeChange: function(size) {
            // 初始化pageCurr
            this.page.pageCurr = 1;
            // 设置pageSize
            this.page.pageSize = size;
            // 查询电池信息
            this.searchBatt();
        },
        showNewBattModal: function() {
            if(this.tbl.active != -1) {
                this.newBatt.show = true;
            }else {
                this.$Message.warning("请先选择机房!")
            }
        },
        showEditBattModal: function() {
            if(this.tbl.active != -1) {
                this.editBatt.show = true;
            }else {
                this.$Message.warning("请先选择电池组!")
            }
        },
        newHomeEnsure: function(valid) {
            if(valid) {
                this.newHome.show = false;
                this.searchStationName1();
            }
        },
        newBattEnsure: function(valid) {
            if(valid) {
                this.newBatt.show = false;
                this.searchBatt();
            }
        },
        eidtBattEnsure: function(valid) {
            if(valid) {
                this.editBatt.show = false;
                this.searchBatt();
            }
        },
        delBattConfirm: function() {
            var self = this;
            if(this.tbl.active != -1) {
                this.$Modal.confirm({
                    title: '系统提示',
                    content: '删除<span style="color: red">'+this.tbl.active.StationName+'-'+this.tbl.active.BattGroupName+'</span>',
                    loading: true,
                    onOk:()=>{
                        this.delBatt();
                    }
                });
            }else {
                this.$Message.warning("请先选择电池组!")
            }
        },
        delBatt: function() {
            var self = this;
            var home = Object.assign({}, this.tbl.active);
            console.log(home);
            // 构造查询条件
            var searchParams = [home];
            // 请求后台添加
            ajax({
                url: 'BattInfAction!delete',
                data: 'json='+JSON.stringify(searchParams),
                success: function(res) {
                    var rs = JSON.parse(res.result);
                    if(rs.code == 1) {
                        self.$Message.success('删除成功!');
                    }else {
                        self.$Message.error('删除失败!');
                    }
                },
                error: function() {
                    self.$Message.error('删除失败!');
                },
                complete: function() {
                    // 关闭按钮的等待框
                    self.$Modal.remove();
                    self.searchStationName1();
                }
            });
        },
        setHt: function() {
            var main = this.$refs.main;
            var ht = main.offsetHeight;
            this.tbl.height = ht-5;
        },
    },
    mounted() {
        var self = this;
        // 设置高度
        this.setHt();
        // 延时执行
        setTimeout(function() {
            // 查询维护区
            self.searchStationName1();
        }, 300);
    }
}
</script>
<style scoped>
.flex-footer-inner {
    padding: 4px 0;
    text-align: center;
}
.ivu-col.white {
    color: #FFFFFF;
}
.tbl-tools-inner {
    padding: 4px 4px;
}
.tbl-tools-inner .ivu-btn {
    margin-left: 8px;
}
</style>