longyvfengyun
2023-12-25 d8d792a6842832e8f6af6604274c438b25053afe
src/pages/dataMager/battGroupMager.vue
@@ -4,9 +4,10 @@
            <div class="table-row">
                <div class="table-cell text-right">省:</div>
                <div class="table-cell">
                    <el-select
                    <el-select
                    v-model="filters.values.province"
                    @change="searchCity"
                    @change="searchCity"
                    allow-create
                    size="small" placeholder="请选择省">
                        <el-option
                        v-for="item in filters.data.province"
@@ -18,9 +19,10 @@
                </div>
                <div class="table-cell text-right">市:</div>
                <div class="table-cell">
                    <el-select
                    <el-select
                    v-model="filters.values.city"
                    @change="searchCounty"
                    @change="searchCounty"
                    allow-create
                    size="small" placeholder="请选择市">
                        <el-option
                        v-for="item in filters.data.city"
@@ -30,12 +32,12 @@
                        </el-option>
                    </el-select>
                </div>
                <div class="table-cell text-right">区/县:</div>
                <div class="table-cell text-right">区/县/班组:</div>
                <div class="table-cell">
                    <el-select
                    <el-select
                    v-model="filters.values.county"
                    @change="searchHome"
                    size="small" placeholder="请选择区/县">
                    @change="searchHome"
                    size="small" placeholder="请选择区/县/班组">
                        <el-option
                        v-for="item in filters.data.county"
                        :key="item.value"
@@ -46,9 +48,11 @@
                </div>
                <div class="table-cell text-right">机房名称:</div>
                <div class="table-cell w360">
                    <el-select
                    <el-select
                    v-model="filters.values.home"
                    @click="changeHome"
                    @change="changeHome"
                    filterable
                    allow-create
                    size="small" placeholder="请选择机房名称">
                        <el-option
                        v-for="item in filters.data.home"
@@ -85,7 +89,7 @@
                </el-table-column>
                <el-table-column
                prop="StationName5"
                label="区县"
                label="区县/班组"
                min-width="120"
                :resizable="false"
                align="center">
@@ -114,21 +118,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>
@@ -154,8 +158,8 @@
                align="center">
                </el-table-column>
                <el-table-column
                prop="BattGroupNum"
                label="机房内电池组编号"
                prop="batteryType"
                label="电池组类型"
                min-width="134"
                :resizable="false"
                align="center">
@@ -275,12 +279,28 @@
                align="center">
                </el-table-column>
                <el-table-column
                    prop="videoUrl"
                    label="视频监控序列号"
                    min-width="120"
                    :resizable="false"
                    align="center">
                </el-table-column>
                <el-table-column
                    prop="tmp_id"
                    label="模板名称"
                    min-width="120"
                    :resizable="false"
                    align="center">
                </el-table-column>
                <el-table-column
                fixed="right"
                label="操作"
                width="180"
                width="250"
                align="center">
                    <template slot-scope="scope">
                        <el-button :disabled="!isCanEdit" @click="handleClick(scope.row)" type="primary" size="mini">编辑</el-button>
                        <el-button :disabled="!isCanEdit" @click="showSelectEditDialog(scope.row)" type="primary" size="mini" v-if="editMore">编辑</el-button>
                        <el-button :disabled="!isCanEdit" @click="handleClick(scope.row)" type="primary" size="mini" v-else>编辑</el-button>
                        <el-button :disabled="!isCanEdit" type="info" @click="handleAddClick(scope.row)" size="mini">添加电池组</el-button>
                        <el-button :disabled="!isCanEdit" type="danger" size="mini" @click="confirmDelHome(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
