优化bug

This commit is contained in:
24kycj
2024-12-22 00:49:30 +08:00
parent c7a7e16dfa
commit 9afb630902
4 changed files with 64 additions and 62 deletions
+60 -58
View File
@@ -567,71 +567,73 @@ export default {
// return
// }
if (e) {
that
.$confirm('确定执行开启服务操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.startService()
})
.catch(() => {
that.serviceLoading = false
})
that.startService()
} else {
that
.$confirm('确定执行关闭服务操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.serviceLoading = true
that.serviceText = '服务关闭中'
that
.$runCmd(`bash ${shPath} stop`)
.then((res) => {
that.$store.dispatch('chat/setDatas', { name: 'workStatus', data: false })
setTimeout(() => {
that.$store.dispatch('chat/closeWebsocket')
that.serviceLoading = false
that.$message({
message: '服务已关闭',
type: 'success'
})
}, 500)
})
.catch((err) => {
that.$message({
message: err,
type: 'error'
})
that.serviceLoading = false
})
})
.catch(() => {
that.serviceLoading = false
})
that.stopService()
}
},
startService() {
let that = this
that.serviceLoading = true
that.serviceText = '服务启动中'
that
.$runCmd(`bash ${shPath} start`)
.then((res) => {
that.$store.dispatch('chat/setDatas', { name: 'workStatus', data: true })
setTimeout(() => {
that.$store.dispatch('chat/initWebSocket')
}, 500)
.$prompt('请输入管理员密码并点击确定以执行开启服务操作', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
})
.catch((err) => {
that.$message({
message: err,
type: 'error'
})
.then(({ value }) => {
that.serviceLoading = true
that.serviceText = '服务启动中'
that
.$runCmd(`bash ${shPath} start ${value}`)
.then((res) => {
that.$store.dispatch('chat/setDatas', { name: 'workStatus', data: true })
setTimeout(() => {
that.$store.dispatch('chat/initWebSocket')
}, 500)
})
.catch((err) => {
that.$message({
message: err,
type: 'error'
})
that.serviceLoading = false
})
})
.catch(() => {
that.serviceLoading = false
})
},
stopService() {
let that = this
that
.$prompt('请输入管理员密码并点击确定以执行关闭服务操作', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
})
.then(({ value }) => {
that.serviceLoading = true
that.serviceText = '服务关闭中'
that
.$runCmd(`bash ${shPath} stop ${value}`)
.then((res) => {
that.$store.dispatch('chat/setDatas', { name: 'workStatus', data: false })
setTimeout(() => {
that.$store.dispatch('chat/closeWebsocket')
that.serviceLoading = false
that.$message({
message: '服务已关闭',
type: 'success'
})
}, 500)
})
.catch((err) => {
that.$message({
message: err,
type: 'error'
})
that.serviceLoading = false
})
})
.catch(() => {
that.serviceLoading = false
})
},