style: 语法优化

This commit is contained in:
a20070322 2024-04-03 09:41:55 +08:00
parent 720c64fad8
commit a25101b97a
9 changed files with 140 additions and 248 deletions

View File

@ -866,30 +866,22 @@ export default {
},
//
handleDelete(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的要删除该 Docker 么?删除只会检查本地系统的数据关联,不会删除 docker 容器中数据',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
const params = {
onOk: () => {
return deleteDcoker({
id: record.id
}
deleteDcoker(params)
.then((res) => {
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})
@ -904,30 +896,22 @@ export default {
"<li style='font-weight: bold;'>请不要优先退出管理节点</li>" +
'<li>操作不能撤回奥</li>' +
' </ul>'
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: h('div', null, [h('p', { innerHTML: html }, null)]),
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
const params = {
onOk: () => {
return dcokerSwarmLeaveForce({
id: record.id
}
dcokerSwarmLeaveForce(params)
.then((res) => {
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -886,31 +886,23 @@ export default {
},
// kill pid
kill(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的要 Kill 这个进程么?',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
// kill
const params = {
...that.idInfo,
onOk: () => {
return killPid({
...this.idInfo,
pid: record.processId
}
killPid(params)
.then((res) => {
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadNodeProcess()
this.loadNodeProcess()
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -1072,7 +1072,6 @@ export default {
},
// submit
onNodeSubmit(restart) {
const that = this
$confirm({
title: '系统提示',
content: restart
@ -1081,13 +1080,12 @@ export default {
okText: '确认',
zIndex: 1009,
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
that.confirmLoading = true
saveNodeConfig({
...that.temp,
onOk: () => {
this.confirmLoading = true
return saveNodeConfig({
...this.temp,
restart: restart,
ids: that.tableSelections.join(',')
ids: this.tableSelections.join(',')
})
.then((res) => {
if (res.code === 200) {
@ -1095,15 +1093,12 @@ export default {
$notification.success({
message: res.msg
})
that.nodeConfigVisible = false
that.tableSelections = []
this.nodeConfigVisible = false
this.tableSelections = []
}
resolve()
})
.catch(reject)
.finally(() => {
that.confirmLoading = false
})
this.confirmLoading = false
})
}
})

View File

@ -883,29 +883,22 @@ export default {
},
//
handleDelete(record) {
const that = this
$confirm({
title: '系统提示',
content: '真的要删除机器 SSH 么?',
zIndex: 1009,
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
machineSshDelete({
onOk: () => {
return machineSshDelete({
id: record.id
})
.then((res) => {
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})
@ -971,34 +964,25 @@ export default {
},
//
handleDeleteWorkspaceItem(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的要删除对应工作空间的 SSH 么?',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
deleteForeSsh(record.id)
.then((res) => {
if (res.code === 200) {
onOk: async () => {
const { code, msg } = await deleteForeSsh(record.id)
if (code === 200) {
$notification.success({
message: res.msg
message: msg
})
const res = await machineListGroupWorkspaceSsh({
id: this.temp.machineSshId
})
machineListGroupWorkspaceSsh({
id: that.temp.machineSshId
}).then((res) => {
if (res.code === 200) {
that.workspaceSshList = res.data
this.workspaceSshList = res.data
}
})
}
resolve()
})
.catch(reject)
})
}
})
},
@ -1056,27 +1040,20 @@ export default {
},
//
handerRestHideField(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的要清除 SSH 隐藏字段信息么?(密码,私钥)',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
restHideField(record.id)
.then((res) => {
onOk: () => {
return restHideField(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -176,29 +176,22 @@ export default {
},
//
handleDelete(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的要删除对应的触发器吗?',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
triggerTokenDelete({
onOk: () => {
return triggerTokenDelete({
id: record.id
})
.then((res) => {
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.handleListLog()
this.handleListLog()
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -592,26 +592,20 @@ export default {
'<li>下载完成后需要手动选择更新到节点才能完成节点更新奥</li>' +
'<li>如果升级失败需要手动恢复奥</li>' +
' </ul>'
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: h('div', null, [h('p', { innerHTML: html }, null)]),
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
downloadRemote()
.then((res) => {
onOk: () => {
return downloadRemote().then((res) => {
if (res.code === 200) {
$notification.success({ message: res.msg })
that.getNodeList()
this.getNodeList()
} else {
//$notification.error({ message: res.msg });
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -365,30 +365,23 @@ export default {
},
//
handleEnvDelete(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的删除当前变量吗?',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
deleteWorkspaceEnv({
onOk: () => {
return deleteWorkspaceEnv({
id: record.id,
workspaceId: that.workspaceId
})
.then((res) => {
workspaceId: this.workspaceId
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadDataEnvVar()
this.loadDataEnvVar()
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -426,81 +426,60 @@ export default {
},
//
handleDelete(record) {
const that = this
$confirm({
title: '系统提示',
content: '真的要删除用户么?',
zIndex: 1009,
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
deleteUser(record.id)
.then((res) => {
onOk: () => {
return deleteUser(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})
},
//
handleUnlock(record) {
const that = this
$confirm({
title: '系统提示',
content: '真的要解锁用户么?',
zIndex: 1009,
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
unlockUser(record.id)
.then((res) => {
onOk: () => {
return unlockUser(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})
},
//
handleCloseMfa(record) {
const that = this
$confirm({
title: '系统提示',
content: '真的关闭当前用户的两步验证么?',
zIndex: 1009,
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
closeUserMfa(record.id)
.then((res) => {
onOk: () => {
return closeUserMfa(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})
@ -529,29 +508,21 @@ export default {
},
//
restUserPwdHander(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '确定要重置用户密码吗?',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
restUserPwd(record.id)
.then((res) => {
onOk: () => {
return restUserPwd(record.id).then((res) => {
if (res.code === 200) {
that.temp = {
this.temp = {
title: '用户密码重置成功',
randomPwd: res.data.randomPwd
}
that.showUserPwd = true
this.showUserPwd = true
}
resolve()
})
.catch(reject)
})
}
})

View File

@ -428,27 +428,20 @@ export default {
},
//
handleDelete(record) {
const that = this
$confirm({
title: '系统提示',
zIndex: 1009,
content: '真的要删除权限组么?',
okText: '确认',
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
//
deletePermissionGroup(record.id)
.then((res) => {
onOk: () => {
return deletePermissionGroup(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
this.loadData()
}
resolve()
})
.catch(reject)
})
}
})