@@ -291,18 +311,33 @@
                <el-button type="primary" @click="searchData" round size="mini" icon="el-icon-search">查询</el-button>
                <el-button type="primary" round size="mini" icon="el-icon-wallet" @click="exportFile">导出</el-button>
            </div>
            <el-pagination size="mini"
            :current-page="page.pageCurr"
            :page-sizes="[10, 20, 30, 50, 100]"
            <el-pagination size="mini"
            :current-page="page.pageCurr"
            :page-sizes="[10, 20, 30, 50, 100]"
            :page-size="page.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page.pageAll"
            @current-change="currentChange"
            @size-change="sizeChange"></el-pagination>
            <div class="el-pagination-btns">
                <el-button :disabled="!isCanEdit" type="primary" @click="addDialog=true" round size="mini" icon="el-icon-plus">新建电池组</el-button>
                <el-button :disabled="!isCanEdit" type="primary" @click="addHome()" round size="mini" icon="el-icon-plus">新建机房</el-button>
            </div>
        </div>
        <!-- 电池信息编辑选择 -->
        <el-dialog
        title="电池信息编辑选择"
        width="auto"
        :visible.sync="selectEdit"
        :close-on-click-modal="false"
        top="0"
        class="dialog-center">
            <div class="padding16161616 white-bg">
                <el-button :disabled="!isCanEdit" @click="dHandleClick()" type="primary" size="mini">电池信息编辑</el-button>
                <el-button :disabled="!isCanEdit" @click="dChangeIpClick()" type="primary" size="mini" v-if="changeIp">远程IP修改</el-button>
                <el-button :disabled="!isCanEdit" @click="dAutographClick()" type="primary" size="mini" v-if="autograph">签名编辑</el-button>
            </div>
        </el-dialog>
        <!-- 添加电池组 -->
        <el-dialog
        title="添加电池组"
@@ -312,8 +347,9 @@
        top="0"
        class="dialog-center"
        :modal-append-to-body="false">
            <add-group-mager
            <add-group-mager
            v-if="addDialog"
            :batt="batt"
            @success="addSuccess"></add-group-mager>
        </el-dialog>
        <!-- 编辑电池组 -->
@@ -325,10 +361,36 @@
        top="0"
        class="dialog-center"
        :modal-append-to-body="false">
            <edit-group-mager
            <edit-group-mager
            v-if="editDialog"
            :batt="batt"
            @success="editSuccess"></edit-group-mager>
        </el-dialog>
        <!-- 签名修改 -->
        <el-dialog
            title="签名修改"
            width="600px"
            :visible.sync="autographDialog"
            :close-on-click-modal="false"
            top="0"
            class="dialog-center"
            :modal-append-to-body="false">
            <edit-autograph :batt="batt" :visible.sync="autographDialog" v-if="autographDialog"></edit-autograph>
        </el-dialog>
        <!-- 远程修改ip -->
        <el-dialog
            title="远程修改IP"
            width="auto"
            :visible.sync="changeIpDialog"
            :close-on-click-modal="false"
            top="0"
            class="dialog-center"
            :modal-append-to-body="false">
            <change-ip-params
                :batt="batt"
                :visible.sync="changeIpDialog"
                v-if="changeIpDialog"
                @success="changeIpSuccess"></change-ip-params>
        </el-dialog>
    </flex-layout>
