feat: uesrTable 添加重置2fa的按钮

This commit is contained in:
zhangyu
2021-08-13 15:18:16 +08:00
parent fd70eab240
commit d1b8eec492
9 changed files with 44 additions and 9 deletions

View File

@@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "nz-icon"; /* Project id 2030432 */ font-family: "nz-icon"; /* Project id 2030432 */
src: url('iconfont.woff2?t=1628678895024') format('woff2'), src: url('iconfont.woff2?t=1628837277704') format('woff2'),
url('iconfont.woff?t=1628678895024') format('woff'), url('iconfont.woff?t=1628837277704') format('woff'),
url('iconfont.ttf?t=1628678895024') format('truetype'); url('iconfont.ttf?t=1628837277704') format('truetype');
} }
.nz-icon { .nz-icon {
@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.nz-icon-reset:before {
content: "\e618";
}
.nz-icon-yanzhengma:before { .nz-icon-yanzhengma:before {
content: "\e736"; content: "\e736";
} }

View File

@@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "nz-icon"; /* Project id 2030432 */ font-family: "nz-icon"; /* Project id 2030432 */
src: url('./font/iconfont.woff2?t=1628678895024') format('woff2'), src: url('./font/iconfont.woff2?t=1628837277704') format('woff2'),
url('./font/iconfont.woff?t=1628678895024') format('woff'), url('./font/iconfont.woff?t=1628837277704') format('woff'),
url('./font/iconfont.ttf?t=1628678895024') format('truetype'); url('./font/iconfont.ttf?t=1628837277704') format('truetype');
} }
.nz-icon { .nz-icon {
@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.nz-icon-reset:before {
content: "\e618";
}
.nz-icon-yanzhengma:before { .nz-icon-yanzhengma:before {
content: "\e736"; content: "\e736";
} }

View File

@@ -574,6 +574,7 @@ const cn = {
confirmOvertime: '确定关闭吗?', // Are you sure you want to delete? confirmOvertime: '确定关闭吗?', // Are you sure you want to delete?
killTerm: '确认关闭 terminal 吗?', killTerm: '确认关闭 terminal 吗?',
resetPrompt: '确认重置吗?', resetPrompt: '确认重置吗?',
resetMfa: '确认重置2FA吗',
confirmBatchDelete: '确定删除这{0}条数据吗?', confirmBatchDelete: '确定删除这{0}条数据吗?',
assetConfirmDelete: '关联的Endpoint和告警将会被删除确认删除吗', assetConfirmDelete: '关联的Endpoint和告警将会被删除确认删除吗',
zoomStatusPrompt: '您的浏览器目前处于缩放状态页面可能会出现错位建议100%大小。', zoomStatusPrompt: '您的浏览器目前处于缩放状态页面可能会出现错位建议100%大小。',
@@ -725,7 +726,8 @@ const cn = {
disable: '关闭', disable: '关闭',
enableMfa: '开启', enableMfa: '开启',
forceEnable: '强制开启', forceEnable: '强制开启',
mfaTitle: 'Two-Factor Authentication' mfaTitle: 'Two-Factor Authentication',
resetMfa: '重置2FA'
}, },
roles: { roles: {
roles: '角色', roles: '角色',

View File

@@ -582,6 +582,7 @@ const en = {
confirmOvertime: "Are you sure it's off?", confirmOvertime: "Are you sure it's off?",
killTerm: 'Are you sure you want to kill terminal?', killTerm: 'Are you sure you want to kill terminal?',
resetPrompt: 'Are you sure to reset?', resetPrompt: 'Are you sure to reset?',
resetMfa: 'Are you sure to reset 2FA?',
confirmBatchDelete: 'Are you sure to delete these {0} pieces of data', confirmBatchDelete: 'Are you sure to delete these {0} pieces of data',
assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?', // Related endpoints and alerts will be removed, are you sure you want to delete this asset? assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?', // Related endpoints and alerts will be removed, are you sure you want to delete this asset?
zoomStatusPrompt: 'Your browser is currently in zoom state, the page may appear dislocation, the proposed 100% size.', zoomStatusPrompt: 'Your browser is currently in zoom state, the page may appear dislocation, the proposed 100% size.',
@@ -734,7 +735,8 @@ const en = {
disable: 'Disable', disable: 'Disable',
enableMfa: 'Enable', enableMfa: 'Enable',
forceEnable: 'Force enable', forceEnable: 'Force enable',
mfaTitle: 'Two-Factor Authentication' mfaTitle: 'Two-Factor Authentication',
resetMfa: 'Reset 2FA'
}, },
roles: { roles: {
roles: 'Role', roles: 'Role',

View File

@@ -83,6 +83,7 @@
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-has="'user_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item> <el-dropdown-item v-has="'user_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'user_delete'" :command="['delete', scope.row]" :disabled="scope.row.id === 1"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item> <el-dropdown-item v-has="'user_delete'" :command="['delete', scope.row]" :disabled="scope.row.id === 1"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'user_edit'" :command="['reset_mfa', scope.row]"><i class="nz-icon nz-icon-reset"></i><span class="operation-dropdown-text">{{$t('config.user.resetMfa')}}</span></el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
@@ -184,12 +185,16 @@ export default {
/deep/ .el-tag.el-tag--mini{ /deep/ .el-tag.el-tag--mini{
border-radius: 10px; border-radius: 10px;
font-size: 12px; font-size: 12px;
line-height: 12px;
height: 12px;
vertical-align: middle;
} }
.user-name-top{ .user-name-top{
color: #333; color: #333;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 14px;
line-height: 14px; line-height: 14px;
vertical-align: middle;
} }
.user-name-bottom{ .user-name-bottom{
color: #999999; color: #999999;

View File

@@ -25,6 +25,7 @@
:height="mainTableHeight" :height="mainTableHeight"
:table-data="tableData" :table-data="tableData"
@del="del" @del="del"
@reset_mfa="resetMfa"
@edit="edit" @edit="edit"
@orderBy="tableDataSort" @orderBy="tableDataSort"
@reload="getTableData" @reload="getTableData"
@@ -46,7 +47,8 @@ import userBox from '@/components/common/rightBox/administration/userBox'
import nzDataList from '@/components/common/table/nzDataList' import nzDataList from '@/components/common/table/nzDataList'
import dataListMixin from '@/components/common/mixin/dataList' import dataListMixin from '@/components/common/mixin/dataList'
import userTable from '@/components/common/table/settings/userTable' import userTable from '@/components/common/table/settings/userTable'
import MessageBox from 'element-ui/packages/message-box/src/main'
import i18n from '@/components/common/i18n'
export default { export default {
name: 'user', name: 'user',
components: { components: {
@@ -121,6 +123,22 @@ export default {
this.rightBox.show = true this.rightBox.show = true
} }
}) })
},
resetMfa (row) {
MessageBox.confirm(i18n.t('tip.resetMfa'), {
confirmButtonText: i18n.t('tip.yes'),
cancelButtonText: i18n.t('tip.no'),
type: 'warning'
}).then(() => {
this.$delete('/sys/user/resetMfa', { ids: row.id }).then(res => {
if (res.code == 200) {
this.$message.success(this.$t('tip.resetSuccess'))
this.getTableData()
} else {
this.$message.error(res.msg)
}
})
})
} }
} }
} }