nayota-show-sdk 1.3.30 → 1.3.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/energyCalculation.js +2 -4
- package/api/energyConsumption.js +145 -0
- package/index.js +2 -0
- package/package.json +1 -1
package/api/energyCalculation.js
CHANGED
|
@@ -94,10 +94,8 @@ export function getOne(id) {
|
|
|
94
94
|
* @param {Object} data - 更新的数据
|
|
95
95
|
* @param {string} data._id - 能耗计算关联ID
|
|
96
96
|
* @param {string} [data.deviceId] - 设备ID
|
|
97
|
-
* @param {string} [data.
|
|
98
|
-
* @param {string} [data.
|
|
99
|
-
* @param {string} [data.flowCalculationNodeId] - 流量表计算节点ID
|
|
100
|
-
* @param {string} [data.flowMeterId] - 流量表ID
|
|
97
|
+
* @param {Array<string>} [data.electricityMeterIds] - 电表ID
|
|
98
|
+
* @param {Array<string>} [data.flowMeterIds] - 流量表ID
|
|
101
99
|
* @param {boolean} [data.isActive] - 是否启用
|
|
102
100
|
* @param {string} [data.description] - 关联描述
|
|
103
101
|
* @returns {Promise<Object>} 更新后的能耗计算关联记录
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { requestShow } from "../utils";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file 能源消耗表api
|
|
5
|
+
* @module 能源消耗表接口
|
|
6
|
+
* @category 能耗管理
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} energyConsumption - 能源消耗记录
|
|
11
|
+
* @property {string} _id - 记录ID
|
|
12
|
+
* @property {string} deviceId - 设备ID,关联到设备表
|
|
13
|
+
* @property {number} electricityConsumption - 电量消耗 (kWh)
|
|
14
|
+
* @property {number} heatConsumption - 热量消耗 (kWh)
|
|
15
|
+
* @property {number} coolingConsumption - 冷量消耗 (kWh)
|
|
16
|
+
* @property {number} runningDuration - 运行时长 (小时)
|
|
17
|
+
* @property {Date} recordDate - 记录日期
|
|
18
|
+
* @property {string} creator - 创建者
|
|
19
|
+
* @property {Date} createdAt - 创建时间
|
|
20
|
+
* @property {Date} updatedAt - 更新时间
|
|
21
|
+
* @example
|
|
22
|
+
* {
|
|
23
|
+
* "_id": "667d2efa52d21700095b58d5",
|
|
24
|
+
* "deviceId": "667d2ee28aaf514ab9bcbca5",
|
|
25
|
+
* "electricityConsumption": 150.5,
|
|
26
|
+
* "heatConsumption": 80.2,
|
|
27
|
+
* "coolingConsumption": 120.8,
|
|
28
|
+
* "runningDuration": 24.5,
|
|
29
|
+
* "recordDate": "2024-01-15T00:00:00.000Z",
|
|
30
|
+
* "creator": "6678e31ff340dfdecd9e1a28",
|
|
31
|
+
* "createdAt": "2024-01-15T10:30:00.000Z",
|
|
32
|
+
* "updatedAt": "2024-01-15T10:30:00.000Z"
|
|
33
|
+
* }
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 创建能源消耗记录
|
|
38
|
+
* @param {Object} data - 能源消耗数据
|
|
39
|
+
* @param {string} data.deviceId - 设备ID
|
|
40
|
+
* @param {number} [data.electricityConsumption=0] - 电量消耗 (kWh)
|
|
41
|
+
* @param {number} [data.heatConsumption=0] - 热量消耗 (kWh)
|
|
42
|
+
* @param {number} [data.coolingConsumption=0] - 冷量消耗 (kWh)
|
|
43
|
+
* @param {number} [data.runningDuration=0] - 运行时长 (小时)
|
|
44
|
+
* @param {Date} [data.recordDate] - 记录日期
|
|
45
|
+
* @returns {Promise<Object>} 创建的能源消耗记录
|
|
46
|
+
*/
|
|
47
|
+
export function create(data) {
|
|
48
|
+
return requestShow({
|
|
49
|
+
url: "/energy-consumptions",
|
|
50
|
+
method: "post",
|
|
51
|
+
data,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 获取能源消耗记录列表
|
|
57
|
+
* @param {Object} [params] - 查询参数
|
|
58
|
+
* @param {number} [params.page=1] - 页码
|
|
59
|
+
* @param {number} [params.limit=50] - 每页数量
|
|
60
|
+
* @param {string} [params.deviceId] - 设备ID筛选
|
|
61
|
+
* @param {Date} [params.startDate] - 开始日期筛选
|
|
62
|
+
* @param {Date} [params.endDate] - 结束日期筛选
|
|
63
|
+
* @param {number} [params.minElectricity] - 最小电量消耗筛选
|
|
64
|
+
* @param {number} [params.maxElectricity] - 最大电量消耗筛选
|
|
65
|
+
* @param {number} [params.minHeat] - 最小热量消耗筛选
|
|
66
|
+
* @param {number} [params.maxHeat] - 最大热量消耗筛选
|
|
67
|
+
* @param {number} [params.minCooling] - 最小冷量消耗筛选
|
|
68
|
+
* @param {number} [params.maxCooling] - 最大冷量消耗筛选
|
|
69
|
+
* @param {string} [params.sortBy] - 排序字段
|
|
70
|
+
* @param {string} [params.sortOrder='desc'] - 排序方向,asc或desc
|
|
71
|
+
* @returns {Promise<Object>} 能源消耗记录列表
|
|
72
|
+
*/
|
|
73
|
+
export function list(params) {
|
|
74
|
+
return requestShow({
|
|
75
|
+
url: "/energy-consumptions",
|
|
76
|
+
method: "get",
|
|
77
|
+
params,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 根据ID获取能源消耗记录详情
|
|
83
|
+
* @param {string} id - 能源消耗记录ID
|
|
84
|
+
* @returns {Promise<Object>} 能源消耗记录详情
|
|
85
|
+
*/
|
|
86
|
+
export function getOne(id) {
|
|
87
|
+
return requestShow({
|
|
88
|
+
url: `/energy-consumptions/${id}`,
|
|
89
|
+
method: "get",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 更新能源消耗记录
|
|
95
|
+
* @param {Object} data - 更新的数据
|
|
96
|
+
* @param {string} data._id - 能源消耗记录ID
|
|
97
|
+
* @param {string} [data.deviceId] - 设备ID
|
|
98
|
+
* @param {number} [data.electricityConsumption] - 电量消耗 (kWh)
|
|
99
|
+
* @param {number} [data.heatConsumption] - 热量消耗 (kWh)
|
|
100
|
+
* @param {number} [data.coolingConsumption] - 冷量消耗 (kWh)
|
|
101
|
+
* @param {number} [data.runningDuration] - 运行时长 (小时)
|
|
102
|
+
* @param {Date} [data.recordDate] - 记录日期
|
|
103
|
+
* @returns {Promise<Object>} 更新后的能源消耗记录
|
|
104
|
+
*/
|
|
105
|
+
export function updateOne(data) {
|
|
106
|
+
return requestShow({
|
|
107
|
+
url: `/energy-consumptions/${data._id}`,
|
|
108
|
+
method: "put",
|
|
109
|
+
data,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 删除能源消耗记录
|
|
115
|
+
* @param {string} id - 能源消耗记录ID
|
|
116
|
+
* @returns {Promise<Object>} 删除结果
|
|
117
|
+
*/
|
|
118
|
+
export function deleteOne(id) {
|
|
119
|
+
return requestShow({
|
|
120
|
+
url: `/energy-consumptions/${id}`,
|
|
121
|
+
method: "delete",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 批量删除能源消耗记录
|
|
127
|
+
* @param {Array<string>} ids - 能源消耗记录ID数组
|
|
128
|
+
* @returns {Promise<Object>} 批量删除结果
|
|
129
|
+
*/
|
|
130
|
+
export function deleteMany(ids) {
|
|
131
|
+
return requestShow({
|
|
132
|
+
url: "/energy-consumptions",
|
|
133
|
+
method: "delete",
|
|
134
|
+
data: ids,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default {
|
|
139
|
+
create,
|
|
140
|
+
list,
|
|
141
|
+
getOne,
|
|
142
|
+
updateOne,
|
|
143
|
+
deleteOne,
|
|
144
|
+
deleteMany,
|
|
145
|
+
};
|
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import datavForms from "./api/datavForms";
|
|
|
33
33
|
import sensor from "./api/sensor";
|
|
34
34
|
import scadaProject from "./api/scadaProject";
|
|
35
35
|
import energyCalculation from "./api/energyCalculation";
|
|
36
|
+
import energyConsumption from "./api/energyConsumption";
|
|
36
37
|
const api = {
|
|
37
38
|
alarmRecord,
|
|
38
39
|
alarmProgress,
|
|
@@ -66,6 +67,7 @@ const api = {
|
|
|
66
67
|
sensor,
|
|
67
68
|
scadaProject,
|
|
68
69
|
energyCalculation,
|
|
70
|
+
energyConsumption,
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
export default {
|