Browse Source

加人员管理

fanmiyou
nili 9 months ago
parent
commit
74c844f580
  1. 17
      config/routes.ts
  2. 193
      dist/104.6ba2d1be.async.js
  3. 1
      dist/134.957d5baa.async.js
  4. 302
      dist/140.d86f6b29.async.js
  5. 14
      dist/271.5eec43d2.async.js
  6. 1
      dist/430.69b00127.async.js
  7. 286
      dist/509.edc750af.async.js
  8. 83
      dist/51.d90b1fa5.async.js
  9. 8
      dist/559.683b9a7b.async.js
  10. 34
      dist/638.d29022f5.async.js
  11. 30
      dist/706.1c4598f2.async.js
  12. 207
      dist/724.11269392.async.js
  13. 27
      dist/89.36b38ea1.async.js
  14. 97
      dist/963.fd5abb07.async.js
  15. 2
      dist/index.html
  16. 10
      dist/p__Admin.4451895f.async.js
  17. 1
      dist/p__AdminManagement.3d8845fe.async.js
  18. 1
      dist/p__AdvRecordList.2ed1c75b.async.js
  19. 1
      dist/p__AdvRecordList.7aa1880e.async.js
  20. 2
      dist/t__plugin-layout__Layout.abca0916.async.js
  21. 433
      dist/umi.679c5b41.js
  22. 433
      dist/umi.b0b0060c.js
  23. 6
      src/access.ts
  24. 158
      src/pages/AdminManagement.tsx
  25. 35
      src/services/matrix/admin.ts
  26. 25
      src/services/matrix/typings.d.ts

17
config/routes.ts

@ -29,21 +29,10 @@ export default [
component: './AdvRecordList', component: './AdvRecordList',
}, },
{ {
path: '/admin', path: '/adminList',
name: 'admin', name: '人员管理',
icon: 'crown',
access: 'canAdmin', access: 'canAdmin',
routes: [ component: './AdminManagement'
{
path: '/admin',
redirect: '/admin/sub-page',
},
{
path: '/admin/sub-page',
name: 'sub-page',
component: './Admin',
},
],
}, },
{ {
path: '/', path: '/',

193
dist/104.6ba2d1be.async.js

File diff suppressed because one or more lines are too long

1
dist/134.957d5baa.async.js

File diff suppressed because one or more lines are too long

302
dist/140.d86f6b29.async.js

File diff suppressed because one or more lines are too long

14
dist/271.5eec43d2.async.js

File diff suppressed because one or more lines are too long

1
dist/430.69b00127.async.js

File diff suppressed because one or more lines are too long

286
dist/509.edc750af.async.js

File diff suppressed because one or more lines are too long

83
dist/51.d90b1fa5.async.js

File diff suppressed because one or more lines are too long

8
dist/559.683b9a7b.async.js

File diff suppressed because one or more lines are too long

34
dist/638.d29022f5.async.js

File diff suppressed because one or more lines are too long

30
dist/706.1c4598f2.async.js

File diff suppressed because one or more lines are too long

207
dist/724.11269392.async.js

File diff suppressed because one or more lines are too long

27
dist/89.36b38ea1.async.js

File diff suppressed because one or more lines are too long

97
dist/963.fd5abb07.async.js

File diff suppressed because one or more lines are too long

2
dist/index.html

@ -9,6 +9,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/umi.b0b0060c.js"></script> <script src="/umi.679c5b41.js"></script>
</body></html> </body></html>

10
dist/p__Admin.4451895f.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AdminManagement.3d8845fe.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AdvRecordList.2ed1c75b.async.js

@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[857],{46701:function(O,i,e){e.r(i);var p=e(15009),d=e.n(p),v=e(99289),o=e.n(v),m=e(48357),h=e(90930),E=e(1507),f=e(35312),I=e(67294),c=e(85893),x=function(){var T=(0,I.useRef)(),M=(0,f.useIntl)(),D=function(){var u=o()(d()().mark(function a(){var s,_,r;return d()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,m.ln)();case 2:return _=n.sent,r=[],(s=_.data)===null||s===void 0||s.forEach(function(t){r.push({label:t.name,value:t.code})}),n.abrupt("return",r);case 6:case"end":return n.stop()}},a)}));return function(){return u.apply(this,arguments)}}(),P=[{title:"\u5E94\u7528\u540D\u79F0",hideInTable:!0,dataIndex:"code",valueType:"select",request:D},{title:"\u8BBE\u5907Id",dataIndex:"deviceId",valueType:"textarea",ellipsis:!0,copyable:!0},{title:"\u5E94\u7528\u540D\u79F0",hideInSearch:!0,dataIndex:"appName",valueType:"textarea"},{title:"\u5E73\u53F0",dataIndex:"platform",valueEnum:{1:{text:"\u7A7F\u5C71\u7532"},2:{text:"\u817E\u8BAF"},3:{text:"\u767E\u5EA6\u8054\u76DF"},4:{text:"Mintegral"},5:{text:"\u5FEB\u624B"},6:{text:"\u6E38\u53EF\u8D62"},7:{text:"Sigmob"},8:{text:"Admob"}}},{title:"\u5E7F\u544A\u7C7B\u578B",dataIndex:"advType",valueEnum:{1:{text:"\u6A2A\u5E45",status:"Default"},2:{text:"\u63D2\u9875",status:"Processing"},3:{text:"\u6FC0\u52B1\u89C6\u9891",status:"Success"}}},{title:"ecpm(\u5143)",dataIndex:"ecpm",hideInSearch:!0,renderText:function(a){return a/100}},{title:"\u8BBE\u5907\u54C1\u724C",dataIndex:"deviceBrand",hideInSearch:!0,valueType:"textarea"},{title:"\u8BBE\u5907\u540D",dataIndex:"deviceName",hideInSearch:!0,valueType:"textarea"},{title:"ip",dataIndex:"ip",hideInSearch:!0,valueType:"textarea"},{title:"\u65F6\u95F4",hideInSearch:!0,dataIndex:"createdAt",valueType:"dateTime"},{title:"\u65F6\u95F4",hideInTable:!0,dataIndex:"createdAt",valueType:"dateRange"}];return(0,c.jsx)(h._z,{children:(0,c.jsx)(E.Z,{headerTitle:M.formatMessage({id:"pages.searchTable.title",defaultMessage:"Enquiry form"}),actionRef:T,rowKey:"key",search:{labelWidth:120},request:function(){var u=o()(d()().mark(function a(s){var _,r,l;return d()().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,m._5)(s);case 2:return l=t.sent,t.abrupt("return",{data:(_=l.data)===null||_===void 0?void 0:_.data,total:(r=l.data)===null||r===void 0?void 0:r.total,success:!0});case 4:case"end":return t.stop()}},a)}));return function(a){return u.apply(this,arguments)}}(),columns:P})})};i.default=x}}]);

