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

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