inl-app-manager 1.5.15
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/README.md +195 -0
- package/createMonacoTheme.js +1250 -0
- package/dist/clientUtils/index.d.ts +355 -0
- package/dist/clientUtils/index.js +338 -0
- package/dist/elements/index.d.ts +153 -0
- package/dist/elements/index.js +13194 -0
- package/dist/iconfont.js +147 -0
- package/dist/index.d.ts +567 -0
- package/dist/index.js +19381 -0
- package/dist/style.css +3 -0
- package/entry.js +14 -0
- package/package.json +92 -0
- package/rollup.config.ts +96 -0
- package/v2 +3 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import * as three from 'three';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import * as axios from 'axios';
|
|
4
|
+
import * as ofetch_dist_shared_ofetch_441891d5 from 'ofetch/dist/shared/ofetch.441891d5';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import * as G2 from '@antv/g2';
|
|
8
|
+
import * as vueUse from '@vueuse/core';
|
|
9
|
+
import * as antdv from 'ant-design-vue';
|
|
10
|
+
import * as vant from 'vant';
|
|
11
|
+
import * as iconsVue from '@ant-design/icons-vue';
|
|
12
|
+
import * as inl from 'inl-ui';
|
|
13
|
+
import Decimal from 'decimal.js';
|
|
14
|
+
|
|
15
|
+
declare const queryOnDutyPerson: () => Promise<void>;
|
|
16
|
+
|
|
17
|
+
declare const __app_common_queryOnDutyPerson: typeof queryOnDutyPerson;
|
|
18
|
+
declare namespace __app_common {
|
|
19
|
+
export {
|
|
20
|
+
__app_common_queryOnDutyPerson as queryOnDutyPerson,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface POINTCODE extends thingPropertyValueVoList {
|
|
25
|
+
value: string;
|
|
26
|
+
unit: string;
|
|
27
|
+
groupName?: string;
|
|
28
|
+
historyDataList?: Array<any>;
|
|
29
|
+
thingEntity?: ThingEntity;
|
|
30
|
+
thingCode?: string;
|
|
31
|
+
thingInstId?: string;
|
|
32
|
+
stateImg?: string;
|
|
33
|
+
}
|
|
34
|
+
interface thingPropertyValueVoList {
|
|
35
|
+
alarmAvailable: Boolean;
|
|
36
|
+
alarmId: string;
|
|
37
|
+
colorTrans: string;
|
|
38
|
+
colspan: number;
|
|
39
|
+
displayType: string;
|
|
40
|
+
displayValue: string | number | boolean;
|
|
41
|
+
eventEnable: Boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 属性label名称
|
|
44
|
+
*/
|
|
45
|
+
label: string;
|
|
46
|
+
/**
|
|
47
|
+
* 属性长度
|
|
48
|
+
*/
|
|
49
|
+
linkUrl: null;
|
|
50
|
+
/**
|
|
51
|
+
* 属性长度
|
|
52
|
+
*/
|
|
53
|
+
listInfo: "";
|
|
54
|
+
/**
|
|
55
|
+
* 属性类型
|
|
56
|
+
*/
|
|
57
|
+
listType: "";
|
|
58
|
+
/**
|
|
59
|
+
* 是否需要报警
|
|
60
|
+
*/
|
|
61
|
+
needColorTrans: Boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 是否需要跳转
|
|
64
|
+
*/
|
|
65
|
+
needLink: Boolean;
|
|
66
|
+
pointCode: null;
|
|
67
|
+
pointCode2: null;
|
|
68
|
+
/**
|
|
69
|
+
* 属性类型
|
|
70
|
+
*/
|
|
71
|
+
propertyType: keyof typeof propertyType;
|
|
72
|
+
/**
|
|
73
|
+
* 刷新频率
|
|
74
|
+
*/
|
|
75
|
+
refresh: null;
|
|
76
|
+
/**
|
|
77
|
+
* 关联属性code
|
|
78
|
+
*/
|
|
79
|
+
relationThingCode: null;
|
|
80
|
+
/**
|
|
81
|
+
* 是否必填
|
|
82
|
+
*/
|
|
83
|
+
selectRequest: Boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 属性排序
|
|
86
|
+
*/
|
|
87
|
+
sort: number;
|
|
88
|
+
/**
|
|
89
|
+
* 属性code
|
|
90
|
+
*/
|
|
91
|
+
thingPropertyCode: string;
|
|
92
|
+
/**
|
|
93
|
+
* 属性id
|
|
94
|
+
*/
|
|
95
|
+
thingPropertyId: string;
|
|
96
|
+
/**
|
|
97
|
+
* 属性实例id
|
|
98
|
+
*/
|
|
99
|
+
thingPropertyInstId: null;
|
|
100
|
+
/**
|
|
101
|
+
* 属性名称
|
|
102
|
+
*/
|
|
103
|
+
thingPropertyName: string;
|
|
104
|
+
/**
|
|
105
|
+
* 属性单位
|
|
106
|
+
*/
|
|
107
|
+
unit: string;
|
|
108
|
+
/**
|
|
109
|
+
* 属性值
|
|
110
|
+
*/
|
|
111
|
+
value: string | null;
|
|
112
|
+
}
|
|
113
|
+
declare enum propertyType {
|
|
114
|
+
/**
|
|
115
|
+
* unknown
|
|
116
|
+
* */
|
|
117
|
+
NONE = "NONE",
|
|
118
|
+
/**
|
|
119
|
+
* 物实例属性
|
|
120
|
+
* */
|
|
121
|
+
ATTRIBUTE = "ATTRIBUTE",
|
|
122
|
+
/**
|
|
123
|
+
* 静态属性
|
|
124
|
+
* */
|
|
125
|
+
PROPERTY = "PROPERTY",
|
|
126
|
+
/**
|
|
127
|
+
* 动态属性
|
|
128
|
+
* */
|
|
129
|
+
METRIC = "METRIC",
|
|
130
|
+
/**
|
|
131
|
+
* 动作下发
|
|
132
|
+
* */
|
|
133
|
+
ACTION = "ACTION",
|
|
134
|
+
/**
|
|
135
|
+
* 下发参数
|
|
136
|
+
* */
|
|
137
|
+
PARAMETER = "PARAMETER",
|
|
138
|
+
/**
|
|
139
|
+
* 报警属性
|
|
140
|
+
* */
|
|
141
|
+
ALARM = "ALARM",
|
|
142
|
+
/**
|
|
143
|
+
* 逻辑属性
|
|
144
|
+
* */
|
|
145
|
+
LOGIC = "LOGIC",
|
|
146
|
+
/**
|
|
147
|
+
* 关系属性
|
|
148
|
+
*/
|
|
149
|
+
RELATION = "RELATION",
|
|
150
|
+
/**
|
|
151
|
+
* 设定参数
|
|
152
|
+
*/
|
|
153
|
+
SETTING = "SETTING"
|
|
154
|
+
}
|
|
155
|
+
type detailGroupList = {
|
|
156
|
+
/**
|
|
157
|
+
* 设备详情组名称
|
|
158
|
+
*/
|
|
159
|
+
groupName: string;
|
|
160
|
+
/**
|
|
161
|
+
* 设备详情组类型
|
|
162
|
+
*/
|
|
163
|
+
groupType: string;
|
|
164
|
+
/**
|
|
165
|
+
* 设备详情组属性列表
|
|
166
|
+
*/
|
|
167
|
+
thingPropertyValueVoList: Array<thingPropertyValueVoList>;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* 物模型 详情
|
|
171
|
+
*/
|
|
172
|
+
interface ThingEntity {
|
|
173
|
+
catalogCode: string;
|
|
174
|
+
catalogName: string;
|
|
175
|
+
children: null;
|
|
176
|
+
code: string;
|
|
177
|
+
createTime: string;
|
|
178
|
+
createUser: null;
|
|
179
|
+
id: string;
|
|
180
|
+
img2dAlarm: string;
|
|
181
|
+
img2dPoweroff: string;
|
|
182
|
+
img2dPoweron: string;
|
|
183
|
+
img2dRun: string;
|
|
184
|
+
img25dAlarm: string;
|
|
185
|
+
img25dPoweroff: string;
|
|
186
|
+
img25dPoweron: string;
|
|
187
|
+
img25dRun: string;
|
|
188
|
+
industryCode: string;
|
|
189
|
+
industryName: string;
|
|
190
|
+
name: string;
|
|
191
|
+
parentCode: string;
|
|
192
|
+
parentId: string;
|
|
193
|
+
photo: string;
|
|
194
|
+
remark: string;
|
|
195
|
+
sort: number;
|
|
196
|
+
tableName: string;
|
|
197
|
+
thingKind: string;
|
|
198
|
+
thingType: string;
|
|
199
|
+
updateTime: string;
|
|
200
|
+
updateUser: string;
|
|
201
|
+
validEnable: true;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 设备实例详情
|
|
205
|
+
*/
|
|
206
|
+
interface thingInstanceDetail {
|
|
207
|
+
/**
|
|
208
|
+
* 设备详情组
|
|
209
|
+
*/
|
|
210
|
+
detailGroupList: Array<detailGroupList>;
|
|
211
|
+
functionCode: "WEB";
|
|
212
|
+
listPropertyList: any;
|
|
213
|
+
thingInstCode: string;
|
|
214
|
+
/**
|
|
215
|
+
* 物模型Code
|
|
216
|
+
*/
|
|
217
|
+
thingEntity: ThingEntity;
|
|
218
|
+
thingCode: string;
|
|
219
|
+
thingInstId: string;
|
|
220
|
+
thingInstName: string;
|
|
221
|
+
thingInstPhoto: string;
|
|
222
|
+
thingName: string;
|
|
223
|
+
stateImg: string;
|
|
224
|
+
}
|
|
225
|
+
interface RequestParams {
|
|
226
|
+
token?: string;
|
|
227
|
+
requestType: string | null;
|
|
228
|
+
thingCode: string | null;
|
|
229
|
+
functionCode: "web" | "topo" | "3dTopo";
|
|
230
|
+
}
|
|
231
|
+
type Downsample = {
|
|
232
|
+
timeNum: number;
|
|
233
|
+
timeUnit: "SECOND" | "MINUTE" | "HOUR" | "DAY" | "WEEK" | "MONTH" | "YEAR";
|
|
234
|
+
aggregator: "AVG" | "MIN" | "MAX" | "SUM" | "COUNT" | "FIRST" | "LAST" | "AVGALL" | "INTERP";
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
type historyDataList = {
|
|
238
|
+
alarmFlag: boolean;
|
|
239
|
+
formatValue: string;
|
|
240
|
+
lastScanTIme: string;
|
|
241
|
+
lastValue: number;
|
|
242
|
+
originValue: number;
|
|
243
|
+
prePointCode: string;
|
|
244
|
+
saveTime: string;
|
|
245
|
+
scanTIme: string;
|
|
246
|
+
state: number;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* @description 创建历史数据查询任务
|
|
250
|
+
* @param codes 设备实例code
|
|
251
|
+
* @param pcs 设备实例属性code
|
|
252
|
+
* @param params 请求参数
|
|
253
|
+
* @returns (* @param startTime 开始时间,@param endTime 结束时间, @param downsample 间隔时间Downsample) => 历史数据
|
|
254
|
+
*/
|
|
255
|
+
declare const createGetHistoryData: (codes: Array<string>, pcs: Array<string>, params: RequestParams) => Promise<(startTime: string, endTime: string, downsample: Downsample) => Promise<Record<string, Record<string, POINTCODE>>>>;
|
|
256
|
+
|
|
257
|
+
interface DeviceStateData {
|
|
258
|
+
displayValue: string | number | boolean;
|
|
259
|
+
thingCode: string;
|
|
260
|
+
thingInstCode: string;
|
|
261
|
+
thingInstId: string;
|
|
262
|
+
thingPropertyCode: string;
|
|
263
|
+
unit: string;
|
|
264
|
+
value: string;
|
|
265
|
+
stateImg?: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* @description 创建设备状态查询 任务
|
|
269
|
+
* @param code 设备实例code
|
|
270
|
+
*/
|
|
271
|
+
declare const getThingInstanceStatus: (code: Array<string>) => Promise<Record<string, DeviceStateData>>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @description 获取设备实例详细信息
|
|
275
|
+
* @param codes 设备实例code
|
|
276
|
+
* @param params 请求参数
|
|
277
|
+
* @param Markers 标记是通过id还是code查询
|
|
278
|
+
* @param filterDataByEventEnable 是否过滤无用属性根据eventEnable
|
|
279
|
+
* @returns
|
|
280
|
+
*/
|
|
281
|
+
declare const getThingInstanceDetail: (codes: Array<string>, params: RequestParams, Markers: "id" | "code", filterDataByEventEnable?: boolean) => Promise<Record<string, thingInstanceDetail>>;
|
|
282
|
+
/**
|
|
283
|
+
* @description 创建查询设备详情方法
|
|
284
|
+
* @param codes 设备实例code
|
|
285
|
+
* @param params 请求参数
|
|
286
|
+
* @param proptypeCodes 需要查询的属性code
|
|
287
|
+
* @param Markers 标记是通过id还是code查询
|
|
288
|
+
* @param filterDataByEventEnable 是否过滤无用属性根据eventEnable
|
|
289
|
+
* @returns
|
|
290
|
+
*/
|
|
291
|
+
declare const createGetThingInstanceDetail: (opt: {
|
|
292
|
+
codes: Array<string>;
|
|
293
|
+
params: RequestParams;
|
|
294
|
+
markers: "id" | "code";
|
|
295
|
+
proptypeCodes?: Array<string>;
|
|
296
|
+
filterDataByEventEnable?: boolean;
|
|
297
|
+
}) => any;
|
|
298
|
+
|
|
299
|
+
type __app_thing_DeviceStateData = DeviceStateData;
|
|
300
|
+
declare const __app_thing_createGetHistoryData: typeof createGetHistoryData;
|
|
301
|
+
declare const __app_thing_createGetThingInstanceDetail: typeof createGetThingInstanceDetail;
|
|
302
|
+
declare const __app_thing_getThingInstanceDetail: typeof getThingInstanceDetail;
|
|
303
|
+
declare const __app_thing_getThingInstanceStatus: typeof getThingInstanceStatus;
|
|
304
|
+
type __app_thing_historyDataList = historyDataList;
|
|
305
|
+
declare namespace __app_thing {
|
|
306
|
+
export {
|
|
307
|
+
__app_thing_DeviceStateData as DeviceStateData,
|
|
308
|
+
__app_thing_createGetHistoryData as createGetHistoryData,
|
|
309
|
+
__app_thing_createGetThingInstanceDetail as createGetThingInstanceDetail,
|
|
310
|
+
__app_thing_getThingInstanceDetail as getThingInstanceDetail,
|
|
311
|
+
__app_thing_getThingInstanceStatus as getThingInstanceStatus,
|
|
312
|
+
__app_thing_historyDataList as historyDataList,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const clientUtils: {
|
|
317
|
+
http: {
|
|
318
|
+
ofetch: ofetch_dist_shared_ofetch_441891d5.$;
|
|
319
|
+
axios: axios.AxiosStatic;
|
|
320
|
+
};
|
|
321
|
+
G2: typeof G2;
|
|
322
|
+
app: {
|
|
323
|
+
thing: typeof __app_thing;
|
|
324
|
+
common: typeof __app_common;
|
|
325
|
+
};
|
|
326
|
+
tools: {
|
|
327
|
+
_: _.LoDashStatic;
|
|
328
|
+
vueUse: typeof vueUse;
|
|
329
|
+
dayjs: typeof dayjs;
|
|
330
|
+
onMounted: (hook: () => any, target?: vue.ComponentInternalInstance) => false | Function;
|
|
331
|
+
three: {
|
|
332
|
+
three: typeof three;
|
|
333
|
+
Stats: any;
|
|
334
|
+
};
|
|
335
|
+
antdv: typeof antdv;
|
|
336
|
+
vant: typeof vant;
|
|
337
|
+
iconsVue: typeof iconsVue;
|
|
338
|
+
Decimal: typeof Decimal;
|
|
339
|
+
createId: () => string;
|
|
340
|
+
DEVICESTATE: "DEVICE_STATE";
|
|
341
|
+
propertyType: typeof propertyType;
|
|
342
|
+
paramsToString: (obj: Record<string, any>) => any;
|
|
343
|
+
resetHeader: (token: string) => {
|
|
344
|
+
token: string;
|
|
345
|
+
"Content-Type": string;
|
|
346
|
+
};
|
|
347
|
+
filterDataByEventEnableFun: (data: thingInstanceDetail) => thingInstanceDetail;
|
|
348
|
+
dataToPointCode: (data: Record<string, thingInstanceDetail>, pcs?: string[]) => Record<string, Record<string, POINTCODE>>;
|
|
349
|
+
getThingStateImg: (v: string | number, d: ThingEntity) => string;
|
|
350
|
+
filterThingInstanceDetailByPc: (res: Record<string, thingInstanceDetail>, pcs: string[]) => Promise<Record<string, Record<string, POINTCODE>>>;
|
|
351
|
+
inl: typeof inl;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
export { clientUtils as default };
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import * as G2 from '@antv/g2';
|
|
4
|
+
import * as vueUse from '@vueuse/core';
|
|
5
|
+
import * as antdv from 'ant-design-vue';
|
|
6
|
+
import * as vant from 'vant';
|
|
7
|
+
import * as iconsVue from '@ant-design/icons-vue';
|
|
8
|
+
import * as inl from 'inl-ui';
|
|
9
|
+
import { ofetch } from 'ofetch';
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import * as THREE from 'three';
|
|
12
|
+
import Stats from 'three/addons/libs/stats.module.js';
|
|
13
|
+
import Decimal from 'decimal.js';
|
|
14
|
+
import { onMounted } from 'vue';
|
|
15
|
+
|
|
16
|
+
var createId = (() => {
|
|
17
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
18
|
+
let r = Math.random() * 16 | 0,
|
|
19
|
+
v = c === "x" ? r : r & 3 | 8;
|
|
20
|
+
return v.toString(16);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const DEVICESTATE = "DEVICE_STATE";
|
|
25
|
+
var propertyType = /* @__PURE__ */(propertyType2 => {
|
|
26
|
+
propertyType2["NONE"] = "NONE";
|
|
27
|
+
propertyType2["ATTRIBUTE"] = "ATTRIBUTE";
|
|
28
|
+
propertyType2["PROPERTY"] = "PROPERTY";
|
|
29
|
+
propertyType2["METRIC"] = "METRIC";
|
|
30
|
+
propertyType2["ACTION"] = "ACTION";
|
|
31
|
+
propertyType2["PARAMETER"] = "PARAMETER";
|
|
32
|
+
propertyType2["ALARM"] = "ALARM";
|
|
33
|
+
propertyType2["LOGIC"] = "LOGIC";
|
|
34
|
+
propertyType2["RELATION"] = "RELATION";
|
|
35
|
+
propertyType2["SETTING"] = "SETTING";
|
|
36
|
+
return propertyType2;
|
|
37
|
+
})(propertyType || {});
|
|
38
|
+
const paramsToString = obj => {
|
|
39
|
+
let arr = [];
|
|
40
|
+
for (let objKey in obj) {
|
|
41
|
+
arr.push(objKey + "=" + obj[objKey]);
|
|
42
|
+
}
|
|
43
|
+
return arr.join("&");
|
|
44
|
+
};
|
|
45
|
+
const resetHeader = token => {
|
|
46
|
+
const reqToken = token ?? sessionStorage.getItem("token");
|
|
47
|
+
if (!reqToken) {
|
|
48
|
+
throw new Error("\u6CA1\u6709token\uFF0C\u4E0D\u80FD\u83B7\u53D6");
|
|
49
|
+
}
|
|
50
|
+
const headers = {
|
|
51
|
+
token: reqToken,
|
|
52
|
+
"Content-Type": "application/json;charset=utf-8"
|
|
53
|
+
};
|
|
54
|
+
return headers;
|
|
55
|
+
};
|
|
56
|
+
const filterDataByEventEnableFun = data => {
|
|
57
|
+
for (let i of data.detailGroupList) {
|
|
58
|
+
i.thingPropertyValueVoList = i.thingPropertyValueVoList.filter(item => item.eventEnable);
|
|
59
|
+
}
|
|
60
|
+
return data;
|
|
61
|
+
};
|
|
62
|
+
const dataToPointCode = (data, pcs) => {
|
|
63
|
+
const pointCodeRecord = {};
|
|
64
|
+
for (let i in data) {
|
|
65
|
+
pointCodeRecord[i] = {};
|
|
66
|
+
if (!data[i]) continue;
|
|
67
|
+
const thingEntity = data[i].thingEntity;
|
|
68
|
+
let stateImg = thingEntity.img25dPoweroff;
|
|
69
|
+
for (let j of data[i].detailGroupList) {
|
|
70
|
+
for (let k of j.thingPropertyValueVoList) {
|
|
71
|
+
const setItem = () => {
|
|
72
|
+
if (k.thingPropertyCode === DEVICESTATE) {
|
|
73
|
+
stateImg = getThingStateImg(k.value, thingEntity);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
...k,
|
|
77
|
+
thingEntity,
|
|
78
|
+
thingCode: data[i].thingCode,
|
|
79
|
+
thingInstId: data[i].thingInstId,
|
|
80
|
+
stateImg
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
if (pcs && pcs.length > 0) {
|
|
84
|
+
if (pcs.includes(k.thingPropertyCode)) {
|
|
85
|
+
pointCodeRecord[i][k.thingPropertyCode] = setItem();
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
pointCodeRecord[i][k.thingPropertyCode] = setItem();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return pointCodeRecord;
|
|
94
|
+
};
|
|
95
|
+
const getThingStateImg = (v, d) => {
|
|
96
|
+
switch (v) {
|
|
97
|
+
case "0":
|
|
98
|
+
return d.img2dPoweroff;
|
|
99
|
+
case "1":
|
|
100
|
+
return d.img2dRun;
|
|
101
|
+
case "2":
|
|
102
|
+
return d.img2dAlarm;
|
|
103
|
+
case "3":
|
|
104
|
+
return d.img2dPoweron;
|
|
105
|
+
case 0:
|
|
106
|
+
return d.img2dPoweroff;
|
|
107
|
+
case 1:
|
|
108
|
+
return d.img2dRun;
|
|
109
|
+
case 2:
|
|
110
|
+
return d.img2dAlarm;
|
|
111
|
+
case 3:
|
|
112
|
+
return d.img2dPoweron;
|
|
113
|
+
default:
|
|
114
|
+
return d.img2dPoweroff;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const filterThingInstanceDetailByPc = async (res, pcs) => dataToPointCode(res, pcs);
|
|
118
|
+
|
|
119
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
120
|
+
__proto__: null,
|
|
121
|
+
DEVICESTATE: DEVICESTATE,
|
|
122
|
+
createId: createId,
|
|
123
|
+
dataToPointCode: dataToPointCode,
|
|
124
|
+
filterDataByEventEnableFun: filterDataByEventEnableFun,
|
|
125
|
+
filterThingInstanceDetailByPc: filterThingInstanceDetailByPc,
|
|
126
|
+
getThingStateImg: getThingStateImg,
|
|
127
|
+
paramsToString: paramsToString,
|
|
128
|
+
propertyType: propertyType,
|
|
129
|
+
resetHeader: resetHeader
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const pathList = location.pathname.split("/").filter(Boolean);
|
|
133
|
+
let thirdPartyPreffix = "";
|
|
134
|
+
if (pathList.length >= 2) {
|
|
135
|
+
thirdPartyPreffix = `/${pathList[0]}/`;
|
|
136
|
+
}
|
|
137
|
+
const getHistoryData = async params => {
|
|
138
|
+
const resPromise = await fetch(thirdPartyPreffix + "/api/mtip/thing/v2/thingInst/queryHistoryData", {
|
|
139
|
+
method: "POST",
|
|
140
|
+
headers: resetHeader(void 0),
|
|
141
|
+
body: JSON.stringify(params)
|
|
142
|
+
});
|
|
143
|
+
const res = await resPromise.json();
|
|
144
|
+
return res.data;
|
|
145
|
+
};
|
|
146
|
+
const getThingInstanceDetailByCode = async (codes, params) => {
|
|
147
|
+
const resPromise = await fetch(thirdPartyPreffix + "/api/mtip/thing/v2/thingInst/findByCodeList?" + paramsToString(params), {
|
|
148
|
+
method: "POST",
|
|
149
|
+
headers: resetHeader(params.token),
|
|
150
|
+
body: JSON.stringify(codes)
|
|
151
|
+
});
|
|
152
|
+
return resPromise;
|
|
153
|
+
};
|
|
154
|
+
const getThingInstanceDetailByUuid = async (codes, params) => {
|
|
155
|
+
const resPromise = await fetch(thirdPartyPreffix + "/api/mtip/thing/v2/thingInst/findByInstanceIdList?" + paramsToString(params), {
|
|
156
|
+
method: "POST",
|
|
157
|
+
headers: resetHeader(params.token),
|
|
158
|
+
body: JSON.stringify(codes)
|
|
159
|
+
});
|
|
160
|
+
return resPromise;
|
|
161
|
+
};
|
|
162
|
+
const getThingInstancePointData = async arr => {
|
|
163
|
+
const resPromise = await fetch(thirdPartyPreffix + "/api/mtip/thing/v2/thingClient/getPropertiesValueByCode", {
|
|
164
|
+
method: "POST",
|
|
165
|
+
headers: resetHeader(void 0),
|
|
166
|
+
body: JSON.stringify(arr)
|
|
167
|
+
});
|
|
168
|
+
const res = await resPromise.json();
|
|
169
|
+
return res.data;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const getThingInstanceDetail = async (codes, params, Markers, ff) => {
|
|
173
|
+
let resPromise;
|
|
174
|
+
if (Markers === "id") {
|
|
175
|
+
resPromise = await getThingInstanceDetailByUuid(codes, params);
|
|
176
|
+
} else {
|
|
177
|
+
resPromise = await getThingInstanceDetailByCode(codes, params);
|
|
178
|
+
}
|
|
179
|
+
const refhCodes = {};
|
|
180
|
+
const res = await resPromise.json();
|
|
181
|
+
if (!res.data) return refhCodes;
|
|
182
|
+
for (let i of codes) {
|
|
183
|
+
refhCodes[i] = null;
|
|
184
|
+
for (let instance of res.data) {
|
|
185
|
+
if (instance.thingInstCode === i) {
|
|
186
|
+
refhCodes[i] = !ff ? instance : filterDataByEventEnableFun(instance);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return refhCodes;
|
|
191
|
+
};
|
|
192
|
+
const createGetThingInstanceDetail = async opt => {
|
|
193
|
+
const {
|
|
194
|
+
codes,
|
|
195
|
+
params,
|
|
196
|
+
markers,
|
|
197
|
+
filterDataByEventEnable,
|
|
198
|
+
proptypeCodes
|
|
199
|
+
} = opt;
|
|
200
|
+
const data = await getThingInstanceDetail(codes, params, markers, filterDataByEventEnable);
|
|
201
|
+
const pointData = dataToPointCode(data || {}, proptypeCodes || []);
|
|
202
|
+
let firstLoading = false;
|
|
203
|
+
return async () => {
|
|
204
|
+
if (!firstLoading) {
|
|
205
|
+
firstLoading = true;
|
|
206
|
+
return pointData;
|
|
207
|
+
}
|
|
208
|
+
const pointCodes = [];
|
|
209
|
+
for (let i in pointData) {
|
|
210
|
+
for (let n in pointData[i]) {
|
|
211
|
+
const item = pointData[i][n];
|
|
212
|
+
pointCodes.push({
|
|
213
|
+
thingCode: item.thingCode,
|
|
214
|
+
thingInstCode: i,
|
|
215
|
+
thingPropertyCode: n,
|
|
216
|
+
thingInstId: item.thingInstId
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const thingInstancePointData = await getThingInstancePointData(pointCodes);
|
|
221
|
+
for (let item of thingInstancePointData || []) {
|
|
222
|
+
const {
|
|
223
|
+
thingInstCode,
|
|
224
|
+
thingPropertyCode
|
|
225
|
+
} = item;
|
|
226
|
+
const propertyItem = pointData[thingInstCode][thingPropertyCode];
|
|
227
|
+
if (pointData[thingInstCode] && propertyItem) {
|
|
228
|
+
if (thingPropertyCode === DEVICESTATE) {
|
|
229
|
+
const stateImg = getThingStateImg(item.value, propertyItem.thingEntity);
|
|
230
|
+
propertyItem.stateImg = stateImg;
|
|
231
|
+
}
|
|
232
|
+
propertyItem.value = item.value;
|
|
233
|
+
propertyItem.displayValue = item.displayValue;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return pointData;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const createGetHistoryData = async (codes, pcs, params) => {
|
|
241
|
+
const data = await getThingInstanceDetail(codes, params, "code");
|
|
242
|
+
const instanceData = dataToPointCode(data, pcs);
|
|
243
|
+
const requestPrePointVoList2 = [];
|
|
244
|
+
for (let i in instanceData) {
|
|
245
|
+
for (let j in instanceData[i]) {
|
|
246
|
+
if (instanceData[i][j].pointCode) {
|
|
247
|
+
requestPrePointVoList2.push({
|
|
248
|
+
pointCode: instanceData[i][j].pointCode,
|
|
249
|
+
thingPropertyId: instanceData[i][j].thingPropertyId,
|
|
250
|
+
thingPropertyInstId: instanceData[i][j].thingPropertyInstId
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return async (startTime, endTime, downsample) => {
|
|
256
|
+
const historyData = await getHistoryData({
|
|
257
|
+
requestPrePointVoList: requestPrePointVoList2,
|
|
258
|
+
startTime,
|
|
259
|
+
endTime,
|
|
260
|
+
downsample
|
|
261
|
+
});
|
|
262
|
+
for (let i of historyData) {
|
|
263
|
+
for (let j in instanceData) {
|
|
264
|
+
for (let k in instanceData[j]) {
|
|
265
|
+
if (instanceData[j][k].pointCode === i.pointCode) {
|
|
266
|
+
instanceData[j][k].historyDataList = i.historyDataList || [];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return instanceData;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const getThingInstanceStatus = async code => {
|
|
276
|
+
const params = [];
|
|
277
|
+
const res = {};
|
|
278
|
+
for (let i of code) {
|
|
279
|
+
params.push({
|
|
280
|
+
thingInstCode: i,
|
|
281
|
+
thingPropertyCode: DEVICESTATE
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
const instanceDetail = await getThingInstancePointData(params);
|
|
285
|
+
for (let i of instanceDetail) {
|
|
286
|
+
res[i.thingInstCode] = i;
|
|
287
|
+
}
|
|
288
|
+
return res;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
var thing = /*#__PURE__*/Object.freeze({
|
|
292
|
+
__proto__: null,
|
|
293
|
+
createGetHistoryData: createGetHistoryData,
|
|
294
|
+
createGetThingInstanceDetail: createGetThingInstanceDetail,
|
|
295
|
+
getThingInstanceDetail: getThingInstanceDetail,
|
|
296
|
+
getThingInstanceStatus: getThingInstanceStatus
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
const queryOnDutyPerson = async () => {};
|
|
300
|
+
|
|
301
|
+
var common = /*#__PURE__*/Object.freeze({
|
|
302
|
+
__proto__: null,
|
|
303
|
+
queryOnDutyPerson: queryOnDutyPerson
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
var app = {
|
|
307
|
+
thing,
|
|
308
|
+
common
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
var three = {
|
|
312
|
+
three: THREE,
|
|
313
|
+
Stats
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const clientUtils = {
|
|
317
|
+
http: {
|
|
318
|
+
ofetch,
|
|
319
|
+
axios
|
|
320
|
+
},
|
|
321
|
+
G2,
|
|
322
|
+
app,
|
|
323
|
+
tools: {
|
|
324
|
+
inl,
|
|
325
|
+
...utils,
|
|
326
|
+
_,
|
|
327
|
+
vueUse,
|
|
328
|
+
dayjs,
|
|
329
|
+
onMounted,
|
|
330
|
+
three,
|
|
331
|
+
antdv,
|
|
332
|
+
vant,
|
|
333
|
+
iconsVue,
|
|
334
|
+
Decimal
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
export { clientUtils as default };
|