feat: dutyinfo service
parent
9bf2ef67be
commit
311d67a1b1
|
|
@ -35,13 +35,14 @@ module.exports = {
|
||||||
'GET /admin/duty/current': {
|
'GET /admin/duty/current': {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
isNormalDuty: true,
|
isNormalDuty: false,
|
||||||
currentDuty: '2',
|
currentDuty: 'off',
|
||||||
inDutyCnt: 3,
|
inDutyCnt: 3,
|
||||||
otherDutyTime: '',
|
otherDutyStart: '2024-03-07T17:53:48.523303',
|
||||||
offDutyReason: '',
|
otherDutyEnd: '2024-03-17T17:53:48.523303',
|
||||||
place: '204',
|
offDutyReason: '期中考试周',
|
||||||
dutyRecoverTime: '',
|
place: '',
|
||||||
|
dutyRecoverTime: '下周一',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'POST /admin/duty/update': {
|
'POST /admin/duty/update': {
|
||||||
|
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
import { PageContainer, ProForm, ProFormRadio, ProFormText } from '@ant-design/pro-components';
|
|
||||||
import { Card, Col, Row, Space, message } from 'antd';
|
|
||||||
|
|
||||||
const waitTime = (time: number = 100) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve(true);
|
|
||||||
}, time);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const Logs: React.FC = () => {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContainer>
|
|
||||||
<Card>
|
|
||||||
<ProForm<{
|
|
||||||
name: string;
|
|
||||||
company?: string;
|
|
||||||
useMode?: string;
|
|
||||||
}>
|
|
||||||
submitter={{
|
|
||||||
render: (props, doms) => {
|
|
||||||
return (
|
|
||||||
<Row>
|
|
||||||
<Col span={14} offset={4}>
|
|
||||||
<Space>{doms}</Space>
|
|
||||||
</Col>
|
|
||||||
</Row>);
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
await waitTime(2000);
|
|
||||||
console.log(values);
|
|
||||||
message.success('提交成功');
|
|
||||||
}}
|
|
||||||
params={{}}
|
|
||||||
request={async () => {
|
|
||||||
await waitTime(100);
|
|
||||||
return {
|
|
||||||
name: '蚂蚁设计有限公司',
|
|
||||||
useMode: 'chapter',
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProFormRadio.Group
|
|
||||||
style={{
|
|
||||||
margin: 16,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<ProFormText
|
|
||||||
width="md"
|
|
||||||
name="name"
|
|
||||||
label="签约客户名称"
|
|
||||||
tooltip="最长为 24 位"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
/>
|
|
||||||
<ProFormText
|
|
||||||
width="md"
|
|
||||||
name="company"
|
|
||||||
label="我方公司名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
/>
|
|
||||||
<ProFormText
|
|
||||||
name={['contract', 'name']}
|
|
||||||
width="md"
|
|
||||||
label="合同名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
/>
|
|
||||||
</ProForm>
|
|
||||||
</Card>
|
|
||||||
</PageContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
export default Logs;
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
import { PageContainer, ProForm, ProFormRadio, ProFormText } from '@ant-design/pro-components';
|
||||||
|
import { Card, Col, Row, Space, message } from 'antd';
|
||||||
|
// import { useState } from 'react';
|
||||||
|
import request from 'umi-request';
|
||||||
|
import { Info } from './info';
|
||||||
|
|
||||||
|
const waitTime = (time: number = 100) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(true);
|
||||||
|
}, time);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const DutyInfo: React.FC = () => {
|
||||||
|
// const [isNormalDuty, setIsNormalDuty] = useState(true);
|
||||||
|
return (
|
||||||
|
<PageContainer>
|
||||||
|
<Card>
|
||||||
|
<ProForm<Info>
|
||||||
|
submitter={{
|
||||||
|
render: (props, doms) => {
|
||||||
|
return (
|
||||||
|
<Row>
|
||||||
|
<Col span={14} offset={4}>
|
||||||
|
<Space>{doms}</Space>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onFinish={async (values) => {
|
||||||
|
await waitTime(2000);
|
||||||
|
console.log(values);
|
||||||
|
message.success('提交成功');
|
||||||
|
}}
|
||||||
|
params={{}}
|
||||||
|
request={async (params = {} as Record<string, any>) =>
|
||||||
|
request<Info>('/admin/duty/current', {
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ProFormRadio.Group
|
||||||
|
style={{
|
||||||
|
margin: 16,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="inDutyCnt"
|
||||||
|
label="值班人数"
|
||||||
|
tooltip="请输入数字"
|
||||||
|
placeholder="请输入值班人数"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="offDutyReason"
|
||||||
|
label="暂停值班原因"
|
||||||
|
placeholder="请输入暂停值班的原因"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
name="dutyRecoverTime"
|
||||||
|
width="md"
|
||||||
|
label="值班恢复时间"
|
||||||
|
placeholder="请输入值班恢复的时间"
|
||||||
|
/>
|
||||||
|
</ProForm>
|
||||||
|
</Card>
|
||||||
|
</PageContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default DutyInfo;
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
export type Info = {
|
||||||
|
isNormalDuty: boolean;
|
||||||
|
inDutyCnt: number;
|
||||||
|
currentDuty: string;
|
||||||
|
place: string;
|
||||||
|
otherDutyStart: string;
|
||||||
|
otherDutyEnd: string;
|
||||||
|
offDutyReason: string;
|
||||||
|
dutyRecoverTime: string;
|
||||||
|
};
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import { Info } from '@/pages/Admin/DutyInfo/info';
|
||||||
import { request } from '@umijs/max';
|
import { request } from '@umijs/max';
|
||||||
import { API } from './typings';
|
import { API } from './typings';
|
||||||
|
|
||||||
|
|
@ -33,7 +34,7 @@ export async function login(body: API.LoginParams, options?: { [key: string]: an
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取首页信息 GET /admin/stats */
|
/** 获取首页信息 GET /stats */
|
||||||
export async function getStat(options?: { [key: string]: any }) {
|
export async function getStat(options?: { [key: string]: any }) {
|
||||||
return request<{
|
return request<{
|
||||||
data: API.Stat;
|
data: API.Stat;
|
||||||
|
|
@ -42,3 +43,13 @@ export async function getStat(options?: { [key: string]: any }) {
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取当前值班信息 GET /admin/duty/current */
|
||||||
|
export async function getDutyInfo(options?: { [key: string]: any }) {
|
||||||
|
return request<{
|
||||||
|
data: Info;
|
||||||
|
}>('/admin/duty/current', {
|
||||||
|
method: 'GET',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue