This commit is contained in:
白菜
2025-12-12 17:38:26 +08:00
parent 9b14d96e24
commit dd4fa36597
13 changed files with 851 additions and 679 deletions

View File

@ -1,6 +1,7 @@
<template>
<el-button :size="size" :type="type" :circle='circle' @click="switchStatus"
icon="el-icon-refresh-left">
<el-button :size="size" :type="type" :round="round" @click="switchStatus"
>
{{ label }}
</el-button>
</template>
@ -8,6 +9,7 @@
</style>
<script>
import {updateDeviceStatus} from "@/api/ems/site";
export default {
props: {
@ -16,26 +18,21 @@ export default {
default: 'mini',
required: false
},
round: {
type: Boolean,
default: false,
required: false
},
type: {
type: String,
default: 'primary',
required: false
},
// plain: {
// type: Boolean,
// default: true,
// required: false
// },
circle: {
type: Boolean,
default: true,
required: false
},
data: {
type: Object,
default: () => {
return {
runningStatus: null,
deviceStatus: null,
deviceId: null,
deviceName: null,
}
@ -45,12 +42,13 @@ export default {
},
computed: {
label() {
return this.data.runningStatus === '4' ? '开机' : '关机'
return this.data.deviceStatus === '4' ? '开机' : '关机'
}
},
methods: {
switchStatus() {
const {runningStatus, deviceId, deviceName} = this.data
console.log(this.data, 11111111)
const {deviceStatus, deviceId, deviceName, siteId} = this.data
this.$confirm(`确认要${this.label}设备${deviceName || ''}吗?`, {
confirmButtonText: "确定",
cancelButtonText: "取消",
@ -61,17 +59,17 @@ export default {
if (action === "confirm") {
instance.confirmButtonLoading = true;
//做开关机操作,更新成功后刷新表格
setTimeout(() => {
instance.confirmButtonLoading = false; //todo delete
done()
}, 2000)
// deleteProtectPlan(row.id)
// .then((response) => {
// response.code === 200 && done();
// })
// .finally(() => {
// instance.confirmButtonLoading = false;
// });
updateDeviceStatus({
siteId,
deviceStatus,
deviceId
})
.then((response) => {
response.code === 200 && done();
})
.finally(() => {
instance.confirmButtonLoading = false;
});
} else {
done();
}

View File

@ -80,12 +80,12 @@
label="设备类别">
</el-table-column>
<el-table-column
prop="runningStatus"
prop="deviceStatus"
label="在线状态">
<template slot-scope="scope">
<span>{{ $store.state.ems.deviceStatusOptions[scope.row.runningStatus] }}</span>
<span>{{ $store.state.ems.deviceStatusOptions[scope.row.deviceStatus] }}</span>
<pcs-switch v-if="scope.row.deviceCategory === 'PCS'" style="margin-left:5px;"
:data="{runningStatus:scope.row.runningStatus,deviceId:scope.row.deviceId,deviceName:scope.row.deviceName}"
:data="{siteId:scope.row.siteId,deviceStatus:scope.row.deviceStatus,deviceId:scope.row.deviceId,deviceName:scope.row.deviceName}"
@updateSuccess="getData"/>
</template>
</el-table-column>
@ -154,7 +154,7 @@
style="margin-top:15px;text-align: center"
>
</el-pagination>
<el-dialog :visible.sync="dialogTableVisible" class="ems-dialog" title=" 详细信息" :close-on-click-modal="false"
<el-dialog :visible.sync="dialogTableVisible" class="ems-dialog" title="详细信息" :close-on-click-modal="false"
:before-close="handleClosed">
<div class="descriptions-main" style="padding: 0">
<el-descriptions direction="vertical" :column="2" :colon="false" border>