瀏覽代碼

提交打包

master
747575620@qq.com 1 年之前
父節點
當前提交
e9ed8faa69
共有 36 個文件被更改,包括 636 次插入3178 次删除
  1. +1
    -1
      frontend/config/routes.ts
  2. +0
    -138
      frontend/dist/328.f17880dd.async.js
  3. +0
    -571
      frontend/dist/513.c0788bc6.async.js
  4. +0
    -8
      frontend/dist/564.bd853797.async.js
  5. +0
    -925
      frontend/dist/630.bef28f50.async.js
  6. +0
    -2
      frontend/dist/811.2cb513d3.async.js
  7. +0
    -82
      frontend/dist/975.e99a8a0c.async.js
  8. +1
    -1
      frontend/dist/index.html
  9. +0
    -2
      frontend/dist/p__kep__index.306fba2b.async.js
  10. +0
    -1
      frontend/dist/p__kep__index.3368f615.chunk.css
  11. +0
    -1
      frontend/dist/p__system__authTemplate__index.a782894c.async.js
  12. +0
    -1
      frontend/dist/p__system__module__index.0a77d9f3.async.js
  13. +0
    -1
      frontend/dist/p__system__role__index.834e458e.async.js
  14. +0
    -1
      frontend/dist/p__system__user__index.df8927e7.async.js
  15. +0
    -1
      frontend/dist/p__user__login__index.eda71cb5.async.js
  16. +0
    -346
      frontend/dist/umi.e60398ba.js
  17. +0
    -45
      frontend/src/api/ModuleAPI.ts
  18. +0
    -52
      frontend/src/api/Role.ts
  19. +0
    -110
      frontend/src/api/User.ts
  20. +0
    -52
      frontend/src/api/accountService.ts
  21. +146
    -0
      frontend/src/api/sys/dto.d.ts
  22. +294
    -0
      frontend/src/api/sys/service.ts
  23. +2
    -2
      frontend/src/app.tsx
  24. +6
    -6
      frontend/src/components/HeaderRight/index.tsx
  25. +9
    -34
      frontend/src/pages/system/account/index.tsx
  26. +0
    -0
     
  27. +0
    -522
      frontend/src/pages/system/authTemplate/index.tsx
  28. +21
    -20
      frontend/src/pages/system/module/index.tsx
  29. +143
    -12
      frontend/src/pages/system/role/index.tsx
  30. +11
    -16
      frontend/src/pages/system/user/index.tsx
  31. +2
    -2
      frontend/src/pages/user/login/index.tsx
  32. +0
    -50
      frontend/src/types/Account.d.ts
  33. +0
    -81
      frontend/src/types/AuthTemplateTypes.d.ts
  34. +0
    -16
      frontend/src/types/ModuleTypes.d.ts
  35. +0
    -17
      frontend/src/types/RoleTypes.d.ts
  36. +0
    -59
      frontend/src/types/UserTypes.d.ts

+ 1
- 1
frontend/config/routes.ts 查看文件

