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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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