From 689b64bfce7ea0eff18349b996994366568a30b3 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 05 八月 2024 13:33:05 +0800
Subject: [PATCH] 下片页面添加落架详情显示
---
UI-Project/src/utils/api.js | 190 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 186 insertions(+), 4 deletions(-)
diff --git a/UI-Project/src/utils/api.js b/UI-Project/src/utils/api.js
index c8674a7..9be06af 100644
--- a/UI-Project/src/utils/api.js
+++ b/UI-Project/src/utils/api.js
@@ -1,14 +1,42 @@
// src/services/api.js
-import request from 'request';
+import request from '../utils/request';
+import { ElMessage } from 'element-plus';
+ // Replace with your actual backend base URL
-export const findTasks = (id, newState) => {
+// Function to find list of raw usages
+const BASE_URL = 'glassStorage/api/rawUsage';
+const taskBASE_URL = 'glassStorage/api/storageTask';
+
+export const findTasks = () => {
const url = `glassStorage/api/storageTask/findTasks`;
const options = {
- method: 'POST',
+ method: 'get',
url,
json: true,
- body: { id, enableState: newState }
+
+ };
+
+ return new Promise((resolve, reject) => {
+ request(options, (error, response, body) => {
+ if (error) {
+ reject(new Error(error.message));
+ } else {
+ resolve(body);
+ }
+ });
+ });
+};
+
+
+
+export const findList = (params) => {
+ const url = `${BASE_URL}/findList`;
+ const options = {
+ method: 'post',
+ url,
+ json: true,
+ body: params
};
return new Promise((resolve, reject) => {
@@ -21,3 +49,157 @@
});
});
};
+
+// Function to find raw usage by ID
+export const findById = (id) => {
+ const url = `${BASE_URL}/${id}`;
+ const options = {
+ method: 'get',
+ url,
+ json: true
+ };
+
+ return new Promise((resolve, reject) => {
+ request(options, (error, response, body) => {
+ if (error) {
+ reject(new Error(error.message));
+ } else {
+ resolve(body);
+ }
+ });
+ });
+};
+
+// Function to insert a new raw usage
+export const insertRawUsage = (rawUsage) => {
+ const url = `${BASE_URL}`;
+ const options = {
+ method: 'post',
+ url,
+ json: true,
+ body: rawUsage
+ };
+
+ return new Promise((resolve, reject) => {
+ request(options, (error, response, body) => {
+ if (error) {
+ reject(new Error(error.message));
+ } else {
+ resolve(body);
+ }
+ });
+ });
+};
+
+
+export const updateRawUsage = async (rawUsage) => {
+ try {
+ const response = await request.post(`${BASE_URL}/updaterawUsage`, rawUsage);
+ ElMessage.success('淇敼鎴愬姛');
+ return response.data;
+ } catch (error) {
+ ElMessage.error('淇敼澶辫触');
+ throw error;
+ }
+};
+
+export const deleteRawUsage = async (id) => {
+ try {
+ const response = await request.post(`${BASE_URL}/id`, id);
+ ElMessage.success('鍒犻櫎鍘熷浣跨敤鏁版嵁鎴愬姛');
+ return response.data;
+ } catch (error) {
+ ElMessage.error('鍒犻櫎鍘熷浣跨敤鏁版嵁澶辫触');
+ throw error;
+ }
+};
+
+export const inStorage = async (RawUsageAndShelfRack) => {
+ try {
+ const response = await request.post(`${BASE_URL}/inStorage`, RawUsageAndShelfRack);
+ ElMessage.success('鍏ュ簱鎿嶄綔鎴愬姛');
+ return response.data;
+ } catch (error) {
+ ElMessage.error('鍏ュ簱鎿嶄綔澶辫触');
+ throw error;
+ }
+};
+
+export const outStorage = async (RawUsageAndShelfRack) => {
+ try {
+ const response = await request.post(`${BASE_URL}/outStorage`, RawUsageAndShelfRack);
+ ElMessage.success('鍑哄簱鎿嶄綔鎴愬姛');
+ return response.data;
+ } catch (error) {
+ ElMessage.error('鍑哄簱鎿嶄綔澶辫触');
+ throw error;
+ }
+};
+
+
+
+export const taskUpdate = async (task) => {
+ try {
+ const response = await request.post(`${taskBASE_URL}/taskUpdate`, task);
+
+ return response.data;
+ } catch (error) {
+
+ throw error;
+ }
+};
+
+
+
+
+
+
+const API_URL = 'glassStorage/api/shelfRack'; // Adjust this based on your actual API URL
+
+export const shelfRackfindList = (params) => {
+ return request.post(`${API_URL}/findList`, params)
+ .then(response => response.data)
+ .catch(error => {
+ throw error; // Handle errors appropriately in your frontend
+ });
+};
+
+export const shelfRackfindById = (id) => {
+ return request.get(`${API_URL}/${id}`)
+ .then(response => response.data)
+ .catch(error => {
+ throw error;
+ });
+};
+
+export const insertShelfRack = (shelfRack) => {
+ return request.post(`${API_URL}`, shelfRack)
+ .then(response => response.data)
+ .catch(error => {
+ throw error;
+ });
+};
+
+export const updateShelfRack = (shelfRack) => {
+ return request.put(`${API_URL}`, shelfRack)
+ .then(response => response.data)
+ .catch(error => {
+ throw error;
+ });
+};
+
+export const shelfRackdeleteById = (id) => {
+ return request.delete(`${API_URL}/${id}`)
+ .then(response => response.data)
+ .catch(error => {
+ throw error;
+ });
+};
+
+export const findShelfRack = () => {
+ return request.get(`${API_URL}/findshelfrack`)
+ .then(response => response.data)
+ .catch(error => {
+ throw error;
+ });
+};
\ No newline at end of file
--
Gitblit v1.8.0