前置管理选中背景,重启,更新进程号

This commit is contained in:
sjl
2025-10-17 10:19:48 +08:00
parent 1211277a0d
commit e7f38519b4
2 changed files with 47 additions and 62 deletions

View File

@@ -207,5 +207,7 @@ defineExpose({
min-width: 128px; min-width: 128px;
} }
} }
</style> </style>
<!-- @/components/table/column/GroupColumn.vue@/components/table/column/GroupColumn.vue --> <!-- @/components/table/column/GroupColumn.vue@/components/table/column/GroupColumn.vue -->

View File

@@ -69,38 +69,42 @@
></span> ></span>
</span> </span>
<div> <div>
<!-- <el-button type="primary" v-if="data.id == undefined" link icon="el-icon-Plus" ></el-button> --> <template v-if="data.id">
<el-button <el-tooltip content="编辑" placement="top">
style="margin-left: 4px"
icon="el-icon-Edit"
v-if="data.id"
type="primary"
@click="edit(data)"
link
></el-button>
<el-popconfirm
v-else
class="box-item"
title="确定重启吗?"
placement="bottom"
@confirm="restart(data)"
>
<template #actions="{ confirm, cancel }">
<el-button size="small" @click="cancel">取消</el-button>
<el-button type="warning" size="small" @click="confirm">确认</el-button>
</template>
<template #reference>
<el-button <el-button
style="margin-left: 4px" style="margin-left: 4px"
icon="el-icon-Refresh" icon="el-icon-Edit"
type="warning" type="primary"
@click="edit(data)"
link link
@click.stop
></el-button> ></el-button>
</template> </el-tooltip>
</el-popconfirm> </template>
<template v-else>
<el-popconfirm
class="box-item"
title="确定重启吗?"
placement="bottom"
@confirm="restart(data)"
>
<template #actions="{ confirm, cancel }">
<el-button size="small" @click="cancel">取消</el-button>
<el-button type="warning" size="small" @click="confirm">确认</el-button>
</template>
<template #reference>
<el-tooltip content="重启" placement="top">
<el-button
style="margin-left: 4px"
icon="el-icon-Refresh"
type="warning"
link
@click.stop
></el-button>
</el-tooltip>
</template>
</el-popconfirm>
</template>
</div> </div>
</div> </div>
</template> </template>
@@ -108,32 +112,6 @@
</div> </div>
</div> </div>
<!-- 重启确认对话框 -->
<el-dialog
draggable
title="重启确认"
v-model="restartDialogVisible"
:close-on-click-modal="false"
width="400px"
:before-close="cancelRestart"
>
<el-form :model="restartForm" label-width="80px" :rules="restartRules" ref="restartFormRef">
<el-form-item label="密码:" prop="password">
<el-input
v-model="restartForm.password"
type="password"
placeholder="请输入密码"
show-password
></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="cancelRestart"> </el-button>
<el-button type="primary" @click="confirmRestart"> </el-button>
</template>
</el-dialog>
<el-dialog <el-dialog
draggable draggable
:title="dialogTitle" :title="dialogTitle"
@@ -378,8 +356,17 @@ const tableStore = new TableStore({
} }
}, },
loadCallback: () => { loadCallback: () => {
tableRef.value.getRef().setCurrentRow(tableStore.table.data[0]) // 确保数据存在且不为空
currentChangeEvent() if (tableStore.table.data && tableStore.table.data.length > 0) {
// 使用 nextTick 确保 DOM 更新完成后再设置当前行
nextTick(() => {
tableRef.value.getRef().setCurrentRow(tableStore.table.data[0])
// 延迟执行 currentChangeEvent 确保 setCurrentRow 生效
setTimeout(() => {
currentChangeEvent()
}, 0)
})
}
} }
}) })
const nodeId = ref('') const nodeId = ref('')
@@ -417,11 +404,9 @@ const currentChangeEvent = () => {
// 重启进程 // 重启进程
const restart = (data: any) => { const restart = (data: any) => {
console.log('🚀 ~ restart ~ data:', data)
restartProcess({ restartProcess({
deviceRebootType: data.processNo,
nodeId: nodeId.value, nodeId: nodeId.value,
processNo: 2 processNo: data.processNo
}).then(res => { }).then(res => {
ElMessage.success('重启成功') ElMessage.success('重启成功')
currentChangeEvent() currentChangeEvent()
@@ -569,9 +554,7 @@ onMounted(() => {
} }
:deep(.default) { :deep(.default) {
display: flex; display: flex;
.row--current {
background-color: var(--el-color-primary-light-8) !important;
}
} }
.custom-tree-node { .custom-tree-node {
flex: 1; flex: 1;