| | |
| | | <el-button @click="onEdit(scope.$index, scope.row)"><el-icon><Edit /></el-icon></el-button> |
| | | |
| | | <el-button @click="onDelete(scope.$index, scope.row)" style="color: red;"><el-icon><Delete /></el-icon></el-button> |
| | | <el-button @click="onRefresh(scope.$index, scope.row)" style="color: red;"><el-icon><Refresh /></el-icon></el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | |
| | | <script> |
| | | import { onMounted, ref } from 'vue'; |
| | | import { ElLoading, ElMessageBox } from 'element-plus'; |
| | | import {listForNutrition,deleteId} from '/@/api/register' |
| | | import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'; |
| | | import {listForNutrition,deleteId,apiResetPwd} from '/@/api/register' |
| | | import EditUser from './component/editUser.vue'; |
| | | export default { |
| | | components: { EditUser }, |
| | |
| | | const onDelete = (index, row) => { |
| | | // 实现删除逻辑 |
| | | console.log(row) |
| | | ElMessageBox.confirm(`确定删除${row.userName}?`, '提示', { |
| | | ElMessageBox.confirm(`确定删除 "${row.userName}"?`, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | |
| | | // 用户取消删除 |
| | | }); |
| | | }; |
| | | const onRefresh=(index,row)=>{ |
| | | // 实现刷新逻辑 |
| | | console.log(row) |
| | | const userCode = row.code; // 用户code |
| | | ElMessageBox.confirm(`确定重置 "${row.userName}" 的密码?`, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | apiResetPwd(userCode).then(res=>{ |
| | | ElMessage({ |
| | | message: '密码已重置为123456', |
| | | type: 'success', |
| | | }); |
| | | }) |
| | | }).catch(() => { |
| | | // 用户取消删除 |
| | | }); |
| | | } |
| | | |
| | | const handleCurrentChange = (currentPage) => { |
| | | search.value.page = currentPage; |
| | |
| | | onAddUser, |
| | | onEdit, |
| | | onDelete, |
| | | onRefresh, |
| | | handleCurrentChange |
| | | }; |
| | | } |