whychdw
2020-11-21 4fe077b7d5393e9b53553e417ce68ea5e293857c
添加电池组信息修改
3个文件已添加
9个文件已修改
326 ■■■■■ 已修改文件
jsconfig.json 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/apis/index.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/apis/outline/index.js 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/const/const_outline.js 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/const/index.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PageHeader.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/battGroupMager/AddBattGroup.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/params/OutlineCuringParams.vue 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataMager/battGroupMager.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/dialogs/ModuleInfo.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/history.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jsconfig.json
New file
@@ -0,0 +1,9 @@
{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "exclude": ["node_modules", "dist"]
}
src/assets/js/apis/index.js
@@ -8,6 +8,7 @@
import jobMager from "./jobMager"
import top from './top'                 // 头部信息查询
import pageSetting from './pageSetting' // 页面配置
import outline from "./outline"
export default {
    login,
@@ -19,5 +20,6 @@
    homeMager,
    jobMager,
    top,
    pageSetting
    pageSetting,
    outline
};
src/assets/js/apis/outline/index.js
New file
@@ -0,0 +1,54 @@
import axios from 'axios'
export default {
    /**
     * 读取离线掩护除硫的信息
     * @param data
     * @returns {AxiosPromise}
     */
    read(data) {
        return axios({
            method: 'post',
            url: 'Fbs9100_setparamAction_action_serchbyDev_id',
            data: 'json='+JSON.stringify(data),
        });
    },
    /**
     * 更新离线养护除硫的信息
     * @param data
     * @returns {AxiosPromise}
     */
    update(data) {
        return axios({
            method: 'post',
            url: 'Fbs9100_setparamAction_action_updateMaintain',
            data: 'json='+JSON.stringify(data),
        });
    },
    /**
     * 启动离线养护除硫
     * @param data
     * @returns {AxiosPromise}
     */
    start(data) {
        return axios({
            method: 'post',
            url: 'Fbs9100_setparamAction_action_updateMaintain',
            data: 'json='+JSON.stringify(data),
        });
    },
    /**
     * 停止离线掩护除硫
     * @param data
     * @returns {AxiosPromise}
     */
    stop(data) {
        return axios({
            method: 'post',
            url: 'Fbs9100_setparamAction_action_updateMaintain',
            data: 'json='+JSON.stringify(data),
        });
    }
    /**
     * ps: 更新,启动和停止公用一个接口,但是发送的命令不同
     */
}
src/assets/js/const/const_outline.js
New file
@@ -0,0 +1,45 @@
export default {
    cmd: {
        start: 0xB4,
        stop: 0xB6,
        set: 0xB2,
        get: 0xB0,
    },
    rules: {
        OnLineVol_Low: {        // 在线电压低阀值(大于44)
            pattern: /^[0-9]+(\.[0-9]{0,1})?$/,
            regVal: true,
            min: 44,
            max: Infinity,
            msg: '取值范围大于44,精确0.1'
        },
        OffLineYH_Cycle: {      // 单次养护时长
            pattern: /^[0-9]+(\.[0-9]{0,1})?$/,
            regVal: true,
            min: 0,
            max: 168,
            msg: '取值范围0~168,精确0.1'
        },
        OffLineYHOnceCycle: {      // 离线养护周期
            pattern: /^[0-9]+$/,
            regVal: true,
            min: 1,
            max: Infinity,
            msg: '取值范围大于0整数'
        },
        OffLineYHTimes: {   // 离线养护次数
            pattern: /^[0-9]+$/,
            regVal: true,
            min: 0,
            max: Infinity,
            msg: '取值范围大于0的整数'
        },
        MonomerTmp_High: {
            pattern: /^[0-9]+$/,
            regVal: true,
            min: 10,
            max: 60,
            msg: '取值范围10~60整数'
        }
    }
}
src/assets/js/const/index.js
@@ -6,6 +6,7 @@
import const_battGroup from './const_battGroup'
import const_curing from "@/assets/js/const/const_curing";
import const_plan from "@/assets/js/const/const_plan";
import const_outline from "@/assets/js/const/const_outline";
export {
    const_9100,
    const_61850,
@@ -14,5 +15,6 @@
    const_province_city_county,
    const_battGroup,
    const_curing,
    const_plan
    const_plan,
    const_outline
};
src/components/PageHeader.vue
@@ -3,7 +3,7 @@
        <div class="page-header-container">
            <flex-layout direction="row">
                <div class="page-header-left" slot="header">
                    <img class="header-first-logo" src="../assets/images/gjdx-log.png">
                    <img class="header-first-logo" src="../assets/images/gjdw-log.png">
                    <span class="header-carve-up"></span>
                    <span>蓄电池监控平台</span>
                    <span class="sys-version">V{{version}}</span>
