From 799cb00eb72632af7017fb3b1a39c5ad00ab44d0 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 01 十一月 2023 19:38:33 +0800 Subject: [PATCH] 本机设备,云端设备编码 组件开发+知识库组件开发 还有报错需要处理 --- src/api/index.ts | 76 +++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 1 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 336ce12..708b8b2 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1 +1,75 @@ -export {} +import { request } from '@/common/utils' +import type { CraftParamsResponse, TasksGroupByChannel } from './task' +import type { PLCResponse } from './plc' + +export interface BaseResponse<T = any> { + code: number + data: T + msg: string +} + +export interface TaskListParams { + /** 1鏈畬鎴�2浠婂ぉ鏈畬鎴�3宸插畬鎴� */ + type: 1 | 2 | 3 + /** 閫氶亾鍙� 涓嶄紶鏌ユ墍鏈夐�氶亾鐨� */ + channel?: number + /** 浠庣鍑犱釜寮�濮嬫煡锛屼粠0寮�濮� */ + offset: number + /** 鏌ュ灏戞潯 */ + limit: number +} + +/** + * 鑾峰彇浠诲姟鍒楄〃 + * @param params + */ +export function getTaskList(params: TaskListParams) { + return request<BaseResponse<TasksGroupByChannel>>({ + url: '/v1/task/list', + method: 'get', + 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 +} +export function sendProcessParams(params: SendProcessParamsParams) { + return request<BaseResponse>({ + url: `v1/task/sendProcessParams`, + method: 'post', + data: params + }) +} -- Gitblit v1.8.0