|
@ -1,10 +1,7 @@ |
|
|
<script setup> |
|
|
<script setup> |
|
|
import { ref, onMounted, reactive, computed } from 'vue' |
|
|
|
|
|
import ElementPlus from 'element-plus' |
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
|
|
|
import axios from 'axios' |
|
|
|
|
|
import moment from 'moment' |
|
|
|
|
|
import { UserFilled, InfoFilled } from '@element-plus/icons-vue' |
|
|
|
|
|
|
|
|
import {onMounted, ref} from 'vue' |
|
|
|
|
|
import {ElMessage} from 'element-plus' |
|
|
|
|
|
import {InfoFilled, UserFilled} from '@element-plus/icons-vue' |
|
|
import _ from 'lodash' |
|
|
import _ from 'lodash' |
|
|
import request from '@/util/http' |
|
|
import request from '@/util/http' |
|
|
|
|
|
|
|
@ -343,6 +340,48 @@ const editStatus = async function (row) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 重置密码弹窗状态 |
|
|
|
|
|
const resetConfirmVisible = ref(false) |
|
|
|
|
|
// 当前选中的行数据 |
|
|
|
|
|
const currentRow = ref(null) |
|
|
|
|
|
// 重置密码 |
|
|
|
|
|
const resetPassword = function (row) { |
|
|
|
|
|
// 显示确认弹窗 |
|
|
|
|
|
currentRow.value = row |
|
|
|
|
|
resetConfirmVisible.value = true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 确认重置密码 |
|
|
|
|
|
const confirmResetPassword = async function () { |
|
|
|
|
|
const params = { |
|
|
|
|
|
account: currentRow.value.account, |
|
|
|
|
|
} |
|
|
|
|
|
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 || '重置密码失败') |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
ElMessage.error('重置密码失败') |
|
|
|
|
|
console.error('请求错误:', error) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 取消重置密码 |
|
|
|
|
|
const cancelResetPassword = function () { |
|
|
|
|
|
resetConfirmVisible.value = false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 挂载 |
|
|
// 挂载 |
|
|
onMounted(async function () { |
|
|
onMounted(async function () { |
|
@ -418,6 +457,15 @@ const handleCurrentChange = function (val) { |
|
|
<el-table-column prop="remark" label="备注"/> |
|
|
<el-table-column prop="remark" label="备注"/> |
|
|
<el-table-column prop="operation" label="操作" width="300px" align="center"> |
|
|
<el-table-column prop="operation" label="操作" width="300px" align="center"> |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="warning" |
|
|
|
|
|
text |
|
|
|
|
|
@click="resetPassword(scope.row)" |
|
|
|
|
|
:disabled="scope.row.adminStatus === 0" |
|
|
|
|
|
> |
|
|
|
|
|
重置密码 |
|
|
|
|
|
</el-button> |
|
|
|
|
|
|
|
|
<el-button type="warning" text @click="permissionEditInit(scope.row)" |
|
|
<el-button type="warning" text @click="permissionEditInit(scope.row)" |
|
|
:disabled="scope.row.adminStatus === 0"> |
|
|
:disabled="scope.row.adminStatus === 0"> |
|
|
修改权限 |
|
|
修改权限 |
|
@ -452,7 +500,8 @@ const handleCurrentChange = function (val) { |
|
|
<!-- 分页 --> |
|
|
<!-- 分页 --> |
|
|
<div class="pagination" style="margin-top: 20px"> |
|
|
<div class="pagination" style="margin-top: 20px"> |
|
|
<el-pagination background :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]" |
|
|
<el-pagination background :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]" |
|
|
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handlePageSizeChange" |
|
|
|
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="total" |
|
|
|
|
|
@size-change="handlePageSizeChange" |
|
|
@current-change="handleCurrentChange"></el-pagination> |
|
|
@current-change="handleCurrentChange"></el-pagination> |
|
|
</div> |
|
|
</div> |
|
|
</el-card> |
|
|
</el-card> |
|
@ -490,7 +539,8 @@ const handleCurrentChange = function (val) { |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item prop="machineId" label="机器码:" required> |
|
|
<el-form-item prop="machineId" label="机器码:" required> |
|
|
<div style="display: flex; align-items: center; flex-wrap: wrap;"> |
|
|
<div style="display: flex; align-items: center; flex-wrap: wrap;"> |
|
|
<el-input v-model="addAdmin.machineId" placeholder="请输入机器码" style="width: 220px; margin-right: 10px;" /> |
|
|
|
|
|
|
|
|
<el-input v-model="addAdmin.machineId" placeholder="请输入机器码" |
|
|
|
|
|
style="width: 220px; margin-right: 10px;"/> |
|
|
<el-button type="primary" @click="addMachineIdInput">添加</el-button> |
|
|
<el-button type="primary" @click="addMachineIdInput">添加</el-button> |
|
|
<!-- 动态添加的机器码输入框 --> |
|
|
<!-- 动态添加的机器码输入框 --> |
|
|
<div v-for="(item, index) in addAdmin.machineIds" :key="index" style="margin-left: 10px;"> |
|
|
<div v-for="(item, index) in addAdmin.machineIds" :key="index" style="margin-left: 10px;"> |
|
@ -564,7 +614,9 @@ const handleCurrentChange = function (val) { |
|
|
</el-descriptions> |
|
|
</el-descriptions> |
|
|
|
|
|
|
|
|
<el-divider> |
|
|
<el-divider> |
|
|
<el-icon><star-filled /></el-icon> |
|
|
|
|
|
|
|
|
<el-icon> |
|
|
|
|
|
<star-filled/> |
|
|
|
|
|
</el-icon> |
|
|
</el-divider> |
|
|
</el-divider> |
|
|
<div> |
|
|
<div> |
|
|
<span class="permissionVisible" style="margin-right: 20px">权限设置:</span> |
|
|
<span class="permissionVisible" style="margin-right: 20px">权限设置:</span> |
|
@ -587,13 +639,34 @@ const handleCurrentChange = function (val) { |
|
|
</template> |
|
|
</template> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 重置密码确认弹窗 --> |
|
|
|
|
|
<el-dialog |
|
|
|
|
|
v-model="resetConfirmVisible" width="500px" :close-on-click-modal="false" :before-close="cancelResetPassword" |
|
|
|
|
|
> |
|
|
|
|
|
<el-row> |
|
|
|
|
|
<el-col :span="4" style="margin-top: 20px"> |
|
|
|
|
|
<el-icon class="dialog-icon" color="#10AEFF" size="50"> |
|
|
|
|
|
<InfoFilled/> |
|
|
|
|
|
</el-icon> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="20"> |
|
|
|
|
|
<h3>提示</h3> |
|
|
|
|
|
<p class="dialog-title">确认重置该账号密码?</p> |
|
|
|
|
|
<p class="dialog-desc">重置后密码为: 123456,请通知用户及时修改</p> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
<template #footer> |
|
|
|
|
|
<div style="align-content: center ; gap: 30px"> |
|
|
|
|
|
<el-button @click="cancelResetPassword">取消</el-button> |
|
|
|
|
|
<el-button type="primary" @click="confirmResetPassword">确定</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
<style scoped> |
|
|
.permissionVisible { |
|
|
.permissionVisible { |
|
|
font-size: 16px; |
|
|
font-size: 16px; |
|
|