You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.8 KiB

2 months ago
2 months ago
  1. import http from 'libs/http'
  2. interface Craft {
  3. id?: number
  4. name?: string
  5. steps?: string
  6. oresId?: number
  7. }
  8. export const getCraftList = (params: { oresId: string }): Promise<CraftTypes.Craft[]> => http.get(`/crafts/list/${params.oresId}`)
  9. export const createCraft = (params: Craft): Promise<null> => http.post('/crafts', params)
  10. export const updateCraft = (params: Craft): Promise<null> => http.put(`/crafts`, params)
  11. export const delCraft = (ids: string): Promise<null> => http.delete(`/crafts/${ids}`)
  12. // 开始执行预设
  13. export const startCraft = (params: { heatId?: string, craftId?: number, columns?: number[] }): Promise<null> => http.post(`/crafts/start`, params)
  14. export const pauseCraft = (params: { heatId: string }): Promise<null> => http.post(`/crafts/pause`, params)
  15. export const resumeCraft = (params: { heatId: string }): Promise<null> => http.post(`/crafts/resume`, params)
  16. export const stopCraft = (params: { heatId: string }): Promise<null> => http.post(`/crafts/stop`, params)
  17. // 加热区配置预设
  18. export const setCraft = (params: { heatId?: string | number, craftId?: string | number }): Promise<null> => http.post(`/crafts/set`, params)
  19. export const craftstatus = (): Promise<CraftTypes.CraftState[]> => http.get(`/monitor/crafts/status`)
  20. export const craftstatusByHeatId = (heatId: string): Promise<CraftTypes.CraftState> => http.get(`/monitor/crafts/status/${heatId}`)
  21. export const craftList = (): Promise<any> => http.get(`/crafts/monitor/list`)
  22. export const craftRestart = (monitorId: string): Promise<CraftTypes.CraftState> => http.post(`/crafts/restart`, { monitorId })
  23. export const craftRestore = (isRestore: boolean): Promise<null> => http.get(`/crafts/restore${isRestore}`)
  24. export const craftRemove = (monitorId: string): Promise<CraftTypes.CraftState> => http.delete(`/crafts/remove`, { params: { monitorId } })