epic-designer-gold 1.0.36 → 1.0.37
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/dist/form-BcyswgAo.cjs +1 -0
- package/dist/{form-DDcaeFok.js → form-CcUK0W1z.js} +70 -68
- package/dist/ocrUpload-CBzBe8ro.cjs +1 -0
- package/dist/{ocrUpload-DFAe83gW.js → ocrUpload-DVHm3yls.js} +27 -27
- package/dist/style.css +1 -1
- package/dist/ui/elementPlus/index.cjs +1 -1
- package/dist/ui/elementPlus/index.js +2 -2
- package/package.json +1 -1
- package/dist/form-sr_OUKVG.cjs +0 -1
- package/dist/ocrUpload-BoJVjq3M.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("element-plus"),w=require("./pluginManager-C8aQylGX.cjs"),R=require("./_plugin-vue_export-helper-NUO0U1Az.cjs"),L=require("./index-BoL2PSBk.cjs"),J={key:0,class:"form-main",style:{height:"100%"}},G={class:"save-modal-content"},K={class:"save-modal-item"},Q={class:"save-modal-item"},Z={class:"signature-container"},ee={class:"signature-controls"},te={key:0,class:"signature-preview"},ne=["src"],oe=e.defineComponent({__name:"form",props:{componentSchema:{type:Object,require:!0,default:()=>({})}},setup(j,{expose:q}){var N,T;const s=j,A=e.inject("pageManager",{}),u=e.ref(null),b=e.inject("forms",{}),F=e.ref(!0),c=e.reactive({});A.addFormData(c,(T=(N=s.componentSchema)==null?void 0:N.componentProps)==null?void 0:T.name),e.provide("formData",c);const O=w.pluginManager.getComponent("modal"),W=w.pluginManager.getComponent("input"),x=w.pluginManager.getComponent("button"),g=e.ref(!1),d=e.ref(""),i=e.ref("");let m=null,f=null;const r=e.ref(null),a=e.ref(null),h=e.ref(!1),y=e.ref(0),C=e.ref(0);function X(){if(!r.value)return;const t=r.value,n=t.parentElement;if(!n)return;const l=n.getBoundingClientRect().width-20,p=400;t.width=l,t.height=p,a.value=t.getContext("2d"),a.value&&(a.value.lineWidth=4,a.value.lineCap="round",a.value.lineJoin="round",a.value.strokeStyle="#000000",a.value.fillStyle="#ffffff",a.value.fillRect(0,0,t.width,t.height))}function V(t){if(h.value=!0,!r.value)return;const n=r.value.getBoundingClientRect(),o=t.type.includes("mouse")?t.offsetX:t.touches[0].clientX-n.left,l=t.type.includes("mouse")?t.offsetY:t.touches[0].clientY-n.top;y.value=o,C.value=l}function B(t){if(!h.value||!a.value||!r.value)return;const n=r.value.getBoundingClientRect(),o=t.type.includes("mouse")?t.offsetX:t.touches[0].clientX-n.left,l=t.type.includes("mouse")?t.offsetY:t.touches[0].clientY-n.top;a.value.beginPath(),a.value.moveTo(y.value,C.value),a.value.lineTo(o,l),a.value.stroke(),y.value=o,C.value=l}function S(){h.value=!1}function D(){!a.value||!r.value||(a.value.fillStyle="#ffffff",a.value.fillRect(0,0,r.value.width,r.value.height),i.value="")}async function Y(){if(r.value)try{const t=r.value,n=await new Promise(p=>{t.toBlob(H=>{p(H||new Blob)},"image/png")});if(!n){v.ElMessage.error("签字转换失败");return}const o=new FormData;o.append("file",n,"signature.png");const l=await R.axios.post("https://ess-ds.com/prod-api/center-file/file/upload",o,{headers:{Authorization:"Bearer "+L.api.get("Admin-Token"),"Content-Type":"multipart/form-data"}});l.data&&l.data.code===200&&l.data.data?(i.value=l.data.data.url,v.ElMessage.success("签字保存成功")):v.ElMessage.error("签字上传失败,请重试")}catch(t){console.error("上传签字失败:",t),v.ElMessage.error("网络错误,签字上传失败")}}function E(){g.value=!1,d.value="",i.value="",D()}function M(){f&&(f(new Error("用户取消了保存确认")),m=null,f=null),setTimeout(()=>{E()},300)}function U(){if(d.value.trim()!=="我已明确当前修改"){alert("请输入准确的确认文字");return}if(!i.value){alert("请签字确认");return}c.saveDescription=d.value,c.signatureData=i.value,m&&(m(c),m=null,f=null);const n=(s.componentSchema?k(s.componentSchema):[]).find(o=>(o==null?void 0:o.type)==="ocr-upload");n&&n.componentProps&&(n.componentProps.hasAlreadyOcr=!1),E()}function k(t){const n=[t];if(t.children&&Array.isArray(t.children))for(const o of t.children)n.push(...k(o));return n}function _(){const n=(s.componentSchema?k(s.componentSchema):[]).find(o=>(o==null?void 0:o.type)==="ocr-upload");return n&&c[n.field+"-orcWarningInfo"]&&n.componentProps.hasAlreadyOcr?new Promise((o,l)=>{g.value=!0,m=o,f=l,e.nextTick(()=>{X()})}):c}function P(t){Object.assign(c,t)}function z(){var t;return(t=u.value)==null?void 0:t.validate()}e.onMounted(async()=>{var t,n,o,l;if(((t=s.componentSchema)==null?void 0:t.type)==="form"&&b.value&&u.value){const p=((o=(n=s.componentSchema)==null?void 0:n.componentProps)==null?void 0:o.name)??((l=s.componentSchema)==null?void 0:l.name)??"default";return b.value[p]=u.value,u.value.getData=_,u.value.setData=P,!1}});const I=e.computed(()=>{const t=s.componentSchema.componentProps;let n=t.labelCol,o=t.wrapperCol;return t.labelLayout==="fixed"&&(n={style:`width:${typeof t.labelWidth=="number"?t.labelWidth+"px":t.labelWidth}`},o={style:"width:auto;flex:1"}),{...t,labelCol:n,wrapperCol:o}}),$=e.computed(()=>s.componentSchema.children??[]);return q({form:u,getData:_,setData:P,validate:z}),(t,n)=>F.value?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(v.ElForm),e.mergeProps({ref_key:"form",ref:u,model:c},I.value,{style:{height:"100%"}}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"edit-node",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,o=>e.renderSlot(t.$slots,"node",{componentSchema:o},void 0,!0)),256))],!0)]),_:3},16,["model"]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(O)),{style:{height:"calc(100vh - 240px)"},modelValue:g.value,"onUpdate:modelValue":n[1]||(n[1]=o=>g.value=o),title:"保存确认",onClose:M,onCancel:M,onOk:U,okText:"确认保存",cancelText:"取消"},{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createElementVNode("div",K,[n[2]||(n[2]=e.createElementVNode("label",{class:"save-modal-label"},"请输入以下文字确认:",-1)),n[3]||(n[3]=e.createElementVNode("div",{class:"confirm-text"},"我已明确当前修改",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(W)),{modelValue:d.value,"onUpdate:modelValue":n[0]||(n[0]=o=>d.value=o),placeholder:"请输入上方文字确认",type:"text",style:{"margin-top":"8px"}},null,8,["modelValue"]))]),e.createElementVNode("div",Q,[n[6]||(n[6]=e.createElementVNode("label",{class:"save-modal-label"},"请签字确认:",-1)),e.createElementVNode("div",Z,[e.createElementVNode("canvas",{ref_key:"signatureCanvas",ref:r,onMousedown:V,onMousemove:B,onMouseup:S,onMouseleave:S,onTouchstart:V,onTouchmove:B,onTouchend:S,class:"signature-canvas"},null,544),e.createElementVNode("div",ee,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(x)),{type:"primary",size:"small",onClick:D},{default:e.withCtx(()=>[...n[4]||(n[4]=[e.createTextVNode("清空",-1)])]),_:1})),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(x)),{type:"primary",size:"small",onClick:Y},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode("确认签字",-1)])]),_:1}))]),i.value?(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("img",{src:i.value,alt:"签字预览",class:"signature-img"},null,8,ne)])):e.createCommentVNode("",!0)])])])]),_:1},40,["modelValue"]))])):e.createCommentVNode("",!0)}}),ae=R._export_sfc(oe,[["__scopeId","data-v-2f567b52"]]);exports.default=ae;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as le, inject as
|
|
2
|
-
import { ElForm as
|
|
3
|
-
import { p as
|
|
4
|
-
import { a as
|
|
1
|
+
import { defineComponent as le, inject as N, ref as r, reactive as se, provide as re, onMounted as ue, computed as U, createElementBlock as M, createCommentVNode as z, openBlock as f, createVNode as ie, createBlock as C, unref as g, mergeProps as ce, withCtx as S, renderSlot as I, Fragment as de, renderList as fe, resolveDynamicComponent as b, createElementVNode as u, createTextVNode as $, nextTick as me } from "vue";
|
|
2
|
+
import { ElForm as pe, ElMessage as w } from "element-plus";
|
|
3
|
+
import { p as T } from "./pluginManager-B0y107-1.js";
|
|
4
|
+
import { a as ve, _ as he } from "./_plugin-vue_export-helper-8DRKdUfJ.js";
|
|
5
5
|
import { a as ge } from "./index-B1s67XDZ.js";
|
|
6
6
|
const ye = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "form-main",
|
|
9
9
|
style: { height: "100%" }
|
|
10
|
-
}, Ce = { class: "save-modal-content" },
|
|
10
|
+
}, Ce = { class: "save-modal-content" }, Se = { class: "save-modal-item" }, be = { class: "save-modal-item" }, we = { class: "signature-container" }, xe = { class: "signature-controls" }, De = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "signature-preview"
|
|
13
13
|
}, _e = ["src"], ke = /* @__PURE__ */ le({
|
|
@@ -20,12 +20,12 @@ const ye = {
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
setup(L, { expose: q }) {
|
|
23
|
-
var
|
|
24
|
-
const
|
|
25
|
-
H.addFormData(
|
|
26
|
-
const G =
|
|
27
|
-
let
|
|
28
|
-
const l =
|
|
23
|
+
var Y, j;
|
|
24
|
+
const s = L, H = N("pageManager", {}), c = r(null), V = N("forms", {}), J = r(!0), i = se({});
|
|
25
|
+
H.addFormData(i, (j = (Y = s.componentSchema) == null ? void 0 : Y.componentProps) == null ? void 0 : j.name), re("formData", i);
|
|
26
|
+
const G = T.getComponent("modal"), K = T.getComponent("input"), B = T.getComponent("button"), y = r(!1), m = r(""), d = r("");
|
|
27
|
+
let p = null, v = null;
|
|
28
|
+
const l = r(null), o = r(null), x = r(!1), D = r(0), _ = r(0);
|
|
29
29
|
function Q() {
|
|
30
30
|
if (!l.value) return;
|
|
31
31
|
const e = l.value, t = e.parentElement;
|
|
@@ -33,12 +33,12 @@ const ye = {
|
|
|
33
33
|
const a = t.getBoundingClientRect().width - 20, h = 400;
|
|
34
34
|
e.width = a, e.height = h, o.value = e.getContext("2d"), o.value && (o.value.lineWidth = 4, o.value.lineCap = "round", o.value.lineJoin = "round", o.value.strokeStyle = "#000000", o.value.fillStyle = "#ffffff", o.value.fillRect(0, 0, e.width, e.height));
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function R(e) {
|
|
37
37
|
if (x.value = !0, !l.value) return;
|
|
38
38
|
const t = l.value.getBoundingClientRect(), n = e.type.includes("mouse") ? e.offsetX : e.touches[0].clientX - t.left, a = e.type.includes("mouse") ? e.offsetY : e.touches[0].clientY - t.top;
|
|
39
39
|
D.value = n, _.value = a;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function A(e) {
|
|
42
42
|
if (!x.value || !o.value || !l.value) return;
|
|
43
43
|
const t = l.value.getBoundingClientRect(), n = e.type.includes("mouse") ? e.offsetX : e.touches[0].clientX - t.left, a = e.type.includes("mouse") ? e.offsetY : e.touches[0].clientY - t.top;
|
|
44
44
|
o.value.beginPath(), o.value.moveTo(D.value, _.value), o.value.lineTo(n, a), o.value.stroke(), D.value = n, _.value = a;
|
|
@@ -58,28 +58,28 @@ const ye = {
|
|
|
58
58
|
}, "image/png");
|
|
59
59
|
});
|
|
60
60
|
if (!t) {
|
|
61
|
-
|
|
61
|
+
w.error("签字转换失败");
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
const n = new FormData();
|
|
65
65
|
n.append("file", t, "signature.png");
|
|
66
|
-
const a = await
|
|
66
|
+
const a = await ve.post("https://ess-ds.com/prod-api/center-file/file/upload", n, {
|
|
67
67
|
headers: {
|
|
68
68
|
Authorization: "Bearer " + ge.get("Admin-Token"),
|
|
69
69
|
"Content-Type": "multipart/form-data"
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
a.data && a.data.code === 200 && a.data.data ? (d.value = a.data.data.url,
|
|
72
|
+
a.data && a.data.code === 200 && a.data.data ? (d.value = a.data.data.url, w.success("签字保存成功")) : w.error("签字上传失败,请重试");
|
|
73
73
|
} catch (e) {
|
|
74
|
-
console.error("上传签字失败:", e),
|
|
74
|
+
console.error("上传签字失败:", e), w.error("网络错误,签字上传失败");
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function F() {
|
|
78
78
|
y.value = !1, m.value = "", d.value = "", E();
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
function W() {
|
|
81
|
+
v && (v(new Error("用户取消了保存确认")), p = null, v = null), setTimeout(() => {
|
|
82
|
+
F();
|
|
83
83
|
}, 300);
|
|
84
84
|
}
|
|
85
85
|
function ee() {
|
|
@@ -91,25 +91,27 @@ const ye = {
|
|
|
91
91
|
alert("请签字确认");
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
i.saveDescription = m.value, i.signatureData = d.value, p && (p(i), p = null, v = null);
|
|
95
|
+
const t = (s.componentSchema ? P(s.componentSchema) : []).find((n) => (n == null ? void 0 : n.type) === "ocr-upload");
|
|
96
|
+
t && t.componentProps && (t.componentProps.hasAlreadyOcr = !1), F();
|
|
95
97
|
}
|
|
96
|
-
function
|
|
98
|
+
function P(e) {
|
|
97
99
|
const t = [e];
|
|
98
100
|
if (e.children && Array.isArray(e.children))
|
|
99
101
|
for (const n of e.children)
|
|
100
|
-
t.push(...
|
|
102
|
+
t.push(...P(n));
|
|
101
103
|
return t;
|
|
102
104
|
}
|
|
103
|
-
function
|
|
104
|
-
const t = (
|
|
105
|
-
return t &&
|
|
106
|
-
y.value = !0,
|
|
105
|
+
function O() {
|
|
106
|
+
const t = (s.componentSchema ? P(s.componentSchema) : []).find((n) => (n == null ? void 0 : n.type) === "ocr-upload");
|
|
107
|
+
return t && i[t.field + "-orcWarningInfo"] && t.componentProps.hasAlreadyOcr ? new Promise((n, a) => {
|
|
108
|
+
y.value = !0, p = n, v = a, me(() => {
|
|
107
109
|
Q();
|
|
108
110
|
});
|
|
109
|
-
}) :
|
|
111
|
+
}) : i;
|
|
110
112
|
}
|
|
111
|
-
function
|
|
112
|
-
Object.assign(
|
|
113
|
+
function X(e) {
|
|
114
|
+
Object.assign(i, e);
|
|
113
115
|
}
|
|
114
116
|
function te() {
|
|
115
117
|
var e;
|
|
@@ -117,13 +119,13 @@ const ye = {
|
|
|
117
119
|
}
|
|
118
120
|
ue(async () => {
|
|
119
121
|
var e, t, n, a;
|
|
120
|
-
if (((e =
|
|
121
|
-
const h = ((n = (t =
|
|
122
|
-
return
|
|
122
|
+
if (((e = s.componentSchema) == null ? void 0 : e.type) === "form" && V.value && c.value) {
|
|
123
|
+
const h = ((n = (t = s.componentSchema) == null ? void 0 : t.componentProps) == null ? void 0 : n.name) ?? ((a = s.componentSchema) == null ? void 0 : a.name) ?? "default";
|
|
124
|
+
return V.value[h] = c.value, c.value.getData = O, c.value.setData = X, !1;
|
|
123
125
|
}
|
|
124
126
|
});
|
|
125
|
-
const ne =
|
|
126
|
-
const e =
|
|
127
|
+
const ne = U(() => {
|
|
128
|
+
const e = s.componentSchema.componentProps;
|
|
127
129
|
let t = e.labelCol, n = e.wrapperCol;
|
|
128
130
|
return e.labelLayout === "fixed" && (t = {
|
|
129
131
|
style: `width:${typeof e.labelWidth == "number" ? e.labelWidth + "px" : e.labelWidth}`
|
|
@@ -132,21 +134,21 @@ const ye = {
|
|
|
132
134
|
labelCol: t,
|
|
133
135
|
wrapperCol: n
|
|
134
136
|
};
|
|
135
|
-
}), oe =
|
|
137
|
+
}), oe = U(() => s.componentSchema.children ?? []);
|
|
136
138
|
return q({
|
|
137
139
|
form: c,
|
|
138
|
-
getData:
|
|
139
|
-
setData:
|
|
140
|
+
getData: O,
|
|
141
|
+
setData: X,
|
|
140
142
|
validate: te
|
|
141
143
|
}), (e, t) => J.value ? (f(), M("div", ye, [
|
|
142
|
-
ie(g(
|
|
144
|
+
ie(g(pe), ce({
|
|
143
145
|
ref_key: "form",
|
|
144
146
|
ref: c,
|
|
145
|
-
model:
|
|
147
|
+
model: i
|
|
146
148
|
}, ne.value, { style: { height: "100%" } }), {
|
|
147
|
-
default:
|
|
148
|
-
|
|
149
|
-
(f(!0), M(de, null, fe(oe.value, (n) =>
|
|
149
|
+
default: S(() => [
|
|
150
|
+
I(e.$slots, "edit-node", {}, () => [
|
|
151
|
+
(f(!0), M(de, null, fe(oe.value, (n) => I(e.$slots, "node", { componentSchema: n }, void 0, !0)), 256))
|
|
150
152
|
], !0)
|
|
151
153
|
]),
|
|
152
154
|
_: 3
|
|
@@ -156,17 +158,17 @@ const ye = {
|
|
|
156
158
|
modelValue: y.value,
|
|
157
159
|
"onUpdate:modelValue": t[1] || (t[1] = (n) => y.value = n),
|
|
158
160
|
title: "保存确认",
|
|
159
|
-
onClose:
|
|
160
|
-
onCancel:
|
|
161
|
+
onClose: W,
|
|
162
|
+
onCancel: W,
|
|
161
163
|
onOk: ee,
|
|
162
164
|
okText: "确认保存",
|
|
163
165
|
cancelText: "取消"
|
|
164
166
|
}, {
|
|
165
|
-
default:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
t[2] || (t[2] =
|
|
169
|
-
t[3] || (t[3] =
|
|
167
|
+
default: S(() => [
|
|
168
|
+
u("div", Ce, [
|
|
169
|
+
u("div", Se, [
|
|
170
|
+
t[2] || (t[2] = u("label", { class: "save-modal-label" }, "请输入以下文字确认:", -1)),
|
|
171
|
+
t[3] || (t[3] = u("div", { class: "confirm-text" }, "我已明确当前修改", -1)),
|
|
170
172
|
(f(), C(b(g(K)), {
|
|
171
173
|
modelValue: m.value,
|
|
172
174
|
"onUpdate:modelValue": t[0] || (t[0] = (n) => m.value = n),
|
|
@@ -175,59 +177,59 @@ const ye = {
|
|
|
175
177
|
style: { "margin-top": "8px" }
|
|
176
178
|
}, null, 8, ["modelValue"]))
|
|
177
179
|
]),
|
|
178
|
-
|
|
179
|
-
t[6] || (t[6] =
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
u("div", be, [
|
|
181
|
+
t[6] || (t[6] = u("label", { class: "save-modal-label" }, "请签字确认:", -1)),
|
|
182
|
+
u("div", we, [
|
|
183
|
+
u("canvas", {
|
|
182
184
|
ref_key: "signatureCanvas",
|
|
183
185
|
ref: l,
|
|
184
|
-
onMousedown:
|
|
185
|
-
onMousemove:
|
|
186
|
+
onMousedown: R,
|
|
187
|
+
onMousemove: A,
|
|
186
188
|
onMouseup: k,
|
|
187
189
|
onMouseleave: k,
|
|
188
|
-
onTouchstart:
|
|
189
|
-
onTouchmove:
|
|
190
|
+
onTouchstart: R,
|
|
191
|
+
onTouchmove: A,
|
|
190
192
|
onTouchend: k,
|
|
191
193
|
class: "signature-canvas"
|
|
192
194
|
}, null, 544),
|
|
193
|
-
|
|
194
|
-
(f(), C(b(g(
|
|
195
|
+
u("div", xe, [
|
|
196
|
+
(f(), C(b(g(B)), {
|
|
195
197
|
type: "primary",
|
|
196
198
|
size: "small",
|
|
197
199
|
onClick: E
|
|
198
200
|
}, {
|
|
199
|
-
default:
|
|
201
|
+
default: S(() => [...t[4] || (t[4] = [
|
|
200
202
|
$("清空", -1)
|
|
201
203
|
])]),
|
|
202
204
|
_: 1
|
|
203
205
|
})),
|
|
204
|
-
(f(), C(b(g(
|
|
206
|
+
(f(), C(b(g(B)), {
|
|
205
207
|
type: "primary",
|
|
206
208
|
size: "small",
|
|
207
209
|
onClick: Z
|
|
208
210
|
}, {
|
|
209
|
-
default:
|
|
211
|
+
default: S(() => [...t[5] || (t[5] = [
|
|
210
212
|
$("确认签字", -1)
|
|
211
213
|
])]),
|
|
212
214
|
_: 1
|
|
213
215
|
}))
|
|
214
216
|
]),
|
|
215
217
|
d.value ? (f(), M("div", De, [
|
|
216
|
-
|
|
218
|
+
u("img", {
|
|
217
219
|
src: d.value,
|
|
218
220
|
alt: "签字预览",
|
|
219
221
|
class: "signature-img"
|
|
220
222
|
}, null, 8, _e)
|
|
221
|
-
])) :
|
|
223
|
+
])) : z("", !0)
|
|
222
224
|
])
|
|
223
225
|
])
|
|
224
226
|
])
|
|
225
227
|
]),
|
|
226
228
|
_: 1
|
|
227
229
|
}, 40, ["modelValue"]))
|
|
228
|
-
])) :
|
|
230
|
+
])) : z("", !0);
|
|
229
231
|
}
|
|
230
|
-
}), Re = /* @__PURE__ */ he(ke, [["__scopeId", "data-v-
|
|
232
|
+
}), Re = /* @__PURE__ */ he(ke, [["__scopeId", "data-v-2f567b52"]]);
|
|
231
233
|
export {
|
|
232
234
|
Re as default
|
|
233
235
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),d=require("element-plus"),I=require("./index-BoL2PSBk.cjs"),{t:P}=I.useLocale(),A=o.defineComponent({props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue","update:ocrData"],setup(B,{emit:z,attrs:e}){const s=o.ref([]),v=o.ref(""),E=o.ref(!1),w=o.ref(!1),y=n=>{E.value=n};o.watch(s,n=>{z("update:modelValue",n)});const u=o.inject("disabled",{value:!1});o.watch(()=>B.modelValue,n=>{if(n!=null&&n.length>0&&s.value!=null){if(s.value===n)return;s.value.length=0,s.value.push(...n)}},{deep:!0,immediate:!0});const W=(n,t)=>{o.nextTick(()=>{C?(s.value=t.filter(l=>{var c,i;return((c=l==null?void 0:l.response)==null?void 0:c.code)===200||((i=l==null?void 0:l.response)==null?void 0:i.code)===201}),C=!1):s.value=t})},j=n=>{var p,f,h;let t=n.url||((f=(p=n==null?void 0:n.response)==null?void 0:p.data)==null?void 0:f.url);if(!t)return;const l=[".jpg",".jpeg",".png",".gif",".svg",".bmp",".webp"],c=((h=n.name)==null?void 0:h.toLowerCase())||"",i=l.some(g=>c.endsWith(g)),m=c.endsWith(".pdf");i?(v.value=t,w.value=!1,y(!0)):m?(v.value=t,w.value=!0,y(!0)):window.open(t)},M=n=>{var i,m,p,f,h;const t=(m=(i=e.componentSchema)==null?void 0:i.componentProps)==null?void 0:m.accept;if(t){const g=t.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r),x=(((p=n.name)==null?void 0:p.toLowerCase())||"").split("."),b=x.length>1?"."+x.pop():"",a=n.type||"";if(!g.some(r=>{if(r==="*/*")return!0;if(r.startsWith("."))return b===r;if(r.endsWith("/*")){const V=r.split("/")[0];return a.startsWith(V+"/")}else return r.includes("/")?a===r||a.startsWith(r+"/"):b==="."+r}))return d.ElMessage.error(`只能上传${t}类型的文件!`),!1}const l=+(((h=(f=e.componentSchema)==null?void 0:f.componentProps)==null?void 0:h.maxSize)??10);return n.size/1024/1024<l?!0:(d.ElMessage.error(`文件大小不能超过 ${l}MB!`),!1)};let C=!1;const R=(n,t,l)=>{n.code!==200&&n.code!==201&&(d.ElMessage.error(P("uploadFailed")),C=!0),console.log(l)},L=(n,t,l)=>{d.ElMessage.error(P("uploadFailed")),console.error(n)},D=(n,t)=>{let{limit:l}=e;d.ElMessage.warning(`最多只能上传 ${l} 个文件`)},U=()=>{var n,t;if(s.value.length===0){d.ElMessage.warning("请先上传文件");return}if(!(e!=null&&e.callBackUrl)){d.ElMessage.warning("请先配置回填接口地址");return}z("update:ocrData",{url:s.value.map(l=>{var c,i;return(i=(c=l.response)==null?void 0:c.data)==null?void 0:i.url}),field:(n=e.componentSchema)==null?void 0:n.field,label:(t=e.componentSchema)==null?void 0:t.label,callBackUrl:e==null?void 0:e.callBackUrl,callBackMethod:e==null?void 0:e.callBackMethod,callBackField:e==null?void 0:e.callBackField,callBackDataPath:e==null?void 0:e.callBackDataPath,validate:e==null?void 0:e.validate,validateParams:e==null?void 0:e.validateParams}),e.componentSchema.componentProps={...e.componentSchema.componentProps,hasAlreadyOcr:!0}};console.log("%c [ ]-199","font-size:13px; background:pink; color:#bf2c9f;",e);const F=o.computed(()=>({...e,"file-list":s.value,beforeUpload:M,onChange:W,onSuccess:R,onError:L,onPreview:j,onExceed:D}));return()=>o.h("div",{class:"epic-ocr-upload",style:{padding:"20px",backgroundColor:"#ffffff",borderRadius:"8px",boxShadow:"0 2px 12px 0 rgba(0, 0, 0, 0.08)",transition:"all 0.3s ease"}},{default:()=>{var n,t,l,c;return[e.disabled||u.value?null:o.h("div",{style:{padding:"16px 20px",backgroundColor:"#f0f9ff",borderRadius:"6px",marginBottom:"20px",border:"1px solid #e0f2fe",color:"#334155",fontSize:"14px",lineHeight:"1.5",display:"flex",alignItems:"flex-start",gap:"8px"}},[o.h("span",{class:"icon--epic icon--epic--error-outline-rounded",style:{color:"#3b82f6",fontSize:"16px",marginTop:"2px"}}),"操作步骤:① 上传文件 → ② 点击「OCR识别」 → 自动识别并回填信息"]),o.h(d.ElUpload,{...F.value,headers:{Authorization:`Bearer ${I.api.get("Admin-Token")}`},listType:"picture-card",style:{marginBottom:e.disabled||u.value?"0":"20px"}},{default:()=>[o.h("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",cursor:e.disabled||u.value?"not-allowed":"pointer",opacity:e.disabled||u.value?.6:1,transition:"all 0.3s ease",borderRadius:"6px",backgroundColor:"#fafafa"}},[o.h("span",{class:"icon--epic icon--epic--cloud-upload-outlined",style:{marginBottom:"8px",color:"#9ca3af",fontSize:"28px",transition:"all 0.3s ease"}}),o.h("span",{style:{fontSize:"14px",color:"#6b7280",fontWeight:500,marginBottom:"4px"}},P("fileUpload")),o.h("span",{style:{fontSize:"12px",color:"#9ca3af"}},"支持图片和PDF文件")])],file:({file:i})=>{var k,x,b;const m=[".jpg",".jpeg",".png",".gif",".svg",".bmp",".webp"],p=((k=i.name)==null?void 0:k.toLowerCase())||"",f=m.some(a=>p.endsWith(a)),h=p.endsWith(".pdf"),g=i.url||((b=(x=i==null?void 0:i.response)==null?void 0:x.data)==null?void 0:b.url);return o.h("div",{class:"el-upload-list__item",style:{backgroundColor:"transparent",border:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",cursor:"pointer"},onClick:()=>j(i)},[e.disabled||u.value?null:o.h("button",{type:"button",class:"el-upload-list__item-delete",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",border:"none",borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.6)",color:"white",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.3s ease",zIndex:10},onClick:a=>{a.stopPropagation();const S=s.value.findIndex(r=>r.uid===i.uid);S!==-1&&s.value.splice(S,1)},onMouseenter:a=>{a.target&&(a.target.style.backgroundColor="#ff4d4f",a.target.style.transform="scale(1.1)")},onMouseleave:a=>{a.target&&(a.target.style.backgroundColor="rgba(0, 0, 0, 0.6)",a.target.style.transform="scale(1)")}},"×"),o.h("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",overflow:"hidden"}},[f&&g?o.h("img",{src:g,style:{width:"100%",height:"100%",objectFit:"contain"}}):h&&g?o.h("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white"}},[o.h("img",{src:"https://ess-ds.com/statics/gd-data/images/pdf.png",style:{width:"60%",height:"60%",objectFit:"contain"},alt:i.name})]):o.h("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white"}},[o.h("img",{src:"https://ess-ds.com/statics/gd-data/images/unknown-file.png",style:{width:"60%",height:"60%",objectFit:"contain"},alt:i.name})])]),o.h("span",{title:i.name,style:{marginTop:"4px",fontSize:"12px",color:"#606266",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"center"}},i.name)])}}),e.disabled||u.value?null:o.h(d.ElButton,{disabled:e.disabled||u.value,onClick:U,style:{marginTop:"0",width:"100%",padding:"10px 24px",fontSize:"14px",fontWeight:500,borderRadius:"6px",backgroundColor:"#3b82f6",borderColor:"#3b82f6",color:"white",transition:"all 0.3s ease"}},{default:()=>[o.h("span",{class:"icon--epic icon--epic--radio-button-checked-outline",style:{marginRight:"8px",fontSize:"16px"}}),"OCR识别"]}),o.h("div",{style:{marginTop:"8px",padding:"12px 16px",backgroundColor:"#ff4d4f",color:"white",borderRadius:"6px",fontSize:"14px",fontWeight:500,textAlign:"left",boxShadow:"0 2px 8px rgba(255, 77, 79, 0.3)",display:(t=e.model)!=null&&t[((n=e.componentSchema)==null?void 0:n.field)+"-orcWarningInfo"]?"block":"none"}},((c=e.model)==null?void 0:c[((l=e.componentSchema)==null?void 0:l.field)+"-orcWarningInfo"])||""),(()=>{if(E.value)return w.value?o.h("div",{class:"el-image-viewer__wrapper",style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:2e3,backgroundColor:"rgba(0, 0, 0, 0.8)",display:"flex",alignItems:"center",justifyContent:"center"}},[o.h("button",{style:{position:"absolute",top:"24px",right:"24px",width:"36px",height:"36px",border:"none",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.15)",color:"white",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.3s ease",backdropFilter:"blur(8px)"},onClick:()=>y(!1)},"×"),o.h("div",{style:{width:"90%",height:"90%",backgroundColor:"white",borderRadius:"8px",overflow:"hidden",position:"relative",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",maxWidth:"1400px",maxHeight:"900px",minWidth:"980px",minHeight:"600px"}},[o.h("iframe",{src:v.value,style:{width:"100%",height:"100%",border:"none"},title:"PDF Preview"})])]):o.h(d.ElImageViewer,{urlList:[v.value],onClose:()=>{y(!1)}})})()]}})}});exports.default=A;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as _, ref as w, watch as W, inject as N, computed as O, h as n, nextTick as T } from "vue";
|
|
2
|
-
import { ElUpload as $, ElButton as H, ElImageViewer as q, ElMessage as
|
|
2
|
+
import { ElUpload as $, ElButton as H, ElImageViewer as q, ElMessage as h } from "element-plus";
|
|
3
3
|
import { a as G, u as J } from "./index-B1s67XDZ.js";
|
|
4
4
|
const { t: P } = J(), Y = _({
|
|
5
5
|
props: {
|
|
@@ -16,7 +16,7 @@ const { t: P } = J(), Y = _({
|
|
|
16
16
|
W(s, (o) => {
|
|
17
17
|
I("update:modelValue", o);
|
|
18
18
|
});
|
|
19
|
-
const
|
|
19
|
+
const p = N("disabled", { value: !1 });
|
|
20
20
|
W(
|
|
21
21
|
() => E.modelValue,
|
|
22
22
|
(o) => {
|
|
@@ -37,17 +37,17 @@ const { t: P } = J(), Y = _({
|
|
|
37
37
|
), k = !1) : s.value = t;
|
|
38
38
|
});
|
|
39
39
|
}, B = (o) => {
|
|
40
|
-
var d,
|
|
41
|
-
let t = o.url || ((
|
|
40
|
+
var d, u, f;
|
|
41
|
+
let t = o.url || ((u = (d = o == null ? void 0 : o.response) == null ? void 0 : d.data) == null ? void 0 : u.url);
|
|
42
42
|
if (!t) return;
|
|
43
|
-
const l = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".bmp", ".webp"], c = ((
|
|
43
|
+
const l = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".bmp", ".webp"], c = ((f = o.name) == null ? void 0 : f.toLowerCase()) || "", i = l.some((g) => c.endsWith(g)), m = c.endsWith(".pdf");
|
|
44
44
|
i ? (v.value = t, C.value = !1, y(!0)) : m ? (v.value = t, C.value = !0, y(!0)) : window.open(t);
|
|
45
45
|
}, L = (o) => {
|
|
46
|
-
var i, m, d,
|
|
46
|
+
var i, m, d, u, f;
|
|
47
47
|
const t = (m = (i = e.componentSchema) == null ? void 0 : i.componentProps) == null ? void 0 : m.accept;
|
|
48
48
|
if (t) {
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
49
|
+
const g = t.split(",").map((r) => r.trim().toLowerCase()).filter((r) => r), x = (((d = o.name) == null ? void 0 : d.toLowerCase()) || "").split("."), b = x.length > 1 ? "." + x.pop() : "", a = o.type || "";
|
|
50
|
+
if (!g.some((r) => {
|
|
51
51
|
if (r === "*/*")
|
|
52
52
|
return !0;
|
|
53
53
|
if (r.startsWith("."))
|
|
@@ -57,27 +57,27 @@ const { t: P } = J(), Y = _({
|
|
|
57
57
|
return a.startsWith(A + "/");
|
|
58
58
|
} else return r.includes("/") ? a === r || a.startsWith(r + "/") : b === "." + r;
|
|
59
59
|
}))
|
|
60
|
-
return
|
|
60
|
+
return h.error(`只能上传${t}类型的文件!`), !1;
|
|
61
61
|
}
|
|
62
|
-
const l = +(((
|
|
63
|
-
return o.size / 1024 / 1024 < l ? !0 : (
|
|
62
|
+
const l = +(((f = (u = e.componentSchema) == null ? void 0 : u.componentProps) == null ? void 0 : f.maxSize) ?? 10);
|
|
63
|
+
return o.size / 1024 / 1024 < l ? !0 : (h.error(`文件大小不能超过 ${l}MB!`), !1);
|
|
64
64
|
};
|
|
65
65
|
let k = !1;
|
|
66
66
|
const D = (o, t, l) => {
|
|
67
|
-
o.code !== 200 && o.code !== 201 && (
|
|
67
|
+
o.code !== 200 && o.code !== 201 && (h.error(P("uploadFailed")), k = !0), console.log(l);
|
|
68
68
|
}, U = (o, t, l) => {
|
|
69
|
-
|
|
69
|
+
h.error(P("uploadFailed")), console.error(o);
|
|
70
70
|
}, F = (o, t) => {
|
|
71
71
|
let { limit: l } = e;
|
|
72
|
-
|
|
72
|
+
h.warning(`最多只能上传 ${l} 个文件`);
|
|
73
73
|
}, M = () => {
|
|
74
74
|
var o, t;
|
|
75
75
|
if (s.value.length === 0) {
|
|
76
|
-
|
|
76
|
+
h.warning("请先上传文件");
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
if (!(e != null && e.callBackUrl)) {
|
|
80
|
-
|
|
80
|
+
h.warning("请先配置回填接口地址");
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
I("update:ocrData", {
|
|
@@ -126,7 +126,7 @@ const { t: P } = J(), Y = _({
|
|
|
126
126
|
var o, t, l, c;
|
|
127
127
|
return [
|
|
128
128
|
// 提示文案
|
|
129
|
-
e.disabled ||
|
|
129
|
+
e.disabled || p.value ? null : n(
|
|
130
130
|
"div",
|
|
131
131
|
{
|
|
132
132
|
style: {
|
|
@@ -166,7 +166,7 @@ const { t: P } = J(), Y = _({
|
|
|
166
166
|
},
|
|
167
167
|
listType: "picture-card",
|
|
168
168
|
style: {
|
|
169
|
-
marginBottom: e.disabled ||
|
|
169
|
+
marginBottom: e.disabled || p.value ? "0" : "20px"
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
{
|
|
@@ -181,8 +181,8 @@ const { t: P } = J(), Y = _({
|
|
|
181
181
|
justifyContent: "center",
|
|
182
182
|
width: "100%",
|
|
183
183
|
height: "100%",
|
|
184
|
-
cursor: e.disabled ||
|
|
185
|
-
opacity: e.disabled ||
|
|
184
|
+
cursor: e.disabled || p.value ? "not-allowed" : "pointer",
|
|
185
|
+
opacity: e.disabled || p.value ? 0.6 : 1,
|
|
186
186
|
transition: "all 0.3s ease",
|
|
187
187
|
borderRadius: "6px",
|
|
188
188
|
backgroundColor: "#fafafa"
|
|
@@ -225,7 +225,7 @@ const { t: P } = J(), Y = _({
|
|
|
225
225
|
],
|
|
226
226
|
file: ({ file: i }) => {
|
|
227
227
|
var S, x, b;
|
|
228
|
-
const m = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".bmp", ".webp"], d = ((S = i.name) == null ? void 0 : S.toLowerCase()) || "",
|
|
228
|
+
const m = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".bmp", ".webp"], d = ((S = i.name) == null ? void 0 : S.toLowerCase()) || "", u = m.some((a) => d.endsWith(a)), f = d.endsWith(".pdf"), g = i.url || ((b = (x = i == null ? void 0 : i.response) == null ? void 0 : x.data) == null ? void 0 : b.url);
|
|
229
229
|
return n(
|
|
230
230
|
"div",
|
|
231
231
|
{
|
|
@@ -244,7 +244,7 @@ const { t: P } = J(), Y = _({
|
|
|
244
244
|
},
|
|
245
245
|
[
|
|
246
246
|
// 删除按钮
|
|
247
|
-
n(
|
|
247
|
+
e.disabled || p.value ? null : n(
|
|
248
248
|
"button",
|
|
249
249
|
{
|
|
250
250
|
type: "button",
|
|
@@ -296,14 +296,14 @@ const { t: P } = J(), Y = _({
|
|
|
296
296
|
}
|
|
297
297
|
},
|
|
298
298
|
[
|
|
299
|
-
|
|
300
|
-
src:
|
|
299
|
+
u && g ? n("img", {
|
|
300
|
+
src: g,
|
|
301
301
|
style: {
|
|
302
302
|
width: "100%",
|
|
303
303
|
height: "100%",
|
|
304
304
|
objectFit: "contain"
|
|
305
305
|
}
|
|
306
|
-
}) :
|
|
306
|
+
}) : f && g ? n(
|
|
307
307
|
"div",
|
|
308
308
|
{
|
|
309
309
|
style: {
|
|
@@ -376,10 +376,10 @@ const { t: P } = J(), Y = _({
|
|
|
376
376
|
}
|
|
377
377
|
),
|
|
378
378
|
// 回填数据按钮
|
|
379
|
-
e.disabled ||
|
|
379
|
+
e.disabled || p.value ? null : n(
|
|
380
380
|
H,
|
|
381
381
|
{
|
|
382
|
-
disabled: e.disabled ||
|
|
382
|
+
disabled: e.disabled || p.value,
|
|
383
383
|
onClick: M,
|
|
384
384
|
style: {
|
|
385
385
|
marginTop: "0",
|