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

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>

posted @   前端导师歌谣  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
历史上的今天:
2021-12-21 歌谣2021|自学转行的程序员的年终总结
点击右上角即可分享
微信分享提示