首页 > 其他分享 >前端项目实战222-进行函数得封装

前端项目实战222-进行函数得封装

时间:2023-02-11 12:06:02浏览次数:36  
标签:实战 Task 封装 id item handleWork && 222 operateType


const handleWork = async (taskStepId: string, Task: string) => {
const empId = localStorage.getItem("empId")
setTask(Task)
const response = await OperateTask({ operateType: Task, taskStepId: taskStepId, daqId: empId })
if (response.code == 200) {
message.success(`${handleStatusWork(Task)}成功`, 1);
} else {
message.warning(response.message);
}
}
<div className='laycloth_btn'>
{item.operateType == "-1" && (
<Button onClick={() => { handleWork(item.id, "START") }}>开工</Button>
)}
{item.operateType == "0" && (
<Button onClick={() => { handleWork(item.id, "PAUSE") }}>暂停</Button>
)}
{item.operateType == "1" && (
<Button onClick={() => { handleWork(item.id, "REPORT") }}>报工</Button>
)
}
{item.operateType == "1" && (
<Button onClick={() => { handleWork(item.id, "RESUME") }}>复工</Button>
)
}
</div>

标签:实战,Task,封装,id,item,handleWork,&&,222,operateType
From: https://blog.51cto.com/u_15460007/6050156

相关文章