| | |
| | | name: 'main', |
| | | component: () => import('../layout/MainErpView.vue'), |
| | | children:[ |
| | | //user模块 |
| | | { |
| | | path:'user', |
| | | name: 'user', |
| | | component: () => import('../views/system/user/User.vue'), |
| | | children:[ |
| | | { |
| | | path: 'userList', |
| | | name: 'userList', |
| | | component: () => import('../views/system/user/UserList.vue') |
| | | }, |
| | | { |
| | | name:'user', |
| | | path: '', |
| | | redirect:'/main/user/userList' |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | //sd模块 |
| | | { |
| | | path:'orderBasicData', |
| | |
| | | }, |
| | | { |
| | | path: '', |
| | | redirect:'/main/order/SelectOrder' |
| | | redirect:'/main/order/selectOrder' |
| | | } |
| | | ] |
| | | }, |
| | |
| | | value-format="YYYY-MM-DD" |
| | | |
| | | /> |
| | | <el-button @click="changeDate" style="margin-top: -5px" id="searchButton" type="primary" :icon="Search">{{ $t('basicData.search') }}</el-button> |
| | | <el-button @click="changeDate" |
| | | style="margin-top: -5px" |
| | | id="searchButton" |
| | | type="primary" |
| | | :icon="Search"> |
| | | {{ $t('basicData.search') }} |
| | | </el-button> |
| | | <vxe-grid |
| | | @filter-change="filterChanged" |
| | | max-height="100%" |
New file |
| | |
| | | <script setup> |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
New file |
| | |
| | | <script setup> |
| | | import {ArrowLeftBold, ArrowRight, Search} from "@element-plus/icons-vue" |
| | | import {useRouter,useRoute,onBeforeRouteUpdate} from "vue-router" |
| | | import {useI18n} from "vue-i18n" |
| | | const { t } = useI18n() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | let indexFlag=$ref(1) |
| | | function changeRouter(index){ |
| | | indexFlag=index |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div id="main-div"> |
| | | <div id="div-title"> |
| | | <el-breadcrumb :separator-icon="ArrowRight"> |
| | | <el-breadcrumb-item @click="changeRouter(1)" :class="indexFlag===1?'indexTag':''" :to="{ path: '/main/user/userList' }">用户首页</el-breadcrumb-item> |
| | | <el-breadcrumb-item v-show="false" @click="changeRouter(2)" :class="indexFlag===2?'indexTag':''" :to="{ path: '/main/order/createOrder' }">{{$t('basicData.create')}}</el-breadcrumb-item> |
| | | </el-breadcrumb> |
| | | </div> |
| | | |
| | | <div id="main-body"> |
| | | <router-view :key="route.fullPath" /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | #main-div{ |
| | | width: 99%; |
| | | height: 100%; |
| | | } |
| | | #div-title{ |
| | | height: 2%; |
| | | width: 100%; |
| | | } |
| | | #searchButton{ |
| | | margin-top: -5px; |
| | | margin-left: 1rem; |
| | | } |
| | | #searchButton1{ |
| | | //margin-left: 10rem; |
| | | } |
| | | /*main-body样式*/ |
| | | #main-body{ |
| | | width: 100%; |
| | | height: 95%; |
| | | margin-top: 1%; |
| | | } |
| | | #select{ |
| | | margin-left:0.5rem; |
| | | } |
| | | :deep(.indexTag .el-breadcrumb__inner){ |
| | | color: #5CADFE !important; |
| | | } |
| | | </style> |
New file |
| | |
| | | <script setup> |
| | | import {onBeforeMount, onMounted, reactive, ref} from "vue" |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | import request from "@/utils/request" |
| | | import {useI18n} from "vue-i18n" |
| | | const { t } = useI18n() |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'userList', |
| | | showFooter: false,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | |
| | | //表头参数 |
| | | columns:[ |
| | | |
| | | ], |
| | | |
| | | //表头按钮 |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | |
| | | ], |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | }) |
| | | onBeforeMount(()=>{ |
| | | let columns = [{title: t('basicData.operate'), width: 133, slots: { default: 'button_slot' }}] |
| | | const columnName = { |
| | | loginName: '用户ID', |
| | | userName:'用户', |
| | | address:'地址', |
| | | phone:'电话', |
| | | role:'角色', |
| | | createTime:'创建时间' |
| | | } |
| | | for (let columnNameKey in columnName) { |
| | | let column = {field: columnNameKey, |
| | | title: columnName[columnNameKey], |
| | | filters:[{ data: '' }], |
| | | slots: { filter: 'filter' }, |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | } |
| | | columns.push(column) |
| | | } |
| | | gridOptions.columns = columns |
| | | |
| | | }) |
| | | onMounted(()=>{ |
| | | request.get('/userInfo/findAll').then(res=>{ |
| | | gridOptions.data = res.data |
| | | }) |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 100% ;"> |
| | | <vxe-grid |
| | | max-height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | > |
| | | <template #filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">设置角色</el-button> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | </vxe-grid> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | </style> |
| | |
| | | * @author kong |
| | | * @since 2022-10-13 |
| | | */ |
| | | @Component // 打开此注解,保证此类被springboot扫描,即可完成sa-token的自定义权限验证扩展 |
| | | |
| | | |
| | | // 打开此注解,保证此类被springboot扫描,即可完成sa-token的自定义权限验证扩展 |
| | | @Component |
| | | public class StpInterfaceImpl implements StpInterface { |
| | | private final PermissionRoleService permissionRoleService; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<String> getPermissionList(Object loginId, String loginType) { |
| | | // 本list仅做模拟,实际项目中要根据具体业务逻辑来查询权限 |
| | | /*List<String> list = new ArrayList<>(); |
| | | list.add("101"); |
| | | list.add("user.add"); |
| | | list.add("user.update"); |
| | | list.add("user.get"); |
| | | // list.add("user.delete"); |
| | | list.add("art.*");*/ |
| | | |
| | | return permissionRoleService.getUserPermission(Integer.parseInt((String) loginId)); |
| | | } |
| | |
| | | import com.example.erp.common.Result; |
| | | import com.example.erp.controller.dto.UserDTO; |
| | | import com.example.erp.service.userInfo.UserService; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/userInfo") |
| | |
| | | return Result.seccess(userService.isLogin()); } |
| | | |
| | | @SaCheckLogin |
| | | @PostMapping("/userAdd") |
| | | @PostMapping("/getTokenInfo") |
| | | public Result userAdd() { |
| | | return Result.seccess(StpUtil.getTokenInfo()); |
| | | } |
| | | |
| | | @PostMapping("/userDelete") |
| | | @SaCheckPermission("user.delete") |
| | | public Result userDelete() { |
| | | return Result.seccess(123123); |
| | | } |
| | | |
| | | @GetMapping("findAll") |
| | | public Result findAll(){ |
| | | return Result.seccess(userService.findAll()); |
| | | } |
| | | } |
| | |
| | | return Result.error(se.getCode(),se.getMessage()); |
| | | } |
| | | |
| | | // 拦截:无权限异常 |
| | | @ExceptionHandler(NotPermissionException.class) |
| | | @ResponseBody |
| | | public Result handlerException(NotPermissionException e) { |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @DS("user_info") |
| | | public class UserService { |
| | |
| | | User user = userMapper.selectOne(new QueryWrapper<User>(). |
| | | eq("login_name", userDTO.getUserId()).eq("password", userDTO.getPass())); |
| | | if(user!=null){ |
| | | //检查是让有登录,有登录直接退出 |
| | | StpUtil.logout(user.getId()); |
| | | //重新进行登录 |
| | | StpUtil.login(user.getId()); |
| | | userDTO.setPass(null); |
| | | userDTO.setId(user.getId()); |
| | |
| | | StpUtil.logout(); |
| | | return true; |
| | | } |
| | | |
| | | public List<User> findAll() { |
| | | List<User> users = userMapper.findAll(); |
| | | users.forEach(user -> { |
| | | user.setPassword(null); |
| | | }); |
| | | return users; |
| | | } |
| | | } |
| | | |
| | |
| | | <select id="findAll"> |
| | | SELECT * |
| | | FROM erp_user_info.user |
| | | where state =1 |
| | | </select> |
| | | |
| | | <select id="findOne" > |
| | |
| | | <select id="findAll"> |
| | | SELECT * |
| | | FROM erp_user_info.user |
| | | where state =1 |
| | | </select> |
| | | |
| | | <select id="findOne" > |