From 3a3cc473c33cb4a97399ace76a1b35e9ffd68525 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期一, 20 十一月 2023 16:45:17 +0800
Subject: [PATCH] feat: 无任务选中通道时从p[lc读取统计

---
 src/api/index.ts |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/src/api/index.ts b/src/api/index.ts
index afab391..818c651 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -3,11 +3,19 @@
 import type { PLCResponse } from './plc'
 import type { Devices } from './device'
 import type { CraftModel } from './craftModel'
+import type { Problem } from './problem'
 
 export interface BaseResponse<T = any> {
   code: number
   data: T
   msg: string
+}
+
+export interface ListResponse<T = any> {
+  code: number
+  data: T
+  msg: string
+  total: number
 }
 
 export interface TaskListParams {
@@ -35,7 +43,6 @@
 
 export interface ProductProgressParams {
   channel: number
-  procedureId: number
 }
 
 /**
@@ -107,11 +114,40 @@
   })
 }
 
+export interface SetCurrentDeviceParams {
+  currentDeviceID: string
+}
+
+/**
+ * 璁惧畾褰撳墠璁惧
+ */
+export function apiSetCurrentDevice(data: SetCurrentDeviceParams) {
+  return request<BaseResponse>({
+    url: `/v1/device/setCurrentDeviceId`,
+    method: 'post',
+    data
+  })
+}
+
+export interface SetCurrentDeviceConfigParams {
+  needSetProcessParams: boolean
+}
+
+/**
+ * 璁惧畾褰撳墠璁惧閰嶇疆
+ */
+export function apiSetCurrentDeviceConfig(data: SetCurrentDeviceConfigParams) {
+  return request<BaseResponse>({
+    url: `/v1/device/config`,
+    method: 'post',
+    data
+  })
+}
+
 export interface CraftModelListParams {
   procedureId: number
   page: number
   pageSize: number
-  number: string
 }
 
 /**
@@ -119,7 +155,7 @@
  * @param params
  */
 export function apiGetCraftModelList(params: CraftModelListParams) {
-  return request<BaseResponse<CraftModel[]>>({
+  return request<ListResponse<CraftModel[]>>({
     url: '/v1/processModel/list',
     method: 'get',
     params
@@ -141,3 +177,13 @@
     data: params
   })
 }
+
+/**
+ * 鑾峰彇闂璇婃柇闂鍒楄〃
+ */
+export function apiGetProblemList() {
+  return request<BaseResponse<Problem[]>>({
+    url: '/v1/system/problemList',
+    method: 'get'
+  })
+}

--
Gitblit v1.8.0