src/components/battGroupMager/AddBattGroup.vue
@@ -89,7 +89,7 @@
                            v-model="params.FBSDeviceId"
                            placeholder="请选择设备类型">
                            <el-option
                                v-for="item in devTypes" :key="item"
                                v-for="item in devTypes" :key="item.value"
                                :label="item.label"
                                :value="item.value"></el-option>
                        </el-select>
@@ -870,6 +870,14 @@
                this.params.StationName5 = batt.StationName5;
                this.params.StationName3 = batt.StationName3;
                this.params.StationName4 = batt.StationName4;
                this.params.FbsDeviceIp = batt.FbsDeviceIp;
                let dev_id = batt.FBSDeviceId;
                this.devTypes.forEach(item=>{
                    let pattern = new RegExp(item.value);
                    if(pattern.test(dev_id)) {
                        this.params.FBSDeviceId = item.value;
                    }
                });
            }
        },
    },
src/components/params/OutlineCuringParams.vue
@@ -54,15 +54,19 @@
                </div>
            </div>
            <div class="form-footer">
                <three-btn>启动</three-btn>
                <three-btn>读取</three-btn>
                <three-btn>设定</three-btn>
                <three-btn :disabled="!startFlag">启动</three-btn>
                <three-btn @click="read">读取</three-btn>
                <three-btn :disabled="!setFlag" @click="submitForm">设定</three-btn>
            </div>
        </el-form>
    </div>
