You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
6.1 KiB
Vue

<template>
<div class="lineInformation">
<div class="lineBox">
<div class="lineBtnGroup">
<h4>线路信息管理</h4>
<el-button type="primary" icon="el-icon-plus" @click="handleAddLine()"
>新增</el-button
>
</div>
<div class="lineTable">
<el-table
ref="multipleTable"
:data="lineTableData"
stripe
tooltip-effect="dark"
style="width: 100%"
height="calc(100% - 40px)"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
v-loading="loading"
>
<!-- <el-table-column type="selection" width="55"> </el-table-column> -->
<!-- <el-table-column type="index" width="55"> </el-table-column> -->
<el-table-column label="公司名称" show-overflow-tooltip>
<template slot-scope="scope">{{
scope.row.bsManufacturer
}}</template>
</el-table-column>
<!-- <el-table-column
prop="id"
label="线路编号"
show-overflow-tooltip
min-width="120"
>
</el-table-column> -->
<el-table-column
prop="name"
label="线路名称"
min-width="120"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="dyLevelname"
label="电压等级名称"
show-overflow-tooltip
min-width="120"
>
</el-table-column>
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button
@click.native.stop="handleResive(scope.row)"
type="text"
>修改</el-button
>
<el-button @click.native.stop="handleTower(scope.row)" type="text"
>新增杆塔</el-button
>
<el-button
type="text"
class="deleteText"
@click.native.stop="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page="page"
:page-size="pageSize"
layout="sizes, prev, pager, next, jumper,total"
:total="total"
background
>
</el-pagination>
</div>
</div>
</div>
<!-- 新增线路 -->
<add-lineDialog
:lineDialogTitle="lineDialogTitle"
ref="addlineDialogref"
></add-lineDialog>
<!-- 新增杆塔 -->
<add-towerDialog ref="addTowerDialogref"></add-towerDialog>
</div>
</template>
<script>
import { getLineListJoggle, deleteLineJoggle } from "@/utils/api/index";
import addLineDialog from "./components/addLineDialog.vue";
import addTowerDialog from "./components/addTowerDialog.vue";
export default {
components: {
addLineDialog,
addTowerDialog,
},
data() {
return {
lineDialogTitle: "", //弹窗标题
lineTableData: [],
//multipleSelection: [], //获取当前选中
page: 1, // 当前页数
pageSize: 20, // 每页数量
total: 0, //总条数
loading: true,
};
},
created() {
this.lineList();
},
methods: {
//获取线路列表数据
lineList() {
this.loading = true;
getLineListJoggle({
pageindex: this.page,
pagesize: this.pageSize,
})
.then((res) => {
this.lineTableData = res.data.list;
this.total = res.data.total;
this.loading = false;
})
.catch((err) => {});
},
//点击行选中
handleRowClick(row, column, event) {
this.$refs.multipleTable.toggleRowSelection(row);
},
//获取选中的行
handleSelectionChange(val) {
this.multipleSelection = val;
},
// 新建弹窗
handleAddLine() {
this.lineDialogTitle = "新增";
this.$refs.addlineDialogref.display();
this.$refs.addlineDialogref.getdataform(null);
},
//handleResive 修改线路数据
handleResive(data) {
this.lineDialogTitle = "修改";
this.$refs.addlineDialogref.display();
this.$refs.addlineDialogref.getdataform(data);
},
//新增杆塔
handleTower(data) {
console.log(data);
this.$refs.addTowerDialogref.display();
this.$refs.addTowerDialogref.getdataform(data);
},
//删除数据
handleDelete(data) {
let deleteArr = [];
deleteArr.push({
id: data.id,
});
this.$confirm("确定要删除记录吗,同时删除关联关系?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteLineJoggle({ list: deleteArr }).then((res) => {
this.lineList(); //刷新
});
this.$message({
duration: 1500,
showClose: true,
type: "success",
message: "删除成功!",
});
})
.catch(() => {
// this.$message({
// duration: 1500,
// showClose: true,
// type: "info",
// message: "已取消删除",
// });
});
},
//点击分页
handleCurrentChange(val) {
this.page = val;
this.lineList();
},
//每页条数
handleSizeChange(val) {
this.pageSize = val;
this.lineList();
},
},
};
</script>
<style lang="less">
.lineInformation {
width: calc(100% - 32px);
height: calc(100% - 32px);
padding: 16px 16px;
background: @color-white;
.lineBox {
border: 1px solid #dddddd;
height: calc(100% - 32px);
padding: 16px;
border-radius: 4px;
}
.lineBtnGroup {
display: flex;
justify-content: space-between;
align-items: center;
}
.lineTable {
margin-top: 16px;
height: calc(100% - 48px);
}
}
</style>