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 = {
id: record.id
}
deleteDcoker(params)
.then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return deleteDcoker({
id: record.id
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})
@ -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 = {
id: record.id
}
dcokerSwarmLeaveForce(params)
.then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return dcokerSwarmLeaveForce({
id: record.id
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})

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,
pid: record.processId
}
killPid(params)
.then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadNodeProcess()
}
resolve()
onOk: () => {
return killPid({
...this.idInfo,
pid: record.processId
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadNodeProcess()
}
})
}
})

View File

@ -1072,7 +1072,6 @@ export default {
},
// submit
onNodeSubmit(restart) {
const that = this
$confirm({
title: '系统提示',
content: restart
@ -1081,30 +1080,26 @@ export default {
okText: '确认',
zIndex: 1009,
cancelText: '取消',
async onOk() {
return await new Promise((resolve, reject) => {
that.confirmLoading = true
saveNodeConfig({
...that.temp,
restart: restart,
ids: that.tableSelections.join(',')
})
.then((res) => {
if (res.code === 200) {
//
$notification.success({
message: res.msg
})
that.nodeConfigVisible = false
that.tableSelections = []
}
resolve()
})
.catch(reject)
.finally(() => {
that.confirmLoading = false
})
onOk: () => {
this.confirmLoading = true
return saveNodeConfig({
...this.temp,
restart: restart,
ids: this.tableSelections.join(',')
})
.then((res) => {
if (res.code === 200) {
//
$notification.success({
message: res.msg
})
this.nodeConfigVisible = false
this.tableSelections = []
}
})
.finally(() => {
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({
id: record.id
})
.then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return machineSshDelete({
id: record.id
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})
@ -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) {
$notification.success({
message: res.msg
})
machineListGroupWorkspaceSsh({
id: that.temp.machineSshId
}).then((res) => {
if (res.code === 200) {
that.workspaceSshList = res.data
}
})
}
resolve()
})
.catch(reject)
})
onOk: async () => {
const { code, msg } = await deleteForeSsh(record.id)
if (code === 200) {
$notification.success({
message: msg
})
const res = await machineListGroupWorkspaceSsh({
id: this.temp.machineSshId
})
if (res.code === 200) {
this.workspaceSshList = res.data
}
}
}
})
},
@ -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) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return restHideField(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})

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({
id: record.id
})
.then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.handleListLog()
}
resolve()
onOk: () => {
return triggerTokenDelete({
id: record.id
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.handleListLog()
}
})
}
})

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) => {
if (res.code === 200) {
$notification.success({ message: res.msg })
that.getNodeList()
} else {
//$notification.error({ message: res.msg });
}
resolve()
})
.catch(reject)
onOk: () => {
return downloadRemote().then((res) => {
if (res.code === 200) {
$notification.success({ message: res.msg })
this.getNodeList()
} else {
//$notification.error({ message: res.msg });
}
})
}
})

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({
id: record.id,
workspaceId: that.workspaceId
})
.then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadDataEnvVar()
}
resolve()
onOk: () => {
return deleteWorkspaceEnv({
id: record.id,
workspaceId: this.workspaceId
}).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadDataEnvVar()
}
})
}
})

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) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return deleteUser(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})
},
//
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) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return unlockUser(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})
},
//
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) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return closeUserMfa(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})
@ -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) => {
if (res.code === 200) {
that.temp = {
title: '用户密码重置成功',
randomPwd: res.data.randomPwd
}
that.showUserPwd = true
}
resolve()
})
.catch(reject)
onOk: () => {
return restUserPwd(record.id).then((res) => {
if (res.code === 200) {
this.temp = {
title: '用户密码重置成功',
randomPwd: res.data.randomPwd
}
this.showUserPwd = true
}
})
}
})

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) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
that.loadData()
}
resolve()
onOk: () => {
return deletePermissionGroup(record.id).then((res) => {
if (res.code === 200) {
$notification.success({
message: res.msg
})
.catch(reject)
this.loadData()
}
})
}
})