1
dist/p__AdvRecordList.7aa1880e.async.js

@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[857],{46701:function(O,i,e){e.r(i);var p=e(15009),d=e.n(p),v=e(99289),o=e.n(v),m=e(48357),h=e(90930),E=e(76104),f=e(35312),I=e(67294),c=e(85893),x=function(){var T=(0,I.useRef)(),M=(0,f.useIntl)(),D=function(){var u=o()(d()().mark(function a(){var s,_,r;return d()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,m.ln)();case 2:return _=n.sent,r=[],(s=_.data)===null||s===void 0||s.forEach(function(t){r.push({label:t.name,value:t.code})}),n.abrupt("return",r);case 6:case"end":return n.stop()}},a)}));return function(){return u.apply(this,arguments)}}(),P=[{title:"\u5E94\u7528\u540D\u79F0",hideInTable:!0,dataIndex:"code",valueType:"select",request:D},{title:"\u8BBE\u5907Id",dataIndex:"deviceId",valueType:"textarea",ellipsis:!0,copyable:!0},{title:"\u5E94\u7528\u540D\u79F0",hideInSearch:!0,dataIndex:"appName",valueType:"textarea"},{title:"\u5E73\u53F0",dataIndex:"platform",valueEnum:{1:{text:"\u7A7F\u5C71\u7532"},2:{text:"\u817E\u8BAF"},3:{text:"\u767E\u5EA6\u8054\u76DF"},4:{text:"Mintegral"},5:{text:"\u5FEB\u624B"},6:{text:"\u6E38\u53EF\u8D62"},7:{text:"Sigmob"},8:{text:"Admob"}}},{title:"\u5E7F\u544A\u7C7B\u578B",dataIndex:"advType",valueEnum:{1:{text:"\u6A2A\u5E45",status:"Default"},2:{text:"\u63D2\u9875",status:"Processing"},3:{text:"\u6FC0\u52B1\u89C6\u9891",status:"Success"}}},{title:"ecpm(\u5143)",dataIndex:"ecpm",hideInSearch:!0,renderText:function(a){return a/100}},{title:"\u8BBE\u5907\u54C1\u724C",dataIndex:"deviceBrand",hideInSearch:!0,valueType:"textarea"},{title:"\u8BBE\u5907\u540D",dataIndex:"deviceName",hideInSearch:!0,valueType:"textarea"},{title:"ip",dataIndex:"ip",hideInSearch:!0,valueType:"textarea"},{title:"\u65F6\u95F4",hideInSearch:!0,dataIndex:"createdAt",valueType:"dateTime"},{title:"\u65F6\u95F4",hideInTable:!0,dataIndex:"createdAt",valueType:"dateRange"}];return(0,c.jsx)(h._z,{children:(0,c.jsx)(E.Z,{headerTitle:M.formatMessage({id:"pages.searchTable.title",defaultMessage:"Enquiry form"}),actionRef:T,rowKey:"key",search:{labelWidth:120},request:function(){var u=o()(d()().mark(function a(s){var _,r,l;return d()().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,m._5)(s);case 2:return l=t.sent,t.abrupt("return",{data:(_=l.data)===null||_===void 0?void 0:_.data,total:(r=l.data)===null||r===void 0?void 0:r.total,success:!0});case 4:case"end":return t.stop()}},a)}));return function(a){return u.apply(this,arguments)}}(),columns:P})})};i.default=x}}]);

