Commit 44c4baf2 authored by Administrator's avatar Administrator

控制切断装置

parent 2fdc51bf
......@@ -95,7 +95,21 @@
<el-table-column align="center" label="切断装置状态" width="120">
<template slot-scope="scope">
<span>
<el-tag :type=" scope.row.shutoff_status==1 ? 'success' : 'warning' " effect="dark">{{ shutoffStatus(scope.row.shutoff_status) }}</el-tag>
<el-popconfirm
:title="'确定' + unshutoff_status(scope.row.shutoff_status) + scope.row.username + shutoffDevice(scope.row.shutoff_type) + '吗?'"
@onConfirm="changeShutoffStatus(scope.row.id, scope.row.shutoff_status, scope.row.dtype)"
@onCancel="()=>{}"
>
<el-button
slot="reference"
:loading="shutoff_loading"
size="mini"
:type=" scope.row.shutoff_status==1 ? 'success' : 'warning' "
@click="shutoff_visible = true"
>
{{ shutoffStatus(scope.row.shutoff_status) }}
</el-button>
</el-popconfirm>
</span>
</template>
</el-table-column>
......@@ -130,7 +144,7 @@
</template>
<script>
import { control } from '@/api/device';
import { control, updedata } from '@/api/device';
import Pagination from '@/components/Pagination'; // 分页
import websocketurl from '@/api/configurl';
import clip from '@/utils/clipboard';
......@@ -142,6 +156,8 @@ export default {
components: { Pagination },
data() {
return {
shutoff_visible: false,
shutoff_loading: false,
downloadLoading: false,
tableKey: 0,
loading: true,
......@@ -259,6 +275,19 @@ export default {
shutoff[2] = '关闭';
return shutoff[id];
},
unshutoff_status(state) {
return state === 1 ? '关闭' : '开启';
},
// 修改切断装置状态
changeShutoffStatus(id, shutoff_status, tid) {
updedata({ deid: id, shutoff_status: shutoff_status !== 1 ? 1 : 2, tid: tid })
.then(response => {
// this.devicelist();
})
.catch(err => {
console.log(err);
});
},
onSubmit() {
this.formSearch.page = 1;
this.devicelist();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment