服务重启&设备配置应用添加确认提示框

This commit is contained in:
wu
2022-08-23 14:50:01 +08:00
parent fd549832e6
commit f845494607
3 changed files with 44 additions and 21 deletions

View File

@@ -61,7 +61,7 @@
<el-button <el-button
class="header-button" class="header-button"
type="primary" type="primary"
@click="setDeviceConfigure" @click="setDeviceConfigureConfirm"
>应用</el-button >应用</el-button
> >
</div> </div>
@@ -735,6 +735,20 @@ export default {
this.$set(this.devicePointData[index], "@Binding", row.nodeCode) this.$set(this.devicePointData[index], "@Binding", row.nodeCode)
done(); done();
}, },
setDeviceConfigureConfirm(){
this.$confirm('是否要应用该配置信息,更改配置后需要重启改服务才能使服务生效?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.setDeviceConfigure()
}).catch(() => {
this.$message({
type: 'info',
message: '已取消应用服务配置'
});
});
},
async setDeviceConfigure() { async setDeviceConfigure() {
try { try {
// 验证表单 // 验证表单

View File

@@ -320,23 +320,34 @@ export default {
}) })
done() done()
}, },
async setServerExec ({ row }) { setServerExec ({ row }) {
try {
await this.$api.SET_SERVER_EXEC({ this.$confirm('是否要重启动该服务', '提示', {
action: 'exec', confirmButtonText: '确定',
server_id: row.id, cancelButtonText: '取消',
command: 'server_restart', type: 'warning'
username: 'admin', }).then(async () => {
password: process.env.VUE_APP_HSLSERVER_PASSWORD try {
}) await this.$api.SET_SERVER_EXEC({
this.$message({ action: 'exec',
message: '服务应用请求成功,请求动作已添加至请求队列中,请从服务监控页面查看结果', server_id: row.id,
type: 'success' command: 'server_restart'
}) })
this.getServers() this.$message({
} catch (e) { message: '服务应用请求成功,请求动作已添加至请求队列中,请从服务监控页面查看结果',
console.log(e) type: 'success'
} })
this.getServers()
} catch (e) {
console.log(e)
}
}).catch(() => {
this.$message({
type: 'info',
message: '已重启动该服务'
});
});
}, },
handleDialogCancel (done) { handleDialogCancel (done) {
this.$message({ this.$message({

View File

@@ -159,9 +159,7 @@ export default {
action: 'exec', action: 'exec',
server_id: server.id, server_id: server.id,
command: command, command: command,
device_name: device.device_name, device_name: device.device_name
username: 'admin',
password: process.env.VUE_APP_HSLSERVER_PASSWORD
}) })
this.$message({ this.$message({
message: '请求成功,请求动作已添加至请求队列中', message: '请求成功,请求动作已添加至请求队列中',