</template>
<script>
import {
    const_outline
} from '@/assets/js/const'
import {testVal} from "@/assets/js/tools";
export default {
    name: "OutlineCuringParams",
    props: {
@@ -75,7 +79,12 @@
    },
    data() {
        let nowDate = new Date().format('yyyy-MM-dd hh:mm:ss');
        let cmd = const_outline.cmd;
        let rules = const_outline.rules;
        return {
            cmd: cmd,
            startFlag: false,   // 启动测试的状态
            setFlag: false,     // 设置参数的状态
            params: {
                op_cmd: 0,
                dev_id: 0,        // 设备id
@@ -86,8 +95,144 @@
                OffLineYHstarttime: nowDate,    // 离线养护开始时间
                MonomerTmp_High: 0    // 单体温度上限
            },
            rules: {}
            rules: {
                OnLineVol_Low: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.OnLineVol_Low)
                    },
                    trigger: 'change'
                }],
                OffLineYH_Cycle: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.OffLineYH_Cycle)
                    },
                    trigger: 'change'
                }],
                OffLineYHOnceCycle: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.OffLineYHOnceCycle)
                    },
                    trigger: 'change'
                }],
                OffLineYHTimes: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.OffLineYHTimes)
                    },
                    trigger: 'change'
                }],
                MonomerTmp_High: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.MonomerTmp_High)
                    },
                    trigger: 'change'
                }],
            }
        }
    },
    methods: {
        // 初始化
        init() {
            // 初始化参数
            this.params = {
                op_cmd: 0,
                dev_id: 0,        // 设备id
                BattGroupNum: 0,    // 电池组编号
                OnLineVol_Low: 0,    // 在线电压低阈值
                OffLineYH_Cycle: 0,     // 单次养护时长
                OffLineYHOnceCycle: 0,    // 离线养护周期
                OffLineYHTimes: 0,    // 离线养护次数
                OffLineYHstarttime: nowDate,    // 离线养护开始时间
                MonomerTmp_High: 0    // 单体温度上限
            };
        },
        // 读取
        read() {
            let batt = this.batt;
            // 构造查询条件
            let searchParams = {
                num: this.cmd.get,
                dev_id: batt.FBSDeviceId,
                testcmd: 0,
            };
            // 开启等待框
            let loading = this.$layer.loading();
            // 启动和设置不可点击
            this.startFlag = false;
            this.setFlag = false;
            // 查询后台
            this.$apis.outline.read(searchParams).then(res=>{
                let rs = JSON.parse(res.data.result);
                if(rs.code === 1) {
                    let data = rs.data[0].fsparam;
                    // 遍历参数属性并赋值
                    for(let key in this.params) {
                        let value = data[key];
                        this.params[key] = value;
                    }
                    this.params.dev_id = this.batt.FBSDeviceId;
                    this.params.op_cmd = this.cmd.set;
                    this.BattGroupNum = this.batt.BattIndexInFbs;
                    // 提示信息
                    this.$layer.msg("读取成功");
                    // 设置按钮可点击
                    this.setFlag = true;
                }else {
                    // 提示信息
                    this.$layer.msg("读取失败");
                }
                // 关闭等待框
                this.$layer.close(loading);
            }).catch(error=>{
                console.log(error);
                // 关闭等待框
                this.$layer.close(loading);
            });
        },
        submitForm() {
            this.$refs.ruleForm.validate((valid) => {
                // 校验通过
                if (valid) {
                    let date = this.params.OffLineYHstarttime;
                    this.params.OffLineYHstarttime = new Date(date).format("yyyy-MM-dd hh:mm:ss");
                    // 更新数据
                    this.update(this.params);
                }else {
                    this.$layer.msg('存在校验未通过的数据!');
                    return false;
                }
            });
        },
        // 更新
        update(params) {
            params.op_cmd = this.cmd.set;
            // 开启等待框
            let loading = this.$layer.loading();
            // 请求后台设置参数
            this.$apis.outline.update(params).then(res=>{
                let rs = JSON.parse(res.data.result);
                if(rs.code == 1) {
                    // 设置启动按钮可以点击
                    this.startFlag = true;
                    // 提示信息
                    this.$layer.msg("设置成功");
                }else {
                    // 提示信息
                    this.$layer.msg("设置失败");
                }
                // 关闭等待框
                this.$layer.close(loading);
            }).catch(error=>{
            });
        },
        // 确认启动
        confirmStart() {
        },
        // 启动
        start() {
        },
    },
    computed: {
        otherParams() {
@@ -103,6 +248,10 @@
            }
        }
    },
    mounted() {
        // 读取信息
        //this.read();
    }
}
</script>
src/main.js
@@ -60,6 +60,13 @@
    return format;
};
// 对toFixed数字保留位数二次封装(ps:toFixed返回的是字符串)
Number.prototype.toHold = function(value) {
    var hold = this.toFixed(value);
    hold = Number(hold);
    return hold;
};
/**
 * @注册一个全局方法储存skin方法
 * @author (zyk)
src/pages/dataMager/battGroupMager.vue
@@ -114,21 +114,21 @@
                <el-table-column
                prop="FbsDeviceIp"
                label="设备IP"
                min-width="120"
                min-width="160"
                :resizable="false"
                align="center">
                </el-table-column>
                <el-table-column
                prop="FbsDeviceIp_YM"
                label="子网掩码"
                min-width="120"
                min-width="160"
                :resizable="false"
                align="center">
                </el-table-column>
                <el-table-column
                prop="FbsDeviceIp_WG"
                label="网关"
                min-width="120"
                min-width="160"
                :resizable="false"
                align="center">
                </el-table-column>
src/pages/dataTest/dialogs/ModuleInfo.vue
@@ -1,7 +1,7 @@
<template>
    <flex-layout>
        <el-row :gutter=8 class="module-info">
            <el-col :span=8>
            <el-col :span=10>
                <table-wrapper class="h500" :title="device.name">
                    <el-table
                        stripe
@@ -11,17 +11,17 @@
                        <el-table-column
                            prop="name"
                            label="参数名称"
                            min-width="200"
                            min-width="240"
                            align="center"></el-table-column>
                        <el-table-column
                            prop="value"
                            label="参数值"
                            min-width="100"
                            min-width="150"
                            align="center"></el-table-column>
                    </el-table>
                </table-wrapper>
            </el-col>
            <el-col :span=8>
            <el-col :span=7>
                <table-wrapper class="h500" :title="collectState.name">
                    <el-table
                        stripe
@@ -31,17 +31,17 @@
                        <el-table-column
                            prop="name"
                            label="参数名称"
                            min-width="200"
                            min-width="150"
                            align="center"></el-table-column>
                        <el-table-column
                            prop="value"
                            label="参数值"
                            min-width="100"
                            min-width="150"
                            align="center"></el-table-column>
                    </el-table>
                </table-wrapper>
            </el-col>
            <el-col :span=8>
            <el-col :span=7>
                <table-wrapper class="h500" :title="chargeEleState.name">
                    <el-table
                        stripe
@@ -51,12 +51,12 @@
                        <el-table-column
                            prop="name"
                            label="参数名称"
                            min-width="200"
                            min-width="150"
                            align="center"></el-table-column>
                        <el-table-column
                            prop="value"
                            label="参数值"
                            min-width="100"
                            min-width="150"
                            align="center"></el-table-column>
                    </el-table>
                </table-wrapper>
src/pages/dataTest/history.vue
@@ -144,6 +144,7 @@
</template>
<script>
    import echarts from "echarts"
    import ContentBox from "../../components/ContentBox";
    import HomeList from "./HomeList";
    import BarChart from "../../components/chart/BarChart";
@@ -458,6 +459,15 @@
                    },
                    series: [{
                        name: "电池电流",
                        areaStyle: {
                            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                offset: 0,
                                color: '#00feff'
                            }, {
                                offset: 1,
                                color: '#00feff00'
                            }])
                        },
                        data: []
                    }]
                };