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.

170 lines
4.6 KiB
Vue

2 years ago
<template>
2 years ago
<div class="deviceInformation">
<div class="deviceBox">
<div class="deviceBtnGroup">
<el-button
type="primary"
icon="el-icon-plus"
@click.native.stop="handleAdddevice()"
>新增</el-button
>
2 years ago
</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"
style="width: 100%"
height="calc(100% - 40px)"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
2 years ago
v-loading="loading"
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> -->
<el-table-column prop="id" label="杆塔编号" show-overflow-tooltip ></el-table-column>
<el-table-column prop="name" label="杆塔名称" show-overflow-tooltip ></el-table-column>
<el-table-column prop="lineId" label="线路编号" show-overflow-tooltip ></el-table-column>
<el-table-column prop="lineName" label="线路名称" show-overflow-tooltip ></el-table-column>
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"
:current-page="page"
:page-size="pageSize"
layout=" prev, pager, next, jumper,total"
: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";
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: 10, // 每页数量
total: 0, //总条数
loading: true,
2 years ago
};
},
2 years ago
created() {
this.deviceList();
},
2 years ago
methods: {
2 years ago
//获取数据列表
deviceList() {
this.loading = true;
getTowerListApi({
pageindex: this.page,
pagesize: this.pageSize,
})
.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(); //刷新
});
this.$message({ type: "success", message: "删除成功!" });
})
.catch(() => {
this.$message({ type: "info", message: "已取消删除" });
});
},
//点击分页
handleCurrentChange(val) {
this.page = val;
this.deviceList();
},
2 years ago
},
2 years ago
};
</script>
<style lang="less">
2 years ago
.deviceInformation {
2 years ago
width: calc(100% - 32px);
height: calc(100% - 32px);
padding: 16px 16px;
background: @color-white;
2 years ago
.deviceBox {
2 years ago
border: 1px solid #dddddd;
height: calc(100% - 32px);
padding: 16px;
border-radius: 4px;
}
2 years ago
.deviceBtnGroup {
2 years ago
display: flex;
2 years ago
justify-content: flex-end;
}
2 years ago
.deviceTable {
2 years ago
margin-top: 16px;
height: calc(100% - 48px);
2 years ago
//background: #fcc;
2 years ago
}
2 years ago
}
2 years ago
</style>