2
dist/t__plugin-layout__Layout.2a198db8.async.js → dist/t__plugin-layout__Layout.abca0916.async.js

File diff suppressed because one or more lines are too long

433
dist/umi.679c5b41.js

File diff suppressed because one or more lines are too long

433
dist/umi.b0b0060c.js

File diff suppressed because one or more lines are too long

6
src/access.ts

@ -3,7 +3,9 @@
* */ * */
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) { export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
const { currentUser } = initialState ?? {}; const { currentUser } = initialState ?? {};
return { let data = {
canAdmin: currentUser && currentUser.access === 'admin', canAdmin: currentUser && currentUser.role && currentUser.role < 3
}; };
return data;
} }

158
src/pages/AdminManagement.tsx

@ -0,0 +1,158 @@
import { Button, Form, Input, Modal, Select, Table, Tag } from 'antd';
import { ColumnsType } from 'antd/es/table';
import React, { useEffect, useState } from 'react';
import { adminList, appList, saveAdmin } from '../services/matrix/admin';
const AdminManagement = () => {
const [data, setData] = useState<API.MatrixAdminBo[]>([]);
const [visible, setVisible] = useState(false);
const [form] = Form.useForm();
const [appArr, setAppArr] = useState<API.MatrixApp[]>([]);
const getAppNameById = (appId:number) => {
const app = appArr.find(app => app.id === appId);
return app ? app.name : '';
};
const handleEdit = (record:API.MatrixAdminBo) => {
form.setFieldsValue(record);
setVisible(true);
};
const columns:ColumnsType<API.MatrixAdminBo> = [
{
title: '姓名',
dataIndex: 'name',
},
{
title: '应用IDs',
dataIndex: 'appIds',
render: (text:[]) => (
<div>
{text?.map(appId => (
<Tag color="blue" key={appId}>
{getAppNameById(appId)}
</Tag>
))}
</div>
),
},
{
title: '角色',
dataIndex: 'role',
render: (r:number) => {
let roleText = '';
switch (r) {
case 1:
roleText = '超级管理员';
break;
case 2:
roleText = '管理员';
break;
case 3:
roleText = '普通账号';
break;
default:
roleText = '';
}
return roleText;
},
},
{
title: '操作',
render: (record:API.MatrixAdminBo) => [
<a key="edit" onClick={() => handleEdit(record)}></a>,
],
},
];
const handleOk = () => {
form.submit();
};
const handleCancel = () => {
setVisible(false);
};
const fetchData = async () => {
const res = await adminList();
if (res.data) {
setData(res.data);
}
};
const fetchApp = async() =>{
const res = await appList();
if (res.data) {
setAppArr(res.data);
}
}
useEffect(() => {
fetchData();
fetchApp();
}, []);
const handleNew = () => {
form.resetFields(); // 重置表单字段
setVisible(true);
};
const handleSaveAdmin = async (values: API.MatrixAdminBo) => {
try{
await saveAdmin(values);
} catch (e) {
return;
}
setVisible(false);
fetchData();
};
return (
<div>
<Button onClick={handleNew}></Button>
<Table columns={columns} dataSource={data} />
<Modal
title="编辑"
visible={visible}
onOk={handleOk}
onCancel={handleCancel}
>
<Form form={form} onFinish={handleSaveAdmin}>
<Form.Item name="id" style={{ display: 'none' }}>
<Input type="hidden" />
</Form.Item>
<Form.Item label="用户名" name="name">
<Input />
</Form.Item>
<Form.Item label="密码" name="password">
<Input.Password />
</Form.Item>
<Form.Item label="应用" name="appIds">
<Select mode="multiple">
{appArr.map(app => (
<Select.Option key={app.id} value={app.id}>
{app.name}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item label="角色" name="role">
<Select>
<Select.Option value={2}></Select.Option>
<Select.Option value={3}></Select.Option>
</Select>
</Form.Item>
</Form>
</Modal>
</div>
);
};
export default AdminManagement;

35
src/services/matrix/admin.ts

@ -2,6 +2,14 @@
/* eslint-disable */ /* eslint-disable */
import { request } from '@umijs/max'; import { request } from '@umijs/max';
/** 此处后端没有提供注释 GET /api/admin/adminList */
export async function adminList(options?: { [key: string]: any }) {
return request<API.RListMatrixAdminBo>('/api/admin/adminList', {
method: 'GET',
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /api/admin/advList */ /** 此处后端没有提供注释 POST /api/admin/advList */
export async function advList(body: API.AdvRecordQuery, options?: { [key: string]: any }) { export async function advList(body: API.AdvRecordQuery, options?: { [key: string]: any }) {
return request<API.RPageResultMatrixAdvRecordBo>('/api/admin/advList', { return request<API.RPageResultMatrixAdvRecordBo>('/api/admin/advList', {
@ -30,6 +38,21 @@ export async function current(options?: { [key: string]: any }) {
}); });
} }
/** 此处后端没有提供注释 POST /api/admin/grantApp */
export async function grantApp(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.grantAppParams,
options?: { [key: string]: any },
) {
return request<API.RVoid>('/api/admin/grantApp', {
method: 'POST',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /api/admin/login */ /** 此处后端没有提供注释 POST /api/admin/login */
export async function adminLogin( export async function adminLogin(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象) // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
@ -44,3 +67,15 @@ export async function adminLogin(
...(options || {}), ...(options || {}),
}); });
} }
/** 此处后端没有提供注释 POST /api/admin/saveAdmin */
export async function saveAdmin(body: API.MatrixAdminBo, options?: { [key: string]: any }) {
return request<API.RVoid>('/api/admin/saveAdmin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}

25
src/services/matrix/typings.d.ts

@ -10,6 +10,7 @@ declare namespace API {
advType?: number; advType?: number;
platform?: number; platform?: number;
deviceId?: string; deviceId?: string;
code?: string;
createdAt?: string[]; createdAt?: string[];
}; };
@ -32,6 +33,11 @@ declare namespace API {
appId?: string; appId?: string;
}; };
type grantAppParams = {
appIds: string;
adminId: number;
};
type InviteInfo = { type InviteInfo = {
inviteCnt?: number; inviteCnt?: number;
list?: InviteUserInfo[]; list?: InviteUserInfo[];
@ -61,6 +67,17 @@ declare namespace API {
id?: number; id?: number;
name?: string; name?: string;
password?: string; password?: string;
appIds?: string;
role?: number;
channel?: string;
};
type MatrixAdminBo = {
id?: number;
name?: string;
password?: string;
appIds?: number[];
role?: number;
}; };
type MatrixAdvRecordBo = { type MatrixAdvRecordBo = {
@ -94,7 +111,7 @@ declare namespace API {
name?: string; name?: string;
code?: string; code?: string;
url?: string; url?: string;
ownerId?: number; income?: number;
}; };
type PageResultMatrixAdvRecordBo = { type PageResultMatrixAdvRecordBo = {
@ -132,6 +149,12 @@ declare namespace API {
data?: InviteInfo; data?: InviteInfo;
}; };
type RListMatrixAdminBo = {
code?: number;
message?: string;
data?: MatrixAdminBo[];
};
type RListMatrixApp = { type RListMatrixApp = {
code?: number; code?: number;
message?: string; message?: string;

Loading…
Cancel
Save