@das-fed/ui 7.1.0 → 7.1.1
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/package.json +5 -5
- package/packages/business-components/device-panel/index.js +6 -6
- package/packages/business-components/device-panel/index.js.gz +0 -0
- package/packages/business-components/device-panel/style.css +1 -1
- package/packages/business-components/device-panel/style.css.gz +0 -0
- package/packages/business-components/export-button/index.js +120 -114
- package/packages/business-components/export-button/index.js.gz +0 -0
- package/packages/business-components/process-form/index.js +315 -312
- package/packages/business-components/process-form/index.js.gz +0 -0
|
Binary file
|
|
@@ -1,90 +1,96 @@
|
|
|
1
1
|
import '@das-fed/ui/packages/business-components/export-button/style.css';
|
|
2
|
-
import { withInstall as
|
|
3
|
-
import { ref as p, defineComponent as
|
|
4
|
-
import { t as
|
|
5
|
-
import { DasDialog as
|
|
6
|
-
import { DasProgress as
|
|
7
|
-
import { DasButton as
|
|
8
|
-
import { iotProgress as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { withInstall as J } from "@das-fed/utils/with-install/index";
|
|
3
|
+
import { ref as p, defineComponent as K, computed as Q, watch as I, createElementBlock as W, openBlock as Z, createVNode as D, createCommentVNode as ee, unref as h, withCtx as M, renderSlot as te, createTextVNode as se, toDisplayString as ae, isRef as H } from "vue";
|
|
4
|
+
import { t as v, currentLang as V, i18n as $, setI18nRule as oe } from "@das-fed/web/packages/i18n/index";
|
|
5
|
+
import { DasDialog as re } from "@das-fed/ui/packages/components/dialog/index";
|
|
6
|
+
import { DasProgress as le } from "@das-fed/ui/packages/components/progress/index";
|
|
7
|
+
import { DasButton as ne } from "@das-fed/ui/packages/components/button/index";
|
|
8
|
+
import { iotProgress as ue } from "@das-fed/utils/api-services/modules/iot";
|
|
9
|
+
import { extractFilename as Y } from "@das-fed/utils/common-tools";
|
|
10
|
+
import E from "dayjs";
|
|
11
|
+
import { DasMessage as _ } from "@das-fed/ui/packages/components/message/index";
|
|
12
|
+
import { getConfig as F } from "@das-fed/utils/config";
|
|
13
|
+
let j = (o = 21) => {
|
|
14
|
+
let l = "", e = crypto.getRandomValues(new Uint8Array(o));
|
|
15
|
+
for (; o--; ) {
|
|
16
|
+
let s = e[o] & 63;
|
|
16
17
|
s < 36 ? l += s.toString(36) : s < 62 ? l += (s - 26).toString(36).toUpperCase() : s < 63 ? l += "_" : l += "-";
|
|
17
18
|
}
|
|
18
19
|
return l;
|
|
19
20
|
};
|
|
20
|
-
const
|
|
21
|
-
let l = p(!1), e = p(!1), s = p(""), i = p(0),
|
|
22
|
-
const
|
|
23
|
-
n.value = "",
|
|
24
|
-
},
|
|
25
|
-
|
|
21
|
+
const ie = ue.get("progress"), pe = (o) => {
|
|
22
|
+
let l = p(!1), e = p(!1), s = p(""), i = p(0), r = p("normal"), m = p(!1), c, x = p(""), n = p(""), d = p(""), f = p(""), g = p(!1), w = p(""), C;
|
|
23
|
+
const N = () => {
|
|
24
|
+
n.value = "", d.value = "", f.value = "", g.value = !1, w.value = "";
|
|
25
|
+
}, q = async (t, u = "", y = "") => {
|
|
26
|
+
r.value = "normal", i.value = 0, s.value = y || v("导出进度"), e.value = !0;
|
|
26
27
|
const b = await (t == null ? void 0 : t());
|
|
27
28
|
if (!b.status) {
|
|
28
|
-
e.value = !1,
|
|
29
|
+
e.value = !1, r.value = "error";
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
T(b.taskId, "action", "");
|
|
32
|
-
},
|
|
33
|
-
|
|
33
|
+
}, A = async (t, u = "", y = "") => {
|
|
34
|
+
r.value = "normal", i.value = 0, s.value = v("导出进度"), e.value = !0;
|
|
34
35
|
const b = await (t == null ? void 0 : t());
|
|
35
36
|
if (!b.status) {
|
|
36
|
-
e.value = !1,
|
|
37
|
+
e.value = !1, r.value = "error";
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
}, T = async (t, u,
|
|
41
|
-
m.value = !0,
|
|
40
|
+
E().format("YYYYMMDDHHmmss") + "", T(b.taskId, "export", u || "", y);
|
|
41
|
+
}, T = async (t, u, y, b = "") => {
|
|
42
|
+
m.value = !0, S(t, u, y, b), c = setTimeout(() => {
|
|
42
43
|
}, 50);
|
|
43
|
-
},
|
|
44
|
-
clearTimeout(
|
|
45
|
-
},
|
|
46
|
-
var
|
|
47
|
-
const [
|
|
44
|
+
}, R = () => {
|
|
45
|
+
clearTimeout(c), c = null, e.value = !1;
|
|
46
|
+
}, S = async (t, u = "export", y, b = "") => {
|
|
47
|
+
var B, L;
|
|
48
|
+
const [X, a] = await ie("", {
|
|
48
49
|
url: `progress/${t}`
|
|
49
50
|
}).run();
|
|
50
|
-
if (
|
|
51
|
+
if (X) {
|
|
51
52
|
m.value = !1;
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
i.value =
|
|
55
|
-
const
|
|
55
|
+
i.value = a.percentage;
|
|
56
|
+
const P = u == "export" ? v("导出") : v("导入");
|
|
56
57
|
if (i.value == 100)
|
|
57
|
-
if (x.value =
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
if (x.value = a, m.value = !1, R(), u == "export")
|
|
59
|
+
if (a.status == 1) {
|
|
60
|
+
r.value = "success";
|
|
61
|
+
let k = await Y(`/oss/${a == null ? void 0 : a.filePath}`);
|
|
62
|
+
const z = ((B = k == null ? void 0 : k.split("/")) == null ? void 0 : B.pop()) || "";
|
|
63
|
+
let G = y || z;
|
|
64
|
+
O(`${F().baseURL}/oss${a.filePath}`, G, b), m.value = !1, o("success");
|
|
65
|
+
} else a.status == 2 && (f.value = a.message || `${P}${V.value === "zh-CN" ? v("失败") : " " + v("失败")}`, _.error({
|
|
66
|
+
message: a.message || `${P}${V.value === "zh-CN" ? v("失败") : " " + v("失败")}`,
|
|
60
67
|
grouping: !0,
|
|
61
68
|
repeatNum: 1
|
|
62
69
|
}));
|
|
63
70
|
else if (u == "import") {
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
n.value = `${X}${A}`, c.value = y.sizeText, f.value = g("部分数据校验不通过,请下载附件并修改,重新导入!"), w.value = `${H().baseURL}/oss${r.filePath}`;
|
|
71
|
+
if (a.filePath) {
|
|
72
|
+
r.value = "error", g.value = !0;
|
|
73
|
+
let k = await Y(`/oss/${a == null ? void 0 : a.filePath}`);
|
|
74
|
+
const z = ((L = k == null ? void 0 : k.split("/")) == null ? void 0 : L.pop()) || "";
|
|
75
|
+
n.value = z, d.value = C.sizeText, f.value = v("部分数据校验不通过,请下载附件并修改,重新导入!"), w.value = `${F().baseURL}/oss${a.filePath}`;
|
|
70
76
|
}
|
|
71
|
-
|
|
72
|
-
} else u == "action" && (
|
|
77
|
+
U(a.status, P), a.status == 1 && (l.value = !1), o("success");
|
|
78
|
+
} else u == "action" && (r.value = "success");
|
|
73
79
|
else
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, 50) : (x.value =
|
|
77
|
-
},
|
|
78
|
-
t == 1 ? (
|
|
79
|
-
message:
|
|
80
|
+
c && a.status != 2 ? c = setTimeout(() => {
|
|
81
|
+
S(t, u, y, b);
|
|
82
|
+
}, 50) : (x.value = a, m.value = !1, U(a.status, P), R(), g.value = !0, f.value = (a == null ? void 0 : a.message) || "");
|
|
83
|
+
}, U = (t, u) => {
|
|
84
|
+
t == 1 ? (r.value = "success", _.success({
|
|
85
|
+
message: v("business-components_export-success-tip", u),
|
|
80
86
|
grouping: !0,
|
|
81
87
|
repeatNum: 1
|
|
82
|
-
}), n.value = "",
|
|
83
|
-
message:
|
|
88
|
+
}), n.value = "", d.value = "", f.value = "") : t == 2 ? (r.value = "error", _.error({
|
|
89
|
+
message: v("business-components_export-failure-tip", u),
|
|
84
90
|
grouping: !0,
|
|
85
91
|
repeatNum: 1
|
|
86
|
-
})) : t == 3 && (
|
|
87
|
-
message:
|
|
92
|
+
})) : t == 3 && (r.value = "error", _.error({
|
|
93
|
+
message: v("business-components_export-partially-failure-tip", u),
|
|
88
94
|
grouping: !0,
|
|
89
95
|
repeatNum: 1
|
|
90
96
|
}));
|
|
@@ -94,63 +100,63 @@ const ue = ne.get("progress"), ie = (a) => {
|
|
|
94
100
|
showProgressDialog: e,
|
|
95
101
|
progressTitle: s,
|
|
96
102
|
percent: i,
|
|
97
|
-
progressStatus:
|
|
103
|
+
progressStatus: r,
|
|
98
104
|
progressLoading: m,
|
|
99
105
|
progressResult: x,
|
|
100
106
|
errorFileName: n,
|
|
101
|
-
errorFileSize:
|
|
107
|
+
errorFileSize: d,
|
|
102
108
|
errorMessage: f,
|
|
103
|
-
errorImport:
|
|
109
|
+
errorImport: g,
|
|
104
110
|
errorFilePath: w,
|
|
105
|
-
fileExport:
|
|
106
|
-
fileAction:
|
|
111
|
+
fileExport: A,
|
|
112
|
+
fileAction: q,
|
|
107
113
|
generateUniqueName: (t) => {
|
|
108
114
|
const u = t == null ? void 0 : t.substr(t.indexOf("."));
|
|
109
|
-
return `${t == null ? void 0 : t.replace(/(.*\/)*([^.]+).*/gi, "$2")}${
|
|
115
|
+
return `${t == null ? void 0 : t.replace(/(.*\/)*([^.]+).*/gi, "$2")}${j()}${u}`;
|
|
110
116
|
},
|
|
111
|
-
downloadFile:
|
|
112
|
-
resetStataus:
|
|
117
|
+
downloadFile: O,
|
|
118
|
+
resetStataus: N,
|
|
113
119
|
checkProgress: T
|
|
114
120
|
};
|
|
115
|
-
},
|
|
121
|
+
}, O = (o, l, e = "xlsx") => {
|
|
116
122
|
const s = new XMLHttpRequest();
|
|
117
|
-
s.open("get",
|
|
118
|
-
const
|
|
123
|
+
s.open("get", o), s.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), s.responseType = "blob", s.onload = function(i) {
|
|
124
|
+
const r = new Blob([this.response], {
|
|
119
125
|
type: e === "zip" ? "application/zip" : e === "xlsx" ? "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : "application/pdf"
|
|
120
|
-
}), m = URL.createObjectURL(
|
|
126
|
+
}), m = URL.createObjectURL(r);
|
|
121
127
|
if (window.navigator.msSaveOrOpenBlob)
|
|
122
|
-
navigator.msSaveBlob(
|
|
128
|
+
navigator.msSaveBlob(r, l);
|
|
123
129
|
else {
|
|
124
|
-
const
|
|
125
|
-
|
|
130
|
+
const c = document.createElement("a");
|
|
131
|
+
c.href = m, c.download = l, c.click(), window.URL.revokeObjectURL(m);
|
|
126
132
|
}
|
|
127
133
|
}, s.send();
|
|
128
|
-
},
|
|
129
|
-
const { showProgressDialog: e, progressTitle: s, percent: i, progressStatus:
|
|
134
|
+
}, me = (o, l) => {
|
|
135
|
+
const { showProgressDialog: e, progressTitle: s, percent: i, progressStatus: r, progressLoading: m, fileExport: c } = pe(l), x = p({}), n = p({}), d = (g, w) => {
|
|
130
136
|
x.value = {
|
|
131
|
-
...
|
|
137
|
+
...g
|
|
132
138
|
}, n.value = {
|
|
133
139
|
...w
|
|
134
140
|
};
|
|
135
|
-
let
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
141
|
+
let C = `${E().format("YYYYMMDD")}-${E().format("HHmmss")}.${o.fileType}`;
|
|
142
|
+
V.value === "en" && !/s$/.test(o.exportFileName) && (C = " " + C);
|
|
143
|
+
const N = `${o.exportFileName}${C}`;
|
|
144
|
+
c(f, N, o.fileType);
|
|
139
145
|
}, f = async () => {
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
const [w,
|
|
143
|
-
return w ? { status: !1 } : { status: !0, taskId:
|
|
146
|
+
let g = j();
|
|
147
|
+
o.taskIdPosition === "params" && (x.value.taskId = g), o.taskIdPosition === "body" && (n.value.taskId = g);
|
|
148
|
+
const [w, C] = await o.exportFun(n.value, { params: x.value }).run();
|
|
149
|
+
return w ? { status: !1 } : { status: !0, taskId: g };
|
|
144
150
|
};
|
|
145
151
|
return {
|
|
146
152
|
showProgressDialog: e,
|
|
147
153
|
progressTitle: s,
|
|
148
154
|
percent: i,
|
|
149
|
-
progressStatus:
|
|
155
|
+
progressStatus: r,
|
|
150
156
|
progressLoading: m,
|
|
151
|
-
exportList:
|
|
157
|
+
exportList: d
|
|
152
158
|
};
|
|
153
|
-
},
|
|
159
|
+
}, ce = { class: "das-export-button" }, de = /* @__PURE__ */ K({
|
|
154
160
|
__name: "App",
|
|
155
161
|
props: {
|
|
156
162
|
modelValue: {},
|
|
@@ -165,27 +171,27 @@ const ue = ne.get("progress"), ie = (a) => {
|
|
|
165
171
|
disabled: { type: Boolean, default: !1 }
|
|
166
172
|
},
|
|
167
173
|
emits: ["update:modelValue", "update:bodyParams", "success"],
|
|
168
|
-
setup(
|
|
169
|
-
const e =
|
|
170
|
-
|
|
174
|
+
setup(o, { emit: l }) {
|
|
175
|
+
const e = o, s = l;
|
|
176
|
+
Q(() => e.exportFileName || v("导出表")), I(e.modelValue, (n) => {
|
|
171
177
|
s("update:modelValue", n);
|
|
172
|
-
}),
|
|
178
|
+
}), I(e.bodyParams, (n) => {
|
|
173
179
|
s("update:bodyParams", n);
|
|
174
180
|
});
|
|
175
|
-
const { showProgressDialog: i, percent:
|
|
176
|
-
return (n,
|
|
177
|
-
|
|
181
|
+
const { showProgressDialog: i, percent: r, progressStatus: m, exportList: c } = me(e, s), x = [$("正在导出中...").value, $("导出失败").value, $("导出成功").value];
|
|
182
|
+
return (n, d) => (Z(), W("div", ce, [
|
|
183
|
+
D(h(ne), {
|
|
178
184
|
block: n.block,
|
|
179
185
|
size: "middle",
|
|
180
186
|
disabled: n.disabled,
|
|
181
187
|
"btn-type": e.btnType,
|
|
182
188
|
ghost: n.ghost,
|
|
183
|
-
onClick:
|
|
189
|
+
onClick: d[0] || (d[0] = (f) => h(c)(e.modelValue, e.bodyParams))
|
|
184
190
|
}, {
|
|
185
|
-
default:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
default: M(() => [
|
|
192
|
+
te(n.$slots, "default", {}, () => [
|
|
193
|
+
se(
|
|
194
|
+
ae(h($)("导出").value),
|
|
189
195
|
1
|
|
190
196
|
/* TEXT */
|
|
191
197
|
)
|
|
@@ -194,23 +200,23 @@ const ue = ne.get("progress"), ie = (a) => {
|
|
|
194
200
|
_: 3
|
|
195
201
|
/* FORWARDED */
|
|
196
202
|
}, 8, ["block", "disabled", "btn-type", "ghost"]),
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
ee(" 进度弹窗 "),
|
|
204
|
+
D(h(re), {
|
|
199
205
|
size: "mini",
|
|
200
|
-
title:
|
|
206
|
+
title: h($)("导出进度").value,
|
|
201
207
|
"is-feedback-img": !1,
|
|
202
|
-
modelValue:
|
|
203
|
-
"onUpdate:modelValue":
|
|
208
|
+
modelValue: h(i),
|
|
209
|
+
"onUpdate:modelValue": d[2] || (d[2] = (f) => H(i) ? i.value = f : null),
|
|
204
210
|
"append-to-body": !0,
|
|
205
211
|
type: "feedback"
|
|
206
212
|
}, {
|
|
207
|
-
default:
|
|
208
|
-
|
|
209
|
-
modelValue:
|
|
210
|
-
"onUpdate:modelValue":
|
|
213
|
+
default: M(() => [
|
|
214
|
+
D(h(le), {
|
|
215
|
+
modelValue: h(r),
|
|
216
|
+
"onUpdate:modelValue": d[1] || (d[1] = (f) => H(r) ? r.value = f : null),
|
|
211
217
|
style: { "margin-top": "35px" },
|
|
212
218
|
type: "circle",
|
|
213
|
-
status:
|
|
219
|
+
status: h(m),
|
|
214
220
|
textMap: x
|
|
215
221
|
}, null, 8, ["modelValue", "status"])
|
|
216
222
|
]),
|
|
@@ -219,12 +225,12 @@ const ue = ne.get("progress"), ie = (a) => {
|
|
|
219
225
|
}, 8, ["title", "modelValue"])
|
|
220
226
|
]));
|
|
221
227
|
}
|
|
222
|
-
}),
|
|
223
|
-
const e =
|
|
228
|
+
}), fe = (o, l) => {
|
|
229
|
+
const e = o.__vccOpts || o;
|
|
224
230
|
for (const [s, i] of l)
|
|
225
231
|
e[s] = i;
|
|
226
232
|
return e;
|
|
227
|
-
},
|
|
233
|
+
}, ve = /* @__PURE__ */ fe(de, [["__scopeId", "data-v-49f0bb05"]]), ge = {
|
|
228
234
|
导出表: { "zh-CN": "导出表", en: "Export Table", _appCode: "framework" },
|
|
229
235
|
导出失败: { "zh-CN": "导出失败", en: "Exported Failed", _appCode: "framework" },
|
|
230
236
|
导出成功: { "zh-CN": "导出成功", en: "Exported Successfully", _appCode: "framework" },
|
|
@@ -245,9 +251,9 @@ const ue = ne.get("progress"), ie = (a) => {
|
|
|
245
251
|
_appCode: "framework"
|
|
246
252
|
}
|
|
247
253
|
};
|
|
248
|
-
|
|
249
|
-
const
|
|
254
|
+
oe(ge);
|
|
255
|
+
const ze = J(ve);
|
|
250
256
|
export {
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
ze as DasExportButton,
|
|
258
|
+
ze as default
|
|
253
259
|
};
|
|
Binary file
|