Browse Source

重置密码地区校验

zhangrenyuan/feature-20250714163943-金币前端二期
ZhangYong 2 weeks ago
parent
commit
51b08e3499
  1. 51
      src/views/home.vue
  2. 81
      src/views/permissions/permission.vue

51
src/views/home.vue

@ -123,24 +123,6 @@ const exportList = ref([])
//
const exportListLoading = ref(false)
//
const getExportList = async () => {
exportListLoading.value = true
try {
const result = await API({ url: '/export/export' })
if (result.code === 200) {
exportList.value = result.data
} else {
ElMessage.error(result.msg || '获取导出列表失败')
}
} catch (error) {
console.error('获取导出列表出错:', error)
ElMessage.error('获取导出列表失败,请稍后重试')
} finally {
exportListLoading.value = false
}
}
//
const getTagType = (state) => {
switch (state) {
@ -353,39 +335,6 @@ const openChangePassword = () => {
</template>
</el-dialog>
<!-- 导出列表弹窗 -->
<el-dialog v-model="exportListVisible" title="导出列表" width="80%">
<el-table :data="exportList" style="width: 100%" :loading="exportListLoading">
<el-table-column prop="fileName" label="文件名"/>
<el-table-column prop="state" label="状态">
<template #default="scope">
<el-tag :type="getTagType(scope.row.state)"
:effect="scope.row.state === 3 ? 'light' : 'plain'">
{{ getTagText(scope.row.state) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间">
<template #default="scope">
{{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button type="primary" size="small" @click="downloadExportFile(scope.row)"
:disabled="scope.row.state !== 2">
下载
</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<div class="dialog-footer">
<el-button text @click="exportListVisible = false">关闭</el-button>
</div>
</template>
</el-dialog>
<!-- 自定义密码修改弹窗组件 -->
<el-dialog
v-model="showPasswordDialog"

81
src/views/permissions/permission.vue

@ -633,17 +633,6 @@ const editStatus = async function (row) {
}
}
//
const resetConfirmVisible = ref(false)
//
const currentRow = ref(null)
//
const resetPassword = function (row) {
//
currentRow.value = row
resetConfirmVisible.value = true
}
const handlePageSizeChange = function (val) {
getObj.value.pageSize = val
@ -734,38 +723,54 @@ const showMenuTree = (treeData, roleName) => {
currentRoleName.value = roleName || '权限详情';
menuTreeVisible.value = true;
};
//
const confirmResetPassword = async function () {
const params = {
account: currentRow.value.account,
//
const resetPassword = function (row) {
console.log('adminData.value.markets', adminData.value.markets);
// markets
if (typeof adminData.value.markets === 'string' && adminData.value.markets) {
adminData.value.markets = adminData.value.markets.split(',');
} else {
adminData.value.markets = [];
}
console.log(params)
//
try {
const result = await request({
url: '/admin/reset',
method: 'post',
data: params // params
})
if (result.code === 200) { // 使
ElMessage.success('重置密码成功')
resetConfirmVisible.value = false //
} else {
ElMessage.error(result.message || '重置密码失败')
if (adminData.value.markets.includes(row.market)||adminData.value.markets=='总部') {
console.log('符合条件,可以操作');
// thencatch
ElMessageBox.confirm(
`确认重置该账号密码?`,
'提示',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: "warning",
lockScroll: false
}
} catch (error) {
ElMessage.error('重置密码失败')
console.error('请求错误:', error)
).then(async () => {
//
try {
const res = await API({
url: '/admin/reset',
data: { account: row.account }
});
if (res.code === 200) {
ElMessage.success(res.data);
}
} catch (error) {
ElMessage.error('请求失败: ' + (error.message || error));
}
}).catch(() => {
//
console.log('用户取消了重置密码操作');
});
}else{
ElMessage.error('您没有修改'+row.market+'地区的用户密码的权限')
}
}
//
const cancelResetPassword = function () {
resetConfirmVisible.value = false
}
//
onMounted(async function () {

Loading…
Cancel
Save