fix: change dutyinfo api

mgy
Dawn1Ocean 2024-04-21 22:59:19 +08:00
parent 9fc19a3ebd
commit a39cef6312
4 changed files with 35 additions and 8 deletions

View File

@ -67,7 +67,7 @@ data:
"isNormalDuty": true, // 判断是否是正常值班时间 "isNormalDuty": true, // 判断是否是正常值班时间
"currentDuty": "1", // 判断是否正在值班 / 值哪一班 "1" | "2" | "3" => 正在值班,"off" => 值班下班 "currentDuty": "1", // 判断是否正在值班 / 值哪一班 "1" | "2" | "3" => 正在值班,"off" => 值班下班
"inDutyCnt": 3, "inDutyCnt": 3,
"otherDutyTime": "", // 正常值班时为空 "otherDutyTime": [], // 正常值班时为空
"offDutyReason": "", "offDutyReason": "",
"place": "204", "place": "204",
"dutyRecoverTime": "" "dutyRecoverTime": ""
@ -83,7 +83,17 @@ data:
"isNormalDuty": false, // 判断是否是正常值班时间 "isNormalDuty": false, // 判断是否是正常值班时间
"currentDuty": "others", // 判断是否正在值班 / 值哪一班 "others" => 正在值班,"off" => 值班下班 "currentDuty": "others", // 判断是否正在值班 / 值哪一班 "others" => 正在值班,"off" => 值班下班
"inDutyCnt": 3, "inDutyCnt": 3,
"otherDutyTime": "", "otherDutyTime": [
{
"name": "第一班",
"range": ["2024-03-07T19:52:48.523303", "2024-03-07T19:52:48.523303"]
},
{
"name": "第二班",
"range": ["2024-03-07T19:52:48.523303", "2024-03-07T19:52:48.523303"]
},
...
],
"offDutyReason": "", "offDutyReason": "",
"place": "204", "place": "204",
"dutyRecoverTime": "" "dutyRecoverTime": ""
@ -98,10 +108,10 @@ request:
```json ```json
{ {
"isNormalDuty": false, "isNormalDuty": true,
"currentDuty": "2", "currentDuty": "2",
"inDutyCnt": 3, "inDutyCnt": 3,
"otherDutyTime": "", "otherDutyTime": [],
"offDutyReason": "", "offDutyReason": "",
"place": "204", "place": "204",
"dutyRecoverTime": "", "dutyRecoverTime": "",

View File

@ -38,8 +38,20 @@ module.exports = {
isNormalDuty: false, isNormalDuty: false,
currentDuty: 'off', currentDuty: 'off',
inDutyCnt: 3, inDutyCnt: 3,
otherDutyStart: '2024-03-07T17:53:48.523303', otherDutyTime: [
otherDutyEnd: '2024-03-17T17:53:48.523303', {
name: '第一班',
range: ['2024-03-07T19:52:48.523303', '2024-03-07T19:52:48.523303'],
},
{
name: '第二班',
range: ['2024-03-07T19:52:48.523303', '2024-03-07T19:52:48.523303'],
},
{
name: '第三班',
range: ['2024-03-07T19:52:48.523303', '2024-03-07T19:52:48.523303'],
},
],
offDutyReason: '期中考试周', offDutyReason: '期中考试周',
place: '', place: '',
dutyRecoverTime: '下周一', dutyRecoverTime: '下周一',

View File

@ -26,6 +26,7 @@ const DutyInfo: React.FC = () => {
useEffect(() => { useEffect(() => {
getDutyInfo() getDutyInfo()
.then((res) => { .then((res) => {
console.log(res.data);
setDutyInfo(res.data); setDutyInfo(res.data);
setLoading(false); setLoading(false);
}) })

View File

@ -1,10 +1,14 @@
export type Shift = {
name: string;
range: string[];
};
export type Info = { export type Info = {
isNormalDuty: boolean; isNormalDuty: boolean;
inDutyCnt: number; inDutyCnt: number;
currentDuty: string; currentDuty: string;
place: string; place: string;
otherDutyStart: string; otherDutyTime: Shift[];
otherDutyEnd: string;
offDutyReason: string; offDutyReason: string;
dutyRecoverTime: string; dutyRecoverTime: string;
}; };