提交 8e912ada 编写于 作者: Cano1997's avatar Cano1997

update: 修复插件文件下载鉴权问题

上级 8b4e556a
......@@ -2,14 +2,14 @@ var ce = Object.defineProperty;
var de = (e, t, s) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var E = (e, t, s) => (de(e, typeof t != "symbol" ? t + "" : t, s), s);
import { IndexViewModel as ue, GridModel as he, ViewType as me, ModelUtil as pe } from "@ibiz-template/model";
import { GridFieldColumnController as Z, GridRowController as X, WFStepTraceViewController as fe, UploadEditorController as J, GridController as ge, GridNotifyState as ve, WFDynaEditView3Controller as we } from "@ibiz-template/controller";
import { defineComponent as k, computed as T, h as c, getCurrentInstance as R, ref as g, watch as N, toRefs as B, onUnmounted as be } from "vue";
import { useNamespace as U, useViewController as Q, usePropsWatch as z, getUploadProps as ye, getEditorEmits as K, getGridUploadProps as _, getGridEditorEmits as $, useClickOutside as Ce, useEventListener as Fe, getInputProps as xe, getGridInputProps as Se, useGridCellEditor as ke, useControlController as Le, useWFStepTraceViewController as Ue, useEditView3Controller as Ee } from "@ibiz-template/vue-util";
import { GridFieldColumnController as Z, GridRowController as X, WFStepTraceViewController as fe, UploadEditorController as J, GridController as ge, GridNotifyState as we, WFDynaEditView3Controller as ve } from "@ibiz-template/controller";
import { defineComponent as L, computed as D, h as c, getCurrentInstance as A, ref as w, watch as N, toRefs as $, onUnmounted as be } from "vue";
import { useNamespace as U, useViewController as Q, usePropsWatch as B, getUploadProps as ye, getEditorEmits as K, getGridUploadProps as z, getGridEditorEmits as _, useClickOutside as Ce, useEventListener as Fe, getInputProps as xe, getGridInputProps as ke, useGridCellEditor as Se, useControlController as Le, useWFStepTraceViewController as Ue, useEditView3Controller as Ee } from "@ibiz-template/vue-util";
import { colorBlend as Ne, HttpError as Y, isImage as Pe, uploadFile as Ie, RuntimeError as Te } from "@ibiz-template/core";
import { getCookie as De, createUUID as W } from "qx-util";
import { debounce as Re } from "lodash-es";
import { ViewMode as ee, UIActionHandler as te, PluginStaticResource as Ae } from "@ibiz-template/runtime";
const Me = k({
import { debounce as Me } from "lodash-es";
import { ViewMode as ee, UIActionHandler as te, PluginStaticResource as Re } from "@ibiz-template/runtime";
const Ae = L({
name: "CodeListGridColumn",
props: {
controller: {
......@@ -22,28 +22,28 @@ const Me = k({
}
},
setup(e) {
const t = U("grid-field-column"), s = T(() => {
const t = U("grid-field-column"), s = D(() => {
var r;
if (e.controller.model.source.cLConvertMode !== "FRONT")
return [];
const n = e.row.data[e.controller.model.codeName];
return (r = e.controller.codeListItems) != null && r.length && n ? n.split(",").map((h) => {
const m = e.controller.codeListItems.find((f) => f.value === h);
if (m) {
const f = m.color || "#515a6e";
return (r = e.controller.codeListItems) != null && r.length && n ? n.split(",").map((m) => {
const p = e.controller.codeListItems.find((g) => g.value === m);
if (p) {
const g = p.color || "#515a6e";
return {
text: m.text,
text: p.text,
colorStyle: t.cssVarBlock({
color: f,
"border-color": f,
"bg-color": Ne(f, "#fff")
color: g,
"border-color": g,
"bg-color": Ne(g, "#fff")
})
};
}
}).filter(Boolean) : [];
}), o = (n) => {
e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
}, i = T(() => {
}, i = D(() => {
let n = "";
switch (e.controller.model.align) {
case "LEFT":
......@@ -101,7 +101,7 @@ class Ge extends fe {
this.imgSrc = URL.createObjectURL(i);
}
}
const Oe = k({
const Oe = L({
name: "PresetWFChartView",
props: {
context: Object,
......@@ -123,8 +123,8 @@ const Oe = k({
setup(e) {
const t = U("preset-wf-chart-view"), {
proxy: s
} = R(), o = Q(s, (i, n) => new Ge(e.modelPath, i, n));
return z(s, "deName", o.setDeName.bind(o)), {
} = A(), o = Q(s, (i, n) => new Ge(e.modelPath, i, n));
return B(s, "deName", o.setDeName.bind(o)), {
c: o,
ns: t
};
......@@ -139,7 +139,7 @@ const Oe = k({
})]);
}
});
const Be = k({
const $e = L({
name: "WFToolbar",
props: {
wfLinks: {
......@@ -181,49 +181,49 @@ const Be = k({
}, [t.sequenceFlowName || ""])]);
})]);
}
}), ze = typeof btoa == "function", j = typeof Buffer == "function";
}), Be = typeof btoa == "function", j = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const V = typeof TextEncoder == "function" ? new TextEncoder() : void 0, _e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", D = Array.prototype.slice.call(_e);
const V = typeof TextEncoder == "function" ? new TextEncoder() : void 0, ze = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", R = Array.prototype.slice.call(ze);
((e) => {
let t = {};
return e.forEach((s, o) => t[s] = o), t;
})(D);
const P = String.fromCharCode.bind(String);
})(R);
const I = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const $e = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), je = (e) => {
const _e = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), je = (e) => {
let t, s, o, i, n = "";
const r = e.length % 3;
for (let a = 0; a < e.length; ) {
if ((s = e.charCodeAt(a++)) > 255 || (o = e.charCodeAt(a++)) > 255 || (i = e.charCodeAt(a++)) > 255)
throw new TypeError("invalid character found");
t = s << 16 | o << 8 | i, n += D[t >> 18 & 63] + D[t >> 12 & 63] + D[t >> 6 & 63] + D[t & 63];
t = s << 16 | o << 8 | i, n += R[t >> 18 & 63] + R[t >> 12 & 63] + R[t >> 6 & 63] + R[t & 63];
}
return r ? n.slice(0, r - 3) + "===".substring(r) : n;
}, se = ze ? (e) => btoa(e) : j ? (e) => Buffer.from(e, "binary").toString("base64") : je, We = j ? (e) => Buffer.from(e).toString("base64") : (e) => {
}, se = Be ? (e) => btoa(e) : j ? (e) => Buffer.from(e, "binary").toString("base64") : je, We = j ? (e) => Buffer.from(e).toString("base64") : (e) => {
let s = [];
for (let o = 0, i = e.length; o < i; o += 4096)
s.push(P.apply(null, e.subarray(o, o + 4096)));
s.push(I.apply(null, e.subarray(o, o + 4096)));
return se(s.join(""));
}, Ve = (e) => {
if (e.length < 2) {
var t = e.charCodeAt(0);
return t < 128 ? e : t < 2048 ? P(192 | t >>> 6) + P(128 | t & 63) : P(224 | t >>> 12 & 15) + P(128 | t >>> 6 & 63) + P(128 | t & 63);
return t < 128 ? e : t < 2048 ? I(192 | t >>> 6) + I(128 | t & 63) : I(224 | t >>> 12 & 15) + I(128 | t >>> 6 & 63) + I(128 | t & 63);
} else {
var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
return P(240 | t >>> 18 & 7) + P(128 | t >>> 12 & 63) + P(128 | t >>> 6 & 63) + P(128 | t & 63);
return I(240 | t >>> 18 & 7) + I(128 | t >>> 12 & 63) + I(128 | t >>> 6 & 63) + I(128 | t & 63);
}
}, qe = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, He = (e) => e.replace(qe, Ve), q = j ? (e) => Buffer.from(e, "utf8").toString("base64") : V ? (e) => We(V.encode(e)) : (e) => se(He(e)), oe = (e, t = !1) => t ? $e(q(e)) : q(e);
}, qe = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, He = (e) => e.replace(qe, Ve), q = j ? (e) => Buffer.from(e, "utf8").toString("base64") : V ? (e) => We(V.encode(e)) : (e) => se(He(e)), oe = (e, t = !1) => t ? _e(q(e)) : q(e);
function Ze(e, t, s) {
var S;
const o = g([]), i = g({
const o = w([]), i = w({
Authorization: `Bearer ${De("access_token")}`
}), n = g(""), r = g(""), a = {
}), n = w(""), r = w(""), a = {
count: 0,
cacheFiles: []
// iview上传过程中不能改default-file-list,所以需要缓存
}, d = (S = s.editorParams) == null ? void 0 : S.blackList;
let h = [];
d && typeof d == "string" && (h = d.split(",")), N(
let m = [];
d && typeof d == "string" && (m = d.split(",")), N(
() => e.value,
(l) => {
o.value = l ? JSON.parse(l) : [];
......@@ -233,86 +233,91 @@ function Ze(e, t, s) {
() => e.data,
(l) => {
if (l) {
const u = s.calcBaseUrl(l);
n.value = u.uploadUrl, r.value = u.downloadUrl;
const h = s.calcBaseUrl(l);
n.value = h.uploadUrl, r.value = h.downloadUrl;
}
},
{ immediate: !0, deep: !0 }
), N(
o,
(l) => {
l != null && l.length && r.value && l.forEach((u) => {
u.url = u.url || r.value.replace("%fileId%", u.id);
l != null && l.length && r.value && l.forEach((h) => {
h.url = h.url || r.value.replace("%fileId%", h.id);
});
},
{ immediate: !0 }
), N(
r,
(l) => {
l && o.value.length && o.value.forEach((u) => {
u.url = r.value.replace("%fileId%", u.id);
l && o.value.length && o.value.forEach((h) => {
h.url = r.value.replace("%fileId%", h.id);
});
},
{ immediate: !0 }
);
const m = () => {
const l = [...o.value, ...a.cacheFiles], u = l.length > 0 ? JSON.stringify(l.map((w) => ({ name: w.name, id: w.id }))) : null;
a.cacheFiles = [], t(u);
}, f = (l) => {
const u = l.name.trim().toLowerCase();
if (h.some((x) => u.endsWith(`.${x}`)))
return ibiz.message.error(`不可上传 ${h.join("、")}类型的文件!`), !1;
const p = () => {
const l = [...o.value, ...a.cacheFiles], h = l.length > 0 ? JSON.stringify(l.map((v) => ({ name: v.name, id: v.id }))) : null;
a.cacheFiles = [], t(h);
}, g = (l) => {
const h = l.name.trim().toLowerCase();
if (m.some((C) => h.endsWith(`.${C}`)))
return ibiz.message.error(`不可上传 ${m.join("、")}类型的文件!`), !1;
a.count += 1;
}, C = (l) => {
}, F = (l) => {
l && (a.cacheFiles.push({
name: l.filename,
id: l.fileid
}), a.count -= 1, a.count === 0 && m());
}, b = (l, u) => {
}), a.count -= 1, a.count === 0 && p());
}, y = (l, h) => {
throw a.count -= 1, new Y({
response: { data: u, status: l.status }
response: { data: h, status: l.status }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
});
}, F = (l) => {
}, x = (l) => {
if (e.disabled)
return;
const u = o.value.findIndex((w) => w.id === l.id);
u !== -1 && o.value.splice(u, 1), m();
}, v = (l) => {
const u = l.url || r.value.replace("%fileId%", l.id);
s.fileDownload({ url: u, name: l.name });
}, p = g(!1), y = g(""), I = g("");
const h = o.value.findIndex((v) => v.id === l.id);
h !== -1 && o.value.splice(h, 1), p();
}, f = (l) => {
const v = (s.parent.form || s.parent.grid).model.appEntity.deName, C = `${l.id}|${v}|${e.data.srfkey}|${s.context.srfpersonid || s.context.srfuserid}`, M = l.url || r.value.replace("%fileId%", l.id);
s.fileDownload({
url: `${M}?key=${window.btoa(C)}${Math.floor(
1e3 + Math.random() * 9e3
)}`,
name: l.name
});
}, u = w(!1), b = w(""), P = w("");
return {
uploadUrl: n,
downloadUrl: r,
headers: i,
files: o,
onDownload: v,
onError: b,
onRemove: F,
onSuccess: C,
beforeUpload: f,
showModal: p,
modalTitle: y,
iframeUrl: I,
onDownload: f,
onError: y,
onRemove: x,
onSuccess: F,
beforeUpload: g,
showModal: u,
modalTitle: b,
iframeUrl: P,
onModalCancel: () => {
p.value = !1, y.value = "", I.value = "";
u.value = !1, b.value = "", P.value = "";
},
previewFile: (l) => {
p.value = !0, y.value = l.name;
const u = window.Environment.previewFileUrl;
if (u) {
const w = encodeURIComponent(
u.value = !0, b.value = l.name;
const h = window.Environment.previewFileUrl;
if (h) {
const v = encodeURIComponent(
oe(
`${window.location.origin}${l.url}?fullfilename=${l.name}`
)
);
I.value = `${u}/onlinePreview?url=${w}`;
P.value = `${h}/onlinePreview?url=${v}`;
}
}
};
}
const Xe = k({
const Xe = L({
name: "SyFileUpload",
props: ye(),
emits: K(),
......@@ -325,16 +330,16 @@ const Xe = k({
files: r,
onDownload: a,
onError: d,
onRemove: h,
onSuccess: m,
beforeUpload: f,
showModal: C,
modalTitle: b,
iframeUrl: F,
onModalCancel: v,
previewFile: p
} = Ze(e, (y) => {
t("change", y);
onRemove: m,
onSuccess: p,
beforeUpload: g,
showModal: F,
modalTitle: y,
iframeUrl: x,
onModalCancel: f,
previewFile: u
} = Ze(e, (b) => {
t("change", b);
}, o);
return {
ns: s,
......@@ -344,14 +349,14 @@ const Xe = k({
files: r,
onDownload: a,
onError: d,
onRemove: h,
onSuccess: m,
beforeUpload: f,
showModal: C,
modalTitle: b,
iframeUrl: F,
onModalCancel: v,
previewFile: p
onRemove: m,
onSuccess: p,
beforeUpload: g,
showModal: F,
modalTitle: y,
iframeUrl: x,
onModalCancel: f,
previewFile: u
};
},
render(e) {
......@@ -608,7 +613,7 @@ const Xe = k({
})])]);
}
});
function G(e, t) {
function O(e, t) {
if (e.url = t.replace("%fileId%", e.id), e.status || (e.status = "finished"), !e.fileName) {
const s = e.name.lastIndexOf(".");
e.fileName = e.name.substring(0, s), e.fileExt = e.name.substring(s), e.isImage = Pe(e.name);
......@@ -616,7 +621,7 @@ function G(e, t) {
return e;
}
function ie(e) {
const t = g(""), s = g(""), o = g([]);
const t = w(""), s = w(""), o = w([]);
return N(
e.data,
(i) => {
......@@ -630,7 +635,7 @@ function ie(e) {
e.value,
(i) => {
o.value = i ? JSON.parse(i) : [], o.value.length && s.value && o.value.forEach((n) => {
G(n, s.value);
O(n, s.value);
});
},
{ immediate: !0 }
......@@ -638,7 +643,7 @@ function ie(e) {
s,
(i) => {
i && o.value.length && o.value.forEach((n) => {
G(n, i);
O(n, i);
});
},
{ immediate: !0 }
......@@ -649,14 +654,14 @@ function ie(e) {
};
}
function ne(e) {
var L, S;
const t = g("undo"), s = g([]), { downloadUrl: o, value: i, uploadUrl: n, controller: r } = e, a = (S = (L = r == null ? void 0 : r.value) == null ? void 0 : L.editorParams) == null ? void 0 : S.blackList;
var k, S;
const t = w("undo"), s = w([]), { downloadUrl: o, value: i, uploadUrl: n, controller: r } = e, a = (S = (k = r == null ? void 0 : r.value) == null ? void 0 : k.editorParams) == null ? void 0 : S.blackList;
let d = [];
a && typeof a == "string" && (d = a.split(",")), N(
i,
(l) => {
l.length > 0 && (s.value = [], l.forEach((u) => {
s.value.push(G(u, o.value));
l.length > 0 && (s.value = [], l.forEach((h) => {
s.value.push(O(h, o.value));
}));
},
{
......@@ -664,90 +669,90 @@ function ne(e) {
deep: !0
}
);
const h = (l, u) => {
const w = [];
return u.forEach((x, A) => {
const M = x.name.trim().toLowerCase();
if (d.some((le) => M.endsWith(`.${le}`))) {
w.push(A);
const m = (l, h) => {
const v = [];
return h.forEach((C, M) => {
const G = C.name.trim().toLowerCase();
if (d.some((le) => G.endsWith(`.${le}`))) {
v.push(M);
return;
}
s.value.push({
name: x.name,
status: x.status,
percentage: x.percentage,
id: x.uid,
name: C.name,
status: C.status,
percentage: C.percentage,
id: C.uid,
url: ""
});
}), w.length === u.length ? (ibiz.message.error(`不可上传 ${d.join("、")}类型的文件!`), !1) : (w.length && (w.forEach((x) => {
l.splice(x, 1), u.splice(x, 1);
}), v.length === h.length ? (ibiz.message.error(`不可上传 ${d.join("、")}类型的文件!`), !1) : (v.length && (v.forEach((C) => {
l.splice(C, 1), h.splice(C, 1);
}), ibiz.message.error(`不可上传 ${d.join("、")}类型的文件!`)), !0);
}, m = (l) => {
l.forEach((u) => {
s.value.find((w) => w.id === u.uid ? (w.percentage = u.percentage, !0) : !1);
}, p = (l) => {
l.forEach((h) => {
s.value.find((v) => v.id === h.uid ? (v.percentage = h.percentage, !0) : !1);
});
}, f = (l, u) => {
l.forEach((w) => {
s.value.find((x) => x.id === w.uid ? (x.status = w.status, x.id = u.data.fileid, x.name = u.data.filename, G(x, o.value), !0) : !1);
}, g = (l, h) => {
l.forEach((v) => {
s.value.find((C) => C.id === v.uid ? (C.status = v.status, C.id = h.data.fileid, C.name = h.data.filename, O(C, o.value), !0) : !1);
});
}, C = (l, u) => {
var x;
l.forEach((A) => {
s.value.find((M) => M.id === A.uid ? (M.status = A.status, !0) : !1);
}, F = (l, h) => {
var C;
l.forEach((M) => {
s.value.find((G) => G.id === M.uid ? (G.status = M.status, !0) : !1);
});
const w = new Y(u);
const v = new Y(h);
ibiz.notification.error({
title: (x = w.status) == null ? void 0 : x.toString(),
desc: w.message,
title: (C = v.status) == null ? void 0 : C.toString(),
desc: v.message,
duration: 10
});
}, b = (l) => {
s.value = s.value.filter((u) => u.status === "finished"), t.value = "done";
}, F = () => {
}, y = (l) => {
s.value = s.value.filter((h) => h.status === "finished"), t.value = "done";
}, x = () => {
Ie({
multiple: e.multiple,
accept: e.accept,
uploadUrl: n.value,
beforeUpload: h,
progress: m,
success: f,
error: C,
finish: b
beforeUpload: m,
progress: p,
success: g,
error: F,
finish: y
});
}, v = g(!1), p = g(""), y = g("");
}, f = w(!1), u = w(""), b = w("");
return {
selectFile: F,
selectFile: x,
fileList: s,
uploadState: t,
showModal: v,
modalTitle: p,
iframeUrl: y,
showModal: f,
modalTitle: u,
iframeUrl: b,
onModalCancel: () => {
v.value = !1, p.value = "", y.value = "";
f.value = !1, u.value = "", b.value = "";
},
previewFile: (l) => {
v.value = !0, p.value = l.name;
const u = window.Environment.previewFileUrl;
if (u) {
const w = encodeURIComponent(
f.value = !0, u.value = l.name;
const h = window.Environment.previewFileUrl;
if (h) {
const v = encodeURIComponent(
oe(
`${window.location.origin}${l.url}?fullfilename=${l.name}`
)
);
y.value = `${u}/onlinePreview?url=${w}`;
b.value = `${h}/onlinePreview?url=${v}`;
}
}
};
}
const Je = k({
const Je = L({
name: "SyGridFileUpload",
props: _(),
props: z(),
setup(e) {
const t = U("sy-grid-file-upload"), {
value: s,
data: o,
controller: i
} = B(e), {
} = $(e), {
downloadUrl: n,
uploadUrl: r,
valueList: a
......@@ -757,11 +762,11 @@ const Je = k({
controller: i
}), {
fileList: d,
showModal: h,
modalTitle: m,
iframeUrl: f,
previewFile: C,
onModalCancel: b
showModal: m,
modalTitle: p,
iframeUrl: g,
previewFile: F,
onModalCancel: y
} = ne({
downloadUrl: n,
uploadUrl: r,
......@@ -770,14 +775,18 @@ const Je = k({
return {
ns: t,
fileList: d,
showModal: h,
modalTitle: m,
iframeUrl: f,
downloadFile: (v) => {
e.controller.fileDownload(v);
showModal: m,
modalTitle: p,
iframeUrl: g,
downloadFile: (f) => {
const u = e.controller, P = u.parent.grid.model.appEntity.deName, T = `${f.id}|${P}|${o.value.srfkey}|${u.context.srfpersonid || u.context.srfuserid}`, k = f.url || n.value.replace("%fileId%", f.id);
u.fileDownload({
url: `${k}?key=${window.btoa(T)}${Math.floor(1e3 + Math.random() * 9e3)}`,
name: f.name
});
},
previewFile: C,
onModalCancel: b
previewFile: F,
onModalCancel: y
};
},
render() {
......@@ -832,10 +841,10 @@ const Je = k({
}
})])]);
}
}), Qe = k({
}), Qe = L({
name: "SyGridFileUploadContainer",
props: _(),
emits: $(),
props: z(),
emits: _(),
render(e) {
return this.disabled || this.readonly ? e("SyGridFileUpload", {
props: {
......@@ -856,7 +865,7 @@ const Je = k({
});
}
});
const Ke = k({
const Ke = L({
name: "SyEditGridFileUploadPopover",
props: {
uploadUrl: {
......@@ -874,6 +883,10 @@ const Ke = k({
controller: {
type: J,
required: !0
},
data: {
type: Object,
required: !0
}
},
emits: {
......@@ -887,34 +900,38 @@ const Ke = k({
value: i,
uploadUrl: n,
controller: r
} = B(e), {
} = $(e), {
fileList: a,
uploadState: d,
selectFile: h
selectFile: m
} = ne({
downloadUrl: o,
value: i,
uploadUrl: n,
controller: r
}), m = g(), f = g(!1), C = Ce(m, async (v) => {
}), p = w(), g = w(!1), F = Ce(p, async (f) => {
t("close", {
isModified: f.value,
isModified: g.value,
resultFiles: a.value
});
});
return N(d, (v) => {
v === "done" ? (f.value = !0, C.proceed()) : v === "loading" && C.pause();
return N(d, (f) => {
f === "done" ? (g.value = !0, F.proceed()) : f === "loading" && F.pause();
}), {
ns: s,
componentRef: m,
componentRef: p,
fileList: a,
deleteFile: (v) => {
const p = a.value.findIndex((y) => y.id === v.id);
a.value.splice(p, 1), f.value = !0;
deleteFile: (f) => {
const u = a.value.findIndex((b) => b.id === f.id);
a.value.splice(u, 1), g.value = !0;
},
selectFile: h,
downloadFile: (v) => {
e.controller.fileDownload(v);
selectFile: m,
downloadFile: (f) => {
const u = e.controller, P = u.parent.grid.model.appEntity.deName, T = `${f.id}|${P}|${e.data.srfkey}|${u.context.srfpersonid || u.context.srfuserid}`, k = f.url || o.value.replace("%fileId%", f.id);
u.fileDownload({
url: `${k}?key=${window.btoa(T)}${Math.floor(1e3 + Math.random() * 9e3)}`,
name: f.name
});
}
};
},
......@@ -954,10 +971,10 @@ const Ke = k({
}), "添加文件"])]);
}
});
const Ye = k({
const Ye = L({
name: "SyEditGridFileUpload",
props: _(),
emits: $(),
props: z(),
emits: _(),
setup(e, {
emit: t
}) {
......@@ -965,7 +982,7 @@ const Ye = k({
value: o,
data: i,
controller: n
} = B(e), {
} = $(e), {
downloadUrl: r,
uploadUrl: a,
valueList: d
......@@ -973,48 +990,49 @@ const Ye = k({
value: o,
data: i,
controller: n
}), h = g(), m = async () => {
if (!h.value)
}), m = w(), p = async () => {
if (!m.value)
throw new Te("容器元素不存在");
const f = h.value.$el, C = f.offsetHeight, b = ibiz.overlay.createPopover((p) => p(Ke, {
const g = m.value.$el, F = g.offsetHeight, y = ibiz.overlay.createPopover((u) => u(Ke, {
props: {
value: d.value,
data: i.value,
uploadUrl: a.value,
downloadUrl: r.value,
controller: n.value
},
on: {
close: (y) => {
b.dismiss(y);
close: (b) => {
y.dismiss(b);
}
}
}), void 0, {
noArrow: !0,
placement: "bottom-start",
offsetOpts: {
mainAxis: -C,
mainAxis: -F,
crossAxis: 0
}
});
await b.present(f);
await y.present(g);
const {
isModified: F,
resultFiles: v
} = await b.onWillDismiss();
if (F) {
const p = v.length > 0 ? JSON.stringify(v.map((y) => ({
name: y.name,
id: y.id
isModified: x,
resultFiles: f
} = await y.onWillDismiss();
if (x) {
const u = f.length > 0 ? JSON.stringify(f.map((b) => ({
name: b.name,
id: b.id
}))) : null;
t("change", p), t("rowSave");
t("change", u), t("rowSave");
}
};
return Fe(h, "click", (f) => {
e.disabled || m();
return Fe(m, "click", (g) => {
e.disabled || p();
}), {
ns: s,
valueList: d,
componentRef: h
componentRef: m
};
},
render() {
......@@ -1035,16 +1053,16 @@ const Ye = k({
}, [e.name])]))])]);
}
});
k({
L({
name: "SyInput",
props: xe(),
emits: K(),
setup(e, {
emit: t
}) {
const s = U("input"), i = e.controller.model, n = g(), r = g(2);
const s = U("input"), i = e.controller.model, n = w(), r = w(2);
i.editorType === "TEXTAREA_10" && (r.value = 10);
const a = T(() => {
const a = D(() => {
switch (i.editorType) {
case "TEXTBOX":
return "text";
......@@ -1056,36 +1074,36 @@ k({
default:
return "string";
}
}), d = g("");
N(() => e.value, (p, y) => {
p !== y && (p ? d.value = p : d.value = "");
}), d = w("");
N(() => e.value, (u, b) => {
u !== b && (u ? d.value = u : d.value = "");
}, {
immediate: !0
});
let h = !1, m, f;
const C = Re((p) => {
f !== p.target.value && t("change", p.target.value), f = void 0, h = !1, m && m();
let m = !1, p, g;
const F = Me((u) => {
g !== u.target.value && t("change", u.target.value), g = void 0, m = !1, p && p();
}, 300, {
leading: !0
}), b = (p) => {
h = !0, C(p);
}, F = (p) => {
p && p.code === "Enter" && h && (m = () => {
n.value.$el.dispatchEvent(p);
}), y = (u) => {
m = !0, F(u);
}, x = (u) => {
u && u.code === "Enter" && m && (p = () => {
n.value.$el.dispatchEvent(u);
});
}, v = () => {
f = n.value.currentValue, t("change", f);
}, f = () => {
g = n.value.currentValue, t("change", g);
};
return e.autoFocus && N(n, (p) => {
p && p.$el.getElementsByTagName("input")[0].focus();
return e.autoFocus && N(n, (u) => {
u && u.$el.getElementsByTagName("input")[0].focus();
}), {
ns: s,
rows: r,
type: a,
currentVal: d,
handleChange: b,
handleKeyUp: F,
handleBlur: v,
handleChange: y,
handleKeyUp: x,
handleBlur: f,
inputRef: n
};
},
......@@ -1116,10 +1134,10 @@ k({
}, [this.controller.model.unitName])])]);
}
});
k({
L({
name: "SyGridInput",
props: Se(),
emits: $(),
props: ke(),
emits: _(),
setup(e, {
emit: t
}) {
......@@ -1129,7 +1147,7 @@ k({
componentRef: n,
onOperateChange: r,
onChange: a
} = ke(e, {
} = Se(e, {
emit: t
});
return {
......@@ -1175,7 +1193,7 @@ function H(e, t) {
class: e.e("logo-caption")
}, [t.caption])]);
}
const et = k({
const et = L({
name: "UserAppLayout",
props: {
model: {
......@@ -1196,9 +1214,9 @@ const et = k({
setup(e, {
emit: t
}) {
const s = U("layout"), o = g(!1), i = () => {
const s = U("layout"), o = w(!1), i = () => {
o.value = !o.value, t("onCollapseChange", o.value);
}, n = T(() => e.model.source.blankMode === !0), r = T(() => !!(window.Environment.manualdownloadurl || ibiz.env.manualdownloadurl));
}, n = D(() => e.model.source.blankMode === !0), r = D(() => !!(window.Environment.manualdownloadurl || ibiz.env.manualdownloadurl));
return {
ns: s,
collapseChange: o,
......@@ -1293,10 +1311,10 @@ function tt(e) {
}), e.singleSelect || s.splice(0, 0, { type: "selection", width: 60 }), s;
}
function st(e) {
const t = g([]);
const t = w([]);
return e.nerve.self.evt.on("created", () => {
t.value = tt(e);
}), [T(() => {
}), [D(() => {
const o = [...t.value];
if (!o.find((r) => !r.width)) {
let r = o.length - 1;
......@@ -1322,14 +1340,14 @@ function ot(e) {
if (!e.singleSelect) {
const a = [];
r.forEach((d) => {
const h = t(d);
h && a.push(h);
const m = t(d);
m && a.push(m);
}), e.onSelectionChange(a);
}
}
function n(r) {
const { column: a, order: d } = r, h = d === "asc" || d === "desc" ? d : void 0;
e.setSort(a.fieldName, h), e.load();
const { column: a, order: d } = r, m = d === "asc" || d === "desc" ? d : void 0;
e.setSort(a.fieldName, m), e.load();
}
return { onRowClick: s, onDbRowClick: o, onSelectionChange: i, onSortChange: n };
}
......@@ -1396,7 +1414,7 @@ class nt extends ge {
})
), this.rows = s.map((o) => {
const i = new X(o, this);
return this.gridStateNotify(i, ve.LOAD), i;
return this.gridStateNotify(i, we.LOAD), i;
}), this.handleGroup(s), s;
}
/**
......@@ -1423,10 +1441,10 @@ class nt extends ge {
function rt(e, t, s, o = {}) {
return Le(e, () => {
const i = new nt(t, s, o);
return z(e, "gridRowActiveMode", i.setGridRowActiveMode.bind(i)), i;
return B(e, "gridRowActiveMode", i.setGridRowActiveMode.bind(i)), i;
});
}
const at = k({
const at = L({
props: {
modelData: he,
context: {
......@@ -1456,68 +1474,68 @@ const at = k({
setup(e) {
const {
proxy: t
} = R(), s = U("grid"), o = rt(t, e.modelData, e.context, e.params), [i] = st(o), {
} = A(), s = U("grid"), o = rt(t, e.modelData, e.context, e.params), [i] = st(o), {
onRowClick: n,
onDbRowClick: r,
onSelectionChange: a,
onSortChange: d
} = ot(o), {
onPageChange: h,
onPageReset: m,
onPageSizeChange: f
} = it(o), C = (L, S) => {
onPageChange: m,
onPageReset: p,
onPageSizeChange: g
} = it(o), F = (k, S) => {
const l = t.$refs.grid;
l && (l.toggleSelect && l.toggleSelect(S), l.highlightCurrentRow && l.highlightCurrentRow(S)), n(L);
}, b = g(0), F = g(null), v = g(null);
let p = null, y = 0;
const I = () => {
var L;
if (F.value && ((L = e.modal) == null ? void 0 : L.mode) !== "EMBED")
if (o.model.source.enablePagingBar && v.value) {
const S = v.value.$el, l = S.offsetHeight + parseFloat(window.getComputedStyle(S).paddingTop);
b.value = F.value.offsetHeight - l;
l && (l.toggleSelect && l.toggleSelect(S), l.highlightCurrentRow && l.highlightCurrentRow(S)), n(k);
}, y = w(0), x = w(null), f = w(null);
let u = null, b = 0;
const P = () => {
var k;
if (x.value && ((k = e.modal) == null ? void 0 : k.mode) !== "EMBED")
if (o.model.source.enablePagingBar && f.value) {
const S = f.value.$el, l = S.offsetHeight + parseFloat(window.getComputedStyle(S).paddingTop);
y.value = x.value.offsetHeight - l;
} else
b.value = F.value.offsetHeight;
o.model.source.height > 0 && (b.value = o.model.source.height);
y.value = x.value.offsetHeight;
o.model.source.height > 0 && (y.value = o.model.source.height);
};
N(F, (L, S) => {
L && L !== S && (I(), window.ResizeObserver && F.value && (p = new ResizeObserver((l) => {
const u = l[0].contentRect.height;
u !== y && (I(), y = u);
}), p.observe(F.value)));
N(x, (k, S) => {
k && k !== S && (P(), window.ResizeObserver && x.value && (u = new ResizeObserver((l) => {
const h = l[0].contentRect.height;
h !== b && (P(), b = h);
}), u.observe(x.value)));
}), be(() => {
p && p.disconnect();
u && u.disconnect();
});
const O = T(() => {
const L = [];
const T = D(() => {
const k = [];
return o.groups.forEach((S) => {
if (!S.children.length)
return;
const u = [...S.children].shift();
L.push({
const h = [...S.children].shift();
k.push({
srfkey: S.caption,
isGroupData: !0,
first: u,
first: h,
children: S.children,
_showChildren: !0
});
}), L;
}), k;
});
return {
c: o,
ns: s,
columns: i,
tableData: O,
tableData: T,
onDbRowClick: r,
onUIRowClick: C,
onUIRowClick: F,
onSelectionChange: a,
onSortChange: d,
onPageChange: h,
onPageSizeChange: f,
onPageReset: m,
tableHeight: b,
gridRef: F,
girdPaginationRef: v
onPageChange: m,
onPageSizeChange: g,
onPageReset: p,
tableHeight: y,
gridRef: x,
girdPaginationRef: f
};
},
render() {
......@@ -1597,7 +1615,7 @@ class lt {
}
class ct {
constructor() {
E(this, "component", Me);
E(this, "component", Ae);
}
async createController(t, s) {
const o = new Z(t, s);
......@@ -1609,7 +1627,7 @@ class dt {
E(this, "component", "IndexView");
}
}
const ae = k({
const ae = L({
name: "WFStepTraceGrid",
props: {
context: Object,
......@@ -1631,19 +1649,19 @@ const ae = k({
setup(e) {
const {
proxy: t
} = R(), s = Ue(t, e.modelPath);
z(t, "deName", s.setDeName.bind(s));
const o = U("wf-step-trace-grid"), i = g([]), n = (a, d, h = !1) => {
a.identitylinks.length > 0 || a.comments.length > 0 && a.comments.forEach((m) => {
var f, C, b;
h && m.type === "启动流程" || d.push({
} = A(), s = Ue(t, e.modelPath);
B(t, "deName", s.setDeName.bind(s));
const o = U("wf-step-trace-grid"), i = w([]), n = (a, d, m = !1) => {
a.identitylinks.length > 0 || a.comments.length > 0 && a.comments.forEach((p) => {
var g, F, y;
m && p.type === "启动流程" || d.push({
id: W(),
nodeName: a.userTaskName,
personName: (f = m.authorName) == null ? void 0 : f.replace(/\([^)]*\)[^(]*$/, ""),
deptName: ((b = (C = m.authorName) == null ? void 0 : C.match(/.*\(([^)]*)\)[^(]*$/)) == null ? void 0 : b[1]) || "",
time: m.time,
content: m.type,
comment: m.fullMessage
personName: (g = p.authorName) == null ? void 0 : g.replace(/\([^)]*\)[^(]*$/, ""),
deptName: ((y = (F = p.authorName) == null ? void 0 : F.match(/.*\(([^)]*)\)[^(]*$/)) == null ? void 0 : y[1]) || "",
time: p.time,
content: p.type,
comment: p.fullMessage
});
});
};
......@@ -1651,9 +1669,9 @@ const ae = k({
var a;
s.data && ((a = s.data.usertasks) == null || a.forEach((d) => {
if (d.usertasks && d.usertasks.length > 0) {
const h = [];
d.usertasks.forEach((m) => {
n(m, h, !0);
const m = [];
d.usertasks.forEach((p) => {
n(p, m, !0);
}), i.value.push({
id: W(),
nodeName: `${d.userTaskName}`,
......@@ -1662,19 +1680,19 @@ const ae = k({
time: "",
content: "",
comment: "",
children: h,
children: m,
_showChildren: !0
});
} else
n(d, i.value);
}), i.value.sort((d, h) => Date.parse(d.time) - Date.parse(h.time)));
}), i.value.sort((d, m) => Date.parse(d.time) - Date.parse(m.time)));
});
const r = g([{
const r = w([{
title: "序号",
key: "index",
width: 60,
resizable: !0,
render: (a, d) => i.value.findIndex((m) => m.id === d.row.id) === -1 ? null : a("span", {
render: (a, d) => i.value.findIndex((p) => p.id === d.row.id) === -1 ? null : a("span", {
style: {
textAlign: "center"
}
......@@ -1734,7 +1752,7 @@ const ae = k({
})]);
}
});
class ut extends we {
class ut extends ve {
async calcWfToolbar() {
await super.calcWfToolbar(), this.isEditable && this.wfLinks.unshift({
sequenceFlowName: "保存",
......@@ -1745,7 +1763,7 @@ class ut extends we {
t.type === "FORM_SAVE" ? await this.save() : super.onLinkClick(t);
}
}
k({
L({
props: {
context: Object,
params: {
......@@ -1762,7 +1780,7 @@ k({
setup(e) {
const {
proxy: t
} = R(), s = Q(t, (r, a) => new ut(e.modelPath, r, a)), o = U(`view-${me.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), i = g(["mainForm"]);
} = A(), s = Q(t, (r, a) => new ut(e.modelPath, r, a)), o = U(`view-${me.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), i = w(["mainForm"]);
return {
c: s,
ns: o,
......@@ -1864,7 +1882,7 @@ k({
})])]);
}
});
k({
L({
name: "SyEditView3",
props: {
context: Object,
......@@ -1882,7 +1900,7 @@ k({
setup(e) {
const {
proxy: t
} = R(), s = Ee(t, e.modelPath), o = U("view-deeditview3"), i = g(["mainForm"]);
} = A(), s = Ee(t, e.modelPath), o = U("view-deeditview3"), i = w(["mainForm"]);
return {
c: s,
ns: o,
......@@ -1977,8 +1995,8 @@ class mt extends te {
if (o && o.length > 0) {
const a = (await ibiz.entityService.getService("XQFBXQPS", s)).local.getList(s);
o.forEach((d) => {
const h = a.find((m) => m.srfkey === d.srfkey);
h && (h.psjg = "10", d.psjg = "10");
const m = a.find((p) => p.srfkey === d.srfkey);
m && (m.psjg = "10", d.psjg = "10");
});
}
return {
......@@ -2000,8 +2018,8 @@ class ft extends te {
if (o && o.length > 0) {
const a = (await ibiz.entityService.getService("XQFBXQPS", s)).local.getList(s);
o.forEach((d) => {
const h = a.find((m) => m.srfkey === d.srfkey);
h && (h.psjg = "20", d.psjg = "20");
const m = a.find((p) => p.srfkey === d.srfkey);
m && (m.psjg = "20", d.psjg = "20");
});
}
return {
......@@ -2018,18 +2036,18 @@ class gt {
return this.handler || (this.handler = new ft()), this.handler;
}
}
class vt {
class wt {
constructor() {
E(this, "component", "GroupGrid");
}
}
const wt = new Ae(import.meta.url), Nt = {
const vt = new Re(import.meta.url), Nt = {
mateUrl: import.meta.url,
install(e) {
pe.getModelService().then((t) => {
var o;
((o = t.app.userParams) == null ? void 0 : o.autoWidth) === "true" && document.getElementsByClassName("app")[0].classList.add("auto-width");
}), wt.loadStyle(["/style.css"]), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", Be), ibiz.register.view.register(
}), vt.loadStyle(["/style.css"]), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", $e), ibiz.register.view.register(
"VIEW_CUSTOM_SyWebIndexView",
new dt()
), ibiz.register.view.register(
......@@ -2049,7 +2067,7 @@ const wt = new Ae(import.meta.url), Nt = {
new gt()
), e.component("GroupGrid", at), ibiz.register.control.register(
"GRID_RENDER_GROUP_GRID",
new vt()
new wt()
);
}
};
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册