This commit is contained in:
xiaozhiyong
2026-06-16 11:49:02 +08:00
parent 82c1cce942
commit 9fdfb2f74b
3 changed files with 62 additions and 7 deletions

View File

@@ -23,7 +23,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="120">
<el-table-column prop="status" label="锁定状态" width="120">
<template #default="{ row }">
<el-tag :type="['success', 'info', 'danger'][row.lockStatus]">
{{ ['正常', '远程合闸禁止', '锁定'][row.lockStatus] }}
@@ -37,6 +37,9 @@
>分闸</el-button
>
<el-button v-else type="danger" link icon="SortDown" @click="changeStatus(row)">合闸</el-button>
<el-button v-if="row.lockStatus == 2" type="primary" link icon="Unlock" @click="unlock(row)"
>解锁</el-button
>
</template>
</el-table-column>
</el-table>
@@ -109,6 +112,24 @@
}
})
}
// 解锁
const unlock = async (row) => {
ElMessageBox.confirm('确认解锁吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const res = await serve.deviceOperation({
id: row.ID,
gatewayId: row.gatewayId,
para: '0xAD'
})
if (res.code === 0) {
ElMessage.success('操作成功')
getDeviceListByPage()
}
})
}
</script>
<style lang="scss" scoped>
@@ -126,7 +147,9 @@
border: 1px solid rgba(0, 212, 255, 0.22);
border-radius: 16px;
background: linear-gradient(135deg, rgba(9, 24, 48, 0.88), rgba(5, 16, 32, 0.74));
box-shadow: inset 0 0 22px rgba(0, 212, 255, 0.06), 0 12px 28px rgba(0, 0, 0, 0.22);
box-shadow:
inset 0 0 22px rgba(0, 212, 255, 0.06),
0 12px 28px rgba(0, 0, 0, 0.22);
&::before {
position: absolute;

View File

@@ -23,7 +23,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="120">
<el-table-column prop="status" label="锁定状态" width="120">
<template #default="{ row }">
<el-tag :type="['success', 'info', 'danger'][row.lockStatus]">
{{ ['正常', '远程合闸禁止', '锁定'][row.lockStatus] }}
@@ -37,6 +37,9 @@
>分闸</el-button
>
<el-button v-else type="danger" link icon="SortDown" @click="changeStatus(row)">合闸</el-button>
<el-button v-if="row.lockStatus == 2" type="primary" link icon="Unlock" @click="unlock(row)"
>解锁</el-button
>
</template>
</el-table-column>
</el-table>
@@ -109,6 +112,24 @@
}
})
}
// 解锁
const unlock = async (row) => {
ElMessageBox.confirm('确认解锁吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const res = await serve.deviceOperation({
id: row.ID,
gatewayId: row.gatewayId,
para: '0xAD'
})
if (res.code === 0) {
ElMessage.success('操作成功')
getDeviceListByPage()
}
})
}
</script>
<style lang="scss" scoped>
@@ -126,7 +147,9 @@
border: 1px solid rgba(0, 212, 255, 0.22);
border-radius: 16px;
background: linear-gradient(135deg, rgba(9, 24, 48, 0.88), rgba(5, 16, 32, 0.74));
box-shadow: inset 0 0 22px rgba(0, 212, 255, 0.06), 0 12px 28px rgba(0, 0, 0, 0.22);
box-shadow:
inset 0 0 22px rgba(0, 212, 255, 0.06),
0 12px 28px rgba(0, 0, 0, 0.22);
&::before {
position: absolute;

View File

@@ -23,22 +23,31 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, onMounted, watch } from 'vue'
import DeviceInfo from './components/info/index.vue'
import DeviceLine from './components/line/index.vue'
import DeviceTrend from './components/trend/index.vue'
import DeviceConfig from './components/config/index.vue'
defineProps({
const props = defineProps({
device: {
type: Object,
default: () => null
}
})
const activeMenu = ref('info')
const activeMenu = ref('')
const emit = defineEmits(['back'])
watch(
() => props.device?.gatewayMac,
(newMac, oldMac) => {
if (newMac && newMac !== oldMac) {
activeMenu.value = 'info'
}
}
)
const handleBack = () => {
activeMenu.value = ''
emit('back')