From e76f0739e647fe8a7e0e2618914e2faff554b1b7 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期一, 17 十一月 2025 17:33:23 +0800
Subject: [PATCH] 解决冲突
---
mes-web/src/api/device/deviceManagement.js | 552 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 552 insertions(+), 0 deletions(-)
diff --git a/mes-web/src/api/device/deviceManagement.js b/mes-web/src/api/device/deviceManagement.js
new file mode 100644
index 0000000..13dd443
--- /dev/null
+++ b/mes-web/src/api/device/deviceManagement.js
@@ -0,0 +1,552 @@
+import request from '@/utils/request'
+
+/**
+ * 璁惧绠$悊API
+ */
+
+// 璁惧閰嶇疆鐩稿叧API
+export const deviceConfigApi = {
+ /**
+ * 鍒涘缓璁惧閰嶇疆
+ */
+ create(data) {
+ return request({
+ url: '/api/plcSend/device/config/devices',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鏇存柊璁惧閰嶇疆
+ */
+ update(id, data) {
+ return request({
+ url: `/api/plcSend/device/config/devices/update`,
+ method: 'post',
+ data: {
+ deviceId: id,
+ deviceConfig: data
+ }
+ })
+ },
+
+ /**
+ * 鍒犻櫎璁惧閰嶇疆
+ */
+ delete(id) {
+ return request({
+ url: `/api/plcSend/device/config/devices/delete`,
+ method: 'post',
+ data: { deviceId: id }
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧閰嶇疆璇︽儏
+ */
+ getById(id) {
+ return request({
+ url: `/api/plcSend/device/config/devices/detail`,
+ method: 'post',
+ data: { deviceId: id }
+ })
+ },
+
+ /**
+ * 鍒嗛〉鏌ヨ璁惧閰嶇疆鍒楄〃
+ */
+ getList(params) {
+ return request({
+ url: '/api/plcSend/device/config/devices/list',
+ method: 'post',
+ data: {
+ page: params.pageNum || params.page || 1,
+ size: params.pageSize || params.size || 10,
+ deviceCode: params.deviceCode,
+ deviceType: params.deviceType,
+ deviceStatus: params.status || params.deviceStatus,
+ keyword: params.keyword
+ }
+ })
+ },
+
+ /**
+ * 鍚敤璁惧
+ */
+ enable(id) {
+ return request({
+ url: '/api/plcSend/device/config/devices/enable',
+ method: 'post',
+ data: { deviceId: id }
+ })
+ },
+
+ /**
+ * 绂佺敤璁惧
+ */
+ disable(id) {
+ return request({
+ url: '/api/plcSend/device/config/devices/disable',
+ method: 'post',
+ data: { deviceId: id }
+ })
+ },
+
+ /**
+ * 鎵归噺鍚敤璁惧
+ */
+ batchEnable(deviceIds) {
+ return request({
+ url: '/api/plcSend/device/config/devices/batch-enable',
+ method: 'post',
+ data: { deviceIds: deviceIds }
+ })
+ },
+
+ /**
+ * 鎵归噺绂佺敤璁惧
+ */
+ batchDisable(deviceIds) {
+ return request({
+ url: '/api/plcSend/device/config/devices/batch-disable',
+ method: 'post',
+ data: { deviceIds: deviceIds }
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧缁熻淇℃伅
+ */
+ getStatistics(params) {
+ return request({
+ url: '/api/plcSend/device/config/statistics/devices',
+ method: 'post',
+ data: params
+ })
+ },
+
+ /**
+ * 妫�鏌ヨ澶囩紪鐮佹槸鍚﹀瓨鍦�
+ */
+ checkCode(deviceCode, excludeId) {
+ return request({
+ url: '/api/plcSend/device/config/devices/check-code',
+ method: 'post',
+ data: {
+ deviceCode,
+ excludeId
+ }
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧绫诲瀷鍒楄〃
+ */
+ getDeviceTypes() {
+ return request({
+ url: '/api/plcSend/device/config/devices/types',
+ method: 'post'
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧鐘舵�佸垪琛�
+ */
+ getDeviceStatuses() {
+ return request({
+ url: '/api/plcSend/device/config/devices/statuses',
+ method: 'post'
+ })
+ },
+
+ /**
+ * 娴嬭瘯璁惧PLC杩炴帴
+ * data 鍙互鏄� { deviceId } 鎴� { plcIp, plcPort, timeout }
+ */
+ testConnection(data) {
+ return request({
+ url: '/api/plcSend/device/config/devices/test-connection',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧閰嶇疆鏍戠粨鏋�
+ */
+ getDeviceTree(params) {
+ return request({
+ url: '/api/plcSend/device/config/devices/tree',
+ method: 'post',
+ data: params
+ })
+ },
+
+ /**
+ * 璁惧鍋ュ悍妫�鏌�
+ */
+ healthCheck(id) {
+ return request({
+ url: `/api/plcSend/device/config/devices/health-check`,
+ method: 'post',
+ data: { deviceId: id }
+ })
+ }
+}
+
+// 璁惧缁勯厤缃浉鍏矨PI
+export const deviceGroupApi = {
+ /**
+ * 鍒涘缓璁惧缁勯厤缃�
+ */
+ create(data) {
+ return request({
+ url: '/api/plcSend/device/group/create',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鏇存柊璁惧缁勯厤缃�
+ */
+ update(data) {
+ return request({
+ url: '/api/plcSend/device/group/update',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鍒犻櫎璁惧缁勯厤缃�
+ */
+ delete(data) {
+ return request({
+ url: '/api/plcSend/device/group/delete',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧缁勯厤缃鎯�
+ */
+ getGroupById(id) {
+ return request({
+ url: `/api/plcSend/device/group/detail`,
+ method: 'post',
+ data: { groupId: id }
+ })
+ },
+
+ /**
+ * 鍒嗛〉鏌ヨ璁惧缁勯厤缃垪琛�
+ */
+ getList(params) {
+ return request({
+ url: '/api/plcSend/device/group/list',
+ method: 'post',
+ data: {
+ groupConfig: {
+ page: params.page,
+ size: params.size,
+ groupType: params.groupType,
+ groupStatus: params.groupStatus,
+ keyword: params.keyword
+ }
+ }
+ })
+ },
+
+ /**
+ * 鍚敤璁惧缁�
+ */
+ enable(data) {
+ return request({
+ url: '/api/plcSend/device/group/enable',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 绂佺敤璁惧缁�
+ */
+ disable(data) {
+ return request({
+ url: '/api/plcSend/device/group/disable',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鎵归噺鍚敤璁惧缁�
+ */
+ batchEnable(data) {
+ return request({
+ url: '/api/plcSend/device/group/batch-enable',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鎵归噺绂佺敤璁惧缁�
+ */
+ batchDisable(data) {
+ return request({
+ url: '/api/plcSend/device/group/batch-disable',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧缁勭粺璁′俊鎭�
+ */
+ getStatistics(params) {
+ return request({
+ url: '/api/plcSend/device/group/statistics/groups',
+ method: 'post',
+ data: params
+ })
+ },
+
+ /**
+ * 妫�鏌ヨ澶囩粍缂栫爜鏄惁宸插瓨鍦�
+ */
+ checkCode(params) {
+ return request({
+ url: '/api/plcSend/device/group/check-code',
+ method: 'post',
+ data: {
+ groupId: params.groupId,
+ groupConfig: {
+ groupCode: params.groupCode
+ }
+ }
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧缁勭被鍨嬪垪琛�
+ */
+ getGroupTypes() {
+ return request({
+ url: `/api/plcSend/device/group/types`,
+ method: 'post'
+ })
+ },
+ /**
+ * 鑾峰彇璁惧缁勭姸鎬佸垪琛�
+ */
+ getGroupStatuses() {
+ return request({
+ url: `/api/plcSend/device/group/statuses`,
+ method: 'post'
+ })
+ },
+
+ /**
+ * 娣诲姞璁惧鍒拌澶囩粍
+ */
+ addDeviceToGroup(data) {
+ return request({
+ url: '/api/plcSend/device/group/devices',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 浠庤澶囩粍绉婚櫎璁惧
+ */
+ removeDeviceFromGroup(data) {
+ return request({
+ url: '/api/plcSend/device/group/devices/remove',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鏇存柊璁惧鍦ㄨ澶囩粍涓殑瑙掕壊
+ */
+ updateDeviceRole(data) {
+ return request({
+ url: '/api/plcSend/device/group/devices/role',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧缁勮澶囧垪琛�
+ */
+ getGroupDevices(groupId) {
+ return request({
+ url: `/api/plcSend/device/group/devices/list`,
+ method: 'post',
+ data: { groupId }
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧璁惧缁勫垪琛�
+ */
+ getDeviceGroups(deviceId) {
+ return request({
+ url: `/api/plcSend/device/group/devices/groups`,
+ method: 'post',
+ data: { deviceId }
+ })
+ },
+
+ /**
+ * 鎵归噺娣诲姞璁惧鍒拌澶囩粍
+ */
+ batchAddDevicesToGroup(data) {
+ return request({
+ url: '/api/plcSend/device/group/batch-add-devices',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鎵归噺浠庤澶囩粍绉婚櫎璁惧
+ */
+ batchRemoveDevicesFromGroup(data) {
+ return request({
+ url: '/api/plcSend/device/group/devices/batch-remove',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 璁惧缁勫仴搴锋鏌�
+ */
+ healthCheck(data) {
+ return request({
+ url: '/api/plcSend/device/group/health-check',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧缁勬�ц兘缁熻
+ */
+ getPerformance(data) {
+ return request({
+ url: '/api/plcSend/device/group/performance',
+ method: 'post',
+ data
+ })
+ }
+}
+
+// 璁惧PLC鎿嶄綔API
+export const devicePlcApi = {
+ /**
+ * 鎵归噺瑙﹀彂PLC璇锋眰
+ */
+ triggerRequests(deviceIds) {
+ return request({
+ url: '/api/plcSend/device/plc/requests',
+ method: 'post',
+ data: { deviceIds }
+ })
+ },
+
+ /**
+ * 鎵归噺妯℃嫙PLC姹囨姤
+ */
+ triggerReports(deviceIds) {
+ return request({
+ url: '/api/plcSend/device/plc/reports',
+ method: 'post',
+ data: { deviceIds }
+ })
+ },
+
+ /**
+ * 鎵归噺閲嶇疆PLC鐘舵��
+ */
+ resetDevices(deviceIds) {
+ return request({
+ url: '/api/plcSend/device/plc/resets',
+ method: 'post',
+ data: { deviceIds }
+ })
+ },
+
+ /**
+ * 璁惧缁勮Е鍙慞LC璇锋眰
+ */
+ triggerGroupRequest(groupId) {
+ return request({
+ url: `/api/plcSend/device/plc/groups/${groupId}/request`,
+ method: 'post'
+ })
+ },
+
+ /**
+ * 璁惧缁勬ā鎷烶LC姹囨姤
+ */
+ triggerGroupReport(groupId) {
+ return request({
+ url: `/api/plcSend/device/plc/groups/${groupId}/report`,
+ method: 'post'
+ })
+ },
+
+ /**
+ * 鏌ヨ璁惧PLC鐘舵��
+ */
+ getDeviceStatus(deviceId) {
+ return request({
+ url: `/api/plcSend/device/plc/status/${deviceId}`,
+ method: 'get'
+ })
+ },
+
+ /**
+ * 鏌ヨ璁惧缁凱LC鐘舵��
+ */
+ getGroupStatus(groupId) {
+ return request({
+ url: `/api/plcSend/device/plc/groups/${groupId}/status`,
+ method: 'get'
+ })
+ }
+}
+
+// 缁熻API
+export const getDeviceStatistics = (data) => {
+ return request({
+ url: '/api/plcSend/device/config/statistics/devices',
+ method: 'post',
+ data
+ })
+}
+
+export const getDeviceGroupStatistics = (params) => {
+ return request({
+ url: '/api/plcSend/device/group/statistics/groups',
+ method: 'post',
+ data: params
+ })
+}
+
+export default {
+ deviceConfigApi,
+ deviceGroupApi,
+ devicePlcApi,
+ getDeviceStatistics,
+ getDeviceGroupStatistics
+}
\ No newline at end of file
--
Gitblit v1.8.0