@@ -10,7 +10,7 @@
{ path: '/system/user', name: '人员管理', component: './system/user' },
{ path: '/system/role', name: '角色管理', component: './system/role' },
{ path: '/system/module', name: '模块管理', component: './system/module' },
{ path: '/system/authTemplate', name: '权限管理', component: './system/authTemplate' },
// { path: '/system/authTemplate', name: '权限管理', component: './system/authTemplate' },
],
},
{


+ 0
- 138
frontend/dist/328.f17880dd.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 571
frontend/dist/513.c0788bc6.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 8
frontend/dist/564.bd853797.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 925
frontend/dist/630.bef28f50.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 2
frontend/dist/811.2cb513d3.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 82
frontend/dist/975.e99a8a0c.async.js
文件差異過大導致無法顯示
查看文件


+ 1
- 1
frontend/dist/index.html 查看文件

@@ -6,6 +6,6 @@
</head>
<body>
<div id="root"></div>
<script src="/umi.e60398ba.js"></script>
<script src="/umi.bd903792.js"></script>

</body></html>

+ 0
- 2
frontend/dist/p__kep__index.306fba2b.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__kep__index.3368f615.chunk.css
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__system__authTemplate__index.a782894c.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__system__module__index.0a77d9f3.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__system__role__index.834e458e.async.js 查看文件

@@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[24],{56160:function(A,M,e){var h=e(97857),_=e.n(h),E=e(12578);M.Z={CreateRole:function(u){return(0,E.request)("/api/authorize/addrole",{method:"POST",data:_()({},u)})},DeleteRole:function(u){return(0,E.request)("/api/authorize/removerole/".concat(u),{method:"GET"})},ModifyRole:function(u){return(0,E.request)("/api/authorize/editrole",{method:"POST",data:_()({},u)})},GetRoleList:function(){return(0,E.request)("/api/authorize/getroleList",{method:"GET"})},GetRolePagedList:function(u){return(0,E.request)("/api/authorize/queryrole",{method:"POST",data:_()({},u)})}}},36056:function(A,M,e){e.r(M);var h=e(15009),_=e.n(h),E=e(99289),d=e.n(E),u=e(5574),v=e.n(u),p=e(67294),f=e(12029),B=e(42075),I=e(86738),c=e(45360),C=e(71577),L=e(5914),O=e(12096),D=e(56160),g=e(51042),K=e(15513),n=e(85893),S=function(){var y=(0,p.useState)({id:"",name:"",description:""}),j=v()(y,2),F=j[0],Z=j[1],U=(0,p.useState)(!1),b=v()(U,2),W=b[0],P=b[1],x=f.Z.useForm(),z=v()(x,1),T=z[0],G=[{title:"\u89D2\u8272\u540D\u79F0",dataIndex:"name",key:"name"},{title:"\u89D2\u8272\u63CF\u8FF0",dataIndex:"description",key:"description",search:!1},{title:"\u64CD\u4F5C",search:!1,key:"action",render:function(t,r){return(0,n.jsxs)(B.Z,{size:"middle",children:[(0,n.jsx)("a",{onClick:function(){return $(r)},children:"\u7F16\u8F91"}),(0,n.jsx)(I.Z,{title:"\u786E\u5B9A\u8981\u5220\u9664\u6B64\u89D2\u8272\u5417\uFF1F",onConfirm:function(){return J(r)},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,n.jsx)("a",{children:"\u5220\u9664"})})]})}}],$=function(t){var r;Z(t),T.setFieldsValue(t),P(!0),(r=R.current)===null||r===void 0||r.reload()},J=function(){var o=d()(_()().mark(function t(r){var s,m;return _()().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,D.Z.DeleteRole(r.id);case 2:s=l.sent,s.statusCode===200?(c.ZP.success("\u5220\u9664\u6210\u529F"),(m=R.current)===null||m===void 0||m.reload()):c.ZP.error(s.msg||"\u5220\u9664\u5931\u8D25");case 4:case"end":return l.stop()}},t)}));return function(r){return o.apply(this,arguments)}}(),V=function(){var o=d()(_()().mark(function t(r){var s,m,a,l;return _()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!r.id){i.next=7;break}return i.next=3,D.Z.ModifyRole(r);case 3:s=i.sent,s.statusCode===200?(c.ZP.success("\u66F4\u65B0\u89D2\u8272\u4FE1\u606F\u6210\u529F"),P(!1),(m=R.current)===null||m===void 0||m.reload()):c.ZP.error(s.msg||"\u66F4\u65B0\u89D2\u8272\u4FE1\u606F\u5931\u8D25"),i.next=11;break;case 7:return i.next=9,D.Z.CreateRole(r);case 9:a=i.sent,a.statusCode===200?(c.ZP.success("\u521B\u5EFA\u89D2\u8272\u6210\u529F"),P(!1),(l=R.current)===null||l===void 0||l.reload()):c.ZP.error(a.msg||"\u521B\u5EFA\u89D2\u8272\u5931\u8D25");case 11:case"end":return i.stop()}},t)}));return function(r){return o.apply(this,arguments)}}(),N=function(){Z({id:"",name:"",description:""}),T.resetFields(),P(!0)},R=(0,p.useRef)();return(0,n.jsxs)("div",{children:[(0,n.jsx)(K.Z,{columns:G,actionRef:R,cardBordered:!0,request:d()(_()().mark(function o(){var t,r,s=arguments;return _()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return t=s.length>0&&s[0]!==void 0?s[0]:{},a.next=3,D.Z.GetRolePagedList({keyword:t.name,sortName:"",sortByAsc:!1,pageIndex:t.current||1,pageSize:t.pageSize||10});case 3:if(r=a.sent,r.statusCode!==200){a.next=8;break}return a.abrupt("return",{data:r.data.items,success:!0,total:r.data.total});case 8:return c.ZP.error(r.errors||"\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25"),a.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return a.stop()}},o)})),rowKey:"id",pagination:{pageSize:10},dateFormatter:"string",headerTitle:"\u89D2\u8272\u5217\u8868",toolBarRender:function(){return[(0,n.jsx)(C.ZP,{icon:(0,n.jsx)(g.Z,{}),type:"primary",onClick:N,children:"\u6DFB\u52A0"},"button")]}}),(0,n.jsx)(L.Z,{footer:null,title:F.id===""?"\u6DFB\u52A0\u89D2\u8272":"\u7F16\u8F91\u89D2\u8272",open:W,onCancel:function(){return P(!1)},children:(0,n.jsxs)(f.Z,{name:"basic",form:T,onFinish:V,children:[(0,n.jsx)(f.Z.Item,{label:"id",name:"id",hidden:!0,children:(0,n.jsx)(O.Z,{})}),(0,n.jsx)(f.Z.Item,{label:"\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\uFF01"}],children:(0,n.jsx)(O.Z,{})}),(0,n.jsx)(f.Z.Item,{label:"\u63CF\u8FF0",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u63CF\u8FF0\uFF01"}],children:(0,n.jsx)(O.Z,{})}),(0,n.jsx)(f.Z.Item,{children:(0,n.jsx)(C.ZP,{type:"primary",htmlType:"submit",children:"\u786E\u5B9A"})})]})})]})};M.default=S}}]);

+ 0
- 1
frontend/dist/p__system__user__index.df8927e7.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__user__login__index.eda71cb5.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 346
frontend/dist/umi.e60398ba.js
文件差異過大導致無法顯示
查看文件


+ 0
- 45
frontend/src/api/ModuleAPI.ts 查看文件

@@ -1,45 +0,0 @@
import { request } from '@umijs/max';

/**
* 模块相关接口
*/
export default {

//创建模块
SaveCreateModule(params: ModuleTypes.ModuleType) {
return request('/api/authorize/addmodule', {
method: 'POST',
data: {
...params
}
});
},

//获取模块视图
GetTreeGridModule(params: ModuleTypes.ModuleType) {
return request(`/api/authorize/gettreegrid`, {
method: 'POST',
data:{
...params
}
});
},

//修改模块
SaveModifyModule(params: ModuleTypes.ModuleType) {
return request('/api/authorize/editmodule', {
method: 'POST',
data: {
...params
}
});
},

//删除模块
DeleteModule(id: string) {
return request(`/api/authorize/removemodule/${id}`, {
method: 'GET'
});
},

}

+ 0
- 52
frontend/src/api/Role.ts 查看文件

@@ -1,52 +0,0 @@
import { request } from '@umijs/max';

export default {
//创建角色
CreateRole(parms: RolelTypes.RoleType) {
return request('/api/authorize/addrole', {
method: 'POST',
data: {
...parms,
},
});
},

//删除角色
DeleteRole(id: string) {
return request(`/api/authorize/removerole/${id}`, {
method: 'GET'
});
},

//修改角色
ModifyRole(parms: RolelTypes.RoleType) {
return request('/api/authorize/editrole', {
method: 'POST',
data: {
...parms,
},
});
},


//获取角色列表
GetRoleList() {
return request('/api/authorize/getroleList', {
method: 'GET',
});
},

/**
* 角色分页查询
* @param parms
* @returns
*/
GetRolePagedList(parms: RolelTypes.RolePageParams) {
return request('/api/authorize/queryrole', {
method: 'POST',
data: {
...parms,
},
});
}
}

+ 0
- 110
frontend/src/api/User.ts 查看文件

@@ -1,110 +0,0 @@
import { request } from '@umijs/max';

export default {
//登录
Login(parms: UserTypes.LoginParams) {
return request('/api/authorize/login', {
method: 'POST',
data: {
...parms
}
});
},

//新增人员
CreateUser(params: UserTypes.PersonnelType) {
return request('/api/authorize/addemployee', {
method: 'POST',
data: {
...params,
},
});
},

//修改人员信息
ModifyUser(params: UserTypes.PersonnelType) {
return request('/api/authorize/editemployee', {
method: 'POST',
data: {
...params,
},
});
},


//根据用户ID查询用户信息
GetUserById(id: string) {
return request(`/api/base/user/getuserbyid?id=${id}`, {
method: 'GET',
});
},

//人员分页查询
GetUserPagedList(params: UserTypes.UserPageParams) {
return request('/api/authorize/queryemployee', {
method: 'POST',
data: {
...params,
},
});
},

/**
* 获取用户已授权菜单
*/
GetUserAuthInfo() {
return request('/api/base/authorize/getuserinfo', {
method: 'POST',
});
},

GetUserInfo() {
return request('/api/authorize/getuserinfo', {
method: 'GET',
});
},
/**
* 删除用户
* @param params
*/
RemoveUser(employeeId:string){
return request(`/api/authorize/removeemployee?employeeId=${employeeId}`, {
method: 'GET'
});
},
/**
* 绑定账户
* @param params
*/
BindAccount(params: Account.TBAccountDTO) {
return request('/api/authorize/addaccountbyuser', {
method: 'POST',
data: {
...params,
},
});
},
/**
* 重置账户
* @param params
* @returns
*/
RestoreAccount(params: string) {
return request(`/api/authorize/restoreaccountbyuser/${params}`, {
method: 'GET',
});
},
/**
* 编辑密码
* @param params
* @returns
*/
EditPwd(params: Account.TBAccountPwdDTO) {
return request(`/api/authorize/editaccountpwd`, {
method: 'POST',
data: {
...params,
},
});
}
}

+ 0
- 52
frontend/src/api/accountService.ts 查看文件

@@ -1,52 +0,0 @@
import { request } from '@umijs/max';


export default {
//创建
Add(parms: Account.TBAccountDTO) {
return request('/api/authorize/addaccount', {
method: 'POST',
data: {
...parms,
},
});
},
//删除
Del(parms: Account.TBAccountDTO) {
return request(`/api/authorize/del`, {
method: 'POST',
data: {
...parms,
},
});
},
//修改
Update(parms: Account.TBAccountDTO) {
return request('/api/authorize/update', {
method: 'POST',
data: {
...parms,
},
});
},
//列表
List() {
return request('/api/authorize/list', {
method: 'POST',
});
},
/**
* 分页查询
* @param parms
* @returns
*/
PagedList(parms: Account.Page) {
return request('/api/authorize/accountpagelist', {
method: 'POST',
data: {
...parms,
},
});
}
}


+ 146
- 0
frontend/src/api/sys/dto.d.ts 查看文件

@@ -0,0 +1,146 @@


// 账号
declare namespace account {
type base_dto = {
id?: string | null | undefined;
/**
*
* @type {string}
* @memberof Account
*/
account?: string | null;
/**
*
* @type {string}
* @memberof Account
*/
pwd: string
/**
*
* @type {string}
* @memberof Account
*/
tB_Employee_Id?: string | null;
}
type updatePwdInput = {
/**
*
* @type {string}
* @memberof Account
*/
tB_Employee_Id: string;
/**
*
* @type {string}
* @memberof Account
*/
oldPwd: string;
/**
*
* @type {string}
* @memberof Account
*/
newPwd: string;
}
interface queryPage {
pageIndex:number,
pageSize:number
account:string
}
}
// 模块类型
declare namespace moduleTypes {

type ModuleType = {
category: number,
openType: number,
parentId: string,
name: string,
icon: string,
url: string,
sort: number,
isDisabled: boolean,
id: string,
children: ModuleType[]
}
}
// 角色类型
declare namespace RolelTypes {

type RoleType = {
id?: string,
name: string,
description: string
}

type RolePageParams = {
keyword: string,
sortName: string,
sortByAsc: boolean,
pageIndex: number,
pageSize: number
}
}
//人员
declare namespace UserTypes {
// 登录参数类型
type LoginParams = {
account: string,
pwd: string
}

//人员数据类型
type PersonnelType = {
account?:string|null
/**
*
* @type {string}
* @memberof TBEmployeeDTO
*/
id?: string | null;
/**
* 排序
* @type {number}
* @memberof TBEmployeeDTO
*/
sort?: number;
/**
* 员工姓名
* @type {string}
* @memberof TBEmployeeDTO
*/
name?: string | null;
/**
* 1男2女
* @type {number}
* @memberof TBEmployeeDTO
*/
gender?: number;
/**
* 1在职2出差3离职
* @type {number}
* @memberof TBEmployeeDTO
*/
status?: number;
/**
* 角色Id
* @type {string}
* @memberof TBEmployeeDTO
*/
roleId?: string | null;

isAccount?: null | boolean ;
}

//人员分页查询参数
type UserPageParams = {
name: string,
status: number?,
pageIndex: number,
pageSize: number,
gender: number?,
}
}

+ 294
- 0
frontend/src/api/sys/service.ts 查看文件

@@ -0,0 +1,294 @@
import { request } from '@umijs/max';

/*
*
*账号
*
*/
const accountApi={
//创建
Add(parms: account.base_dto) {
return request('/api/authorize/addaccount', {
method: 'POST',
data: {
...parms,
},
});
},
//删除
Del(parms: account.base_dto) {
return request(`/api/authorize/del`, {
method: 'POST',
data: {
...parms,
},
});
},
//修改
Update(parms: account.base_dto) {
return request('/api/authorize/update', {
method: 'POST',
data: {
...parms,
},
});
},
//列表
List() {
return request('/api/authorize/list', {
method: 'POST',
});
},
/**
* 分页查询
* @param parms
* @returns
*/
PagedList(parms: account.queryPage) {
return request('/api/authorize/accountpagelist', {
method: 'POST',
data: {
...parms,
},
});
}
}

/*
*
*模块
*
*/

const moduleApi={
//创建模块
SaveCreateModule(params: moduleTypes.ModuleType) {
return request('/api/authorize/addmodule', {
method: 'POST',
data: {
...params
}
});
},

//获取模块视图
GetTreeGridModule(params?: moduleTypes.ModuleType) {
return request(`/api/authorize/gettreegrid`, {
method: 'POST',
data:{
...params
}
});
},

//修改模块
SaveModifyModule(params: moduleTypes.ModuleType) {
return request('/api/authorize/editmodule', {
method: 'POST',
data: {
...params
}
});
},

//删除模块
DeleteModule(id: string) {
return request(`/api/authorize/removemodule/${id}`, {
method: 'GET'
});
},
}

/*
*
*角色
*
*/
const roleApi={
//创建角色
CreateRole(parms: RolelTypes.RoleType) {
return request('/api/authorize/addrole', {
method: 'POST',
data: {
...parms,
},
});
},

//删除角色
DeleteRole(id: string) {
return request(`/api/authorize/removerole/${id}`, {
method: 'GET'
});
},

//修改角色
ModifyRole(parms: RolelTypes.RoleType) {
return request('/api/authorize/editrole', {
method: 'POST',
data: {
...parms,
},
});
},


//获取角色列表
GetRoleList() {
return request('/api/authorize/getroleList', {
method: 'GET',
});
},

/**
* 角色分页查询
* @param parms
* @returns
*/
GetRolePagedList(parms: RolelTypes.RolePageParams) {
return request('/api/authorize/queryrole', {
method: 'POST',
data: {
...parms,
},
});
},
/*
*
* 获取角色模块
*
*/
GetRoleModuleList(roleId:string){
return request(`/api/authorize/rolemodulelist/${roleId}`, {
method: 'GET',
});
},
/*
*
* 分配角色模块
*
*/
AddRoleModule(parms:any){
return request(`/api/authorize/addrolemodule`, {
method: 'POST',
data: {
...parms,
},
});
}
}
/*
*
*人员
*
*/
const userApi={
//登录
Login(parms: UserTypes.LoginParams) {
return request('/api/authorize/login', {
method: 'POST',
data: {
...parms
}
});
},

//新增人员
CreateUser(params: UserTypes.PersonnelType) {
return request('/api/authorize/addemployee', {
method: 'POST',
data: {
...params,
},
});
},

//修改人员信息
ModifyUser(params: UserTypes.PersonnelType) {
return request('/api/authorize/editemployee', {
method: 'POST',
data: {
...params,
},
});
},


//根据用户ID查询用户信息
GetUserById(id: string) {
return request(`/api/base/user/getuserbyid?id=${id}`, {
method: 'GET',
});
},

//人员分页查询
GetUserPagedList(params: UserTypes.UserPageParams) {
return request('/api/authorize/queryemployee', {
method: 'POST',
data: {
...params,
},
});
},

/**
* 获取用户已授权菜单
*/
GetUserAuthInfo() {
return request('/api/base/authorize/getuserinfo', {
method: 'POST',
});
},

GetUserInfo() {
return request('/api/authorize/getuserinfo', {
method: 'GET',
});
},
/**
* 删除用户
* @param params
*/
RemoveUser(employeeId:string){
return request(`/api/authorize/removeemployee?employeeId=${employeeId}`, {
method: 'GET'
});
},
/**
* 绑定账户
* @param params
*/
BindAccount(params: account.base_dto) {
return request('/api/authorize/addaccountbyuser', {
method: 'POST',
data: {
...params,
},
});
},
/**
* 重置账户
* @param params
* @returns
*/
RestoreAccount(params: string) {
return request(`/api/authorize/restoreaccountbyuser/${params}`, {
method: 'GET',
});
},
/**
* 编辑密码
* @param params
* @returns
*/
EditPwd(params: account.updatePwdInput) {
return request(`/api/authorize/editaccountpwd`, {
method: 'POST',
data: {
...params,
},
});
}
}

export { accountApi,moduleApi,roleApi,userApi }

+ 2
- 2
frontend/src/app.tsx 查看文件

@@ -5,7 +5,7 @@ import defaultSettings from '../config/defaultSettings';
import { errorConfig } from './requestErrorConfig';
import HeaderRight from './components/HeaderRight';
import { history } from '@umijs/max';
import UserAPI from '@/api/User';
import { userApi } from '@/api/sys/service';
import React from 'react';
import * as Icon from '@ant-design/icons';
const isDev = process.env.NODE_ENV === 'development';
@@ -40,7 +40,7 @@ export async function getInitialState(): Promise<{
currentUser: any;
}> {
const fetchUserInfo = async () => {
const response:MyResponse.Content = await UserAPI.GetUserInfo();
const response:MyResponse.Content = await userApi.GetUserInfo();
if (response.statusCode===200) {
console.log('response',response);


+ 6
- 6
frontend/src/components/HeaderRight/index.tsx 查看文件

@@ -7,7 +7,7 @@ import type { MenuProps } from 'antd';
import md5 from 'js-md5'
import { history, useModel } from "@umijs/max";
import Password from 'antd/es/input/Password';
import userAPI from "@/api/User";
import { userApi } from '@/api/sys/service';


const HeaderRight: React.FC = () => {
@@ -24,13 +24,13 @@ const HeaderRight: React.FC = () => {
break;
}
};
const onEditPwd = async (acc: Account.TBAccountPwdDTO) => {
acc.tB_Employee_Id = JSON.parse(localStorage.getItem("USER_TOKEN")?.toString()).userId;
const onEditPwd = async (acc: account.updatePwdInput) => {
acc.tB_Employee_Id = JSON.parse(localStorage.getItem("USER_TOKEN")!.toString()).userId;
const md5_str = md5(acc.newPwd)
const md5_str2 = md5(acc.oldPwd)
acc.newPwd = md5_str;
acc.oldPwd=md5_str2;
const response = await userAPI.EditPwd(acc);
acc.oldPwd = md5_str2;
const response = await userApi.EditPwd(acc);
if (response.data === true) {
message.success('修改成功!');
localStorage.clear();
@@ -69,7 +69,7 @@ const HeaderRight: React.FC = () => {
</span>
</div>
</Dropdown>
<Modal footer={null} width={500} title='用户账户' open={isEditPwd} onOk={_ => setIsEditPwd(false)} onCancel={_ => setIsEditPwd(false)}>
<Modal footer={null} width={500} title='用户账户' open={isEditPwd} onOk={() => { setIsEditPwd(false) }} onCancel={_ => setIsEditPwd(false)}>
<Form
form={form}
name="basic"


+ 9
- 34
frontend/src/pages/system/account/index.tsx 查看文件

@@ -5,9 +5,9 @@
*/
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { Button, Modal, Form, Input, message, Popconfirm, Tag} from 'antd';
import { Button, Modal, Form, Input, message,Tag} from 'antd';
import { useRef, useState, useEffect } from 'react';
import AccountAPI from '@/api/accountService';
import {accountApi} from '@/api/sys/service';
export default () => {
//表单
@@ -16,7 +16,7 @@
//编辑/新增弹窗
const [isModalOpen, setIsModalOpen] = useState(false);
const actionRef = useRef<ActionType>();
const columns: ProColumns<Account.TBAccountDTO>[] = [
const columns: ProColumns<account.base_dto>[] = [
{
title: '账号',
dataIndex: 'account',
@@ -40,31 +40,6 @@
>
重置密码
</Button>,
// <Popconfirm
// key="del"
// title="确定要删除此条数据吗?"
// onConfirm={() => {
// const EnablejsonData: Account.TBAccountDTO = {
// id: record.id,
// name: '',
// code: ''
// };
// AccountAPI.Del(EnablejsonData).then((r) => {
// if (r.statusCode === 200) {
// message.success(r.statusCode === 200 ? '删除成功' : r.message);
// actionRef.current?.reload();
// }
// });
// }}
// onCancel={() => {
// message.info('已取消删除');
// }}
// okText="确认"
// cancelText="关闭"
// >
// <Button type="primary" danger ghost>删除</Button>
// </Popconfirm>,
],
},
];
@@ -83,9 +58,9 @@
/*
*表单提交
*/
const OnSubmit = async (values: Account.TBAccountDTO) => {
const OnSubmit = async (values: account.base_dto) => {
if (values.id) {
const response = await AccountAPI.Update(values);
const response = await accountApi.Update(values);
if (response.statusCode === 200) {
message.success('修改成功');
actionRef.current?.reload();
@@ -94,7 +69,7 @@
message.error(response.errors || '修改失败');
}
} else {
const response = await AccountAPI.Add(values);
const response = await accountApi.Add(values);
console.log('response', response);
if (response.statusCode === 200) {
message.success('添加成功');
@@ -107,18 +82,18 @@
};
return (
<>
<ProTable<Account.TBAccountDTO>
<ProTable<account.base_dto>
key="myTable"
columns={columns}
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const jsonData: Account.Page = {
const jsonData: account.queryPage = {
pageIndex: params.current || 1,
pageSize: params.pageSize || 10,
account: params.account || '',
};
const response = await AccountAPI.PagedList(jsonData);
const response = await accountApi.PagedList(jsonData);
if (response.statusCode === 200) {
return {
data: response.data.items,


+ 0
- 0
查看文件


+ 0
- 522
frontend/src/pages/system/authTemplate/index.tsx 查看文件

@@ -1,522 +0,0 @@
import React, { useRef, useState, useEffect } from 'react';
import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import type { ColumnsType } from 'antd/es/table';
import { ProTable } from '@ant-design/pro-components';
import { Button, Modal, Form, Input, message, Popconfirm, Table, Tag, Tabs, Space, Spin, TagProps, TabsProps } from 'antd';
import authTempAPI from '@/api/AuthTemplate';
import moduleAPI from '@/api/ModuleAPI';
const AuthTemplate: React.FC = () => {
const [isModalVisible, setIsModalVisible] = useState<boolean>(false);
const actionRef = useRef<ActionType>();
const [currentPage, setCurrentPage] = useState<number>(1);
const [pageSize, setPageSize] = useState<number>(10);
const [total, setTotal] = useState<number>(0);
const [authTempList, setAuthTempList] = useState<AuthTemplateTypes.AuthTemplateType[]>([]);
const [authForm] = Form.useForm();
const [isLoading, setIsLoading] = useState(false);

const TabItems: TabsProps['items']=[
{
label:'用户',key:'account'
},{
label:'角色',key:'role'
}
]

/**
* 模板相关
*/
//是否显示模板弹窗
const [showTemplateModal, setShowTemplateModal] = useState<boolean>(false);
// 模板列表数组
const [moduleList, setModuleList] = useState<AuthTemplateTypes.ModuleType[]>([]);
const [currentTemplate, setCurrentTemplate] = useState<AuthTemplateTypes.AuthTemplateType>();
const [selectedTempRowKeys, setSelectTempRowKeys] = useState<string[]>([]);
const [submitKeys, setSubmitKeys] = useState<string[]>([]);


/**
* 创建授权模板之前
*/
const onBeforeCreate = () => {
authForm.resetFields();
setIsModalVisible(true);
}

/**
* 点击编辑按钮
*/
const onBeforeEdit = (values: AuthTemplateTypes.AuthTemplateType) => {
setCurrentTemplate(values);
setIsModalVisible(true);
authForm.setFieldsValue(values);
}

/**
* 删除权限模板
* @param values
*/
const onDeleteAuth = async (values: AuthTemplateTypes.AuthTemplateType) => {
const response = await authTempAPI.DeleteAuthTemp(values.id);
if (response.statusCode === 200) {
message.success('删除成功');
} else {
message.error(response.errors || '删除失败');
}
actionRef.current?.reload();
}

/**
* 提交模板表单
*/
const onFinishAuth = async (values: AuthTemplateTypes.AuthTemplateType) => {
if (values.id) {
const response = await authTempAPI.SaveModifyAuthTemp(values);
if (response.statusCode === 200) {
message.success('修改成功');
setIsModalVisible(false);
} else {
message.error(response.errors || '修改失败');
}
} else {
const response = await authTempAPI.SaveCreateAuthTemp(values);
if (response.statusCode === 200) {
message.success('添加成功');
setIsModalVisible(false);
} else {
message.error(response.errors || '添加失败');
}
}
actionRef.current?.reload();
}

/**
* 获取授权模板列表
*/
const onFetchAuthTempList = async (values: AuthTemplateTypes.AuthTemplateSearch) => {
const response = await authTempAPI.GetPagedListAuthTemp(values);
if (response.statusCode === 200) {
setAuthTempList(response.data.items);
return response.data.items;
} else {
message.error(response.errors || '获取授权模板列表失败');
return [];
}
}

/**
* 分配模块
* @param values
*/
const onDistributionModuleBefore = async (values: AuthTemplateTypes.AuthTemplateType) => {
setShowTemplateModal(true);
setCurrentTemplate(values);
setIsLoading(true);
const response = await authTempAPI.GetModules(values.id);
setIsLoading(false);
if (response.statusCode === 200) {
console.log(' response.data', response.data);
const selectKeys: string[] = [];
response.data.forEach((item: AuthTemplateTypes.ModuleType) => {
// if (item.hasPermission) {
selectKeys.push(item.tB_ModuleId!);
// if (item.childrens.length > 0) {
// item.childrens.forEach((cItem: AuthTemplateTypes.ModuleType) => {
// if (cItem.hasPermission) {
// selectKeys.push(cItem.id);
// if (cItem.childrens.length > 0) {
// cItem.childrens.forEach((fItem: AuthTemplateTypes.ModuleType) => {
// selectKeys.push(fItem.id);
// })
// }
// }
// });
// }
// }
});
console.log('selectKeys', selectKeys);
setSelectTempRowKeys(selectKeys);
} else {
setSelectTempRowKeys([])
}
}

const moduleColumns: ColumnsType<AuthTemplateTypes.ModuleType> = [
{
title: '名称',
dataIndex: 'name',
key: 'name',
},
{
title: '类型',
dataIndex: 'category',
render: (_, record) => (
<>
{
(() => {
if (record.category === 1) {
return <Tag color='green'>
菜单
</Tag>
} else if (record.category === 2) {
return <Tag color='geekblue'>
视图
</Tag>
} else {
return <Tag color='volcano'>
功能
</Tag>
}
})()
}
</>
)
},
]
const formartModuleList = (moduleListPramrm: AuthTemplateTypes.ModuleType[]) => {
moduleListPramrm.forEach(item => {
if (item.children && item.children.length > 0) {
formartModuleList(item.children);
}
});
return moduleListPramrm;
}

/**
* 给模板 授权模块
*/
const onTempAuthModule = async () => {
const response = await authTempAPI.SaveUpdateItems({
tB_TemplateId: currentTemplate?.id || '',
tB_ModuleIds: submitKeys
});
if (response.statusCode === 200) {
message.success('授权成功');
} else {
message.error(response.errors || '授权失败');
}
setShowTemplateModal(false);
}

/**
* 模板授权: 账号/角色
*/
const [showAuthAccRoleModal, setShowAuthAccRoleModal] = useState<boolean>(false);
const [accRoleTabActive, setAccRoleTabActive] = useState<string>('account');
const [personData, setPersonData] = useState<AuthTemplateTypes.AuthObjectItem[]>([]);


/**
* 根据模板ID 获取用户/角色授权列表
*/
const onFetchUserOrRoleAuthTemp = async () => {
const jsonData: AuthTemplateTypes.AuthObjectParams = {
templateId: currentTemplate?.id || '',
type: -1,
keyWord: ''
}
if (accRoleTabActive === 'account') {
jsonData.type = 1;
} else {
jsonData.type = 2;
}
const response = await authTempAPI.GetauthorizeObjects(jsonData);
if (response.statusCode === 200) {
setPersonData(response.data);
} else {
message.error(response.errors || '获取用户/角色列表失败!');
}
}

/**
* 添加授权
*/
const onAddauthorize = async (id: string) => {
const jsonData = {
templateIds: [currentTemplate?.id as string],
authorizeType: -1,
objectId: id
}
if (accRoleTabActive === 'account') {
jsonData.authorizeType = 1;
} else {
jsonData.authorizeType = 2;
}
const response = await authTempAPI.Addauthorize(jsonData);
if (response.statusCode === 200) {
message.success('授权成功');
onFetchUserOrRoleAuthTemp();
} else {
message.error(response.errors || '授权失败');
}
}

/**
* 移除授权
* @param id
*/
const onRemoveauthorize = async (id: string) => {
const jsonData = {
templateId: currentTemplate?.id as string,
type: -1,
objectIds: [id]
}
if (accRoleTabActive === 'account') {
jsonData.type = 1;
} else {
jsonData.type = 2;
}
const response = await authTempAPI.Removeauthorize(jsonData);
if (response.statusCode === 200) {
message.success('移除成功');
onFetchUserOrRoleAuthTemp();
} else {
message.error(response.errors || '移除失败');
}
}


useEffect(() => {
/**
* 获取模板列表
*/
const onFetchModuleList = async () => {
const response = await moduleAPI.GetTreeGridModule(null);
if (response.statusCode === 200) {
setModuleList(formartModuleList(response.data));
} else {
message.error(response.errors || '获取模板列表失败');
}
}
onFetchModuleList();
}, []);

useEffect(() => {
actionRef.current?.reload();
}, [currentPage, pageSize]);

useEffect(() => {
if (currentTemplate?.id) {
onFetchUserOrRoleAuthTemp();
}
}, [accRoleTabActive, currentTemplate]);

const authTempColums: ProColumns<AuthTemplateTypes.AuthTemplateType>[] = [
{
title: '名称',
dataIndex: 'name',
key: 'name',
},
{
title: '描述',
dataIndex: 'remark',
search:false,
key: 'remark',
},
{
title: '操作',
valueType: 'option',
key: 'option',
render: (_, record) => [
<a key="edit" onClick={() => onBeforeEdit(record)}>编辑</a>,
<Popconfirm
key="sure"
title="确定要删除此模块吗?"
onConfirm={() => onDeleteAuth(record)}
okText="确定"
cancelText="取消"
>
<a >删除</a>
</Popconfirm>,
<a key="authModule" onClick={() => onDistributionModuleBefore(record)}>分配模块</a>,
<a key="auth" onClick={() => { setCurrentTemplate(JSON.parse(JSON.stringify(record))); setShowAuthAccRoleModal(true); }}>授权角色/账号</a>
],
},
];
const personelColumns: ColumnsType<AuthTemplateTypes.AuthObjectItem> = [
{
title: '账号',
dataIndex: 'name',
key: 'name',
},
{
title: '状态',
dataIndex: 'isauthorized',
key: 'isauthorized',
render: (_, record) => (
<>
{
(() => {
if (record.isauthorized) {
return <div style={{ color: 'green' }}>
已授权
</div>
} else {
return ""
}
})()
}

</>
)
},
{
title: '操作',
key: 'action',
render: (_, record) => (
<Space size="middle" >
{
(() => {
if (record.isauthorized) {
return <a style={{ color: '#F84352' }} onClick={() => onRemoveauthorize(record.id)}>
移除授权
</a>
} else {
return <a style={{ color: 'green' }} onClick={() => onAddauthorize(record.id)}>
授权
</a>
}
})()
}
</Space>
),
},
];
return (
<div>
<ProTable<AuthTemplateTypes.AuthTemplateType>
columns={authTempColums}
actionRef={actionRef}
cardBordered
rowKey="id"
request={async (values) => {
const authList = await onFetchAuthTempList({
keyWord: values.name||'',
sortName: '',
sortByAsc: false,
pageIndex: values.current || 1,
pageSize: values.pageSize || 10
});
return {
data: authList,
success: true,
total: total,
}
}}
search={{
labelWidth: 'auto',
}}
options={{
setting: {
listsHeight: 400,
},
}}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page) => setCurrentPage(page)
}}
headerTitle="授权模板"
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={onBeforeCreate}>
新建
</Button>
]}
/>
<Modal destroyOnClose title={`编辑授权模块【${currentTemplate?.name}】`} footer={null} open={isModalVisible} onCancel={() => setIsModalVisible(false)}>
<Form
name="basic"
onFinish={onFinishAuth}
autoComplete="off"
form={authForm}
>
<Form.Item
name="id"
hidden={true}
>
<Input />
</Form.Item>

<Form.Item
label="名称"
name="name"
rules={[{ required: true, message: '请输入授权模板名称!' }]}
>
<Input />
</Form.Item>

<Form.Item
label="备注"
name="remark"
rules={[{ required: true, message: '请输入授权模板备注!' }]}
>
<Input />
</Form.Item>

{/* <Form.Item
label="是否禁用"
name="isDisabled"
valuePropName="checked"
>
<Switch checkedChildren="是" unCheckedChildren="否"></Switch>
</Form.Item> */}

<Form.Item>
<Button type="primary" htmlType="submit">
确定
</Button>
</Form.Item>
</Form>
</Modal>
<Modal title={`分配授权模块【${currentTemplate?.name}】`} open={showTemplateModal} onOk={onTempAuthModule} onCancel={() => setShowTemplateModal(false)}>
<Spin size="large" spinning={isLoading}>
<Table
rowSelection={{
checkStrictly: false,
type: 'checkbox',
selectedRowKeys: selectedTempRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
const tempSelected = [...selectedRowKeys];
selectedRows.forEach(rowItem => {
const find = tempSelected.find(item => rowItem.parentId === item);
const repetFind = tempSelected.find(reItem => reItem === rowItem.parentId);
if (!find && rowItem.parentId != '' && !repetFind) {
tempSelected.push(rowItem.parentId);
}
});
// console.log('selectedRowKeys', selectedRowKeys);
// console.log('selectedRows', selectedRows);
// console.log('>>>>', tempSelected);
setSubmitKeys(tempSelected as string[]);
setSelectTempRowKeys(selectedRowKeys as string[]);
}
}}
pagination={false}
columns={moduleColumns}
dataSource={moduleList}
rowKey="id"
/>
</Spin>
</Modal>
<Modal width={800} footer={null} title={`授权模板【${currentTemplate?.name}】`} open={showAuthAccRoleModal} onCancel={() => setShowAuthAccRoleModal(false)}>
<Tabs items={TabItems.map((item)=>{
return{
label: item.label,
key: item.key,
children: <Table rowKey={record => record.id} columns={personelColumns} dataSource={personData} />,
}
})} activeKey={accRoleTabActive} onChange={(active) => setAccRoleTabActive(active)} tabPosition="left">
</Tabs>
</Modal>
</div>
);
};

export default AuthTemplate;

+ 21
- 20
frontend/src/pages/system/module/index.tsx 查看文件

@@ -1,17 +1,18 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import React, { useState, useEffect, useRef } from 'react';
import styles from './index.less';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { Button, message, Modal, Row, Col, Form, Input, Popconfirm, TreeSelect, Select, Switch, Tag } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import * as Icon from '@ant-design/icons';
import moduleAPI from '@/api/ModuleAPI';
import { moduleApi } from '@/api/sys/service';
import styles from './index.less';

const SystemManagement: React.FC = () => {

const [currentPage, setCurrentPage] = useState<number>(1);
const [isModalVisible, setIsModalVisible] = useState(false);
const [currentMenu, setCurrentMenu] = useState<ModuleTypes.ModuleType>({
const [currentMenu, setCurrentMenu] = useState<moduleTypes.ModuleType>({
category: 0,
openType: 0,
parentId: '',
@@ -23,13 +24,13 @@ const SystemManagement: React.FC = () => {
id: '',
children: []
});
const [menuTree, setMenuTree] = useState<ModuleTypes.ModuleType[]>([]);
const [menuTree, setMenuTree] = useState<moduleTypes.ModuleType[]>([]);
const [menuTreeSelect, setMenuTreeSelect] = useState('');

const [menuForm] = Form.useForm();
const tableRef = useRef<ActionType>();

const menuColumns: ProColumns<ModuleTypes.ModuleType>[] = [
const menuColumns: ProColumns<moduleTypes.ModuleType>[] = [
{
title: '菜单名称',
dataIndex: 'name',
@@ -37,21 +38,21 @@ const SystemManagement: React.FC = () => {
{
title: '菜单路径',
dataIndex: 'url',
search:false
search: false
},
{
title: '菜单图标',
dataIndex: 'icon',
search:false,
search: false,
render: (_, record) => (
<>
{record.icon && React.createElement(Icon[record.icon as string])}
{record.icon && React.createElement(Icon && (Icon as any)[record.icon])}
</>
)
},
{
title: '菜单类型',
search:false,
search: false,
dataIndex: 'category',
render: (_, record) => (
<>
@@ -77,7 +78,7 @@ const SystemManagement: React.FC = () => {
},
{
title: '是否禁用',
search:false,
search: false,
dataIndex: 'isDisabled',
render: (_, record) => (
<>
@@ -113,7 +114,7 @@ const SystemManagement: React.FC = () => {
* 获取全部菜单树形结构
*/
const onGetMenuAllTree = async () => {
const response = await moduleAPI.GetTreeGridModule(null);
const response = await moduleApi.GetTreeGridModule();
if (response.statusCode === 200) {
setMenuTree(toTreeSelectData(response.data));
tableRef.current?.reload();
@@ -144,7 +145,7 @@ const SystemManagement: React.FC = () => {
* 新建菜单
*/
const onCreateMenu = () => {
const empty: ModuleTypes.ModuleType = {
const empty: moduleTypes.ModuleType = {
category: 1,
openType: 0,
parentId: '',
@@ -164,9 +165,9 @@ const SystemManagement: React.FC = () => {
/**
* 提交菜单表单信息
*/
const onFinishMenu = async (menuForm: ModuleTypes.ModuleType) => {
const onFinishMenu = async (menuForm: moduleTypes.ModuleType) => {
if (menuForm.id === '') {//新增
const response = await moduleAPI.SaveCreateModule(menuForm);
const response = await moduleApi.SaveCreateModule(menuForm);
if (response.statusCode === 200) {
onGetMenuAllTree();
setIsModalVisible(false);
@@ -175,7 +176,7 @@ const SystemManagement: React.FC = () => {
message.error(response.msg || '新增失败');
}
} else {//修改
const response = await moduleAPI.SaveModifyModule(menuForm);
const response = await moduleApi.SaveModifyModule(menuForm);
if (response.statusCode === 200) {
onGetMenuAllTree();
setIsModalVisible(false);
@@ -190,8 +191,8 @@ const SystemManagement: React.FC = () => {
* 删除菜单
* @param menuItem
*/
const onDeleteMenuItem = async (menuItem: ModuleTypes.ModuleType) => {
const response = await moduleAPI.DeleteModule(menuItem.id as string);
const onDeleteMenuItem = async (menuItem: moduleTypes.ModuleType) => {
const response = await moduleApi.DeleteModule(menuItem.id as string);
if (response.statusCode === 200) {
message.success('删除成功');
onGetMenuAllTree();
@@ -211,7 +212,7 @@ const SystemManagement: React.FC = () => {

return (
<div className={styles.container}>
<ProTable<ModuleTypes.ModuleType>
<ProTable<moduleTypes.ModuleType>
actionRef={tableRef}
columns={menuColumns}
cardBordered
@@ -219,8 +220,8 @@ const SystemManagement: React.FC = () => {
const params = JSON.parse(JSON.stringify(values));
delete params.current;
delete params.pageSize;
const response:MyResponse.Content = await moduleAPI.GetTreeGridModule(params);
const response: MyResponse.Content = await moduleApi.GetTreeGridModule(params);
const resData = response.data.filter((item: any) => {
let isFind = false;
if (Object.keys(params).length > 0) {


+ 143
- 12
frontend/src/pages/system/role/index.tsx 查看文件

@@ -1,7 +1,7 @@
import React, { useState, useRef } from 'react';
import { Button, Space, Modal, Form, Input, message, Popconfirm } from 'antd';
import roleAPI from "@/api/Role";
/* eslint-disable @typescript-eslint/no-use-before-define */
import React, { useState, useRef, useEffect } from 'react';
import { Button, Space, Modal, Form, Input, message, Popconfirm, Table, Spin, Tag } from 'antd';
import {roleApi,moduleApi} from '@/api/sys/service';
import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
@@ -20,9 +20,14 @@ const Role: React.FC = () => {
description: ''
});
const [isModalVisible, setIsModalVisible] = useState(false);

const [showTemplateModal,setShowTemplateModal] = useState(false);
const [submitKeys, setSubmitKeys] = useState<any[]>([]);
const [selectedTempRowKeys, setSelectTempRowKeys] = useState<string[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [form] = Form.useForm();

const actionRef = useRef<ActionType>();
// 模板列表数组
const [moduleList, setModuleList] = useState<any[]>([]);
const roleColumns: ProColumns<RoleType>[] = [
{
title: '角色名称',
@@ -42,6 +47,7 @@ const Role: React.FC = () => {
render: (_: any, record: any) => (
<Space size="middle">
<a onClick={() => onEditRole(record)}>编辑</a>
<a onClick={()=> onGetRoleModule(record)}>分配模块</a>
<Popconfirm
title="确定要删除此角色吗?"
onConfirm={() => onDeleteRole(record)}
@@ -61,13 +67,12 @@ const Role: React.FC = () => {
setIsModalVisible(true);
actionRef.current?.reload();
}

/**
* 删除角色
* @param record
*/
const onDeleteRole = async (record: RoleType) => {
const response = await roleAPI.DeleteRole(record.id);
const response = await roleApi.DeleteRole(record.id);
if (response.statusCode === 200) {
message.success('删除成功');
actionRef.current?.reload();
@@ -81,7 +86,7 @@ const Role: React.FC = () => {
*/
const onFinishRole = async (role: RoleType) => {
if (role.id) {
const response = await roleAPI.ModifyRole(role);
const response = await roleApi.ModifyRole(role);
if (response.statusCode === 200) {
message.success('更新角色信息成功');
setIsModalVisible(false);
@@ -90,7 +95,7 @@ const Role: React.FC = () => {
message.error(response.msg || '更新角色信息失败');
}
} else {
const response = await roleAPI.CreateRole(role);
const response = await roleApi.CreateRole(role);
if (response.statusCode === 200) {
message.success('创建角色成功');
setIsModalVisible(false);
@@ -100,7 +105,65 @@ const Role: React.FC = () => {
}
}
}
/**
* 分配模块
* @param values
*/
const onGetRoleModule = async (record:any) => {
setCurrentRole(record);
setShowTemplateModal(true);
setIsLoading(true);
const response:MyResponse.Content = await roleApi.GetRoleModuleList(record.id);
setIsLoading(false);
if (response.statusCode === 200) {
console.log(' response.data', response.data);
const selectKeys: string[] = [];
response.data.forEach((item: any) => {
selectKeys.push(item.moduleId!);
});
setSelectTempRowKeys(selectKeys);
} else {
setSelectTempRowKeys([])
}
}
const formartModuleList = (moduleListPramrm: any[]) => {
moduleListPramrm.forEach(item => {
if (item.children && item.children.length > 0) {
formartModuleList(item.children);
}
});
return moduleListPramrm;
}
useEffect(() => {
/**
* 获取模板列表
*/
const onFetchModuleList = async () => {
const response = await moduleApi.GetTreeGridModule();
if (response.statusCode === 200) {
setModuleList(formartModuleList(response.data));
} else {
message.error(response.errors || '获取模板列表失败');
}
}
onFetchModuleList();
}, []);

/**
* 给模板 授权模块
*/
const onAddRoleModule = async (roleId:string) => {
const response = await roleApi.AddRoleModule({
roleId: roleId,
moduleIds: submitKeys
});
if (response.statusCode === 200) {
message.success('授权成功');
} else {
message.error(response.errors || '授权失败');
}
setShowTemplateModal(false);
}
/**
* 添加角色
*/
@@ -114,7 +177,7 @@ const Role: React.FC = () => {
setIsModalVisible(true);
}

const actionRef = useRef<ActionType>();


return (
@@ -124,7 +187,7 @@ const Role: React.FC = () => {
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const response = await roleAPI.GetRolePagedList({
const response = await roleApi.GetRolePagedList({
keyword: params.name,
sortName: '',
sortByAsc: false,
@@ -195,6 +258,74 @@ const Role: React.FC = () => {
</Form.Item>
</Form>
</Modal>

<Modal title={`分配授权模块【${currentRole?.name}】`} open={showTemplateModal} onOk={()=>{
onAddRoleModule(currentRole?.id)
}} onCancel={() => setShowTemplateModal(false)}>
<Spin size="large" spinning={isLoading}>
<Table
rowSelection={{
checkStrictly: false,
type: 'checkbox',
selectedRowKeys: selectedTempRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
let myselectedRows:any[] = selectedRows;
myselectedRows.map((v:any)=>(
// if (!v.parentId) {
// if (v.children.length>0) {
// tempSelected = tempSelected.filter(function(item) {
// return item !== v.id;
// });
// }
// }
v.moduleId = v.id
))
setSubmitKeys(myselectedRows)
setSelectTempRowKeys(selectedRowKeys as string[]);
}
}}
pagination={false}
columns={[
{
title: '名称',
dataIndex: 'name',
key: 'name',
},
{
title: '类型',
dataIndex: 'category',
render: (_, record) => (
<>
{
(() => {
if (record.category === 1) {
return <Tag color='green'>
菜单
</Tag>
} else if (record.category === 2) {
return <Tag color='geekblue'>
视图
</Tag>
} else {
return <Tag color='volcano'>
功能
</Tag>
}
})()
}
</>
)
},
]}
dataSource={moduleList}
rowKey="id"
/>
</Spin>
</Modal>


</div>
);
};


+ 11
- 16
frontend/src/pages/system/user/index.tsx 查看文件

@@ -1,15 +1,10 @@
import React, { useState, useEffect, useRef } from 'react';
import styles from './index.less';
import { Space, Modal, Form, Input, Button, message, Select, DatePicker as TDatePicker, Popconfirm, Tag } from 'antd';
import roleAPI from "@/api/Role";
import userAPI from "@/api/User";
import moment from 'moment'
import md5 from 'js-md5'
import { Space, Modal, Form, Input, Button, message, Select, Popconfirm } from 'antd';
import { userApi, roleApi } from '@/api/sys/service';
import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';

const DatePicker: any = TDatePicker;
import styles from './index.less';

const User: React.FC = () => {

@@ -143,7 +138,7 @@ const User: React.FC = () => {
key="del"
title="确定要重置密码吗?"
onConfirm={async () => {
const response = await userAPI.RestoreAccount(record.id!);
const response = await userApi.RestoreAccount(record.id!);
if (response.data === true) {
message.success('成功!');
} else {
@@ -168,7 +163,7 @@ const User: React.FC = () => {
key="del"
title="确定要删除此条数据吗?"
onConfirm={async () => {
const response = await userAPI.RemoveUser(record.id!);
const response = await userApi.RemoveUser(record.id!);
if (response.data === true) {
message.success('删除成功!');
actionRef.current?.reload();
@@ -206,7 +201,7 @@ const User: React.FC = () => {
* 获取角色列表
*/
const onFetchRoleList = async () => {
const response = await roleAPI.GetRoleList();
const response = await roleApi.GetRoleList();
if (response.statusCode === 200) {
setRoleList(response.data);
} else {
@@ -223,7 +218,7 @@ const User: React.FC = () => {
*/
const onFinishPerson = async (user: UserTypes.PersonnelType) => {
if (user.id) {
const response = await userAPI.ModifyUser(user);
const response = await userApi.ModifyUser(user);
if (response.data === true) {
message.success('更新用户信息成功!');
setIsPersonDetailVisible(false);
@@ -231,7 +226,7 @@ const User: React.FC = () => {
message.error(response.msg || '更新用户信息失败');
}
} else {
const response = await userAPI.CreateUser(user);
const response = await userApi.CreateUser(user);
if (response.statusCode === 200) {
message.success('创建成功!');
setIsPersonDetailVisible(false);
@@ -245,10 +240,10 @@ const User: React.FC = () => {
/**
* 绑定用户账户
*/
const onBindAcction = async (acc: Account.TBAccountDTO) => {
const onBindAcction = async (acc: account.base_dto) => {
// const md5_str = md5(acc.pwd)
// acc.pwd = md5_str;
const response = await userAPI.BindAccount(acc);
const response = await userApi.BindAccount(acc);
if (response.data === true) {
message.success('绑定成功!');
actionRef?.current?.reload();
@@ -271,7 +266,7 @@ const User: React.FC = () => {
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const response = await userAPI.GetUserPagedList({
const response = await userApi.GetUserPagedList({
name: params.name,
status: params.status,
pageIndex: params.current || 1,


+ 2
- 2
frontend/src/pages/user/login/index.tsx 查看文件

@@ -3,7 +3,7 @@ import { Form, Input, Button, message, Divider } from 'antd';
import { UserOutlined, LockOutlined, LoadingOutlined } from '@ant-design/icons';
import styles from './index.less';
import Footer from '@/components/Footer';
import UserAPI from '@/api/User';
import { userApi } from '@/api/sys/service';
import { history, useModel } from '@umijs/max';
import md5 from 'js-md5';

@@ -20,7 +20,7 @@ const Login: React.FC = () => {
setIsLoading(true);
const md5_str = md5(params.pwd);
params.pwd = md5_str;
UserAPI.Login(params).then((response: MyResponse.Content)=>{
userApi.Login(params).then((response: MyResponse.Content)=>{
setIsLoading(false);
if (response.statusCode===200) {
refresh();


+ 0
- 50
frontend/src/types/Account.d.ts 查看文件

@@ -1,50 +0,0 @@


declare namespace Account {
type TBAccountDTO = {
id?: string | null | undefined;
/**
*
* @type {string}
* @memberof TBAccountDTO
*/
account?: string | null;
/**
*
* @type {string}
* @memberof TBAccountDTO
*/
pwd: string
/**
*
* @type {string}
* @memberof TBAccountDTO
*/
tB_Employee_Id?: string | null;
}
type TBAccountPwdDTO = {
/**
*
* @type {string}
* @memberof TBAccountPwdDTO
*/
tB_Employee_Id: string;
/**
*
* @type {string}
* @memberof TBAccountPwdDTO
*/
oldPwd: string;
/**
*
* @type {string}
* @memberof TBAccountPwdDTO
*/
newPwd: string;
}
interface Page {
pageIndex:number,
pageSize:number
account:string
}
}

+ 0
- 81
frontend/src/types/AuthTemplateTypes.d.ts 查看文件

@@ -1,81 +0,0 @@
declare namespace AuthTemplateTypes {
//授权模板类型
type AuthTemplateType = {
id: string;
name: string;
remark: string;
};

type PageParams = {
keyWord: string,
sortName: string,
sortByAsc: boolean,
pageIndex: number,
pageSize: number
};

//模板授权模块
type TempAuthModule = {
tB_TemplateId: string,
tB_ModuleIds: string[]
}

//模板授权 用户|角色参数
type AuthObjectParams = {
keyWord: string,
templateId: string,
type: number
}

//模板授权 用户|角色 数据类型
type AuthObjectItem = {
id: string,
name: string,
isauthorized: boolean
}

/**
* 添加授权-参数
*/
type AddAuthParams = {
templateIds: string[],
authorizeType: number,
objectId: string
}

/**
* 移除授权-参数
*/
type RemoveAuthParams = {
templateId: string,
type: number,
objectIds: string[]
}

type AuthTemplateSearch = {
keyWord: string,
sortName: string,
sortByAsc: boolean,
pageIndex: number,
pageSize: number
}

// 模块类型
type ModuleType = {
category: number,
openType: number,
parentId: string,
name: string,
icon: string,
url: string,
sort: number,
isDisabled: boolean,
id: string,
children: ModuleType[],
childrens: ModuleType[],
hasPermission?: boolean,
tB_ModuleId?:string|null
}


}

+ 0
- 16
frontend/src/types/ModuleTypes.d.ts 查看文件

@@ -1,16 +0,0 @@
declare namespace ModuleTypes {
// 模块类型
type ModuleType = {
category: number,
openType: number,
parentId: string,
name: string,
icon: string,
url: string,
sort: number,
isDisabled: boolean,
id: string,
children: ModuleType[]
}
}

+ 0
- 17
frontend/src/types/RoleTypes.d.ts 查看文件

@@ -1,17 +0,0 @@

declare namespace RolelTypes {
// 角色类型
type RoleType = {
id?: string,
name: string,
description: string
}

type RolePageParams = {
keyword: string,
sortName: string,
sortByAsc: boolean,
pageIndex: number,
pageSize: number
}
}

+ 0
- 59
frontend/src/types/UserTypes.d.ts 查看文件

@@ -1,59 +0,0 @@
declare namespace UserTypes {
// 登录参数类型
type LoginParams = {
account: string,
pwd: string
}

//人员数据类型
type PersonnelType = {
/**
*
* @type {string}
* @memberof TBEmployeeDTO
*/
id?: string | null;
/**
* 排序
* @type {number}
* @memberof TBEmployeeDTO
*/
sort?: number;
/**
* 员工姓名
* @type {string}
* @memberof TBEmployeeDTO
*/
name?: string | null;
/**
* 1男2女
* @type {number}
* @memberof TBEmployeeDTO
*/
gender?: number;
/**
* 1在职2出差3离职
* @type {number}
* @memberof TBEmployeeDTO
*/
status?: number;
/**
* 角色Id
* @type {string}
* @memberof TBEmployeeDTO
*/
roleId?: string | null;

isAccount?: null | boolean ;
}

//人员分页查询参数
type UserPageParams = {
name: string,
status: number?,
pageIndex: number,
pageSize: number,
gender: number?,
}
}

Loading…
取消
儲存