From 4757e21f5477d10934c8e26d28e19bbafaa7196f Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期四, 02 十一月 2023 19:26:56 +0800 Subject: [PATCH] 物料详情的弹框开发一半 --- src/api/index.ts | 101 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 93 insertions(+), 8 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 1c5ab52..c8e30e9 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,7 @@ import { request } from '@/common/utils' -import type { TasksResponse } from './task' +import type { CraftParamsResponse, TasksGroupByChannel } from './task' +import type { PLCResponse } from './plc' +import type { Devices } from './device' export interface BaseResponse<T = any> { code: number @@ -7,16 +9,99 @@ msg: string } +export interface TaskListParams { + /** 1鏈畬鎴�2浠婂ぉ鏈畬鎴�3宸插畬鎴� */ + type: 1 | 2 | 3 + /** 閫氶亾鍙� 涓嶄紶鏌ユ墍鏈夐�氶亾鐨� */ + channel?: number + /** 浠庣鍑犱釜寮�濮嬫煡锛屼粠0寮�濮� */ + offset: number + /** 鏌ュ灏戞潯 */ + limit: number +} + /** * 鑾峰彇浠诲姟鍒楄〃 - * @param taskMode 1: 寰呯敓浜х殑浠诲姟 2: 鐪嬫澘鍚勯�氶亾褰撳墠灞曠ず鐨勪换鍔� + * @param params */ -export function getTaskList(taskMode: 1 | 2) { - return request<BaseResponse<TasksResponse>>({ - url: '/v1/task/get', +export function getTaskList(params: TaskListParams) { + return request<BaseResponse<TasksGroupByChannel>>({ + url: '/v1/task/list', method: 'get', - params: { - taskMode - } + params + }) +} + +export interface ProductProgressParams { + channel: number + procedureId: number +} + +/** + * 鑾峰彇PLC杩愯鏁版嵁 + * @param params + */ +export function getProductProgress(params: ProductProgressParams) { + return request<BaseResponse<PLCResponse>>({ + url: '/v1/plc/productProgress', + method: 'post', + data: params + }) +} +export interface CraftParamsParams { + id: number +} + +/** + * 鑾峰彇宸ヨ壓鍙傛暟 + * @param params + */ +export function getCraftParams(params: CraftParamsParams) { + return request<BaseResponse<CraftParamsResponse>>({ + url: `v1/task/start/${params.id}`, + method: 'get', + data: params + }) +} + +export interface SendProcessParamsParams { + procedureId: number +} + +/** + * 涓嬪彂宸ヨ壓鍙傛暟 + * @param params + */ +export function sendProcessParams(params: SendProcessParamsParams) { + return request<BaseResponse>({ + url: `v1/task/sendProcessParams`, + method: 'post', + data: params + }) +} + +export interface FinishTaskParams { + id: number +} + +/** + * 缁撴潫浠诲姟 + * @param params + */ +export function finishTask(params: FinishTaskParams) { + return request<BaseResponse>({ + url: `v1/task/finish/${params.id}`, + method: 'put', + data: params + }) +} + +/** + * 鑾峰彇褰撳墠闈㈡澘缁戝畾鐨勮澶囧垪琛� + */ +export function getDeviceList() { + return request<BaseResponse<Devices>>({ + url: `/v1/device/list`, + method: 'get' }) } -- Gitblit v1.8.0