大屏页面初始化
This commit is contained in:
@@ -41,4 +41,16 @@ export function updatePasswd(params) {
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化密码
|
||||
*/
|
||||
export function initPasswd(params) {
|
||||
return request({
|
||||
url: '/initPasswd',
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
@@ -68,6 +68,7 @@ const submitForm = async () => {
|
||||
userId: userStore.loginUser?.userId || ''
|
||||
}
|
||||
const res = await updatePasswd(reqParams)
|
||||
ElMessage.success(res.msg);
|
||||
await new Promise(res => setTimeout(res, 800))
|
||||
isMounted.value && emit('success')
|
||||
return true
|
||||
|
||||
@@ -377,7 +377,6 @@ const submitEditPwd = () => {
|
||||
const handlePwdModifySuccess = () => {
|
||||
if (!isMounted.value) return
|
||||
closeEditPwdDialog();
|
||||
ElMessage.success('密码修改成功,请重新登录');
|
||||
userStore.logout();
|
||||
router.push('/login');
|
||||
}
|
||||
|
||||
@@ -73,6 +73,10 @@
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button size="small" type="warning" @click="handleResetPwd(scope.row)">
|
||||
<el-icon><Key /></el-icon>
|
||||
初始化
|
||||
</el-button>
|
||||
<el-button size="small" type="danger" @click="handleDelete(scope.row)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
@@ -98,8 +102,9 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
||||
import { Plus, Download, Edit, Delete } from '@element-plus/icons-vue'
|
||||
import { initPasswd } from '@/api/user'
|
||||
import { getHomeUserList, getHomeUserSave, getHomeUserDelete } from '@/api/bizUser'
|
||||
|
||||
import CSearch from '@/components/Search/proSearch.vue'
|
||||
@@ -191,21 +196,45 @@ const handleExport = () => {
|
||||
}
|
||||
|
||||
const handleDelete = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除该条数据吗?', '删除确认', {
|
||||
type: 'warning',
|
||||
closeOnClickModal: false,
|
||||
showClose: false
|
||||
})
|
||||
ElMessageBox.confirm('确定要删除该条数据吗?', '删除确认', {
|
||||
type: 'warning',
|
||||
closeOnClickModal: false,
|
||||
showClose: false
|
||||
})
|
||||
.then(async () => {
|
||||
const reqParams = {
|
||||
userId: row.userId
|
||||
}
|
||||
const res = await getHomeUserDelete(reqParams);
|
||||
ElMessage.success(res.msg);
|
||||
getDataList();
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.info('已取消删除数据操作');
|
||||
});
|
||||
}
|
||||
|
||||
const handleResetPwd = async (row) => {
|
||||
ElMessageBox.confirm('确定要初始化该用户的密码吗?', '初始化确认', {
|
||||
type: 'warning',
|
||||
closeOnClickModal: false,
|
||||
showClose: false
|
||||
})
|
||||
.then(async () => {
|
||||
const reqParams = {
|
||||
userId: row.userId
|
||||
}
|
||||
const res = await getHomeUserDelete(reqParams);
|
||||
ElMessage.success('删除成功');
|
||||
getDataList();
|
||||
} catch (error) {
|
||||
ElMessage.error('删除数据失败,请重试' ,error);
|
||||
}
|
||||
const res = await initPasswd(reqParams);
|
||||
ElNotification({
|
||||
title: '初始化密码',
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
})
|
||||
getDataList();
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.info('已取消密码初始化操作');
|
||||
});
|
||||
}
|
||||
|
||||
const handleSizeChange = (val) => {
|
||||
|
||||
Reference in New Issue
Block a user