</template>
@@ -347,16 +409,30 @@
   export_json_to_excel
} from '../../assets/js/excel/Export2Excel.js'
import {isHasPermit} from "@/assets/js/tools";
import faceManager from "@/assets/js/apis/faceManager/faceManager";
import EditAutograph from "@/components/battGroupMager/EditAutograph";
import ChangeIpParams from "@/pages/dataMager/dialog/ChangeIpParams";
import {
    const_battery_type
} from "@/assets/js/const";
export default {
    components: {
        ChangeIpParams,
        EditAutograph,
        AddGroupMager,
        EditGroupMager
        EditGroupMager,
    },
    data() {
        let permits = this.$store.state.user.permits;
        let isCanEdit = isHasPermit('batttest_data_edit_permit', permits);
        let config = this.$CFG;
        return {
            isCanEdit: isCanEdit,
            autograph: config.autograph.value,
            selectEdit: false,
            autographDialog: false,
            changeIp: config.changeIp.value,
            changeIpDialog: false,
            batt: {},
            loading: '',
            filters: {
@@ -384,11 +460,23 @@
        }
    },
    methods: {
        addHome() {
            this.batt = {};
            this.addDialog = true;
        },
        handleAddClick(row) {
            this.batt = row;
            this.addDialog = true;
        },
      // 导出表格
      exportFile() {
         let tHeader  = ['机房编号','省','市','区县','机房名称','设备名称','设备ID','设备IP','子网掩码','网关','协议名称','FBS设备索引','电池组ID','机房内电池组编号','电池组名称','浮充电压阀值(V)','离线电压阀值(V)','浮充电流阀值(A)','单体数量','标称容量(AH)','标称单体电压(V)','标称单体内阻(mΩ)','标称单体电导','单体电压次低偏移量(V)','负载电流(A)','最大核容电流(A)','电池品牌','电池型号','电池生产日期','投入使用日期'];
         let filterVal = ['StationId','StationName1','StationName2','StationName5','StationName3','StationName4','FBSDeviceId','FbsDeviceIp','FbsDeviceIp_YM','FbsDeviceIp_WG','FBSDeviceName','GroupIndexInFBSDevice','BattGroupId','BattGroupNum','BattGroupName','FloatVolLevel','OfflineVolLevel','BattFloatCurrent','MonCount','MonCapStd','MonVolStd','MonResStd','MonSerStd','MonVolLowToAvg','Load_curr','DisCurrMax','BattProducer','BattModel','BattProductDate','BattInUseDate'];
         let filterVal = ['StationId','StationName1','StationName2','StationName5','StationName3','StationName4','FBSDeviceId','FbsDeviceIp','FbsDeviceIp_YM','FbsDeviceIp_WG','FBSDeviceName','GroupIndexInFBSDevice','BattGroupId','BattGroupNum','BattGroupName','FloatVolLevel','OfflineVolLevel','BattFloatCurrent','MonCount','MonCapStd','MonVolStd','MonResStd','MonSerStd','MonVolLowToAvg','Load_curr','DisCurrMax','BattProducer','BattModel','BattProductDate1','BattInUseDate1'];
         let list = this.tableData;
         this.tableData.forEach(item=>{
                item.BattProductDate1 = new Date(item.BattProductDate).format('yyyy-MM-dd');
                item.BattInUseDate1 = new Date(item.BattInUseDate).format('yyyy-MM-dd');
            });
         let excelData = this.formatJson(filterVal, list);
         export_json_to_excel(tHeader, excelData, "电池信息管理数据");
      },
@@ -509,7 +597,7 @@
            if(searchParams.StationName5 == "") {
                // 设置机房
                this.filters.data.home = [{
                    label: "请选择区/县",
                    label: "请选择区/县/班组",
                    value: ''
                }];
                // 查询数据
@@ -534,7 +622,7 @@
                            };
                            data.push(tmp);
                        }
                    }
                }
                // 设置第一笔数据
@@ -544,7 +632,7 @@
                });
                // 设置机房
                this.filters.data.home = data;
                // 查询数据
                this.searchData(true);
            });
@@ -566,7 +654,7 @@
        searchData(noLoading) {
            if(!noLoading) {
                this.loading = this.$layer.loading(1);
            }
            }
            let filters= this.filters.values;
            // 构造查询条件
            let searchParams = {
@@ -594,6 +682,10 @@
                    this.page.pageCurr = 1;
                    this.page.pageAll = 0;
                }
                data.forEach(item=>{
                    item.batteryType = const_battery_type.getLabel(item.BattGroupNum, const_battery_type.types)
                });
                console.log(data);
                // 设置表格数据
                this.tableData = data;
@@ -651,6 +743,11 @@
                this.$layer.close(loading);
            }).catch(error=>{
                console.log(error);
                this.$message({
                  type: 'success',
                  message: '删除'+batt.StationName3+'成功!'
                });
                this.searchData();
                // 关闭等待框
                this.$layer.close(loading);
            });
@@ -659,9 +756,31 @@
            this.batt = batt;
            this.editDialog = true;
        },
        showSelectEditDialog(batt) {
            this.batt = batt;
            this.selectEdit = true;
        },
        dHandleClick() {
            this.selectEdit = false;
            this.editDialog = true;
        },
        dAutographClick() {
            this.selectEdit = false;
            this.autographDialog = true;
        },
        dChangeIpClick() {
            this.selectEdit = false;
            this.changeIpDialog = true;
        },
        editSuccess() {
            // 关闭弹出面板
            this.editDialog = false
            // 从新查询数据
            this.searchData();
        },
        changeIpSuccess() {
            // 关闭弹出面板
            this.changeIpDialog = false
            // 从新查询数据
            this.searchData();
        }
@@ -672,6 +791,9 @@
            return "编辑"+batt.StationName1+'-'+batt.StationName2
                                    +'-'+batt.StationName5+'-'+batt.StationName3
                                    +'-'+batt.StationName4
        },
        editMore() {
            return this.autograph||this.changeIp?true:false;
        }
    },
    mounted() {
@@ -682,7 +804,9 @@
</script>
<style scoped>
.white-bg {
  background-color: #fff;
}
</style>