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.

309 lines
8.0 KiB
Vue

2 years ago
<template>
2 years ago
<div class="towerinfobox">
2 years ago
<div class="deviceBox">
<div class="deviceBtnGroup">
2 years ago
<h4>杆塔信息管理</h4>
2 years ago
<el-button
type="primary"
icon="el-icon-plus"
@click.native.stop="handleAdddevice()"
>新增</el-button
>
2 years ago
</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>
2 years ago
<div class="deviceTable">
2 years ago
<el-table
ref="multipleTable"
2 years ago
:data="tableDate"
2 years ago
tooltip-effect="dark"
2 years ago
stripe
2 years ago
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"
2 years ago
>
2 years ago
<!-- <el-table-column type="index" width="55"> </el-table-column>
<el-table-column type="selection" width="55"> </el-table-column> -->
<template slot="empty">
<el-empty :image-size="160" description="暂无数据"></el-empty>
</template>
2 years ago
<el-table-column
2 years ago
prop="lineName"
label="线路名称"
2 years ago
show-overflow-tooltip
>
<template slot-scope="scope">
2 years ago
<el-link @click.native.stop="handleResive(scope.row)">{{
scope.row.lineName
}}</el-link>
</template>
</el-table-column>
2 years ago
<!-- <el-table-column
2 years ago
prop="lineId"
label="线路编号"
2 years ago
show-overflow-tooltip
2 years ago
></el-table-column> -->
<el-table-column prop="name" label="杆塔名称" show-overflow-tooltip>
<template slot-scope="scope">
2 years ago
<el-link @click.native.stop="handleResive(scope.row)">{{
scope.row.name
}}</el-link>
</template></el-table-column
>
<el-table-column
prop="address"
label="杆塔地址"
show-overflow-tooltip
></el-table-column>
2 years ago
<el-table-column prop="order" label="排序号" width="100">
2 years ago
<template slot-scope="scope">
{{ scope.row.order == null ? 0 : scope.row.order }}
</template>
</el-table-column>
2 years ago
2 years ago
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
2 years ago
<el-button
@click.native.stop="handleResive(scope.row)"
type="text"
>修改</el-button
>
<el-button
type="text"
class="deleteText"
@click.native.stop="handleDelete(scope.row)"
>删除</el-button
>
2 years ago
</template>
</el-table-column>
</el-table>
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
2 years ago
:current-page="page"
:page-size="pageSize"
layout="sizes, prev, pager, next, jumper,total"
2 years ago
:total="total"
background
>
</el-pagination>
</div>
</div>
2 years ago
</div>
2 years ago
<!-- 新增时间表 -->
<addDialog :title="title" ref="addDialogref"></addDialog>
2 years ago
</div>
2 years ago
</template>
<script>
2 years ago
import { getTowerListApi, delTowerApi } from "@/utils/api/index";
2 years ago
import addDialog from "./components/addDialog.vue";
2 years ago
export default {
2 years ago
components: {
addDialog,
},
2 years ago
data() {
return {
2 years ago
title: "", //弹窗标题
tableDate: [],
//multipleSelection: [], //获取当前选中
page: 1, // 当前页数
pageSize: 20, // 每页数量
2 years ago
total: 0, //总条数
loading: true,
formdata: {
search: "",
},
2 years ago
};
},
created() {
var that = this;
document.onkeydown = function (e) {
var key = window.event.keyCode;
if (key === 13) {
that.onSubmit(); // 触发事件
}
};
console.log(this.$route.query);
this.formdata.search = this.$route.query.name;
console.log(this.formdata.search);
},
mounted() {
2 years ago
this.deviceList();
},
2 years ago
methods: {
2 years ago
getRowKeys(row) {
return row.id;
},
//点击线路跳转
handleLineLink(val) {
console.log(val);
this.$router.push({
path: "/lineInformation",
query: { lineName: val.lineName, name: val.name },
});
},
//点击线路跳转
handletowerLink(val) {
console.log(val);
this.$router.push({
path: "/photographicDevice",
query: { lineName: val.lineName, name: val.name },
});
},
//查询
onSubmit() {
this.page = 1;
this.deviceList();
},
//重置
onReset() {
this.formdata = {};
this.page = 1;
this.pageSize = 20;
this.deviceList();
},
2 years ago
//获取数据列表
deviceList() {
this.loading = true;
this.$set(this.formdata, "pageindex", this.page);
this.$set(this.formdata, "pagesize", this.pageSize);
getTowerListApi(this.formdata)
2 years ago
.then((res) => {
this.tableDate = 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;
},
// 新建
handleAdddevice() {
this.title = "新增";
this.$refs.addDialogref.display();
this.$refs.addDialogref.getdataform(null);
},
//修改
handleResive(data) {
this.title = "修改";
this.$refs.addDialogref.display();
this.$refs.addDialogref.getdataform(data);
},
//删除数据
handleDelete(data) {
let deleteArr = [];
deleteArr.push({
id: data.id,
});
this.$confirm("确定要删除记录吗,同时删除关联关系?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delTowerApi({ list: deleteArr }).then((res) => {
this.deviceList(); //刷新
});
2 years ago
this.$message({
duration: 1500,
2 years ago
showClose: true,
type: "success",
message: "删除成功!",
});
2 years ago
})
.catch(() => {
2 years ago
this.$message({
duration: 1500,
2 years ago
showClose: true,
type: "info",
message: "已取消删除",
});
2 years ago
});
},
//点击分页
handleCurrentChange(val) {
this.page = val;
this.deviceList();
},
//每页条数
handleSizeChange(val) {
this.pageSize = val;
this.deviceList();
},
2 years ago
},
2 years ago
};
</script>
<style lang="less">
2 years ago
.towerinfobox {
2 years ago
width: calc(100% - 24px);
height: calc(100% - 24px);
padding: 12px 12px;
2 years ago
background: @color-white;
2 years ago
.deviceBox {
2 years ago
border: 1px solid #dddddd;
2 years ago
height: calc(100% - 24px);
padding: 12px;
2 years ago
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;
}
}
}
}
2 years ago
}
2 years ago
.deviceBtnGroup {
2 years ago
display: flex;
2 years ago
justify-content: space-between;
align-items: center;
2 years ago
}
2 years ago
.deviceTable {
height: calc(100% - 94px);
2 years ago
//background: #fcc;
2 years ago
}
2 years ago
}
2 years ago
</style>