更新优化
This commit is contained in:
parent
39f03f8e3f
commit
21d222eab5
|
@ -65,15 +65,13 @@ export function delUser(userId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户密码重置
|
// 用户密码重置
|
||||||
export function resetUserPwd(userId, password) {
|
export function resetUserPwd(userId) {
|
||||||
const data = {
|
|
||||||
userId,
|
|
||||||
password
|
|
||||||
}
|
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/resetPwd',
|
url: '/system/user/resetPwd',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
params: {
|
||||||
|
userId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ const user = {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getInfo().then(res => {
|
getInfo().then(res => {
|
||||||
const user = res.user
|
const user = res.user
|
||||||
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
|
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar;
|
||||||
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||||
commit('SET_ROLES', res.roles)
|
commit('SET_ROLES', res.roles)
|
||||||
commit('SET_PERMISSIONS', res.permissions)
|
commit('SET_PERMISSIONS', res.permissions)
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<div class="log-info">
|
<div class="log-info">
|
||||||
<span class="info-item">
|
<span class="info-item">
|
||||||
<i class="el-icon-location"></i>
|
<i class="el-icon-location"></i>
|
||||||
{{ log.longitude.toFixed(6) }}, {{ log.latitude.toFixed(6) }}
|
{{ log.longitude | dv }}, {{ log.latitude | dv }}
|
||||||
</span>
|
</span>
|
||||||
<span class="info-item">
|
<span class="info-item">
|
||||||
<i class="el-icon-odometer"></i>
|
<i class="el-icon-odometer"></i>
|
||||||
|
|
76
src/views/system/user/components/UserShowPasswordDialog.vue
Normal file
76
src/views/system/user/components/UserShowPasswordDialog.vue
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog :visible.sync="dialogVisible" title="重置密码" width="400px" :close-on-click-modal="false">
|
||||||
|
|
||||||
|
|
||||||
|
<el-descriptions :column="1" border>
|
||||||
|
<el-descriptions-item label="账号">{{ passwordData.userName | dv}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="密码">
|
||||||
|
{{ password | dv}}
|
||||||
|
<el-button type="text" @click="showPassword = false" v-if="showPassword" icon="el-icon-unlock"/>
|
||||||
|
<el-button type="text" @click="showPassword = true" v-else icon="el-icon-view"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<div style="margin-top: 20px; text-align: center; color: red; font-size: 12px">
|
||||||
|
密码重置成功,仅在当前页面展示一次,请及时复制保存。
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-row :gutter="4" style="margin-top: 20px;">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button style="width: 100%" @click="handleClose" icon="el-icon-close">关闭</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="18">
|
||||||
|
<el-button style="width: 100%" type="primary" v-clipboard:copy="copyText" icon="el-icon-document-copy" v-clipboard:success="handleCopySuccess">复制</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'UserShowPasswordDialog',
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
passwordData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showPassword: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dialogVisible: {
|
||||||
|
get() {
|
||||||
|
return this.visible;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:visible', val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
copyText() {
|
||||||
|
return `登录地址:https://ele.ccttiot.com\n账号:${this.passwordData.userName}\n密码:${this.passwordData.password}\n\n温馨提示:\n请妥善保管您的密码,并在登录系统后,及时修改密码。`;
|
||||||
|
},
|
||||||
|
password() {
|
||||||
|
return this.showPassword ? this.passwordData.password : '********';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose() {
|
||||||
|
this.$emit('update:visible', false);
|
||||||
|
},
|
||||||
|
handleCopySuccess() {
|
||||||
|
this.$message.success('复制成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -185,13 +185,13 @@
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:user:remove']"
|
v-hasPermi="['system:user:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
<el-button
|
||||||
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
size="mini"
|
||||||
<el-dropdown-menu slot="dropdown">
|
type="text"
|
||||||
<el-dropdown-item command="handleResetPwd" icon="el-icon-key"
|
icon="el-icon-key"
|
||||||
v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
|
@click="handleResetPwd(scope.row)"
|
||||||
</el-dropdown-menu>
|
v-hasPermi="['system:user:resetPwd']"
|
||||||
</el-dropdown>
|
>重置密码</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -213,6 +213,12 @@
|
||||||
ref="userFormDialog"
|
ref="userFormDialog"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 重置密码对话框组件 -->
|
||||||
|
<user-show-password-dialog
|
||||||
|
:visible.sync="showPasswordData"
|
||||||
|
:password-data="passwordData"
|
||||||
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -232,6 +238,7 @@ import { UserType, WithdrawServiceType } from '@/utils/enums'
|
||||||
import BooleanTag from '@/components/BooleanTag/index.vue'
|
import BooleanTag from '@/components/BooleanTag/index.vue'
|
||||||
import UserLink from '@/components/Business/User/UserLink.vue'
|
import UserLink from '@/components/Business/User/UserLink.vue'
|
||||||
import RoleSelect from '@/components/Business/Role/RoleSelect.vue'
|
import RoleSelect from '@/components/Business/Role/RoleSelect.vue'
|
||||||
|
import UserShowPasswordDialog from '@/views/system/user/components/UserShowPasswordDialog.vue'
|
||||||
|
|
||||||
// 默认排序字段
|
// 默认排序字段
|
||||||
const defaultSort = {
|
const defaultSort = {
|
||||||
|
@ -243,7 +250,7 @@ export default {
|
||||||
name: "User",
|
name: "User",
|
||||||
mixins: [$showColumns],
|
mixins: [$showColumns],
|
||||||
dicts: ['user_status', 'sys_user_sex', 'user_employ_status', 'withdraw_service_type'],
|
dicts: ['user_status', 'sys_user_sex', 'user_employ_status', 'withdraw_service_type'],
|
||||||
components: {UserFormDialog, FormCol, DeptSelect, BooleanTag, UserLink, RoleSelect},
|
components: {UserFormDialog, FormCol, DeptSelect, BooleanTag, UserLink, RoleSelect, UserShowPasswordDialog},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
WithdrawServiceType,
|
WithdrawServiceType,
|
||||||
|
@ -310,6 +317,8 @@ export default {
|
||||||
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||||
],
|
],
|
||||||
userType: null,
|
userType: null,
|
||||||
|
passwordData: {},
|
||||||
|
showPasswordData: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -419,22 +428,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
handleResetPwd(row) {
|
handleResetPwd(row) {
|
||||||
this.$prompt('请输入"' + row.nickName + '"的新密码', "提示", {
|
this.$confirm('确定要重置"' + row.nickName + '"的密码吗?').then(() => {
|
||||||
confirmButtonText: "确定",
|
resetUserPwd(row.userId).then(res => {
|
||||||
cancelButtonText: "取消",
|
this.passwordData = res.data;
|
||||||
closeOnClickModal: false,
|
this.showPasswordData = true;
|
||||||
inputPattern: /^.{5,20}$/,
|
});
|
||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
})
|
||||||
inputValidator: (value) => {
|
|
||||||
if (/<|>|"|'|\||\\/.test(value)) {
|
|
||||||
return "不能包含非法字符:< > \" ' \\\ |"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}).then(({ value }) => {
|
|
||||||
resetUserPwd(row.userId, value).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
|
||||||
});
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 分配角色操作 */
|
/** 分配角色操作 */
|
||||||
handleAuthRole: function(row) {
|
handleAuthRole: function(row) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user