@ganwei-web/gw-base-components-plus 1.0.29 → 1.0.31
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/equipProcessing/dist/index.es.js +127 -128
- package/equipProcessing/dist/index.umd.js +1 -1
- package/formdesigner/assets/img/fixedTableForm.png +0 -0
- package/formdesigner/assets/img/groupForm.png +0 -0
- package/formdesigner/assets/img/masterSlaveForm.png +0 -0
- package/formdesigner/assets/img/multiColumnForm.png +0 -0
- package/formdesigner/assets/img/questionnaire.png +0 -0
- package/formdesigner/assets/img/responsiveForm.png +0 -0
- package/formdesigner/assets/img/singleExampleForm.png +0 -0
- package/formdesigner/assets/img/tabForm.png +0 -0
- package/formdesigner/assets/img/user.jpeg +0 -0
- package/formdesigner/assets/json/fixedTableForm.json +4616 -0
- package/formdesigner/assets/json/groupForm.json +875 -0
- package/formdesigner/assets/json/masterSlaveForm.json +1072 -0
- package/formdesigner/assets/json/multiColumnForm.json +1 -0
- package/formdesigner/assets/json/questionnaire.json +574 -0
- package/formdesigner/assets/json/responsiveForm.json +814 -0
- package/formdesigner/assets/json/singleExampleForm.json +536 -0
- package/formdesigner/assets/json/tabForm.json +585 -0
- package/formdesigner/formdesigner.scss +134 -0
- package/formdesigner/formdesigner.vue +59 -0
- package/formdesigner/templatesConfig.js +79 -0
- package/formdesigner/vform/designer.style.css +12072 -0
- package/formdesigner/vform/designer.umd.js +263878 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
class
|
|
3
|
-
constructor(
|
|
4
|
-
this.url =
|
|
1
|
+
import * as a from "@aspnet/signalr";
|
|
2
|
+
class d {
|
|
3
|
+
constructor(e, i, t) {
|
|
4
|
+
this.url = e, this.connectionId = i, this.equipNo = t, this.signalr = null;
|
|
5
5
|
}
|
|
6
6
|
openConnect() {
|
|
7
|
-
return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new
|
|
7
|
+
return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new a.HubConnectionBuilder().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise((e) => {
|
|
8
8
|
this.signalr.start().then(() => {
|
|
9
|
-
this.connectionId && this.send(),
|
|
9
|
+
this.connectionId && this.send(), e(this.signalr);
|
|
10
10
|
}).catch((i) => {
|
|
11
11
|
console.log(i);
|
|
12
12
|
});
|
|
@@ -15,38 +15,38 @@ class a {
|
|
|
15
15
|
async send() {
|
|
16
16
|
try {
|
|
17
17
|
await this.signalr.invoke(this.connectionId, this.equipNo);
|
|
18
|
-
} catch (
|
|
19
|
-
console.log("connectHub 连接失败" +
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.log("connectHub 连接失败" + e);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
class c {
|
|
24
24
|
constructor() {
|
|
25
|
-
this.eGroupNotify = new
|
|
25
|
+
this.eGroupNotify = new d("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.winRef = window;
|
|
26
26
|
try {
|
|
27
|
-
window.top.equipGroup,
|
|
27
|
+
window.top.equipGroup, this.winRef = window.top;
|
|
28
28
|
} catch {
|
|
29
|
-
|
|
29
|
+
this.winRef = window;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
stop() {
|
|
33
33
|
this.notify && this.notify.stop();
|
|
34
34
|
}
|
|
35
35
|
Init() {
|
|
36
|
-
this.eGroupNotify.openConnect().then((
|
|
37
|
-
this.notify =
|
|
36
|
+
this.eGroupNotify.openConnect().then((e) => {
|
|
37
|
+
this.notify = e;
|
|
38
38
|
try {
|
|
39
|
-
|
|
39
|
+
e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree");
|
|
40
40
|
} catch (i) {
|
|
41
41
|
console.log(i);
|
|
42
42
|
}
|
|
43
|
-
this.subscribeTo(
|
|
43
|
+
this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
e.invoke("GetGroupEquips");
|
|
46
46
|
} catch (i) {
|
|
47
47
|
console.log(i);
|
|
48
48
|
}
|
|
49
|
-
this.subscribeTo(
|
|
49
|
+
this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "CopyEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose((i) => {
|
|
50
50
|
try {
|
|
51
51
|
this.Init();
|
|
52
52
|
} catch (t) {
|
|
@@ -54,187 +54,186 @@ class c {
|
|
|
54
54
|
}
|
|
55
55
|
console.log("重连", i);
|
|
56
56
|
});
|
|
57
|
-
}).catch((
|
|
58
|
-
console.error(
|
|
57
|
+
}).catch((e) => {
|
|
58
|
+
console.error(e);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
subscribeTo(
|
|
62
|
-
|
|
61
|
+
subscribeTo(e, i) {
|
|
62
|
+
e.off(i), e.on(i, (t) => {
|
|
63
63
|
t && t.isSuccess && (this[i] ? this[i](t.data) : this.notice({ func: i, data: t.data, key: t.groupId }));
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
// 获取分组---无权限管理的分组列表--空设备分组不展示
|
|
67
|
-
GetEquipGroupTree(
|
|
68
|
-
|
|
67
|
+
GetEquipGroupTree(e) {
|
|
68
|
+
this.winRef.groupList || (this.winRef.groupList = e, this.notice({ type: "GetEquipGroupTree" }));
|
|
69
69
|
}
|
|
70
70
|
// 获取全量分组---设备管理使用
|
|
71
|
-
GetAllEquipGroupTree(
|
|
72
|
-
|
|
71
|
+
GetAllEquipGroupTree(e) {
|
|
72
|
+
this.winRef.groupList_manageMent || (this.winRef.groupList_manageMent = e, this.notice({ type: "GetEquipGroupTreeWidthTreeType" }));
|
|
73
73
|
}
|
|
74
74
|
// 新增分组
|
|
75
|
-
AddEquipGroup(
|
|
76
|
-
const { parentGroupId: i, groupId: t, groupName:
|
|
77
|
-
t && (
|
|
75
|
+
AddEquipGroup(e) {
|
|
76
|
+
const { parentGroupId: i, groupId: t, groupName: s } = e || {};
|
|
77
|
+
t && (this.winRef.groupList_manageMent || (this.winRef.groupList_manageMent = []), this.winRef.groupList_manageMent.push({
|
|
78
78
|
parentId: i,
|
|
79
79
|
id: t,
|
|
80
|
-
name:
|
|
80
|
+
name: s,
|
|
81
81
|
equipCount: 0
|
|
82
|
-
}), this.notice({ type: "AddEquipGroup", data:
|
|
82
|
+
}), this.notice({ type: "AddEquipGroup", data: e }));
|
|
83
83
|
}
|
|
84
84
|
// 编辑分组
|
|
85
|
-
EditEquipGroup(
|
|
86
|
-
const { groupId: i, groupName: t } =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
|
|
91
|
-
}), this.notice({ type: "EditEquipGroup", data:
|
|
92
|
-
}
|
|
93
|
-
deleteChildGroup(
|
|
85
|
+
EditEquipGroup(e) {
|
|
86
|
+
const { groupId: i, groupName: t } = e;
|
|
87
|
+
this.winRef.groupList && this.winRef.groupList.forEach((s) => {
|
|
88
|
+
s.id == i && (s.name = t);
|
|
89
|
+
}), this.winRef.groupList_manageMent && this.winRef.groupList_manageMent.forEach((s) => {
|
|
90
|
+
s.id == i && (s.name = t);
|
|
91
|
+
}), this.notice({ type: "EditEquipGroup", data: e });
|
|
92
|
+
}
|
|
93
|
+
deleteChildGroup(e, i) {
|
|
94
94
|
let t = [];
|
|
95
|
-
i.forEach((
|
|
96
|
-
|
|
97
|
-
}), t.forEach((
|
|
98
|
-
let
|
|
99
|
-
|
|
95
|
+
i.forEach((s) => {
|
|
96
|
+
s.parentId == e && t.push(s.id);
|
|
97
|
+
}), t.forEach((s) => {
|
|
98
|
+
let o = i.findIndex((n) => n.id == s);
|
|
99
|
+
o > -1 && i.splice(o, 1), this.deleteChildGroup(s, i);
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
// 删除分组
|
|
103
|
-
DeleteEquipGroup(
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
let t =
|
|
107
|
-
t > -1 &&
|
|
103
|
+
DeleteEquipGroup(e) {
|
|
104
|
+
e.forEach((i) => {
|
|
105
|
+
if (this.winRef.groupList) {
|
|
106
|
+
let t = this.winRef.groupList.findIndex((s) => s.id == i.groupId);
|
|
107
|
+
t > -1 && this.winRef.groupList.splice(t, 1), this.deleteChildGroup(i.groupId, this.winRef.groupList);
|
|
108
108
|
}
|
|
109
|
-
if (
|
|
110
|
-
let t =
|
|
111
|
-
t > -1 &&
|
|
109
|
+
if (this.winRef.groupList_manageMent) {
|
|
110
|
+
let t = this.winRef.groupList_manageMent.findIndex((s) => s.id == i.groupId);
|
|
111
|
+
t > -1 && this.winRef.groupList_manageMent.splice(t, 1), this.deleteChildGroup(i.groupId, this.winRef.groupList_manageMent);
|
|
112
112
|
}
|
|
113
|
-
}), this.notice({ type: "DeleteEquipGroup", data:
|
|
113
|
+
}), this.notice({ type: "DeleteEquipGroup", data: e });
|
|
114
114
|
}
|
|
115
115
|
// 获取设备
|
|
116
|
-
GetGroupEquips(
|
|
117
|
-
const { groupId: i, equips: t } =
|
|
118
|
-
this.alreadyUpdate[i] || (
|
|
119
|
-
|
|
120
|
-
}),
|
|
116
|
+
GetGroupEquips(e) {
|
|
117
|
+
const { groupId: i, equips: t } = e || {};
|
|
118
|
+
this.alreadyUpdate[i] || (this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[i] = {}, i && t && t instanceof Array && (t.forEach((s) => {
|
|
119
|
+
s.title = s.name, s.groupId = i, s.equipNo = s.id, delete s.name, this.winRef.equipCache || (this.winRef.equipCache = {}), this.winRef.equipCache[s.id] = s, this.winRef.groupCache[i][s.id] = s;
|
|
120
|
+
}), this.winRef[`group-${i}`] = t, this.notice({ type: "GetGroupEquips", data: { groupId: i } }), this.alreadyUpdate[i] = !0));
|
|
121
121
|
}
|
|
122
122
|
// 新增设备
|
|
123
|
-
AddEquip(
|
|
124
|
-
const { groupId: i, equips: t } =
|
|
125
|
-
|
|
126
|
-
let
|
|
123
|
+
AddEquip(e) {
|
|
124
|
+
const { groupId: i, equips: t } = e || {};
|
|
125
|
+
this.winRef[`group-${i}`] || (this.winRef[`group-${i}`] = []), this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[i] || (this.winRef.groupCache[i] = {}), this.winRef.equipCache || (this.winRef.equipCache = {});
|
|
126
|
+
let s = this.winRef[`group-${i}`].length;
|
|
127
127
|
if (i && t) {
|
|
128
|
-
if (t.forEach((
|
|
129
|
-
|
|
128
|
+
if (t.forEach((o, n) => {
|
|
129
|
+
this.winRef[`group-${i}`].push(
|
|
130
130
|
{
|
|
131
|
-
equipNo:
|
|
131
|
+
equipNo: o.id,
|
|
132
132
|
groupId: i,
|
|
133
|
-
id:
|
|
134
|
-
title:
|
|
133
|
+
id: o.id,
|
|
134
|
+
title: o.name
|
|
135
135
|
}
|
|
136
|
-
),
|
|
137
|
-
}), !this.exist(i,
|
|
138
|
-
let
|
|
139
|
-
|
|
136
|
+
), this.winRef.equipCache[o.id] = this.winRef[`group-${i}`][s + n], this.winRef.groupCache[i][o.id] = this.winRef[`group-${i}`][s + n];
|
|
137
|
+
}), !this.exist(i, this.winRef.groupList)) {
|
|
138
|
+
let o = this.findParentList(i, this.winRef.groupList_manageMent);
|
|
139
|
+
this.winRef.groupList.push(...o);
|
|
140
140
|
}
|
|
141
|
-
this.notice({ type: "AddEquip", data:
|
|
141
|
+
this.notice({ type: "AddEquip", data: e });
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
CopyEquips(
|
|
145
|
-
const { targetGroupId: i, equips: t } =
|
|
144
|
+
CopyEquips(e) {
|
|
145
|
+
const { targetGroupId: i, equips: t } = e || {};
|
|
146
146
|
if (!i || !t || !Array.isArray(t)) {
|
|
147
|
-
console.warn("CopyEquips: 无效的数据格式",
|
|
147
|
+
console.warn("CopyEquips: 无效的数据格式", e);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
let
|
|
151
|
-
|
|
152
|
-
!
|
|
153
|
-
const
|
|
154
|
-
id:
|
|
150
|
+
let s = [i], o = [];
|
|
151
|
+
this.winRef[`group-${i}`] || (this.winRef[`group-${i}`] = [], o.push(i)), this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[i] || (this.winRef.groupCache[i] = {}), this.winRef.equipCache || (this.winRef.equipCache = {}), t.forEach((n) => {
|
|
152
|
+
!n.name && this.winRef.equipCache && this.winRef.equipCache[n.id] && (n.name = this.winRef.equipCache[n.id].title || this.winRef.equipCache[n.id].name);
|
|
153
|
+
const h = {
|
|
154
|
+
id: n.id,
|
|
155
155
|
// 新设备的ID(后端生成)
|
|
156
|
-
equipNo:
|
|
156
|
+
equipNo: n.id,
|
|
157
157
|
groupId: i,
|
|
158
158
|
// 目标分组ID
|
|
159
|
-
title:
|
|
159
|
+
title: n.name || "",
|
|
160
160
|
// 设备名称
|
|
161
|
-
name:
|
|
161
|
+
name: n.name || ""
|
|
162
162
|
// 保留name属性
|
|
163
163
|
};
|
|
164
|
-
|
|
165
|
-
}),
|
|
166
|
-
if (!this.exist(
|
|
167
|
-
let
|
|
168
|
-
|
|
164
|
+
this.winRef.equipCache[n.id] = h, this.winRef.groupCache[i][n.id] = h, this.winRef[`group-${i}`].push(h);
|
|
165
|
+
}), o.forEach((n) => {
|
|
166
|
+
if (!this.exist(n, this.winRef.groupList)) {
|
|
167
|
+
let h = this.findParentList(n, this.winRef.groupList_manageMent);
|
|
168
|
+
this.winRef.groupList.push(...h);
|
|
169
169
|
}
|
|
170
170
|
}), this.notice({
|
|
171
171
|
type: "moveEquips",
|
|
172
172
|
data: {
|
|
173
|
-
updateGroups:
|
|
173
|
+
updateGroups: s,
|
|
174
174
|
buildTree: !1,
|
|
175
175
|
targetGroupId: i,
|
|
176
176
|
equipCount: t.length
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
moveEquips(
|
|
181
|
-
let i = [], t = !0,
|
|
182
|
-
const { sourceGroup:
|
|
183
|
-
|
|
184
|
-
if (i.push(
|
|
185
|
-
if (
|
|
186
|
-
let
|
|
187
|
-
|
|
180
|
+
moveEquips(e) {
|
|
181
|
+
let i = [], t = !0, s = [];
|
|
182
|
+
const { sourceGroup: o, targetGroupId: n } = e || {};
|
|
183
|
+
n && i.push(n), o.forEach((h) => {
|
|
184
|
+
if (i.push(h.groupId), (!this.winRef[`group-${n}`] || !this.winRef[`group-${n}`].length) && (this.winRef[`group-${n}`] = [], s.push(n)), this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[n] || (this.winRef.groupCache[n] = {}), h.equips.forEach((r) => {
|
|
185
|
+
if (r.title = r.name, r.groupId = n, r.equipNo = r.id, this.winRef[`group-${h.groupId}`]) {
|
|
186
|
+
let p = this.winRef[`group-${h.groupId}`].findIndex((f) => f.id == r.id);
|
|
187
|
+
p > -1 && this.winRef[`group-${h.groupId}`].splice(p, 1);
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
}), !
|
|
191
|
-
let
|
|
192
|
-
|
|
189
|
+
this.winRef.equipCache || (this.winRef.equipCache = {}), this.winRef.equipCache[r.id] = r, this.winRef.groupCache[n][r.id] = r, this.winRef[`group-${n}`].push(r);
|
|
190
|
+
}), !this.winRef[`group-${h.groupId}`].length) {
|
|
191
|
+
let r = this.winRef.groupList.findIndex((p) => p.id == h.groupId);
|
|
192
|
+
r > -1 && this.winRef.groupList.splice(r, 1), this.deleteChildGroup(h.groupId, this.winRef.groupList);
|
|
193
193
|
}
|
|
194
|
-
}),
|
|
195
|
-
if (!this.exist(
|
|
196
|
-
let
|
|
197
|
-
|
|
194
|
+
}), s.forEach((h) => {
|
|
195
|
+
if (!this.exist(h, this.winRef.groupList)) {
|
|
196
|
+
let r = this.findParentList(h, this.winRef.groupList_manageMent);
|
|
197
|
+
this.winRef.groupList.push(...r);
|
|
198
198
|
}
|
|
199
199
|
}), this.notice({ type: "moveEquips", data: { updateGroups: i, buildTree: t } });
|
|
200
200
|
}
|
|
201
|
-
exist(
|
|
202
|
-
return i ? i.some((t) => t.id ==
|
|
201
|
+
exist(e, i) {
|
|
202
|
+
return i ? i.some((t) => t.id == e) : !1;
|
|
203
203
|
}
|
|
204
|
-
findParentList(
|
|
204
|
+
findParentList(e, i) {
|
|
205
205
|
let t = [];
|
|
206
206
|
if (i) {
|
|
207
|
-
let
|
|
208
|
-
|
|
207
|
+
let s = i.findIndex((o) => o.id == e);
|
|
208
|
+
s > -1 && t.push({ ...i[s] }), i[s].parentId && !this.exist(i[s].parentId, this.winRef.groupList) && t.push(...this.findParentList(i[s].parentId, this.winRef.groupList_manageMent));
|
|
209
209
|
}
|
|
210
210
|
return t;
|
|
211
211
|
}
|
|
212
212
|
// 删除设备
|
|
213
|
-
DeleteEquip(
|
|
214
|
-
const { groupId: i, equips: t } =
|
|
213
|
+
DeleteEquip(e) {
|
|
214
|
+
const { groupId: i, equips: t } = e || {};
|
|
215
215
|
if (i && t && t instanceof Array) {
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
let
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
this.notice({ type: "DeleteEquip", data:
|
|
216
|
+
if (this.winRef[`group-${i}`]) {
|
|
217
|
+
for (let s = 0, o = t.length; s < o; s++) {
|
|
218
|
+
let n = this.winRef[`group-${i}`].findIndex((h) => h.id == t[s].id);
|
|
219
|
+
n > -1 && this.winRef[`group-${i}`].splice(n, 1), delete this.winRef.equipCache[t[s].id], delete this.winRef.groupCache[i][t[s].id];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this.notice({ type: "DeleteEquip", data: e });
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
// 编辑设备
|
|
226
|
-
EditEquip(
|
|
227
|
-
const { equipNo: i, groupId: t, equipName:
|
|
228
|
-
t && i && (
|
|
226
|
+
EditEquip(e) {
|
|
227
|
+
const { equipNo: i, groupId: t, equipName: s } = e || {};
|
|
228
|
+
t && i && (this.winRef[`group-${t}`] && (this.winRef.equipCache[i] = s), this.notice({ type: "EditEquip", data: e }));
|
|
229
229
|
}
|
|
230
|
-
notice(
|
|
231
|
-
if (
|
|
230
|
+
notice(e) {
|
|
231
|
+
if (this.winRef.hasIframe) {
|
|
232
232
|
let i = document.getElementsByTagName("iframe");
|
|
233
|
-
for (let t of i) { t.contentWindow.postMessage(
|
|
234
|
-
} else {
|
|
233
|
+
for (let t of i) { t.contentWindow.postMessage(e); }
|
|
234
|
+
} else { this.winRef.postMessage(e, "*"); }
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
export {
|
|
238
238
|
c as equipCache,
|
|
239
|
-
|
|
240
|
-
};
|
|
239
|
+
d as Signalr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function
|
|
1
|
+
(function(p, f){ typeof exports == "object" && typeof module < "u" ? f(exports, require("@aspnet/signalr")) : typeof define == "function" && define.amd ? define(["exports", "@aspnet/signalr"], f) : (p = typeof globalThis < "u" ? globalThis : p || self, f(p.index = {}, p.SignalR)) })(this, function(p, f){ "use strict";function c(u){ const e = Object.create(null, {[Symbol.toStringTag]: {value: "Module"}});if(u){ for(const i in u){ if(i !== "default"){ const t = Object.getOwnPropertyDescriptor(u, i);Object.defineProperty(e, i, t.get ? t : {enumerable: !0, get: ()=>u[i]}) } } }return e.default = u, Object.freeze(e) }const g = c(f);class d{constructor(e, i, t){ this.url = e, this.connectionId = i, this.equipNo = t, this.signalr = null }openConnect(){ return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new g.HubConnectionBuilder().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise(e=>{ this.signalr.start().then(()=>{ this.connectionId && this.send(), e(this.signalr) }).catch(i=>{ console.log(i) }) }) }async send(){ try{ await this.signalr.invoke(this.connectionId, this.equipNo) }catch(e){ console.log("connectHub 连接失败" + e) } }}class l{constructor(){ this.eGroupNotify = new d("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.winRef = window;try{ window.top.equipGroup, this.winRef = window.top }catch{ this.winRef = window } }stop(){ this.notify && this.notify.stop() }Init(){ this.eGroupNotify.openConnect().then(e=>{ this.notify = e;try{ e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree") }catch(i){ console.log(i) }this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");try{ e.invoke("GetGroupEquips") }catch(i){ console.log(i) }this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "CopyEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose(i=>{ try{ this.Init() }catch(t){ console.log(t) }console.log("重连", i) }) }).catch(e=>{ console.error(e) }) }subscribeTo(e, i){ e.off(i), e.on(i, t=>{ t && t.isSuccess && (this[i] ? this[i](t.data) : this.notice({func: i, data: t.data, key: t.groupId})) }) }GetEquipGroupTree(e){ this.winRef.groupList || (this.winRef.groupList = e, this.notice({type: "GetEquipGroupTree"})) }GetAllEquipGroupTree(e){ this.winRef.groupList_manageMent || (this.winRef.groupList_manageMent = e, this.notice({type: "GetEquipGroupTreeWidthTreeType"})) }AddEquipGroup(e){ const{parentGroupId: i, groupId: t, groupName: s} = e || {};t && (this.winRef.groupList_manageMent || (this.winRef.groupList_manageMent = []), this.winRef.groupList_manageMent.push({parentId: i, id: t, name: s, equipCount: 0}), this.notice({type: "AddEquipGroup", data: e})) }EditEquipGroup(e){ const{groupId: i, groupName: t} = e;this.winRef.groupList && this.winRef.groupList.forEach(s=>{ s.id == i && (s.name = t) }), this.winRef.groupList_manageMent && this.winRef.groupList_manageMent.forEach(s=>{ s.id == i && (s.name = t) }), this.notice({type: "EditEquipGroup", data: e}) }deleteChildGroup(e, i){ let t = [];i.forEach(s=>{ s.parentId == e && t.push(s.id) }), t.forEach(s=>{ let o = i.findIndex(n=>n.id == s);o > -1 && i.splice(o, 1), this.deleteChildGroup(s, i) }) }DeleteEquipGroup(e){ e.forEach(i=>{ if(this.winRef.groupList){ let t = this.winRef.groupList.findIndex(s=>s.id == i.groupId);t > -1 && this.winRef.groupList.splice(t, 1), this.deleteChildGroup(i.groupId, this.winRef.groupList) }if(this.winRef.groupList_manageMent){ let t = this.winRef.groupList_manageMent.findIndex(s=>s.id == i.groupId);t > -1 && this.winRef.groupList_manageMent.splice(t, 1), this.deleteChildGroup(i.groupId, this.winRef.groupList_manageMent) } }), this.notice({type: "DeleteEquipGroup", data: e}) }GetGroupEquips(e){ const{groupId: i, equips: t} = e || {};this.alreadyUpdate[i] || (this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[i] = {}, i && t && t instanceof Array && (t.forEach(s=>{ s.title = s.name, s.groupId = i, s.equipNo = s.id, delete s.name, this.winRef.equipCache || (this.winRef.equipCache = {}), this.winRef.equipCache[s.id] = s, this.winRef.groupCache[i][s.id] = s }), this.winRef[`group-${i}`] = t, this.notice({type: "GetGroupEquips", data: {groupId: i}}), this.alreadyUpdate[i] = !0)) }AddEquip(e){ const{groupId: i, equips: t} = e || {};this.winRef[`group-${i}`] || (this.winRef[`group-${i}`] = []), this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[i] || (this.winRef.groupCache[i] = {}), this.winRef.equipCache || (this.winRef.equipCache = {});let s = this.winRef[`group-${i}`].length;if(i && t){ if(t.forEach((o, n)=>{ this.winRef[`group-${i}`].push({equipNo: o.id, groupId: i, id: o.id, title: o.name}), this.winRef.equipCache[o.id] = this.winRef[`group-${i}`][s + n], this.winRef.groupCache[i][o.id] = this.winRef[`group-${i}`][s + n] }), !this.exist(i, this.winRef.groupList)){ let o = this.findParentList(i, this.winRef.groupList_manageMent);this.winRef.groupList.push(...o) }this.notice({type: "AddEquip", data: e}) } }CopyEquips(e){ const{targetGroupId: i, equips: t} = e || {};if(!i || !t || !Array.isArray(t)){ console.warn("CopyEquips: 无效的数据格式", e);return }let s = [i], o = [];this.winRef[`group-${i}`] || (this.winRef[`group-${i}`] = [], o.push(i)), this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[i] || (this.winRef.groupCache[i] = {}), this.winRef.equipCache || (this.winRef.equipCache = {}), t.forEach(n=>{ !n.name && this.winRef.equipCache && this.winRef.equipCache[n.id] && (n.name = this.winRef.equipCache[n.id].title || this.winRef.equipCache[n.id].name);const h = {id: n.id, equipNo: n.id, groupId: i, title: n.name || "", name: n.name || ""};this.winRef.equipCache[n.id] = h, this.winRef.groupCache[i][n.id] = h, this.winRef[`group-${i}`].push(h) }), o.forEach(n=>{ if(!this.exist(n, this.winRef.groupList)){ let h = this.findParentList(n, this.winRef.groupList_manageMent);this.winRef.groupList.push(...h) } }), this.notice({type: "moveEquips", data: {updateGroups: s, buildTree: !1, targetGroupId: i, equipCount: t.length}}) }moveEquips(e){ let i = [], t = !0, s = [];const{sourceGroup: o, targetGroupId: n} = e || {};n && i.push(n), o.forEach(h=>{ if(i.push(h.groupId), (!this.winRef[`group-${n}`] || !this.winRef[`group-${n}`].length) && (this.winRef[`group-${n}`] = [], s.push(n)), this.winRef.groupCache || (this.winRef.groupCache = {}), this.winRef.groupCache[n] || (this.winRef.groupCache[n] = {}), h.equips.forEach(r=>{ if(r.title = r.name, r.groupId = n, r.equipNo = r.id, this.winRef[`group-${h.groupId}`]){ let a = this.winRef[`group-${h.groupId}`].findIndex(w=>w.id == r.id);a > -1 && this.winRef[`group-${h.groupId}`].splice(a, 1) }this.winRef.equipCache || (this.winRef.equipCache = {}), this.winRef.equipCache[r.id] = r, this.winRef.groupCache[n][r.id] = r, this.winRef[`group-${n}`].push(r) }), !this.winRef[`group-${h.groupId}`].length){ let r = this.winRef.groupList.findIndex(a=>a.id == h.groupId);r > -1 && this.winRef.groupList.splice(r, 1), this.deleteChildGroup(h.groupId, this.winRef.groupList) } }), s.forEach(h=>{ if(!this.exist(h, this.winRef.groupList)){ let r = this.findParentList(h, this.winRef.groupList_manageMent);this.winRef.groupList.push(...r) } }), this.notice({type: "moveEquips", data: {updateGroups: i, buildTree: t}}) }exist(e, i){ return i ? i.some(t=>t.id == e) : !1 }findParentList(e, i){ let t = [];if(i){ let s = i.findIndex(o=>o.id == e);s > -1 && t.push({...i[s]}), i[s].parentId && !this.exist(i[s].parentId, this.winRef.groupList) && t.push(...this.findParentList(i[s].parentId, this.winRef.groupList_manageMent)) }return t }DeleteEquip(e){ const{groupId: i, equips: t} = e || {};if(i && t && t instanceof Array){ if(this.winRef[`group-${i}`]){ for(let s = 0, o = t.length;s < o;s++){ let n = this.winRef[`group-${i}`].findIndex(h=>h.id == t[s].id);n > -1 && this.winRef[`group-${i}`].splice(n, 1), delete this.winRef.equipCache[t[s].id], delete this.winRef.groupCache[i][t[s].id] } }this.notice({type: "DeleteEquip", data: e}) } }EditEquip(e){ const{equipNo: i, groupId: t, equipName: s} = e || {};t && i && (this.winRef[`group-${t}`] && (this.winRef.equipCache[i] = s), this.notice({type: "EditEquip", data: e})) }notice(e){ if(this.winRef.hasIframe){ let i = document.getElementsByTagName("iframe");for(let t of i){ t.contentWindow.postMessage(e) } }else { this.winRef.postMessage(e, "*") } }}p.Signalr = d, p.equipCache = l, Object.defineProperty(p, Symbol.toStringTag, {value: "Module"}) });
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|