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.

308 lines
8.2 KiB
Vue

2 years ago
<template>
<div class="lineInformation">
<div class="lineBox">
<div class="lineBtnGroup">
2 years ago
<h4>线路信息管理</h4>
<el-button type="primary" icon="el-icon-plus" @click="handleAddLine()"
>新增</el-button
>
</div>
<div class="searchBox">
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<el-form-item>
<el-input
v-model="formdata.search"
placeholder="请输入线路名称或公司名称"
2 years ago
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary" @click="onReset"></el-button>
</el-form-item>
</el-form>
</div>
<div class="lineTable">
<el-table
ref="multipleTable"
:data="lineTableData"
2 years ago
stripe
tooltip-effect="dark"
style="width: 100%"
height="calc(100% - 40px)"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
2 years ago
v-loading="loading"
2 years ago
highlight-current-row
:row-key="getRowKeys"
>
<!-- <el-table-column type="selection" width="55"> </el-table-column> -->
2 years ago
<!-- <el-table-column type="index" width="55"> </el-table-column> -->
<template slot="empty">
<el-empty :image-size="160" description="暂无数据"></el-empty>
</template>
2 years ago
<el-table-column label="公司名称" show-overflow-tooltip>
<template slot-scope="scope">{{
scope.row.bsManufacturer
}}</template>
</el-table-column>
2 years ago
<el-table-column
prop="dyLevelname"
label="电压等级名称"
show-overflow-tooltip
min-width="120"
>
</el-table-column>
2 years ago
<!-- <el-table-column
prop="id"
label="线路编号"
show-overflow-tooltip
min-width="120"
>
2 years ago
</el-table-column> -->
<el-table-column
prop="name"
label="线路名称"
min-width="120"
show-overflow-tooltip
>
</el-table-column>
2 years ago
2 years ago
<el-table-column
prop="status"
label="是否启用"
show-overflow-tooltip
min-width="120"
>
<template slot-scope="scope">
{{ scope.row.status == 1 ? "已启用" : "未启用" }}</template
>
</el-table-column>
2 years ago
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button
@click.native.stop="handleResive(scope.row)"
type="text"
>修改</el-button
>
2 years ago
<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>
2 years ago
</template>
<script>
import { getLineListJoggle, deleteLineJoggle } from "@/utils/api/index";
import addLineDialog from "./components/addLineDialog.vue";
import addTowerDialog from "./components/addTowerDialog.vue";
2 years ago
export default {
components: {
addLineDialog,
addTowerDialog,
},
data() {
return {
lineDialogTitle: "", //弹窗标题
lineTableData: [],
//multipleSelection: [], //获取当前选中
page: 1, // 当前页数
pageSize: 20, // 每页数量
total: 0, //总条数
2 years ago
loading: true,
formdata: {
search: "",
},
};
},
created() {
var that = this;
document.onkeydown = function (e) {
var key = window.event.keyCode;
if (key === 13) {
that.onSubmit(); // 触发事件
}
};
2 years ago
// console.log(this.$route.query);
// this.formdata.search = this.$route.query.lineName;
// console.log(this.formdata.search);
},
mounted() {
this.lineList();
},
methods: {
2 years ago
getRowKeys(row) {
return row.id;
},
//获取线路列表数据
lineList() {
2 years ago
this.loading = true;
this.$set(this.formdata, "pageindex", this.page);
this.$set(this.formdata, "pagesize", this.pageSize);
getLineListJoggle(this.formdata)
.then((res) => {
this.lineTableData = res.data.list;
this.total = res.data.total;
2 years ago
this.loading = false;
})
.catch((err) => {});
},
//点击行选中
handleRowClick(row, column, event) {
this.$refs.multipleTable.toggleRowSelection(row);
},
//获取选中的行
handleSelectionChange(val) {
this.multipleSelection = val;
},
//查询
onSubmit() {
this.page = 1;
this.lineList();
},
//重置
onReset() {
this.formdata = {};
this.page = 1;
this.pageSize = 20;
this.lineList();
},
// 新建弹窗
handleAddLine() {
this.lineDialogTitle = "新增";
this.$refs.addlineDialogref.display();
this.$refs.addlineDialogref.getdataform(null);
},
//handleResive 修改线路数据
handleResive(data) {
console.log(data);
this.lineDialogTitle = "修改";
this.$refs.addlineDialogref.display();
this.$refs.addlineDialogref.getdataform(data);
2 years ago
},
2 years ago
//新增杆塔
handleTower(data) {
console.log(data);
this.$refs.addTowerDialogref.display();
this.$refs.addTowerDialogref.getdataform(data);
2 years ago
},
//删除数据
handleDelete(data) {
let deleteArr = [];
deleteArr.push({
id: data.id,
});
this.$confirm("确定要删除记录吗,同时删除关联关系?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteLineJoggle({ list: deleteArr }).then((res) => {
this.lineList(); //刷新
});
2 years ago
this.$message({
duration: 1500,
2 years ago
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();
},
},
2 years ago
};
</script>
<style lang="less">
.lineInformation {
2 years ago
width: calc(100% - 24px);
height: calc(100% - 24px);
padding: 12px 12px;
background: @color-white;
.lineBox {
border: 1px solid #dddddd;
2 years ago
height: calc(100% - 24px);
padding: 12px;
border-radius: 4px;
.searchBox {
margin-top: 8px;
.ml10 {
margin-left: 10px;
}
.el-form {
.dybox {
.el-form-item__content {
width: 120px;
}
}
.xlbox {
.el-form-item__content {
width: 160px;
}
}
}
}
}
.lineBtnGroup {
display: flex;
2 years ago
justify-content: space-between;
align-items: center;
}
.lineTable {
//margin-top: 16px;
height: calc(100% - 94px);
}
2 years ago
}
</style>