@gct-paas/word 0.1.51-patch.5 → 0.1.51-patch.7
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/index.es.js +2039 -4
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6,6 +6,8 @@ import exifr from "exifr";
|
|
|
6
6
|
import { VxeGrid } from "vxe-table";
|
|
7
7
|
import CryptoJS from "crypto-js";
|
|
8
8
|
import { jsPDF } from "jspdf";
|
|
9
|
+
import JsBarcode from "jsbarcode";
|
|
10
|
+
import QRCode from "qrcode";
|
|
9
11
|
import draggable from "vuedraggable";
|
|
10
12
|
//#region \0rolldown/runtime.js
|
|
11
13
|
var __create = Object.create;
|
|
@@ -141045,6 +141047,14 @@ function useWidgetMeta(widget) {
|
|
|
141045
141047
|
isDialog: computed(() => DIALOG_TYPES.has(widgetType.value))
|
|
141046
141048
|
};
|
|
141047
141049
|
}
|
|
141050
|
+
function usePaperWidgetMeta(widget) {
|
|
141051
|
+
const { meta: pageWidgetMeta, props: pageWidgetProps, widgetType } = useMetaFromWidget(widget, "pageWidgetMeta");
|
|
141052
|
+
return {
|
|
141053
|
+
pageWidgetMeta,
|
|
141054
|
+
pageWidgetProps,
|
|
141055
|
+
widgetType
|
|
141056
|
+
};
|
|
141057
|
+
}
|
|
141048
141058
|
function useFieldInfo(fieldMeta) {
|
|
141049
141059
|
const designCtx = useDesignSuiteContext();
|
|
141050
141060
|
const field = computed(() => fieldMeta());
|
|
@@ -141141,6 +141151,17 @@ function useWidgetStaticAttrs(widget) {
|
|
|
141141
141151
|
showDisplayStatus: newDisplayStatus
|
|
141142
141152
|
};
|
|
141143
141153
|
}
|
|
141154
|
+
function usePaperWidgetStaticAttrs(widget) {
|
|
141155
|
+
const { docInst, isDesignMode } = useDocPubApiContext();
|
|
141156
|
+
const { pageWidgetMeta, pageWidgetProps, widgetType } = usePaperWidgetMeta(widget);
|
|
141157
|
+
return {
|
|
141158
|
+
docInst,
|
|
141159
|
+
isDesignMode,
|
|
141160
|
+
pageWidgetMeta,
|
|
141161
|
+
pageWidgetProps,
|
|
141162
|
+
widgetType
|
|
141163
|
+
};
|
|
141164
|
+
}
|
|
141144
141165
|
var MULTIPLE_TYPES, ASYNC_TYPES, DROPDOWN_TYPES, DIALOG_TYPES;
|
|
141145
141166
|
var init_useWidgetRenderData = __esmMin((() => {
|
|
141146
141167
|
init_core$1();
|
|
@@ -145637,6 +145658,22 @@ function computeImageDisplaySize(natural, opts = {}) {
|
|
|
145637
145658
|
height: Math.round(nh * scale)
|
|
145638
145659
|
};
|
|
145639
145660
|
}
|
|
145661
|
+
/**
|
|
145662
|
+
* 在目标框内等比缩放(contain),不压缩、不拉伸
|
|
145663
|
+
*/
|
|
145664
|
+
function computeContainDisplaySize(natural, box) {
|
|
145665
|
+
const nw = natural.width;
|
|
145666
|
+
const nh = natural.height;
|
|
145667
|
+
if (!nw || !nh || !box.width || !box.height) return {
|
|
145668
|
+
width: box.width || nw,
|
|
145669
|
+
height: box.height || nh
|
|
145670
|
+
};
|
|
145671
|
+
const scale = Math.min(box.width / nw, box.height / nh);
|
|
145672
|
+
return {
|
|
145673
|
+
width: Math.round(nw * scale),
|
|
145674
|
+
height: Math.round(nh * scale)
|
|
145675
|
+
};
|
|
145676
|
+
}
|
|
145640
145677
|
function wrapText(text, maxWidth, context) {
|
|
145641
145678
|
const characters = text.split("");
|
|
145642
145679
|
const lines = [];
|
|
@@ -145775,6 +145812,13 @@ function createFormSignFallbackImage(name, width, height, time) {
|
|
|
145775
145812
|
});
|
|
145776
145813
|
return canvas.toDataURL("image/png");
|
|
145777
145814
|
}
|
|
145815
|
+
function loadDataUrlAsImage(dataUrl) {
|
|
145816
|
+
return new Promise((resolve) => {
|
|
145817
|
+
const img = new Image();
|
|
145818
|
+
img.src = dataUrl;
|
|
145819
|
+
img.onload = () => resolve(img);
|
|
145820
|
+
});
|
|
145821
|
+
}
|
|
145778
145822
|
/**
|
|
145779
145823
|
* 创建无图签名兜底图(用户名 + 电子签名 + 验证日期)
|
|
145780
145824
|
* 按字段宽高绘制,显示框设多大,字就按多大排
|
|
@@ -145782,6 +145826,9 @@ function createFormSignFallbackImage(name, width, height, time) {
|
|
|
145782
145826
|
function createSignatureImageDataUrl(name, width = 180, height = 102, time) {
|
|
145783
145827
|
return createFormSignFallbackImage(name, Math.max(1, Math.round(width)), Math.max(1, Math.round(height)), time);
|
|
145784
145828
|
}
|
|
145829
|
+
function createSignatureImage(name, width = 180, height = 102, time) {
|
|
145830
|
+
return loadDataUrlAsImage(createSignatureImageDataUrl(name, width, height, time));
|
|
145831
|
+
}
|
|
145785
145832
|
var import_dayjs_min$1, SIGN_CANVAS_BASE_WIDTH, FALLBACK_SIGN_DPR, ELECTRONIC_SIGNATURE_LABEL, DATE_LABEL;
|
|
145786
145833
|
var init_image_size_util = __esmMin((() => {
|
|
145787
145834
|
import_dayjs_min$1 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
|
|
@@ -157436,12 +157483,2000 @@ function loadPaperWidgetManifestModules() {
|
|
|
157436
157483
|
}
|
|
157437
157484
|
var paperWidgetManifestMap = loadPaperWidgetManifestModules();
|
|
157438
157485
|
//#endregion
|
|
157486
|
+
//#region src/suites/shared/components/checkbox-canvas.vue?vue&type=script&setup=true&lang.ts
|
|
157487
|
+
init_core$1();
|
|
157488
|
+
//#endregion
|
|
157489
|
+
//#region src/suites/shared/components/checkbox-canvas.vue
|
|
157490
|
+
var checkbox_canvas_default = /* @__PURE__ */ defineComponent({
|
|
157491
|
+
__name: "checkbox-canvas",
|
|
157492
|
+
props: {
|
|
157493
|
+
id: {},
|
|
157494
|
+
x: {},
|
|
157495
|
+
y: {},
|
|
157496
|
+
value: { type: [
|
|
157497
|
+
String,
|
|
157498
|
+
Number,
|
|
157499
|
+
Boolean
|
|
157500
|
+
] },
|
|
157501
|
+
modelValue: {},
|
|
157502
|
+
readonly: { type: Boolean },
|
|
157503
|
+
disabled: { type: Boolean },
|
|
157504
|
+
required: { type: Boolean },
|
|
157505
|
+
multiple: { type: Boolean },
|
|
157506
|
+
size: {},
|
|
157507
|
+
iconType: {}
|
|
157508
|
+
},
|
|
157509
|
+
emits: ["update:modelValue", "change"],
|
|
157510
|
+
setup(__props, { emit: __emit }) {
|
|
157511
|
+
const props = __props;
|
|
157512
|
+
const emit = __emit;
|
|
157513
|
+
const hover = ref(false);
|
|
157514
|
+
const boxSize = computed(() => props.size === "small" ? 14 : 18);
|
|
157515
|
+
const hitArea = computed(() => {
|
|
157516
|
+
return {
|
|
157517
|
+
x: -4,
|
|
157518
|
+
y: -4,
|
|
157519
|
+
size: boxSize.value + 8
|
|
157520
|
+
};
|
|
157521
|
+
});
|
|
157522
|
+
const checked = computed(() => {
|
|
157523
|
+
if (props.multiple) return Array.isArray(props.modelValue) && props.modelValue.includes(props.value);
|
|
157524
|
+
return props.modelValue === props.value;
|
|
157525
|
+
});
|
|
157526
|
+
const isReadonly = computed(() => !!props.readonly);
|
|
157527
|
+
const isDisabled = computed(() => !!props.disabled);
|
|
157528
|
+
const isRequired = computed(() => !!props.required);
|
|
157529
|
+
const borderColor = computed(() => {
|
|
157530
|
+
if (isDisabled.value) return "#d9d9d9";
|
|
157531
|
+
if (checked.value) return "#026ac8";
|
|
157532
|
+
if (isRequired.value) return "#ff4d4f";
|
|
157533
|
+
if (hover.value) return "#026ac8";
|
|
157534
|
+
return "rgb(128, 128, 128)";
|
|
157535
|
+
});
|
|
157536
|
+
const backgroundColor = computed(() => {
|
|
157537
|
+
if (isDisabled.value) return "rgba(0, 0, 0, 0.04)";
|
|
157538
|
+
if (checked.value) return "#026ac8";
|
|
157539
|
+
if (isRequired.value) return "rgba(255, 77, 79, 0.05)";
|
|
157540
|
+
return "#fff";
|
|
157541
|
+
});
|
|
157542
|
+
const checkedColor = computed(() => {
|
|
157543
|
+
if (isDisabled.value) return "rgba(0, 0, 0, 0.25)";
|
|
157544
|
+
return "#fff";
|
|
157545
|
+
});
|
|
157546
|
+
const checkPoints = computed(() => {
|
|
157547
|
+
const s = boxSize.value;
|
|
157548
|
+
return [
|
|
157549
|
+
halfPixel(s * .25) - 2,
|
|
157550
|
+
halfPixel(s * .55) - 1,
|
|
157551
|
+
halfPixel(s * .42) - 1,
|
|
157552
|
+
halfPixel(s * .72),
|
|
157553
|
+
halfPixel(s * .75),
|
|
157554
|
+
halfPixel(s * .28) - 1
|
|
157555
|
+
];
|
|
157556
|
+
});
|
|
157557
|
+
function onClick() {
|
|
157558
|
+
if (isDisabled.value || isReadonly.value) return;
|
|
157559
|
+
const mv = props.modelValue;
|
|
157560
|
+
setTimeout(() => {
|
|
157561
|
+
if (props.multiple) {
|
|
157562
|
+
const list = Array.isArray(mv) ? [...mv] : [];
|
|
157563
|
+
const index = list.indexOf(props.value);
|
|
157564
|
+
if (index > -1) list.splice(index, 1);
|
|
157565
|
+
else list.push(props.value);
|
|
157566
|
+
emit("update:modelValue", list);
|
|
157567
|
+
emit("change", list);
|
|
157568
|
+
return;
|
|
157569
|
+
}
|
|
157570
|
+
if (checked.value) {
|
|
157571
|
+
emit("update:modelValue", void 0);
|
|
157572
|
+
emit("change", void 0);
|
|
157573
|
+
} else {
|
|
157574
|
+
emit("update:modelValue", props.value);
|
|
157575
|
+
emit("change", props.value);
|
|
157576
|
+
}
|
|
157577
|
+
}, 120);
|
|
157578
|
+
}
|
|
157579
|
+
function onEnter() {
|
|
157580
|
+
if (isReadonly.value || isDisabled.value) return;
|
|
157581
|
+
hover.value = true;
|
|
157582
|
+
}
|
|
157583
|
+
function onLeave() {
|
|
157584
|
+
hover.value = false;
|
|
157585
|
+
}
|
|
157586
|
+
return (_ctx, _cache) => {
|
|
157587
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
157588
|
+
const _component_v_line = resolveComponent("v-line");
|
|
157589
|
+
const _component_v_group = resolveComponent("v-group");
|
|
157590
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
157591
|
+
x: __props.x,
|
|
157592
|
+
y: __props.y,
|
|
157593
|
+
id: __props.id,
|
|
157594
|
+
onPointerenter: onEnter,
|
|
157595
|
+
onPointerleave: onLeave
|
|
157596
|
+
} }, {
|
|
157597
|
+
default: withCtx(() => [
|
|
157598
|
+
createVNode(_component_v_rect, {
|
|
157599
|
+
width: boxSize.value,
|
|
157600
|
+
height: boxSize.value,
|
|
157601
|
+
cornerRadius: 2,
|
|
157602
|
+
stroke: borderColor.value,
|
|
157603
|
+
fill: backgroundColor.value,
|
|
157604
|
+
strokeWidth: 1,
|
|
157605
|
+
listening: false
|
|
157606
|
+
}, null, 8, [
|
|
157607
|
+
"width",
|
|
157608
|
+
"height",
|
|
157609
|
+
"stroke",
|
|
157610
|
+
"fill"
|
|
157611
|
+
]),
|
|
157612
|
+
checked.value ? (openBlock(), createBlock(_component_v_line, {
|
|
157613
|
+
key: 0,
|
|
157614
|
+
points: checkPoints.value,
|
|
157615
|
+
stroke: checkedColor.value,
|
|
157616
|
+
strokeWidth: 2,
|
|
157617
|
+
lineCap: "round",
|
|
157618
|
+
lineJoin: "round",
|
|
157619
|
+
perfectDrawEnabled: false,
|
|
157620
|
+
listening: false
|
|
157621
|
+
}, null, 8, ["points", "stroke"])) : createCommentVNode("", true),
|
|
157622
|
+
createVNode(_component_v_rect, {
|
|
157623
|
+
x: hitArea.value.x,
|
|
157624
|
+
y: hitArea.value.y,
|
|
157625
|
+
width: hitArea.value.size,
|
|
157626
|
+
height: hitArea.value.size,
|
|
157627
|
+
fill: "transparent",
|
|
157628
|
+
listening: true,
|
|
157629
|
+
onPointerdown: onClick
|
|
157630
|
+
}, null, 8, [
|
|
157631
|
+
"x",
|
|
157632
|
+
"y",
|
|
157633
|
+
"width",
|
|
157634
|
+
"height"
|
|
157635
|
+
])
|
|
157636
|
+
]),
|
|
157637
|
+
_: 1
|
|
157638
|
+
}, 8, ["config"]);
|
|
157639
|
+
};
|
|
157640
|
+
}
|
|
157641
|
+
});
|
|
157642
|
+
//#endregion
|
|
157643
|
+
//#region src/suites/shared/components/radio-canvas.vue?vue&type=script&setup=true&lang.ts
|
|
157644
|
+
var radius = 8;
|
|
157645
|
+
//#endregion
|
|
157646
|
+
//#region src/suites/shared/components/radio-canvas.vue
|
|
157647
|
+
var radio_canvas_default = /* @__PURE__ */ defineComponent({
|
|
157648
|
+
__name: "radio-canvas",
|
|
157649
|
+
props: {
|
|
157650
|
+
id: {},
|
|
157651
|
+
x: {},
|
|
157652
|
+
y: {},
|
|
157653
|
+
value: { type: [
|
|
157654
|
+
String,
|
|
157655
|
+
Number,
|
|
157656
|
+
Boolean
|
|
157657
|
+
] },
|
|
157658
|
+
modelValue: {},
|
|
157659
|
+
readonly: { type: Boolean },
|
|
157660
|
+
disabled: { type: Boolean },
|
|
157661
|
+
required: { type: Boolean },
|
|
157662
|
+
multiple: { type: Boolean },
|
|
157663
|
+
iconType: {}
|
|
157664
|
+
},
|
|
157665
|
+
emits: ["update:modelValue", "change"],
|
|
157666
|
+
setup(__props, { emit: __emit }) {
|
|
157667
|
+
const props = __props;
|
|
157668
|
+
const emit = __emit;
|
|
157669
|
+
const hover = ref(false);
|
|
157670
|
+
const hitArea = computed(() => {
|
|
157671
|
+
return {
|
|
157672
|
+
x: -3,
|
|
157673
|
+
y: -3,
|
|
157674
|
+
size: 23
|
|
157675
|
+
};
|
|
157676
|
+
});
|
|
157677
|
+
const checked = computed(() => {
|
|
157678
|
+
if (props.multiple) return Array.isArray(props.modelValue) && props.modelValue.includes(props.value);
|
|
157679
|
+
return props.modelValue === props.value;
|
|
157680
|
+
});
|
|
157681
|
+
const isReadonly = computed(() => !!props.readonly);
|
|
157682
|
+
const isDisabled = computed(() => !!props.disabled);
|
|
157683
|
+
const isRequired = computed(() => !!props.required);
|
|
157684
|
+
const borderColor = computed(() => {
|
|
157685
|
+
if (isDisabled.value) return "#d9d9d9";
|
|
157686
|
+
if (checked.value) return "#026ac8";
|
|
157687
|
+
if (isRequired.value) return "#ff4d4f";
|
|
157688
|
+
if (hover.value) return "#026ac8";
|
|
157689
|
+
return "rgb(128, 128, 128)";
|
|
157690
|
+
});
|
|
157691
|
+
const backgroundColor = computed(() => {
|
|
157692
|
+
if (isDisabled.value) return "rgba(0, 0, 0, 0.04)";
|
|
157693
|
+
if (checked.value) return "#026ac8";
|
|
157694
|
+
if (isRequired.value) return "rgba(255, 77, 79, 0.05)";
|
|
157695
|
+
return "#fff";
|
|
157696
|
+
});
|
|
157697
|
+
const checkedColor = computed(() => {
|
|
157698
|
+
if (isDisabled.value) return "rgba(0, 0, 0, 0.25)";
|
|
157699
|
+
return "#fff";
|
|
157700
|
+
});
|
|
157701
|
+
const innerRadius = computed(() => radius * .5);
|
|
157702
|
+
function onClick() {
|
|
157703
|
+
if (isDisabled.value || isReadonly.value) return;
|
|
157704
|
+
const mv = props.modelValue;
|
|
157705
|
+
setTimeout(() => {
|
|
157706
|
+
if (props.multiple) {
|
|
157707
|
+
const list = Array.isArray(mv) ? [...mv] : [];
|
|
157708
|
+
const index = list.indexOf(props.value);
|
|
157709
|
+
if (index > -1) list.splice(index, 1);
|
|
157710
|
+
else list.push(props.value);
|
|
157711
|
+
emit("update:modelValue", list);
|
|
157712
|
+
emit("change", list);
|
|
157713
|
+
return;
|
|
157714
|
+
}
|
|
157715
|
+
if (checked.value) {
|
|
157716
|
+
emit("update:modelValue", void 0);
|
|
157717
|
+
emit("change", void 0);
|
|
157718
|
+
} else {
|
|
157719
|
+
emit("update:modelValue", props.value);
|
|
157720
|
+
emit("change", props.value);
|
|
157721
|
+
}
|
|
157722
|
+
}, 120);
|
|
157723
|
+
}
|
|
157724
|
+
function onEnter() {
|
|
157725
|
+
if (isReadonly.value || isDisabled.value) return;
|
|
157726
|
+
hover.value = true;
|
|
157727
|
+
}
|
|
157728
|
+
function onLeave() {
|
|
157729
|
+
hover.value = false;
|
|
157730
|
+
}
|
|
157731
|
+
return (_ctx, _cache) => {
|
|
157732
|
+
const _component_v_circle = resolveComponent("v-circle");
|
|
157733
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
157734
|
+
const _component_v_group = resolveComponent("v-group");
|
|
157735
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
157736
|
+
x: __props.x,
|
|
157737
|
+
y: __props.y,
|
|
157738
|
+
id: __props.id,
|
|
157739
|
+
onPointerenter: onEnter,
|
|
157740
|
+
onPointerleave: onLeave
|
|
157741
|
+
} }, {
|
|
157742
|
+
default: withCtx(() => [
|
|
157743
|
+
createVNode(_component_v_circle, {
|
|
157744
|
+
x: radius,
|
|
157745
|
+
y: radius,
|
|
157746
|
+
radius,
|
|
157747
|
+
stroke: borderColor.value,
|
|
157748
|
+
strokeWidth: 1,
|
|
157749
|
+
fill: backgroundColor.value,
|
|
157750
|
+
perfectDrawEnabled: false,
|
|
157751
|
+
strokeScaleEnabled: false,
|
|
157752
|
+
hitGraphEnabled: false
|
|
157753
|
+
}, null, 8, ["stroke", "fill"]),
|
|
157754
|
+
checked.value ? (openBlock(), createBlock(_component_v_circle, {
|
|
157755
|
+
key: 0,
|
|
157756
|
+
x: radius,
|
|
157757
|
+
y: radius,
|
|
157758
|
+
radius: innerRadius.value,
|
|
157759
|
+
fill: checkedColor.value,
|
|
157760
|
+
perfectDrawEnabled: false,
|
|
157761
|
+
strokeScaleEnabled: false,
|
|
157762
|
+
hitGraphEnabled: false
|
|
157763
|
+
}, null, 8, ["radius", "fill"])) : createCommentVNode("", true),
|
|
157764
|
+
createVNode(_component_v_rect, {
|
|
157765
|
+
x: hitArea.value.x,
|
|
157766
|
+
y: hitArea.value.y,
|
|
157767
|
+
width: hitArea.value.size,
|
|
157768
|
+
height: hitArea.value.size,
|
|
157769
|
+
fill: "transparent",
|
|
157770
|
+
listening: true,
|
|
157771
|
+
onPointerdown: onClick
|
|
157772
|
+
}, null, 8, [
|
|
157773
|
+
"x",
|
|
157774
|
+
"y",
|
|
157775
|
+
"width",
|
|
157776
|
+
"height"
|
|
157777
|
+
])
|
|
157778
|
+
]),
|
|
157779
|
+
_: 1
|
|
157780
|
+
}, 8, ["config"]);
|
|
157781
|
+
};
|
|
157782
|
+
}
|
|
157783
|
+
});
|
|
157784
|
+
//#endregion
|
|
157785
|
+
//#region src/suites/shared/components/icon-canvas.vue?vue&type=script&setup=true&lang.ts
|
|
157786
|
+
init_attachment();
|
|
157787
|
+
init_doc();
|
|
157788
|
+
init_img();
|
|
157789
|
+
init_mp4();
|
|
157790
|
+
init_pdf();
|
|
157791
|
+
init_ppt();
|
|
157792
|
+
init_xlsx();
|
|
157793
|
+
//#endregion
|
|
157794
|
+
//#region src/suites/shared/components/icon-canvas.vue
|
|
157795
|
+
var icon_canvas_default = /* @__PURE__ */ defineComponent({
|
|
157796
|
+
__name: "icon-canvas",
|
|
157797
|
+
props: {
|
|
157798
|
+
id: {},
|
|
157799
|
+
x: {},
|
|
157800
|
+
y: {},
|
|
157801
|
+
value: { type: [
|
|
157802
|
+
String,
|
|
157803
|
+
Number,
|
|
157804
|
+
Boolean
|
|
157805
|
+
] },
|
|
157806
|
+
modelValue: {},
|
|
157807
|
+
readonly: { type: Boolean },
|
|
157808
|
+
disabled: { type: Boolean },
|
|
157809
|
+
required: { type: Boolean },
|
|
157810
|
+
multiple: { type: Boolean },
|
|
157811
|
+
size: {},
|
|
157812
|
+
iconType: {}
|
|
157813
|
+
},
|
|
157814
|
+
setup(__props) {
|
|
157815
|
+
const svg = {
|
|
157816
|
+
img: img_default,
|
|
157817
|
+
doc: doc_default,
|
|
157818
|
+
mp4: mp4_default,
|
|
157819
|
+
pdf: pdf_default,
|
|
157820
|
+
xlsx: xlsx_default,
|
|
157821
|
+
ppt: ppt_default,
|
|
157822
|
+
attachment: attachment_default
|
|
157823
|
+
};
|
|
157824
|
+
const props = __props;
|
|
157825
|
+
const imageObj = ref();
|
|
157826
|
+
onMounted(() => {
|
|
157827
|
+
const img = new Image();
|
|
157828
|
+
img.src = svg[props.iconType || "attachment"];
|
|
157829
|
+
img.onload = () => {
|
|
157830
|
+
imageObj.value = img;
|
|
157831
|
+
};
|
|
157832
|
+
});
|
|
157833
|
+
return (_ctx, _cache) => {
|
|
157834
|
+
const _component_v_image = resolveComponent("v-image");
|
|
157835
|
+
return imageObj.value ? (openBlock(), createBlock(_component_v_image, {
|
|
157836
|
+
key: 0,
|
|
157837
|
+
config: {
|
|
157838
|
+
x: __props.x,
|
|
157839
|
+
y: __props.y - 6,
|
|
157840
|
+
image: imageObj.value,
|
|
157841
|
+
width: 24,
|
|
157842
|
+
height: 24
|
|
157843
|
+
}
|
|
157844
|
+
}, null, 8, ["config"])) : createCommentVNode("", true);
|
|
157845
|
+
};
|
|
157846
|
+
}
|
|
157847
|
+
});
|
|
157848
|
+
//#endregion
|
|
157849
|
+
//#region src/suites/edhr/component/gct-control-render.vue?vue&type=script&setup=true&name=gct-control-render&lang.ts
|
|
157850
|
+
init_core$1();
|
|
157851
|
+
init_file();
|
|
157852
|
+
init_enum();
|
|
157853
|
+
init_useWidgetRenderData();
|
|
157854
|
+
init_form();
|
|
157855
|
+
init_core();
|
|
157856
|
+
init_field_type();
|
|
157857
|
+
var gct_control_render_vue_vue_type_script_setup_true_name_gct_control_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
157858
|
+
__name: "gct-control-render",
|
|
157859
|
+
props: {
|
|
157860
|
+
modelId: {},
|
|
157861
|
+
widget: {}
|
|
157862
|
+
},
|
|
157863
|
+
setup(__props) {
|
|
157864
|
+
const props = __props;
|
|
157865
|
+
/**
|
|
157866
|
+
* 组件映射表
|
|
157867
|
+
*/
|
|
157868
|
+
const RenderCompMap = {
|
|
157869
|
+
[RenderCompTypeConst.Checkbox]: checkbox_canvas_default,
|
|
157870
|
+
[RenderCompTypeConst.Radio]: radio_canvas_default,
|
|
157871
|
+
icon: icon_canvas_default
|
|
157872
|
+
};
|
|
157873
|
+
const { docInst, isMultiple, runtimeValuePath, showRequired, showDisabled, showReadonly, widgetProps, widgetType, fieldMeta } = useWidgetStaticAttrs(props.widget);
|
|
157874
|
+
const CurrentComp = computed(() => {
|
|
157875
|
+
if (widgetType.value === "fw:file") return RenderCompMap["icon"] ?? null;
|
|
157876
|
+
const type = widgetProps.value.renderComp;
|
|
157877
|
+
return RenderCompMap[type] ?? null;
|
|
157878
|
+
});
|
|
157879
|
+
const iconType = computed(() => {
|
|
157880
|
+
if (widgetType.value === "fw:file") return getUploadFileIcon(props.widget?.widgetFileItem?.value);
|
|
157881
|
+
});
|
|
157882
|
+
const options = computed(() => safeParseJson(widgetProps.value.optionsJson));
|
|
157883
|
+
/**
|
|
157884
|
+
* 当前选项值
|
|
157885
|
+
*/
|
|
157886
|
+
const optionValue = computed(() => props.widget?.widgetOption?.value);
|
|
157887
|
+
const modelValue = computed({
|
|
157888
|
+
get() {
|
|
157889
|
+
let value;
|
|
157890
|
+
if (docInst.value.isInEditMode()) value = docInst.value?.dataManager?.getDefault(runtimeValuePath.value);
|
|
157891
|
+
else value = docInst.value?.dataManager?.get(runtimeValuePath.value);
|
|
157892
|
+
if (fieldMeta.value?.fieldType === FIELD_TYPE.BOOLEAN) value = toBoolean(value);
|
|
157893
|
+
return getValue$1(value, isMultiple.value);
|
|
157894
|
+
},
|
|
157895
|
+
set(v) {
|
|
157896
|
+
const data = setValue(v, runtimeValuePath.value, {
|
|
157897
|
+
multiple: isMultiple.value,
|
|
157898
|
+
options: options.value,
|
|
157899
|
+
labelKey: "label",
|
|
157900
|
+
needLabel: true
|
|
157901
|
+
});
|
|
157902
|
+
docInst.value?.dataManager.setMultiple(data);
|
|
157903
|
+
}
|
|
157904
|
+
});
|
|
157905
|
+
return (_ctx, _cache) => {
|
|
157906
|
+
return CurrentComp.value ? (openBlock(), createBlock(resolveDynamicComponent(CurrentComp.value), {
|
|
157907
|
+
key: 0,
|
|
157908
|
+
id: __props.widget.id,
|
|
157909
|
+
x: 0,
|
|
157910
|
+
y: 0,
|
|
157911
|
+
readonly: unref(showReadonly),
|
|
157912
|
+
disabled: unref(showDisabled),
|
|
157913
|
+
required: unref(showRequired),
|
|
157914
|
+
multiple: unref(isMultiple),
|
|
157915
|
+
iconType: iconType.value,
|
|
157916
|
+
value: optionValue.value,
|
|
157917
|
+
"model-value": modelValue.value,
|
|
157918
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
|
|
157919
|
+
}, null, 8, [
|
|
157920
|
+
"id",
|
|
157921
|
+
"readonly",
|
|
157922
|
+
"disabled",
|
|
157923
|
+
"required",
|
|
157924
|
+
"multiple",
|
|
157925
|
+
"iconType",
|
|
157926
|
+
"value",
|
|
157927
|
+
"model-value"
|
|
157928
|
+
])) : createCommentVNode("", true);
|
|
157929
|
+
};
|
|
157930
|
+
}
|
|
157931
|
+
});
|
|
157932
|
+
//#endregion
|
|
157933
|
+
//#region src/suites/edhr/component/gct-control-render.vue
|
|
157934
|
+
var gct_control_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_control_render_default });
|
|
157935
|
+
var gct_control_render_default = gct_control_render_vue_vue_type_script_setup_true_name_gct_control_render_lang_default;
|
|
157936
|
+
//#endregion
|
|
157937
|
+
//#region src/suites/edhr/component/gct-image-render.vue?vue&type=script&setup=true&name=gct-image-render&lang.ts
|
|
157938
|
+
init_asset_helper_util();
|
|
157939
|
+
init_image_size_util();
|
|
157940
|
+
init_canvas$1();
|
|
157941
|
+
init_core$1();
|
|
157942
|
+
init__register_();
|
|
157943
|
+
init_useWidgetRenderData();
|
|
157944
|
+
var gct_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
157945
|
+
__name: "gct-image-render",
|
|
157946
|
+
props: {
|
|
157947
|
+
widget: {},
|
|
157948
|
+
modelId: {}
|
|
157949
|
+
},
|
|
157950
|
+
setup(__props) {
|
|
157951
|
+
const interCtx = useInteractionContext();
|
|
157952
|
+
const props = __props;
|
|
157953
|
+
const imgRef = ref(null);
|
|
157954
|
+
const { runtimeValuePath } = useWidgetStaticAttrs(props.widget);
|
|
157955
|
+
const natural = ref({
|
|
157956
|
+
width: 0,
|
|
157957
|
+
height: 0
|
|
157958
|
+
});
|
|
157959
|
+
const display = ref({
|
|
157960
|
+
width: props.widget.width ?? 100,
|
|
157961
|
+
height: props.widget.height ?? 100
|
|
157962
|
+
});
|
|
157963
|
+
const placeholder = {
|
|
157964
|
+
width: props.widget.width ?? 120,
|
|
157965
|
+
height: props.widget.height ?? 80,
|
|
157966
|
+
fill: "#f3f3f3"
|
|
157967
|
+
};
|
|
157968
|
+
watch(() => props.widget.src, async (v) => {
|
|
157969
|
+
const img = await AssetHelper.loadImage(v);
|
|
157970
|
+
if (!img) return;
|
|
157971
|
+
natural.value = {
|
|
157972
|
+
width: img.naturalWidth,
|
|
157973
|
+
height: img.naturalHeight
|
|
157974
|
+
};
|
|
157975
|
+
const size = computeImageDisplaySize(natural.value, {
|
|
157976
|
+
width: props.widget.width,
|
|
157977
|
+
height: props.widget.height,
|
|
157978
|
+
keepAspect: props.widget.keepAspect ?? true,
|
|
157979
|
+
maxDefaultWidth: 200
|
|
157980
|
+
});
|
|
157981
|
+
display.value = size;
|
|
157982
|
+
imgRef.value = img;
|
|
157983
|
+
}, { immediate: true });
|
|
157984
|
+
const imageConfig = computed(() => {
|
|
157985
|
+
const w = display.value.width;
|
|
157986
|
+
const h = display.value.height;
|
|
157987
|
+
return {
|
|
157988
|
+
x: 0,
|
|
157989
|
+
y: 0,
|
|
157990
|
+
image: imgRef.value,
|
|
157991
|
+
width: w,
|
|
157992
|
+
height: h
|
|
157993
|
+
};
|
|
157994
|
+
});
|
|
157995
|
+
const baseLineConfig = {
|
|
157996
|
+
stroke: "#ff4d4f",
|
|
157997
|
+
strokeWidth: 1,
|
|
157998
|
+
...baseCanvasAttrs
|
|
157999
|
+
};
|
|
158000
|
+
const useLineConfig = (offsetY = 0) => computed(() => ({
|
|
158001
|
+
points: [
|
|
158002
|
+
0,
|
|
158003
|
+
halfPixel(display.value.height + offsetY),
|
|
158004
|
+
halfPixel(props.widget.width),
|
|
158005
|
+
halfPixel(display.value.height + offsetY)
|
|
158006
|
+
],
|
|
158007
|
+
...baseLineConfig
|
|
158008
|
+
}));
|
|
158009
|
+
const lineOneConfig = useLineConfig(0);
|
|
158010
|
+
const lineTwoConfig = useLineConfig(2);
|
|
158011
|
+
const isShowMark = computed(() => {
|
|
158012
|
+
return interCtx.annotationIds && interCtx.annotationIds.length !== 0 && interCtx.annotationIds.includes(runtimeValuePath.value);
|
|
158013
|
+
});
|
|
158014
|
+
return (_ctx, _cache) => {
|
|
158015
|
+
const _component_v_line = resolveComponent("v-line");
|
|
158016
|
+
const _component_v_image = resolveComponent("v-image");
|
|
158017
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
158018
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158019
|
+
return openBlock(), createBlock(_component_v_group, null, {
|
|
158020
|
+
default: withCtx(() => [
|
|
158021
|
+
isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
|
|
158022
|
+
key: 0,
|
|
158023
|
+
config: unref(lineOneConfig)
|
|
158024
|
+
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
158025
|
+
isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
|
|
158026
|
+
key: 1,
|
|
158027
|
+
config: unref(lineTwoConfig)
|
|
158028
|
+
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
158029
|
+
imgRef.value ? (openBlock(), createBlock(_component_v_image, {
|
|
158030
|
+
key: 2,
|
|
158031
|
+
config: imageConfig.value
|
|
158032
|
+
}, null, 8, ["config"])) : (openBlock(), createBlock(_component_v_rect, {
|
|
158033
|
+
key: 3,
|
|
158034
|
+
width: placeholder.width,
|
|
158035
|
+
height: placeholder.height,
|
|
158036
|
+
fill: placeholder.fill
|
|
158037
|
+
}, null, 8, [
|
|
158038
|
+
"width",
|
|
158039
|
+
"height",
|
|
158040
|
+
"fill"
|
|
158041
|
+
]))
|
|
158042
|
+
]),
|
|
158043
|
+
_: 1
|
|
158044
|
+
});
|
|
158045
|
+
};
|
|
158046
|
+
}
|
|
158047
|
+
});
|
|
158048
|
+
//#endregion
|
|
158049
|
+
//#region src/suites/edhr/component/gct-image-render.vue
|
|
158050
|
+
var gct_image_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_image_render_default });
|
|
158051
|
+
var gct_image_render_default = gct_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default;
|
|
158052
|
+
//#endregion
|
|
158053
|
+
//#region src/suites/edhr/component/gct-leftMarker-render.vue?vue&type=script&setup=true&name=gct-leftMarker-render&lang.ts
|
|
158054
|
+
var gct_leftMarker_render_vue_vue_type_script_setup_true_name_gct_leftMarker_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158055
|
+
__name: "gct-leftMarker-render",
|
|
158056
|
+
props: {
|
|
158057
|
+
widget: {},
|
|
158058
|
+
modelId: {}
|
|
158059
|
+
},
|
|
158060
|
+
setup(__props) {
|
|
158061
|
+
const props = __props;
|
|
158062
|
+
const textConfig = computed(() => ({
|
|
158063
|
+
x: 0,
|
|
158064
|
+
y: 0,
|
|
158065
|
+
width: props.widget.width,
|
|
158066
|
+
text: props.widget.text,
|
|
158067
|
+
fontSize: props.widget.fontSize,
|
|
158068
|
+
fontFamily: props.widget.fontFamily,
|
|
158069
|
+
fill: "#000",
|
|
158070
|
+
wrap: "none"
|
|
158071
|
+
}));
|
|
158072
|
+
return (_ctx, _cache) => {
|
|
158073
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158074
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158075
|
+
return openBlock(), createBlock(_component_v_group, null, {
|
|
158076
|
+
default: withCtx(() => [createVNode(_component_v_text, {
|
|
158077
|
+
ref: "textRef",
|
|
158078
|
+
id: __props.widget.id,
|
|
158079
|
+
config: textConfig.value
|
|
158080
|
+
}, null, 8, ["id", "config"])]),
|
|
158081
|
+
_: 1
|
|
158082
|
+
});
|
|
158083
|
+
};
|
|
158084
|
+
}
|
|
158085
|
+
});
|
|
158086
|
+
//#endregion
|
|
158087
|
+
//#region src/suites/edhr/component/gct-leftMarker-render.vue
|
|
158088
|
+
var gct_leftMarker_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_leftMarker_render_default });
|
|
158089
|
+
var gct_leftMarker_render_default = gct_leftMarker_render_vue_vue_type_script_setup_true_name_gct_leftMarker_render_lang_default;
|
|
158090
|
+
//#endregion
|
|
158091
|
+
//#region src/suites/edhr/component/gct-placeholder-render.vue?vue&type=script&setup=true&name=gct-placeholder-render&lang.ts
|
|
158092
|
+
init__register_();
|
|
158093
|
+
init_useWidgetRenderData();
|
|
158094
|
+
var gct_placeholder_render_vue_vue_type_script_setup_true_name_gct_placeholder_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158095
|
+
__name: "gct-placeholder-render",
|
|
158096
|
+
props: {
|
|
158097
|
+
widget: {},
|
|
158098
|
+
modelId: {}
|
|
158099
|
+
},
|
|
158100
|
+
setup(__props) {
|
|
158101
|
+
const props = __props;
|
|
158102
|
+
const interCtx = useInteractionContext();
|
|
158103
|
+
const { showDisabled, showRequired, showReadonly } = useWidgetStaticAttrs(props.widget);
|
|
158104
|
+
const isActive = computed(() => props.modelId === interCtx.panelData?.modelId || props.modelId === interCtx.hoverModelId);
|
|
158105
|
+
/**
|
|
158106
|
+
* 统一颜色逻辑
|
|
158107
|
+
*/
|
|
158108
|
+
const colors = computed(() => {
|
|
158109
|
+
if (showDisabled.value) return {
|
|
158110
|
+
text: "#c9c9c9",
|
|
158111
|
+
line: "#c9c9c9",
|
|
158112
|
+
bg: isActive.value ? "#f0f0f0" : "#f5f5f5"
|
|
158113
|
+
};
|
|
158114
|
+
if (showReadonly.value) return {
|
|
158115
|
+
text: "#666666",
|
|
158116
|
+
line: "#d9d9d9",
|
|
158117
|
+
bg: isActive.value ? "#f5f7fa" : "#fafafa"
|
|
158118
|
+
};
|
|
158119
|
+
if (showRequired.value) return {
|
|
158120
|
+
text: "#f26c6c",
|
|
158121
|
+
line: "#f26c6c",
|
|
158122
|
+
bg: isActive.value ? "rgba(255, 230, 230, 1)" : "rgba(255, 242, 242, 1)"
|
|
158123
|
+
};
|
|
158124
|
+
return {
|
|
158125
|
+
text: "#999999",
|
|
158126
|
+
line: "#999999",
|
|
158127
|
+
bg: isActive.value ? "rgba(147, 197, 253, 0.4)" : "#F2F8FE"
|
|
158128
|
+
};
|
|
158129
|
+
});
|
|
158130
|
+
const textConfig = computed(() => ({
|
|
158131
|
+
x: 0,
|
|
158132
|
+
y: 0,
|
|
158133
|
+
text: props.widget.text,
|
|
158134
|
+
fontSize: props.widget.fontSize,
|
|
158135
|
+
fontFamily: props.widget.fontFamily,
|
|
158136
|
+
fill: colors.value.text,
|
|
158137
|
+
wrap: "none"
|
|
158138
|
+
}));
|
|
158139
|
+
computed(() => ({
|
|
158140
|
+
points: [
|
|
158141
|
+
0,
|
|
158142
|
+
props.widget.fontSize + 4,
|
|
158143
|
+
props.widget.width,
|
|
158144
|
+
props.widget.fontSize + 4
|
|
158145
|
+
],
|
|
158146
|
+
stroke: colors.value.line,
|
|
158147
|
+
strokeWidth: 1
|
|
158148
|
+
}));
|
|
158149
|
+
const bgConfig = computed(() => ({
|
|
158150
|
+
x: 0,
|
|
158151
|
+
y: -3,
|
|
158152
|
+
width: props.widget.width,
|
|
158153
|
+
height: props.widget.height + 6,
|
|
158154
|
+
fill: colors.value.bg
|
|
158155
|
+
}));
|
|
158156
|
+
return (_ctx, _cache) => {
|
|
158157
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
158158
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158159
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158160
|
+
return openBlock(), createBlock(_component_v_group, null, {
|
|
158161
|
+
default: withCtx(() => [createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"]), createVNode(_component_v_text, {
|
|
158162
|
+
ref: "textRef",
|
|
158163
|
+
id: __props.widget.id,
|
|
158164
|
+
config: textConfig.value
|
|
158165
|
+
}, null, 8, ["id", "config"])]),
|
|
158166
|
+
_: 1
|
|
158167
|
+
});
|
|
158168
|
+
};
|
|
158169
|
+
}
|
|
158170
|
+
});
|
|
158171
|
+
//#endregion
|
|
158172
|
+
//#region src/suites/edhr/component/gct-placeholder-render.vue
|
|
158173
|
+
var gct_placeholder_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_placeholder_render_default });
|
|
158174
|
+
var gct_placeholder_render_default = gct_placeholder_render_vue_vue_type_script_setup_true_name_gct_placeholder_render_lang_default;
|
|
158175
|
+
//#endregion
|
|
158176
|
+
//#region src/suites/edhr/component/gct-rightMarker-render.vue?vue&type=script&setup=true&name=gct-rightMarker-render&lang.ts
|
|
158177
|
+
var gct_rightMarker_render_vue_vue_type_script_setup_true_name_gct_rightMarker_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158178
|
+
__name: "gct-rightMarker-render",
|
|
158179
|
+
props: {
|
|
158180
|
+
widget: {},
|
|
158181
|
+
modelId: {}
|
|
158182
|
+
},
|
|
158183
|
+
setup(__props) {
|
|
158184
|
+
const props = __props;
|
|
158185
|
+
const textConfig = computed(() => ({
|
|
158186
|
+
x: 0,
|
|
158187
|
+
y: 0,
|
|
158188
|
+
width: props.widget.width,
|
|
158189
|
+
text: props.widget.text,
|
|
158190
|
+
fontSize: props.widget.fontSize,
|
|
158191
|
+
fontFamily: props.widget.fontFamily,
|
|
158192
|
+
fill: "#000",
|
|
158193
|
+
wrap: "none",
|
|
158194
|
+
align: "right"
|
|
158195
|
+
}));
|
|
158196
|
+
return (_ctx, _cache) => {
|
|
158197
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158198
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158199
|
+
return openBlock(), createBlock(_component_v_group, null, {
|
|
158200
|
+
default: withCtx(() => [createVNode(_component_v_text, {
|
|
158201
|
+
ref: "textRef",
|
|
158202
|
+
id: __props.widget.id,
|
|
158203
|
+
config: textConfig.value
|
|
158204
|
+
}, null, 8, ["id", "config"])]),
|
|
158205
|
+
_: 1
|
|
158206
|
+
});
|
|
158207
|
+
};
|
|
158208
|
+
}
|
|
158209
|
+
});
|
|
158210
|
+
//#endregion
|
|
158211
|
+
//#region src/suites/edhr/component/gct-rightMarker-render.vue
|
|
158212
|
+
var gct_rightMarker_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_rightMarker_render_default });
|
|
158213
|
+
var gct_rightMarker_render_default = gct_rightMarker_render_vue_vue_type_script_setup_true_name_gct_rightMarker_render_lang_default;
|
|
158214
|
+
//#endregion
|
|
158215
|
+
//#region src/suites/edhr/component/gct-signature-render.vue?vue&type=script&setup=true&name=gct-signature-render&lang.ts
|
|
158216
|
+
init_asset_helper_util();
|
|
158217
|
+
init_image_size_util();
|
|
158218
|
+
init_canvas$1();
|
|
158219
|
+
init_core$1();
|
|
158220
|
+
init__register_();
|
|
158221
|
+
init_useWidgetRenderData();
|
|
158222
|
+
var gct_signature_render_vue_vue_type_script_setup_true_name_gct_signature_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158223
|
+
__name: "gct-signature-render",
|
|
158224
|
+
props: {
|
|
158225
|
+
widget: {},
|
|
158226
|
+
modelId: {}
|
|
158227
|
+
},
|
|
158228
|
+
setup(__props) {
|
|
158229
|
+
const interCtx = useInteractionContext();
|
|
158230
|
+
const props = __props;
|
|
158231
|
+
const imgRef = ref(null);
|
|
158232
|
+
const { runtimeValuePath } = useWidgetStaticAttrs(props.widget);
|
|
158233
|
+
const imageWidth = computed(() => props.widget._width);
|
|
158234
|
+
const imageHeight = computed(() => props.widget._height);
|
|
158235
|
+
const natural = ref({
|
|
158236
|
+
width: 0,
|
|
158237
|
+
height: 0
|
|
158238
|
+
});
|
|
158239
|
+
const display = ref({
|
|
158240
|
+
width: imageWidth.value,
|
|
158241
|
+
height: imageHeight.value
|
|
158242
|
+
});
|
|
158243
|
+
const placeholder = computed(() => ({
|
|
158244
|
+
width: imageWidth.value ?? 180,
|
|
158245
|
+
height: imageHeight.value ?? 102,
|
|
158246
|
+
fill: "#f3f3f3"
|
|
158247
|
+
}));
|
|
158248
|
+
async function loadImage() {
|
|
158249
|
+
const { src, signature, signTime } = props.widget;
|
|
158250
|
+
if (signature) return await createSignatureImage(signature, imageWidth.value, imageHeight.value, signTime);
|
|
158251
|
+
if (src) return await AssetHelper.loadImage(src);
|
|
158252
|
+
return null;
|
|
158253
|
+
}
|
|
158254
|
+
watch(() => [
|
|
158255
|
+
props.widget.src,
|
|
158256
|
+
props.widget.signature,
|
|
158257
|
+
props.widget.signTime,
|
|
158258
|
+
imageWidth.value,
|
|
158259
|
+
imageHeight.value
|
|
158260
|
+
], async () => {
|
|
158261
|
+
const img = await loadImage();
|
|
158262
|
+
if (!img) return;
|
|
158263
|
+
natural.value = {
|
|
158264
|
+
width: img.naturalWidth,
|
|
158265
|
+
height: img.naturalHeight
|
|
158266
|
+
};
|
|
158267
|
+
display.value = computeContainDisplaySize(natural.value, {
|
|
158268
|
+
width: imageWidth.value,
|
|
158269
|
+
height: imageHeight.value
|
|
158270
|
+
});
|
|
158271
|
+
imgRef.value = img;
|
|
158272
|
+
}, { immediate: true });
|
|
158273
|
+
const imageConfig = computed(() => ({
|
|
158274
|
+
x: (imageWidth.value - display.value.width) / 2,
|
|
158275
|
+
y: (imageHeight.value - display.value.height) / 2,
|
|
158276
|
+
image: imgRef.value,
|
|
158277
|
+
width: display.value.width,
|
|
158278
|
+
height: display.value.height
|
|
158279
|
+
}));
|
|
158280
|
+
const dateTimeConfigs = computed(() => {
|
|
158281
|
+
const list = props.widget.decorations;
|
|
158282
|
+
if (!list?.length) return [];
|
|
158283
|
+
return list.map((item) => ({
|
|
158284
|
+
x: item.x,
|
|
158285
|
+
y: item.y,
|
|
158286
|
+
text: item.text,
|
|
158287
|
+
fontSize: item.fontSize || 14,
|
|
158288
|
+
fill: "#000",
|
|
158289
|
+
width: item.width,
|
|
158290
|
+
height: item.height
|
|
158291
|
+
}));
|
|
158292
|
+
});
|
|
158293
|
+
const baseLineConfig = {
|
|
158294
|
+
stroke: "#ff4d4f",
|
|
158295
|
+
strokeWidth: 1,
|
|
158296
|
+
...baseCanvasAttrs
|
|
158297
|
+
};
|
|
158298
|
+
const useLineConfig = (offsetY = 0) => computed(() => ({
|
|
158299
|
+
points: [
|
|
158300
|
+
0,
|
|
158301
|
+
halfPixel(display.value.height + offsetY),
|
|
158302
|
+
halfPixel(props.widget.width),
|
|
158303
|
+
halfPixel(display.value.height + offsetY)
|
|
158304
|
+
],
|
|
158305
|
+
...baseLineConfig
|
|
158306
|
+
}));
|
|
158307
|
+
const lineOneConfig = useLineConfig(0);
|
|
158308
|
+
const lineTwoConfig = useLineConfig(2);
|
|
158309
|
+
const isShowMark = computed(() => {
|
|
158310
|
+
return interCtx.annotationIds && interCtx.annotationIds.length !== 0 && interCtx.annotationIds.includes(runtimeValuePath.value);
|
|
158311
|
+
});
|
|
158312
|
+
return (_ctx, _cache) => {
|
|
158313
|
+
const _component_v_line = resolveComponent("v-line");
|
|
158314
|
+
const _component_v_image = resolveComponent("v-image");
|
|
158315
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
158316
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158317
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158318
|
+
return openBlock(), createBlock(_component_v_group, null, {
|
|
158319
|
+
default: withCtx(() => [
|
|
158320
|
+
isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
|
|
158321
|
+
key: 0,
|
|
158322
|
+
config: unref(lineOneConfig)
|
|
158323
|
+
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
158324
|
+
isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
|
|
158325
|
+
key: 1,
|
|
158326
|
+
config: unref(lineTwoConfig)
|
|
158327
|
+
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
158328
|
+
imgRef.value ? (openBlock(), createBlock(_component_v_image, {
|
|
158329
|
+
key: 2,
|
|
158330
|
+
config: imageConfig.value
|
|
158331
|
+
}, null, 8, ["config"])) : (openBlock(), createBlock(_component_v_rect, {
|
|
158332
|
+
key: 3,
|
|
158333
|
+
width: placeholder.value.width,
|
|
158334
|
+
height: placeholder.value.height,
|
|
158335
|
+
fill: placeholder.value.fill
|
|
158336
|
+
}, null, 8, [
|
|
158337
|
+
"width",
|
|
158338
|
+
"height",
|
|
158339
|
+
"fill"
|
|
158340
|
+
])),
|
|
158341
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(dateTimeConfigs.value, (cfg, i) => {
|
|
158342
|
+
return openBlock(), createBlock(_component_v_text, {
|
|
158343
|
+
key: i,
|
|
158344
|
+
config: cfg
|
|
158345
|
+
}, null, 8, ["config"]);
|
|
158346
|
+
}), 128))
|
|
158347
|
+
]),
|
|
158348
|
+
_: 1
|
|
158349
|
+
});
|
|
158350
|
+
};
|
|
158351
|
+
}
|
|
158352
|
+
});
|
|
158353
|
+
//#endregion
|
|
158354
|
+
//#region src/suites/edhr/component/gct-signature-render.vue
|
|
158355
|
+
var gct_signature_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_signature_render_default });
|
|
158356
|
+
var gct_signature_render_default = gct_signature_render_vue_vue_type_script_setup_true_name_gct_signature_render_lang_default;
|
|
158357
|
+
//#endregion
|
|
158358
|
+
//#region src/suites/edhr/component/gct-space-render.vue?vue&type=script&setup=true&name=gct-space-render&lang.ts
|
|
158359
|
+
var gct_space_render_vue_vue_type_script_setup_true_name_gct_space_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158360
|
+
__name: "gct-space-render",
|
|
158361
|
+
props: { widget: {} },
|
|
158362
|
+
setup(__props) {
|
|
158363
|
+
const props = __props;
|
|
158364
|
+
const textConfig = computed(() => {
|
|
158365
|
+
return {
|
|
158366
|
+
x: 0,
|
|
158367
|
+
y: 0,
|
|
158368
|
+
text: props.widget.text || "",
|
|
158369
|
+
fontSize: props.widget.fontSize,
|
|
158370
|
+
fontFamily: props.widget.fontFamily,
|
|
158371
|
+
fill: props.widget.color,
|
|
158372
|
+
width: props.widget.width,
|
|
158373
|
+
height: props.widget.height,
|
|
158374
|
+
wrap: "none"
|
|
158375
|
+
};
|
|
158376
|
+
});
|
|
158377
|
+
return (_ctx, _cache) => {
|
|
158378
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158379
|
+
return openBlock(), createBlock(_component_v_text, {
|
|
158380
|
+
id: __props.widget.id,
|
|
158381
|
+
config: textConfig.value
|
|
158382
|
+
}, null, 8, ["id", "config"]);
|
|
158383
|
+
};
|
|
158384
|
+
}
|
|
158385
|
+
});
|
|
158386
|
+
//#endregion
|
|
158387
|
+
//#region src/suites/edhr/component/gct-space-render.vue
|
|
158388
|
+
var gct_space_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_space_render_default });
|
|
158389
|
+
var gct_space_render_default = gct_space_render_vue_vue_type_script_setup_true_name_gct_space_render_lang_default;
|
|
158390
|
+
//#endregion
|
|
158391
|
+
//#region src/suites/edhr/component/gct-text-render.vue?vue&type=script&setup=true&name=gct-text-render&lang.ts
|
|
158392
|
+
init__register_();
|
|
158393
|
+
init_canvas$1();
|
|
158394
|
+
init_useWidgetRenderData();
|
|
158395
|
+
init_core$1();
|
|
158396
|
+
var gct_text_render_vue_vue_type_script_setup_true_name_gct_text_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158397
|
+
__name: "gct-text-render",
|
|
158398
|
+
props: {
|
|
158399
|
+
widget: {},
|
|
158400
|
+
modelId: {}
|
|
158401
|
+
},
|
|
158402
|
+
setup(__props) {
|
|
158403
|
+
const props = __props;
|
|
158404
|
+
const interCtx = useInteractionContext();
|
|
158405
|
+
const { docInst, showDisabled, showReadonly, runtimeValuePath } = useWidgetStaticAttrs(props.widget);
|
|
158406
|
+
const isActive = computed(() => props.modelId === interCtx.panelData?.modelId || props.modelId === interCtx.hoverModelId);
|
|
158407
|
+
const isShowMark = computed(() => {
|
|
158408
|
+
return interCtx.annotationIds && interCtx.annotationIds.length !== 0 && interCtx.annotationIds.includes(runtimeValuePath.value);
|
|
158409
|
+
});
|
|
158410
|
+
/**
|
|
158411
|
+
* 统一颜色逻辑
|
|
158412
|
+
*/
|
|
158413
|
+
const colors = computed(() => {
|
|
158414
|
+
const textColor = props.widget.color;
|
|
158415
|
+
if (isShowMark.value) return {
|
|
158416
|
+
text: "#ff4d4f",
|
|
158417
|
+
line: "#ff4d4f",
|
|
158418
|
+
bg: "#fff2f2"
|
|
158419
|
+
};
|
|
158420
|
+
if (docInst.value.isInPrintMode() || showReadonly.value) return {
|
|
158421
|
+
text: textColor,
|
|
158422
|
+
line: "#999999",
|
|
158423
|
+
bg: "transparent"
|
|
158424
|
+
};
|
|
158425
|
+
if (showDisabled.value) return {
|
|
158426
|
+
text: "#c9c9c9",
|
|
158427
|
+
line: "#c9c9c9",
|
|
158428
|
+
bg: isActive.value ? "#f0f0f0" : "#f5f5f5"
|
|
158429
|
+
};
|
|
158430
|
+
return {
|
|
158431
|
+
text: textColor,
|
|
158432
|
+
line: "#999999",
|
|
158433
|
+
bg: isActive.value ? "rgba(147, 197, 253, 0.4)" : "#F2F8FE"
|
|
158434
|
+
};
|
|
158435
|
+
});
|
|
158436
|
+
const textConfig = computed(() => ({
|
|
158437
|
+
x: 0,
|
|
158438
|
+
y: 0,
|
|
158439
|
+
text: props.widget.text,
|
|
158440
|
+
fontSize: props.widget.fontSize,
|
|
158441
|
+
fontFamily: props.widget.fontFamily,
|
|
158442
|
+
fill: colors.value.text,
|
|
158443
|
+
textDecoration: props.widget.underline ? "underline" : void 0,
|
|
158444
|
+
wrap: "none"
|
|
158445
|
+
}));
|
|
158446
|
+
const baseLineConfig = {
|
|
158447
|
+
strokeWidth: 1,
|
|
158448
|
+
...baseCanvasAttrs
|
|
158449
|
+
};
|
|
158450
|
+
const useLineConfig = (offsetY = 0) => computed(() => ({
|
|
158451
|
+
points: [
|
|
158452
|
+
0,
|
|
158453
|
+
halfPixel(props.widget.fontSize + offsetY),
|
|
158454
|
+
halfPixel(props.widget.width),
|
|
158455
|
+
halfPixel(props.widget.fontSize + offsetY)
|
|
158456
|
+
],
|
|
158457
|
+
stroke: colors.value.line,
|
|
158458
|
+
...baseLineConfig
|
|
158459
|
+
}));
|
|
158460
|
+
const lineOneConfig = useLineConfig(0);
|
|
158461
|
+
const lineTwoConfig = useLineConfig(2);
|
|
158462
|
+
const bgConfig = computed(() => ({
|
|
158463
|
+
x: 0,
|
|
158464
|
+
y: -3,
|
|
158465
|
+
width: props.widget.width,
|
|
158466
|
+
height: props.widget.height + 6,
|
|
158467
|
+
fill: colors.value.bg
|
|
158468
|
+
}));
|
|
158469
|
+
return (_ctx, _cache) => {
|
|
158470
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
158471
|
+
const _component_v_line = resolveComponent("v-line");
|
|
158472
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158473
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158474
|
+
return openBlock(), createBlock(_component_v_group, null, {
|
|
158475
|
+
default: withCtx(() => [
|
|
158476
|
+
createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"]),
|
|
158477
|
+
isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
|
|
158478
|
+
key: 0,
|
|
158479
|
+
config: unref(lineOneConfig)
|
|
158480
|
+
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
158481
|
+
isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
|
|
158482
|
+
key: 1,
|
|
158483
|
+
config: unref(lineTwoConfig)
|
|
158484
|
+
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
158485
|
+
createVNode(_component_v_text, {
|
|
158486
|
+
ref: "textRef",
|
|
158487
|
+
id: __props.widget.id,
|
|
158488
|
+
config: textConfig.value
|
|
158489
|
+
}, null, 8, ["id", "config"])
|
|
158490
|
+
]),
|
|
158491
|
+
_: 1
|
|
158492
|
+
});
|
|
158493
|
+
};
|
|
158494
|
+
}
|
|
158495
|
+
});
|
|
158496
|
+
//#endregion
|
|
158497
|
+
//#region src/suites/edhr/component/gct-text-render.vue
|
|
158498
|
+
var gct_text_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_text_render_default });
|
|
158499
|
+
var gct_text_render_default = gct_text_render_vue_vue_type_script_setup_true_name_gct_text_render_lang_default;
|
|
158500
|
+
//#endregion
|
|
158501
|
+
//#region src/suites/edhr/component/pw-barcode-render.vue?vue&type=script&setup=true&name=gct-image-render&lang.ts
|
|
158502
|
+
init_core();
|
|
158503
|
+
init_enum();
|
|
158504
|
+
init_core$1();
|
|
158505
|
+
init_useWidgetRenderData();
|
|
158506
|
+
var UNIT_WIDTH = 1;
|
|
158507
|
+
var pw_barcode_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158508
|
+
__name: "pw-barcode-render",
|
|
158509
|
+
props: {
|
|
158510
|
+
widget: {},
|
|
158511
|
+
modelId: {}
|
|
158512
|
+
},
|
|
158513
|
+
setup(__props) {
|
|
158514
|
+
const props = __props;
|
|
158515
|
+
const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
|
|
158516
|
+
const readonlyValue = ref();
|
|
158517
|
+
const valueType = computed(() => pageWidgetProps.value.valueType);
|
|
158518
|
+
const alignType = computed(() => pageWidgetProps.value.justifyContent);
|
|
158519
|
+
/** 值处理 */
|
|
158520
|
+
const modelValue = computed(() => {
|
|
158521
|
+
let text = pageWidgetProps.value.value;
|
|
158522
|
+
if (valueType.value === ValueTypeConst.Field) {
|
|
158523
|
+
const path = text?.exp?.fieldData?.valuePath;
|
|
158524
|
+
if (path) {
|
|
158525
|
+
const runtimePath = replacePathIndexPlaceholders({
|
|
158526
|
+
y: props.widget?.dataSlotIndex?.yDataIndex,
|
|
158527
|
+
x: props.widget?.dataSlotIndex?.xDataIndex,
|
|
158528
|
+
n: props.widget?.dataSlotIndex?.dataIndex,
|
|
158529
|
+
templatePath: path
|
|
158530
|
+
});
|
|
158531
|
+
text = docInst.value?.dataManager?.get(runtimePath);
|
|
158532
|
+
}
|
|
158533
|
+
}
|
|
158534
|
+
return Array.isArray(text) ? text.join() : text;
|
|
158535
|
+
});
|
|
158536
|
+
watch(() => modelValue.value, async () => {
|
|
158537
|
+
if (isDesignMode.value) {
|
|
158538
|
+
readonlyValue.value = "GCT";
|
|
158539
|
+
return;
|
|
158540
|
+
}
|
|
158541
|
+
if (valueType.value === ValueTypeConst.Formula) {
|
|
158542
|
+
const subFieldKey = modelValue.value?.subFieldKey;
|
|
158543
|
+
const rawData = docInst.value.dataManager.getRawData();
|
|
158544
|
+
const path = subFieldKey ? `${subFieldKey}[${props.widget?.dataSlotIndex?.dataIndex}]` : "";
|
|
158545
|
+
const subRowData = path ? docInst.value.dataManager.get(path) : {};
|
|
158546
|
+
const result = await formulaUtils.calculateFormula(modelValue.value?.exp, rawData, subRowData);
|
|
158547
|
+
readonlyValue.value = result;
|
|
158548
|
+
} else readonlyValue.value = modelValue.value;
|
|
158549
|
+
}, { immediate: true });
|
|
158550
|
+
/** 布局 */
|
|
158551
|
+
const layout = computed(() => {
|
|
158552
|
+
const h = props.widget.height;
|
|
158553
|
+
return {
|
|
158554
|
+
paddingX: 12,
|
|
158555
|
+
paddingY: 4,
|
|
158556
|
+
barcodeHeight: showText.value ? h * .7 : h,
|
|
158557
|
+
textHeight: showText.value ? h * .3 : 0
|
|
158558
|
+
};
|
|
158559
|
+
});
|
|
158560
|
+
const rawBars = computed(() => {
|
|
158561
|
+
if (!readonlyValue.value) return [];
|
|
158562
|
+
return getBarsFromSVG(readonlyValue.value, pageWidgetProps.value.codeType);
|
|
158563
|
+
});
|
|
158564
|
+
/** 渲染条码 */
|
|
158565
|
+
const bars = computed(() => {
|
|
158566
|
+
if (!rawBars.value.length) return getBrokenBarsStable("barcode-placeholder").map((b) => ({
|
|
158567
|
+
...b,
|
|
158568
|
+
fill: "#bbb"
|
|
158569
|
+
}));
|
|
158570
|
+
return rawBars.value.map((bar) => ({
|
|
158571
|
+
x: layout.value.paddingX + bar.x * UNIT_WIDTH,
|
|
158572
|
+
width: bar.width * UNIT_WIDTH,
|
|
158573
|
+
fill: "#000"
|
|
158574
|
+
}));
|
|
158575
|
+
});
|
|
158576
|
+
/** 宽度自适应 */
|
|
158577
|
+
const renderWidth = computed(() => {
|
|
158578
|
+
if (!rawBars.value.length) return props.widget.width;
|
|
158579
|
+
return Math.max(...rawBars.value.map((b) => b.x + b.width)) * UNIT_WIDTH + layout.value.paddingX * 2;
|
|
158580
|
+
});
|
|
158581
|
+
/** 闪电遮罩 */
|
|
158582
|
+
const lightningPath = computed(() => {
|
|
158583
|
+
const w = renderWidth.value;
|
|
158584
|
+
const mid = layout.value.barcodeHeight / 2;
|
|
158585
|
+
return `
|
|
158586
|
+
M 0 ${mid - 6}
|
|
158587
|
+
L ${w * .25} ${mid - 2}
|
|
158588
|
+
L ${w * .4} ${mid + 2}
|
|
158589
|
+
L ${w * .6} ${mid - 4}
|
|
158590
|
+
L ${w * .8} ${mid + 3}
|
|
158591
|
+
L ${w} ${mid - 1}
|
|
158592
|
+
L ${w} ${mid + 6}
|
|
158593
|
+
L ${w * .8} ${mid + 10}
|
|
158594
|
+
L ${w * .6} ${mid + 4}
|
|
158595
|
+
L ${w * .4} ${mid + 12}
|
|
158596
|
+
L ${w * .25} ${mid + 6}
|
|
158597
|
+
L 0 ${mid + 10}
|
|
158598
|
+
Z
|
|
158599
|
+
`;
|
|
158600
|
+
});
|
|
158601
|
+
/** 是否显示文本 */
|
|
158602
|
+
const showText = computed(() => {
|
|
158603
|
+
return !isEmptyValue$1(readonlyValue.value) && pageWidgetProps.value.showValue;
|
|
158604
|
+
});
|
|
158605
|
+
/** 文本内容 */
|
|
158606
|
+
const textValue = computed(() => {
|
|
158607
|
+
if (isDesignMode.value) {
|
|
158608
|
+
if (valueType.value === ValueTypeConst.Field) return "请配置字段";
|
|
158609
|
+
if (valueType.value === ValueTypeConst.Formula) return "请配置公式";
|
|
158610
|
+
return "请输入文本";
|
|
158611
|
+
}
|
|
158612
|
+
return readonlyValue.value;
|
|
158613
|
+
});
|
|
158614
|
+
const fontSize = computed(() => {
|
|
158615
|
+
if (!textValue.value) return 12;
|
|
158616
|
+
return Math.max(8, Math.min(14, renderWidth.value / textValue.value.length * 1));
|
|
158617
|
+
});
|
|
158618
|
+
const textColor = computed(() => isDesignMode.value ? "#999" : "#333");
|
|
158619
|
+
const bgConfig = computed(() => ({
|
|
158620
|
+
x: 0,
|
|
158621
|
+
y: 0,
|
|
158622
|
+
width: props.widget.width,
|
|
158623
|
+
height: props.widget.height,
|
|
158624
|
+
fill: "transparent"
|
|
158625
|
+
}));
|
|
158626
|
+
watch(() => renderWidth.value, (value) => {
|
|
158627
|
+
if (!isDesignMode.value) {
|
|
158628
|
+
props.widget.pageWidgetMeta.props.newSpecificConfig ??= {};
|
|
158629
|
+
props.widget.pageWidgetMeta.props.newSpecificConfig[`${props.widget.modelRef.id}@${props.widget?.dataSlotIndex?.dataIndex}`] = {
|
|
158630
|
+
relWidth: value,
|
|
158631
|
+
relValue: readonlyValue.value
|
|
158632
|
+
};
|
|
158633
|
+
}
|
|
158634
|
+
}, { immediate: true });
|
|
158635
|
+
function getBarsFromSVG(value, format) {
|
|
158636
|
+
if (!value) return [];
|
|
158637
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
158638
|
+
try {
|
|
158639
|
+
JsBarcode(svg, value, {
|
|
158640
|
+
format,
|
|
158641
|
+
displayValue: false,
|
|
158642
|
+
margin: 0,
|
|
158643
|
+
background: "transparent"
|
|
158644
|
+
});
|
|
158645
|
+
} catch (e) {
|
|
158646
|
+
console.error(e);
|
|
158647
|
+
return [];
|
|
158648
|
+
}
|
|
158649
|
+
const group = svg.querySelector("g");
|
|
158650
|
+
if (!group) return [];
|
|
158651
|
+
const rects = group.querySelectorAll("rect");
|
|
158652
|
+
const bars = [];
|
|
158653
|
+
rects.forEach((rect) => {
|
|
158654
|
+
const x = Number(rect.getAttribute("x") || 0);
|
|
158655
|
+
const width = Number(rect.getAttribute("width") || 0);
|
|
158656
|
+
if (width > 0) bars.push({
|
|
158657
|
+
x,
|
|
158658
|
+
width
|
|
158659
|
+
});
|
|
158660
|
+
});
|
|
158661
|
+
return bars;
|
|
158662
|
+
}
|
|
158663
|
+
function getBrokenBarsStable(seed) {
|
|
158664
|
+
const bars = [];
|
|
158665
|
+
const totalWidth = renderWidth.value;
|
|
158666
|
+
let x = layout.value.paddingX;
|
|
158667
|
+
let hash = 0;
|
|
158668
|
+
for (let i = 0; i < seed.length; i++) hash += seed.charCodeAt(i);
|
|
158669
|
+
let i = 0;
|
|
158670
|
+
while (x < totalWidth - layout.value.paddingX) {
|
|
158671
|
+
const width = i % 3 === 0 ? 2 : 1;
|
|
158672
|
+
if ((hash + i * 7) % 10 > 2) bars.push({
|
|
158673
|
+
x,
|
|
158674
|
+
width
|
|
158675
|
+
});
|
|
158676
|
+
x += width + 1;
|
|
158677
|
+
i++;
|
|
158678
|
+
}
|
|
158679
|
+
return bars;
|
|
158680
|
+
}
|
|
158681
|
+
return (_ctx, _cache) => {
|
|
158682
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
158683
|
+
const _component_v_path = resolveComponent("v-path");
|
|
158684
|
+
const _component_v_text = resolveComponent("v-text");
|
|
158685
|
+
const _component_v_group = resolveComponent("v-group");
|
|
158686
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
158687
|
+
x: __props.widget.x,
|
|
158688
|
+
y: __props.widget.y,
|
|
158689
|
+
id: __props.widget.id
|
|
158690
|
+
} }, {
|
|
158691
|
+
default: withCtx(() => [
|
|
158692
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(bars.value, (bar, i) => {
|
|
158693
|
+
return openBlock(), createBlock(_component_v_rect, {
|
|
158694
|
+
key: i,
|
|
158695
|
+
x: bar.x,
|
|
158696
|
+
y: 0,
|
|
158697
|
+
width: bar.width,
|
|
158698
|
+
height: layout.value.barcodeHeight,
|
|
158699
|
+
fill: bar.fill
|
|
158700
|
+
}, null, 8, [
|
|
158701
|
+
"x",
|
|
158702
|
+
"width",
|
|
158703
|
+
"height",
|
|
158704
|
+
"fill"
|
|
158705
|
+
]);
|
|
158706
|
+
}), 128)),
|
|
158707
|
+
!rawBars.value.length ? (openBlock(), createBlock(_component_v_path, {
|
|
158708
|
+
key: 0,
|
|
158709
|
+
data: lightningPath.value,
|
|
158710
|
+
fill: "#fff"
|
|
158711
|
+
}, null, 8, ["data"])) : createCommentVNode("", true),
|
|
158712
|
+
showText.value ? (openBlock(), createBlock(_component_v_text, {
|
|
158713
|
+
key: 1,
|
|
158714
|
+
x: 0,
|
|
158715
|
+
y: layout.value.barcodeHeight + layout.value.paddingY,
|
|
158716
|
+
width: renderWidth.value,
|
|
158717
|
+
height: layout.value.textHeight,
|
|
158718
|
+
text: textValue.value,
|
|
158719
|
+
align: alignType.value,
|
|
158720
|
+
verticalAlign: "middle",
|
|
158721
|
+
fontSize: fontSize.value,
|
|
158722
|
+
fill: textColor.value
|
|
158723
|
+
}, null, 8, [
|
|
158724
|
+
"y",
|
|
158725
|
+
"width",
|
|
158726
|
+
"height",
|
|
158727
|
+
"text",
|
|
158728
|
+
"align",
|
|
158729
|
+
"fontSize",
|
|
158730
|
+
"fill"
|
|
158731
|
+
])) : createCommentVNode("", true),
|
|
158732
|
+
createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"])
|
|
158733
|
+
]),
|
|
158734
|
+
_: 1
|
|
158735
|
+
}, 8, ["config"]);
|
|
158736
|
+
};
|
|
158737
|
+
}
|
|
158738
|
+
});
|
|
158739
|
+
//#endregion
|
|
158740
|
+
//#region src/suites/edhr/component/pw-barcode-render.vue
|
|
158741
|
+
var pw_barcode_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_barcode_render_default });
|
|
158742
|
+
var pw_barcode_render_default = pw_barcode_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default;
|
|
158743
|
+
//#endregion
|
|
158744
|
+
//#region src/suites/edhr/component/pw-diagonal-render.vue?vue&type=script&setup=true&name=pw-diagonal-render&lang.ts
|
|
158745
|
+
init_core();
|
|
158746
|
+
init_useWidgetRenderData();
|
|
158747
|
+
init_enum();
|
|
158748
|
+
init_core$1();
|
|
158749
|
+
init__register_();
|
|
158750
|
+
var CELL_PADDING = 5;
|
|
158751
|
+
var pw_diagonal_render_vue_vue_type_script_setup_true_name_pw_diagonal_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
158752
|
+
__name: "pw-diagonal-render",
|
|
158753
|
+
props: {
|
|
158754
|
+
modelId: {},
|
|
158755
|
+
widget: {}
|
|
158756
|
+
},
|
|
158757
|
+
setup(__props) {
|
|
158758
|
+
const designCtx = useDesignSuiteContext();
|
|
158759
|
+
const props = __props;
|
|
158760
|
+
const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
|
|
158761
|
+
const textStyle = computed(() => {
|
|
158762
|
+
const style = {
|
|
158763
|
+
...DEFAULT_WIDGET_TEXT_STYLE,
|
|
158764
|
+
...pageWidgetProps.value.textStyle
|
|
158765
|
+
};
|
|
158766
|
+
const fontStyle = [style.bold && "bold", style.italic && "italic"].filter(Boolean).join(" ") || void 0;
|
|
158767
|
+
const textDecoration = [style.underline && "underline", style.strike && "line-through"].filter(Boolean).filter((v, i, arr) => arr.indexOf(v) === i).join(" ") || void 0;
|
|
158768
|
+
return {
|
|
158769
|
+
fontSize: style.fontSize,
|
|
158770
|
+
fontFamily: style.fontFamily,
|
|
158771
|
+
lineHeight: 1.2,
|
|
158772
|
+
fill: style.color,
|
|
158773
|
+
fontStyle,
|
|
158774
|
+
textDecoration,
|
|
158775
|
+
bold: style.bold,
|
|
158776
|
+
italic: style.italic
|
|
158777
|
+
};
|
|
158778
|
+
});
|
|
158779
|
+
const fontSize = computed(() => textStyle.value.fontSize);
|
|
158780
|
+
const lineHeight = computed(() => textStyle.value.fontSize * 1.2);
|
|
158781
|
+
const width = computed(() => props.widget.width);
|
|
158782
|
+
const height = computed(() => props.widget.height);
|
|
158783
|
+
const size = computed(() => pageWidgetProps.value.size);
|
|
158784
|
+
const isBackward = computed(() => pageWidgetProps.value.direction === DiagonalDirectionTypeConst.Backward);
|
|
158785
|
+
/** 分割线 */
|
|
158786
|
+
function flipX(x) {
|
|
158787
|
+
return isBackward.value ? width.value - x : x;
|
|
158788
|
+
}
|
|
158789
|
+
const lines = computed(() => {
|
|
158790
|
+
if (size.value === 2) return [{
|
|
158791
|
+
points: [
|
|
158792
|
+
flipX(0),
|
|
158793
|
+
0,
|
|
158794
|
+
flipX(width.value),
|
|
158795
|
+
height.value
|
|
158796
|
+
],
|
|
158797
|
+
stroke: "rgb(128, 128, 128)",
|
|
158798
|
+
strokeWidth: 1
|
|
158799
|
+
}];
|
|
158800
|
+
return [{
|
|
158801
|
+
points: [
|
|
158802
|
+
flipX(width.value * .4),
|
|
158803
|
+
0,
|
|
158804
|
+
flipX(width.value),
|
|
158805
|
+
height.value
|
|
158806
|
+
],
|
|
158807
|
+
stroke: "rgb(128, 128, 128)",
|
|
158808
|
+
strokeWidth: 1
|
|
158809
|
+
}, {
|
|
158810
|
+
points: [
|
|
158811
|
+
flipX(0),
|
|
158812
|
+
height.value * .4,
|
|
158813
|
+
flipX(width.value),
|
|
158814
|
+
height.value
|
|
158815
|
+
],
|
|
158816
|
+
stroke: "rgb(128, 128, 128)",
|
|
158817
|
+
strokeWidth: 1
|
|
158818
|
+
}];
|
|
158819
|
+
});
|
|
158820
|
+
const getNameByIndex = (index) => {
|
|
158821
|
+
if (!pageWidgetProps.value.enableFields?.[index]) return pageWidgetProps.value.names[index];
|
|
158822
|
+
const fieldMeta = pageWidgetProps.value.bindFields?.[index];
|
|
158823
|
+
if (fieldMeta && fieldMeta.fieldData) {
|
|
158824
|
+
const modelKey = getLastSegment(fieldMeta.fieldData.modelLink);
|
|
158825
|
+
const fieldKey = getLastSegment(fieldMeta.fieldData.fieldLink);
|
|
158826
|
+
const fieldInfo = modelKey && fieldKey ? designCtx.runtime.getFieldList(modelKey)?.find((f) => f.key === fieldKey) ?? null : null;
|
|
158827
|
+
const path = fieldMeta.fieldData?.valuePath;
|
|
158828
|
+
if (isDesignMode.value) return fieldInfo?.name ? `\${${fieldInfo.name}}` : path;
|
|
158829
|
+
if (path) {
|
|
158830
|
+
const runtimePath = replacePathIndexPlaceholders({
|
|
158831
|
+
y: props.widget?.dataSlotIndex?.yDataIndex,
|
|
158832
|
+
x: props.widget?.dataSlotIndex?.xDataIndex,
|
|
158833
|
+
n: props.widget?.dataSlotIndex?.dataIndex,
|
|
158834
|
+
templatePath: path
|
|
158835
|
+
});
|
|
158836
|
+
return docInst.value?.dataManager?.get(runtimePath);
|
|
158837
|
+
}
|
|
158838
|
+
}
|
|
158839
|
+
return "";
|
|
158840
|
+
};
|
|
158841
|
+
const names = computed(() => {
|
|
158842
|
+
return [
|
|
158843
|
+
0,
|
|
158844
|
+
1,
|
|
158845
|
+
2
|
|
158846
|
+
].map((i) => getNameByIndex(i));
|
|
158847
|
+
});
|
|
158848
|
+
function createCharWidthGetter(size, family, bold, italic) {
|
|
158849
|
+
const cache = /* @__PURE__ */ new Map();
|
|
158850
|
+
return (char) => {
|
|
158851
|
+
const key = [
|
|
158852
|
+
char,
|
|
158853
|
+
size,
|
|
158854
|
+
family,
|
|
158855
|
+
bold,
|
|
158856
|
+
italic
|
|
158857
|
+
].join("_");
|
|
158858
|
+
if (cache.has(key)) return cache.get(key);
|
|
158859
|
+
const { width } = TextUtil.getLayoutSize({
|
|
158860
|
+
fontSize: size,
|
|
158861
|
+
fontFamily: family,
|
|
158862
|
+
bold,
|
|
158863
|
+
italic,
|
|
158864
|
+
text: char
|
|
158865
|
+
});
|
|
158866
|
+
cache.set(key, width);
|
|
158867
|
+
return width;
|
|
158868
|
+
};
|
|
158869
|
+
}
|
|
158870
|
+
function sliceLine(text, start, maxWidth, getCharWidth) {
|
|
158871
|
+
let width = 0;
|
|
158872
|
+
let end = start;
|
|
158873
|
+
while (end < text.length) {
|
|
158874
|
+
const w = getCharWidth(text[end]);
|
|
158875
|
+
if (width + w > maxWidth) break;
|
|
158876
|
+
width += w;
|
|
158877
|
+
end++;
|
|
158878
|
+
}
|
|
158879
|
+
if (end === start) {
|
|
158880
|
+
width = getCharWidth(text[start]);
|
|
158881
|
+
end = start + 1;
|
|
158882
|
+
}
|
|
158883
|
+
return {
|
|
158884
|
+
end,
|
|
158885
|
+
width,
|
|
158886
|
+
text: text.slice(start, end)
|
|
158887
|
+
};
|
|
158888
|
+
}
|
|
158889
|
+
function layoutByLineWidth({ text, x0, y0, height, getLineWidth, getX = (y, width, maxWidth) => x0 }) {
|
|
158890
|
+
const result = [];
|
|
158891
|
+
const getCharWidth = createCharWidthGetter(fontSize.value, textStyle.value.fontFamily, textStyle.value.bold, textStyle.value.italic);
|
|
158892
|
+
let y = y0;
|
|
158893
|
+
let cursor = 0;
|
|
158894
|
+
while (cursor < text.length) {
|
|
158895
|
+
if (y + lineHeight.value > y0 + height) break;
|
|
158896
|
+
const maxWidth = getLineWidth(y);
|
|
158897
|
+
if (maxWidth <= 0) {
|
|
158898
|
+
y += lineHeight.value;
|
|
158899
|
+
continue;
|
|
158900
|
+
}
|
|
158901
|
+
const { end, width, text: lineText } = sliceLine(text, cursor, maxWidth, getCharWidth);
|
|
158902
|
+
result.push({
|
|
158903
|
+
text: lineText,
|
|
158904
|
+
x: getX(y, width, maxWidth),
|
|
158905
|
+
y
|
|
158906
|
+
});
|
|
158907
|
+
cursor = end;
|
|
158908
|
+
y += lineHeight.value;
|
|
158909
|
+
}
|
|
158910
|
+
return result;
|
|
158911
|
+
}
|
|
158912
|
+
const topTextLines = computed(() => {
|
|
158913
|
+
const text = names.value[isBackward.value ? 0 : 2] || "";
|
|
158914
|
+
if (isBackward.value) {
|
|
158915
|
+
const w = size.value === 2 ? width.value : width.value - width.value * .4;
|
|
158916
|
+
return layoutByLineWidth({
|
|
158917
|
+
text,
|
|
158918
|
+
x0: 0,
|
|
158919
|
+
y0: 0,
|
|
158920
|
+
height: height.value,
|
|
158921
|
+
getLineWidth: (y) => w * (1 - y / height.value) - 12
|
|
158922
|
+
});
|
|
158923
|
+
}
|
|
158924
|
+
const y0 = size.value === 2 ? 0 : height.value * .4;
|
|
158925
|
+
const h = size.value === 2 ? height.value : height.value - height.value * .4;
|
|
158926
|
+
return layoutByLineWidth({
|
|
158927
|
+
text,
|
|
158928
|
+
x0: 0,
|
|
158929
|
+
y0,
|
|
158930
|
+
height: h,
|
|
158931
|
+
getLineWidth: (y) => width.value * (y - y0) / h
|
|
158932
|
+
});
|
|
158933
|
+
});
|
|
158934
|
+
const bottomTextLines = computed(() => {
|
|
158935
|
+
const text = names.value[isBackward.value ? 2 : 0] || "";
|
|
158936
|
+
if (isBackward.value) {
|
|
158937
|
+
const y0 = size.value === 2 ? 0 : height.value * .4;
|
|
158938
|
+
const h = size.value === 2 ? height.value : height.value - height.value * .4;
|
|
158939
|
+
return layoutByLineWidth({
|
|
158940
|
+
text,
|
|
158941
|
+
x0: 0,
|
|
158942
|
+
y0,
|
|
158943
|
+
height: h,
|
|
158944
|
+
getLineWidth: (y) => width.value * ((y - y0) / h),
|
|
158945
|
+
getX: (y, lineWidth) => width.value - lineWidth
|
|
158946
|
+
});
|
|
158947
|
+
}
|
|
158948
|
+
const x0 = size.value === 2 ? 0 : width.value * .4;
|
|
158949
|
+
const w = size.value === 2 ? width.value : width.value - width.value * .4;
|
|
158950
|
+
return layoutByLineWidth({
|
|
158951
|
+
text,
|
|
158952
|
+
x0,
|
|
158953
|
+
y0: 0,
|
|
158954
|
+
height: height.value,
|
|
158955
|
+
getLineWidth: (y) => w * (1 - y / height.value) - 13,
|
|
158956
|
+
getX: (y, lineWidth) => x0 + w - lineWidth
|
|
158957
|
+
});
|
|
158958
|
+
});
|
|
158959
|
+
function layoutInShape({ text, height, xLeft, xRight }) {
|
|
158960
|
+
const result = [];
|
|
158961
|
+
const getCharWidth = createCharWidthGetter(fontSize.value, textStyle.value.fontFamily, textStyle.value.bold, textStyle.value.italic);
|
|
158962
|
+
let cursor = 0;
|
|
158963
|
+
let y = 0;
|
|
158964
|
+
while (y < height && cursor < text.length) {
|
|
158965
|
+
const yTop = y;
|
|
158966
|
+
const yBottom = Math.min(y + lineHeight.value, height);
|
|
158967
|
+
const left = Math.max(xLeft(yTop), xLeft(yBottom));
|
|
158968
|
+
const maxWidth = Math.min(xRight(yTop), xRight(yBottom)) - left;
|
|
158969
|
+
if (maxWidth <= 0) break;
|
|
158970
|
+
const { end, width, text: lineText } = sliceLine(text, cursor, maxWidth, getCharWidth);
|
|
158971
|
+
const isLastLine = end >= text.length;
|
|
158972
|
+
const charCount = lineText.length;
|
|
158973
|
+
let x = left;
|
|
158974
|
+
let letterSpacing = 0;
|
|
158975
|
+
if (!isLastLine && charCount > 1) letterSpacing = (maxWidth - width) / (charCount - 1);
|
|
158976
|
+
result.push({
|
|
158977
|
+
text: lineText,
|
|
158978
|
+
x,
|
|
158979
|
+
y: yTop,
|
|
158980
|
+
width: maxWidth,
|
|
158981
|
+
textWidth: width,
|
|
158982
|
+
letterSpacing
|
|
158983
|
+
});
|
|
158984
|
+
cursor = end;
|
|
158985
|
+
y += lineHeight.value;
|
|
158986
|
+
}
|
|
158987
|
+
return result;
|
|
158988
|
+
}
|
|
158989
|
+
const middleTextLines = computed(() => {
|
|
158990
|
+
const text = names.value[1] || "";
|
|
158991
|
+
if (isBackward.value) {
|
|
158992
|
+
const x1 = width.value - width.value * .4;
|
|
158993
|
+
const y2 = height.value * .4;
|
|
158994
|
+
const kRight = (y2 - height.value) / width.value;
|
|
158995
|
+
const xLeft = (y) => x1 * (height.value - y) / height.value;
|
|
158996
|
+
const xRight = (y) => {
|
|
158997
|
+
if (y <= y2) return width.value;
|
|
158998
|
+
return (y - height.value) / kRight;
|
|
158999
|
+
};
|
|
159000
|
+
return layoutInShape({
|
|
159001
|
+
text,
|
|
159002
|
+
height: height.value,
|
|
159003
|
+
xLeft,
|
|
159004
|
+
xRight
|
|
159005
|
+
});
|
|
159006
|
+
}
|
|
159007
|
+
const x1 = width.value * .4;
|
|
159008
|
+
const y1 = height.value * .4;
|
|
159009
|
+
const xLeft = (y) => y <= y1 ? 0 : width.value * (y - y1) / (height.value - y1);
|
|
159010
|
+
const xRight = (y) => x1 + (width.value - x1) * y / height.value;
|
|
159011
|
+
return layoutInShape({
|
|
159012
|
+
text,
|
|
159013
|
+
height: height.value,
|
|
159014
|
+
xLeft,
|
|
159015
|
+
xRight
|
|
159016
|
+
});
|
|
159017
|
+
});
|
|
159018
|
+
const allTextLines = computed(() => {
|
|
159019
|
+
return [
|
|
159020
|
+
...topTextLines.value.map((i) => ({
|
|
159021
|
+
...i,
|
|
159022
|
+
align: "left"
|
|
159023
|
+
})),
|
|
159024
|
+
...size.value === 3 ? middleTextLines.value.map((i) => ({
|
|
159025
|
+
...i,
|
|
159026
|
+
align: "left"
|
|
159027
|
+
})) : [],
|
|
159028
|
+
...bottomTextLines.value.map((i) => ({
|
|
159029
|
+
...i,
|
|
159030
|
+
align: "right"
|
|
159031
|
+
}))
|
|
159032
|
+
];
|
|
159033
|
+
});
|
|
159034
|
+
const bgConfig = computed(() => ({
|
|
159035
|
+
x: 0,
|
|
159036
|
+
y: 0,
|
|
159037
|
+
width: props.widget.width,
|
|
159038
|
+
height: props.widget.height,
|
|
159039
|
+
fill: "transparent"
|
|
159040
|
+
}));
|
|
159041
|
+
return (_ctx, _cache) => {
|
|
159042
|
+
const _component_v_line = resolveComponent("v-line");
|
|
159043
|
+
const _component_v_text = resolveComponent("v-text");
|
|
159044
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
159045
|
+
const _component_v_group = resolveComponent("v-group");
|
|
159046
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
159047
|
+
x: __props.widget.x - CELL_PADDING,
|
|
159048
|
+
y: __props.widget.y - CELL_PADDING,
|
|
159049
|
+
id: __props.widget.id
|
|
159050
|
+
} }, {
|
|
159051
|
+
default: withCtx(() => [
|
|
159052
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (line, i) => {
|
|
159053
|
+
return openBlock(), createBlock(_component_v_line, {
|
|
159054
|
+
key: i,
|
|
159055
|
+
config: line
|
|
159056
|
+
}, null, 8, ["config"]);
|
|
159057
|
+
}), 128)),
|
|
159058
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(allTextLines.value, (line, i) => {
|
|
159059
|
+
return openBlock(), createBlock(_component_v_text, {
|
|
159060
|
+
key: "text-" + i,
|
|
159061
|
+
config: {
|
|
159062
|
+
x: line.x,
|
|
159063
|
+
y: line.y,
|
|
159064
|
+
text: line.text,
|
|
159065
|
+
fontSize: textStyle.value.fontSize,
|
|
159066
|
+
fontFamily: textStyle.value.fontFamily,
|
|
159067
|
+
lineHeight: textStyle.value.lineHeight,
|
|
159068
|
+
fill: textStyle.value.fill,
|
|
159069
|
+
fontStyle: textStyle.value.fontStyle,
|
|
159070
|
+
textDecoration: textStyle.value.textDecoration,
|
|
159071
|
+
align: line.align
|
|
159072
|
+
}
|
|
159073
|
+
}, null, 8, ["config"]);
|
|
159074
|
+
}), 128)),
|
|
159075
|
+
createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"])
|
|
159076
|
+
]),
|
|
159077
|
+
_: 1
|
|
159078
|
+
}, 8, ["config"]);
|
|
159079
|
+
};
|
|
159080
|
+
}
|
|
159081
|
+
});
|
|
159082
|
+
//#endregion
|
|
159083
|
+
//#region src/suites/edhr/component/pw-diagonal-render.vue
|
|
159084
|
+
var pw_diagonal_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_diagonal_render_default });
|
|
159085
|
+
var pw_diagonal_render_default = pw_diagonal_render_vue_vue_type_script_setup_true_name_pw_diagonal_render_lang_default;
|
|
159086
|
+
//#endregion
|
|
159087
|
+
//#region src/suites/edhr/component/pw-image-render.vue?vue&type=script&setup=true&name=gct-image-render&lang.ts
|
|
159088
|
+
init_asset_helper_util();
|
|
159089
|
+
init_image_size_util();
|
|
159090
|
+
init_useWidgetRenderData();
|
|
159091
|
+
var pw_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default = /*@__PURE__*/ defineComponent({
|
|
159092
|
+
__name: "pw-image-render",
|
|
159093
|
+
props: {
|
|
159094
|
+
widget: {},
|
|
159095
|
+
modelId: {}
|
|
159096
|
+
},
|
|
159097
|
+
setup(__props) {
|
|
159098
|
+
const props = __props;
|
|
159099
|
+
const imgRef = ref(null);
|
|
159100
|
+
const { pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
|
|
159101
|
+
const natural = ref({
|
|
159102
|
+
width: 0,
|
|
159103
|
+
height: 0
|
|
159104
|
+
});
|
|
159105
|
+
const display = ref({
|
|
159106
|
+
width: props.widget.width,
|
|
159107
|
+
height: props.widget.height
|
|
159108
|
+
});
|
|
159109
|
+
const placeholder = {
|
|
159110
|
+
width: props.widget.width,
|
|
159111
|
+
height: props.widget.height,
|
|
159112
|
+
fill: "#f3f3f3"
|
|
159113
|
+
};
|
|
159114
|
+
watch(() => pageWidgetProps.value.value, async (v) => {
|
|
159115
|
+
const img = await AssetHelper.loadImage(v);
|
|
159116
|
+
if (!img) return;
|
|
159117
|
+
natural.value = {
|
|
159118
|
+
width: img.naturalWidth,
|
|
159119
|
+
height: img.naturalHeight
|
|
159120
|
+
};
|
|
159121
|
+
const size = computeImageDisplaySize(natural.value, {
|
|
159122
|
+
width: props.widget.width,
|
|
159123
|
+
height: props.widget.height,
|
|
159124
|
+
keepAspect: props.widget.keepAspect ?? true,
|
|
159125
|
+
maxDefaultWidth: 200
|
|
159126
|
+
});
|
|
159127
|
+
display.value = size;
|
|
159128
|
+
imgRef.value = img;
|
|
159129
|
+
}, { immediate: true });
|
|
159130
|
+
const imageConfig = computed(() => {
|
|
159131
|
+
const w = display.value.width;
|
|
159132
|
+
const h = display.value.height;
|
|
159133
|
+
return {
|
|
159134
|
+
x: 0,
|
|
159135
|
+
y: 0,
|
|
159136
|
+
image: imgRef.value,
|
|
159137
|
+
width: w,
|
|
159138
|
+
height: h
|
|
159139
|
+
};
|
|
159140
|
+
});
|
|
159141
|
+
return (_ctx, _cache) => {
|
|
159142
|
+
const _component_v_image = resolveComponent("v-image");
|
|
159143
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
159144
|
+
const _component_v_group = resolveComponent("v-group");
|
|
159145
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
159146
|
+
x: __props.widget.x,
|
|
159147
|
+
y: __props.widget.y,
|
|
159148
|
+
id: __props.widget.id
|
|
159149
|
+
} }, {
|
|
159150
|
+
default: withCtx(() => [imgRef.value ? (openBlock(), createBlock(_component_v_image, {
|
|
159151
|
+
key: 0,
|
|
159152
|
+
config: imageConfig.value
|
|
159153
|
+
}, null, 8, ["config"])) : (openBlock(), createBlock(_component_v_rect, {
|
|
159154
|
+
key: 1,
|
|
159155
|
+
width: placeholder.width,
|
|
159156
|
+
height: placeholder.height,
|
|
159157
|
+
fill: placeholder.fill
|
|
159158
|
+
}, null, 8, [
|
|
159159
|
+
"width",
|
|
159160
|
+
"height",
|
|
159161
|
+
"fill"
|
|
159162
|
+
]))]),
|
|
159163
|
+
_: 1
|
|
159164
|
+
}, 8, ["config"]);
|
|
159165
|
+
};
|
|
159166
|
+
}
|
|
159167
|
+
});
|
|
159168
|
+
//#endregion
|
|
159169
|
+
//#region src/suites/edhr/component/pw-image-render.vue
|
|
159170
|
+
var pw_image_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_image_render_default });
|
|
159171
|
+
var pw_image_render_default = pw_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default;
|
|
159172
|
+
//#endregion
|
|
159173
|
+
//#region src/suites/edhr/component/pw-line-render.vue?vue&type=script&setup=true&lang.ts
|
|
159174
|
+
init_canvas$1();
|
|
159175
|
+
init_core$1();
|
|
159176
|
+
init_useWidgetRenderData();
|
|
159177
|
+
var pw_line_render_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
159178
|
+
__name: "pw-line-render",
|
|
159179
|
+
props: {
|
|
159180
|
+
widget: {},
|
|
159181
|
+
modelId: {}
|
|
159182
|
+
},
|
|
159183
|
+
setup(__props) {
|
|
159184
|
+
const props = __props;
|
|
159185
|
+
const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
|
|
159186
|
+
const lineGroupConfig = computed(() => {
|
|
159187
|
+
return {
|
|
159188
|
+
x: props.widget.x,
|
|
159189
|
+
y: props.widget.y,
|
|
159190
|
+
id: props.widget.id
|
|
159191
|
+
};
|
|
159192
|
+
});
|
|
159193
|
+
const lineProps = computed(() => {
|
|
159194
|
+
const { borderColor, borderWidth, borderStyle, direction, rotate } = pageWidgetProps.value;
|
|
159195
|
+
const width = props.widget.width;
|
|
159196
|
+
const height = props.widget.height;
|
|
159197
|
+
const centerX = halfPixel(width / 2);
|
|
159198
|
+
const centerY = halfPixel(height / 2);
|
|
159199
|
+
let points;
|
|
159200
|
+
let offsetX = 0;
|
|
159201
|
+
let offsetY = 0;
|
|
159202
|
+
if (direction === "vertical") {
|
|
159203
|
+
points = [
|
|
159204
|
+
centerX,
|
|
159205
|
+
0,
|
|
159206
|
+
centerX,
|
|
159207
|
+
height
|
|
159208
|
+
];
|
|
159209
|
+
offsetX = centerX;
|
|
159210
|
+
offsetY = height / 2;
|
|
159211
|
+
} else {
|
|
159212
|
+
points = [
|
|
159213
|
+
0,
|
|
159214
|
+
centerY,
|
|
159215
|
+
width,
|
|
159216
|
+
centerY
|
|
159217
|
+
];
|
|
159218
|
+
offsetX = width / 2;
|
|
159219
|
+
offsetY = centerY;
|
|
159220
|
+
}
|
|
159221
|
+
return {
|
|
159222
|
+
x: offsetX,
|
|
159223
|
+
y: offsetY,
|
|
159224
|
+
stroke: borderColor || "#000",
|
|
159225
|
+
strokeWidth: borderWidth || 1,
|
|
159226
|
+
dash: borderStyle === "dashed" ? [6, 4] : borderStyle === "dotted" ? [2, 2] : void 0,
|
|
159227
|
+
points,
|
|
159228
|
+
offsetX,
|
|
159229
|
+
offsetY,
|
|
159230
|
+
rotation: rotate || 0,
|
|
159231
|
+
...baseCanvasAttrs
|
|
159232
|
+
};
|
|
159233
|
+
});
|
|
159234
|
+
return (_ctx, _cache) => {
|
|
159235
|
+
const _component_v_line = resolveComponent("v-line");
|
|
159236
|
+
const _component_v_group = resolveComponent("v-group");
|
|
159237
|
+
return openBlock(), createBlock(_component_v_group, { config: lineGroupConfig.value }, {
|
|
159238
|
+
default: withCtx(() => [createVNode(_component_v_line, normalizeProps(guardReactiveProps(lineProps.value)), null, 16)]),
|
|
159239
|
+
_: 1
|
|
159240
|
+
}, 8, ["config"]);
|
|
159241
|
+
};
|
|
159242
|
+
}
|
|
159243
|
+
});
|
|
159244
|
+
//#endregion
|
|
159245
|
+
//#region src/suites/edhr/component/pw-line-render.vue
|
|
159246
|
+
var pw_line_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_line_render_default });
|
|
159247
|
+
var pw_line_render_default = pw_line_render_vue_vue_type_script_setup_true_lang_default;
|
|
159248
|
+
//#endregion
|
|
159249
|
+
//#region src/suites/edhr/component/pw-pagination-render.vue?vue&type=script&setup=true&lang.ts
|
|
159250
|
+
var pw_pagination_render_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
159251
|
+
__name: "pw-pagination-render",
|
|
159252
|
+
props: {
|
|
159253
|
+
widget: {},
|
|
159254
|
+
modelId: {}
|
|
159255
|
+
},
|
|
159256
|
+
setup(__props) {
|
|
159257
|
+
const props = __props;
|
|
159258
|
+
const textConfig = computed(() => {
|
|
159259
|
+
const widget = props.widget;
|
|
159260
|
+
const fontStyle = [widget.bold && "bold", widget.italic && "italic"].filter(Boolean).join(" ") || void 0;
|
|
159261
|
+
const textDecoration = [
|
|
159262
|
+
widget.isComposition && "underline",
|
|
159263
|
+
widget.underline && "underline",
|
|
159264
|
+
widget.strike && "line-through"
|
|
159265
|
+
].filter(Boolean).filter((v, i, arr) => arr.indexOf(v) === i).join(" ") || void 0;
|
|
159266
|
+
return {
|
|
159267
|
+
x: 0,
|
|
159268
|
+
y: 0,
|
|
159269
|
+
text: widget.text,
|
|
159270
|
+
fontSize: widget.fontSize,
|
|
159271
|
+
fontFamily: widget.fontFamily,
|
|
159272
|
+
fill: widget.color,
|
|
159273
|
+
fontStyle,
|
|
159274
|
+
align: widget.textAlign,
|
|
159275
|
+
letterSpacing: widget.letterSpacing,
|
|
159276
|
+
textDecoration,
|
|
159277
|
+
wrap: "none"
|
|
159278
|
+
};
|
|
159279
|
+
});
|
|
159280
|
+
return (_ctx, _cache) => {
|
|
159281
|
+
const _component_v_text = resolveComponent("v-text");
|
|
159282
|
+
const _component_v_group = resolveComponent("v-group");
|
|
159283
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
159284
|
+
x: __props.widget.x,
|
|
159285
|
+
y: __props.widget.y,
|
|
159286
|
+
id: __props.widget.id
|
|
159287
|
+
} }, {
|
|
159288
|
+
default: withCtx(() => [createVNode(_component_v_text, { config: textConfig.value }, null, 8, ["config"])]),
|
|
159289
|
+
_: 1
|
|
159290
|
+
}, 8, ["config"]);
|
|
159291
|
+
};
|
|
159292
|
+
}
|
|
159293
|
+
});
|
|
159294
|
+
//#endregion
|
|
159295
|
+
//#region src/suites/edhr/component/pw-pagination-render.vue
|
|
159296
|
+
var pw_pagination_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_pagination_render_default });
|
|
159297
|
+
var pw_pagination_render_default = pw_pagination_render_vue_vue_type_script_setup_true_lang_default;
|
|
159298
|
+
//#endregion
|
|
159299
|
+
//#region src/suites/edhr/component/pw-qrcode-render.vue?vue&type=script&setup=true&lang.ts
|
|
159300
|
+
init_core$1();
|
|
159301
|
+
init_useWidgetRenderData();
|
|
159302
|
+
init_enum();
|
|
159303
|
+
init_core();
|
|
159304
|
+
var pw_qrcode_render_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
159305
|
+
__name: "pw-qrcode-render",
|
|
159306
|
+
props: {
|
|
159307
|
+
widget: {},
|
|
159308
|
+
modelId: {}
|
|
159309
|
+
},
|
|
159310
|
+
setup(__props) {
|
|
159311
|
+
const props = __props;
|
|
159312
|
+
const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
|
|
159313
|
+
const readonlyValue = ref("");
|
|
159314
|
+
const valueType = computed(() => pageWidgetProps.value.valueType);
|
|
159315
|
+
/** 值处理 */
|
|
159316
|
+
const modelValue = computed(() => {
|
|
159317
|
+
let text = pageWidgetProps.value.value;
|
|
159318
|
+
if (valueType.value === ValueTypeConst.Field) {
|
|
159319
|
+
const path = text?.exp?.fieldData?.valuePath;
|
|
159320
|
+
if (path) {
|
|
159321
|
+
const runtimePath = replacePathIndexPlaceholders({
|
|
159322
|
+
y: props.widget?.dataSlotIndex?.yDataIndex,
|
|
159323
|
+
x: props.widget?.dataSlotIndex?.xDataIndex,
|
|
159324
|
+
n: props.widget?.dataSlotIndex?.dataIndex,
|
|
159325
|
+
templatePath: path
|
|
159326
|
+
});
|
|
159327
|
+
text = docInst.value?.dataManager?.get(runtimePath);
|
|
159328
|
+
}
|
|
159329
|
+
}
|
|
159330
|
+
return Array.isArray(text) ? text.join() : text;
|
|
159331
|
+
});
|
|
159332
|
+
watch(() => modelValue.value, async () => {
|
|
159333
|
+
if (isDesignMode.value) {
|
|
159334
|
+
readonlyValue.value = "GCT";
|
|
159335
|
+
return;
|
|
159336
|
+
}
|
|
159337
|
+
if (valueType.value === ValueTypeConst.Formula) {
|
|
159338
|
+
const subFieldKey = modelValue.value?.subFieldKey;
|
|
159339
|
+
const rawData = docInst.value.dataManager.getRawData();
|
|
159340
|
+
const path = subFieldKey ? `${subFieldKey}[${props.widget?.dataSlotIndex?.dataIndex}]` : "";
|
|
159341
|
+
const subRowData = path ? docInst.value.dataManager.get(path) : {};
|
|
159342
|
+
const result = await formulaUtils.calculateFormula(modelValue.value?.exp, rawData, subRowData);
|
|
159343
|
+
readonlyValue.value = result;
|
|
159344
|
+
} else readonlyValue.value = modelValue.value;
|
|
159345
|
+
}, { immediate: true });
|
|
159346
|
+
const isValueEmpty = computed(() => {
|
|
159347
|
+
return isEmptyValue$1(readonlyValue.value);
|
|
159348
|
+
});
|
|
159349
|
+
const qrData = computed(() => {
|
|
159350
|
+
if (isValueEmpty.value) return [];
|
|
159351
|
+
try {
|
|
159352
|
+
return QRCode.create(readonlyValue.value, {
|
|
159353
|
+
errorCorrectionLevel: "H",
|
|
159354
|
+
margin: 1
|
|
159355
|
+
}).modules.data;
|
|
159356
|
+
} catch {
|
|
159357
|
+
return [];
|
|
159358
|
+
}
|
|
159359
|
+
});
|
|
159360
|
+
const blocks = computed(() => {
|
|
159361
|
+
if (isValueEmpty.value) {
|
|
159362
|
+
const placeholder = [];
|
|
159363
|
+
const size = 21;
|
|
159364
|
+
const unit = props.widget.width / size;
|
|
159365
|
+
for (let row = 0; row < size; row++) for (let col = 0; col < size; col++) if ((row + col) % 3 === 0) placeholder.push({
|
|
159366
|
+
x: col * unit,
|
|
159367
|
+
y: row * unit,
|
|
159368
|
+
w: unit,
|
|
159369
|
+
h: unit,
|
|
159370
|
+
fill: "#bbb"
|
|
159371
|
+
});
|
|
159372
|
+
return placeholder;
|
|
159373
|
+
}
|
|
159374
|
+
const blocksArr = [];
|
|
159375
|
+
const size = Math.sqrt(qrData.value.length);
|
|
159376
|
+
const unit = props.widget.width / size;
|
|
159377
|
+
for (let row = 0; row < size; row++) for (let col = 0; col < size; col++) {
|
|
159378
|
+
const idx = row * size + col;
|
|
159379
|
+
if (qrData.value[idx]) blocksArr.push({
|
|
159380
|
+
x: col * unit,
|
|
159381
|
+
y: row * unit,
|
|
159382
|
+
w: unit,
|
|
159383
|
+
h: unit,
|
|
159384
|
+
fill: "#000"
|
|
159385
|
+
});
|
|
159386
|
+
}
|
|
159387
|
+
return blocksArr;
|
|
159388
|
+
});
|
|
159389
|
+
const lightningPath = computed(() => {
|
|
159390
|
+
const w = props.widget.width;
|
|
159391
|
+
const mid = props.widget.width / 2;
|
|
159392
|
+
return `
|
|
159393
|
+
M 0 ${mid - 6}
|
|
159394
|
+
L ${w * .25} ${mid - 2}
|
|
159395
|
+
L ${w * .4} ${mid + 2}
|
|
159396
|
+
L ${w * .6} ${mid - 4}
|
|
159397
|
+
L ${w * .8} ${mid + 3}
|
|
159398
|
+
L ${w} ${mid - 1}
|
|
159399
|
+
L ${w} ${mid + 6}
|
|
159400
|
+
L ${w * .8} ${mid + 10}
|
|
159401
|
+
L ${w * .6} ${mid + 4}
|
|
159402
|
+
L ${w * .4} ${mid + 12}
|
|
159403
|
+
L ${w * .25} ${mid + 6}
|
|
159404
|
+
L 0 ${mid + 10}
|
|
159405
|
+
Z
|
|
159406
|
+
`;
|
|
159407
|
+
});
|
|
159408
|
+
const bgConfig = computed(() => ({
|
|
159409
|
+
x: 0,
|
|
159410
|
+
y: 0,
|
|
159411
|
+
width: props.widget.width,
|
|
159412
|
+
height: props.widget.height,
|
|
159413
|
+
fill: "transparent"
|
|
159414
|
+
}));
|
|
159415
|
+
return (_ctx, _cache) => {
|
|
159416
|
+
const _component_v_rect = resolveComponent("v-rect");
|
|
159417
|
+
const _component_v_path = resolveComponent("v-path");
|
|
159418
|
+
const _component_v_group = resolveComponent("v-group");
|
|
159419
|
+
return openBlock(), createBlock(_component_v_group, { config: {
|
|
159420
|
+
x: __props.widget.x,
|
|
159421
|
+
y: __props.widget.y,
|
|
159422
|
+
id: __props.widget.id
|
|
159423
|
+
} }, {
|
|
159424
|
+
default: withCtx(() => [
|
|
159425
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block, i) => {
|
|
159426
|
+
return openBlock(), createBlock(_component_v_rect, {
|
|
159427
|
+
key: i,
|
|
159428
|
+
x: block.x,
|
|
159429
|
+
y: block.y,
|
|
159430
|
+
width: block.w,
|
|
159431
|
+
height: block.h,
|
|
159432
|
+
fill: block.fill
|
|
159433
|
+
}, null, 8, [
|
|
159434
|
+
"x",
|
|
159435
|
+
"y",
|
|
159436
|
+
"width",
|
|
159437
|
+
"height",
|
|
159438
|
+
"fill"
|
|
159439
|
+
]);
|
|
159440
|
+
}), 128)),
|
|
159441
|
+
isValueEmpty.value ? (openBlock(), createBlock(_component_v_path, {
|
|
159442
|
+
key: 0,
|
|
159443
|
+
data: lightningPath.value,
|
|
159444
|
+
fill: "#fff"
|
|
159445
|
+
}, null, 8, ["data"])) : createCommentVNode("", true),
|
|
159446
|
+
createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"])
|
|
159447
|
+
]),
|
|
159448
|
+
_: 1
|
|
159449
|
+
}, 8, ["config"]);
|
|
159450
|
+
};
|
|
159451
|
+
}
|
|
159452
|
+
});
|
|
159453
|
+
//#endregion
|
|
159454
|
+
//#region src/suites/edhr/component/pw-qrcode-render.vue
|
|
159455
|
+
var pw_qrcode_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_qrcode_render_default });
|
|
159456
|
+
var pw_qrcode_render_default = pw_qrcode_render_vue_vue_type_script_setup_true_lang_default;
|
|
159457
|
+
//#endregion
|
|
157439
159458
|
//#region src/suites/edhr/component/index.ts
|
|
157440
|
-
/**
|
|
157441
|
-
* 同步加载 Vue 组件
|
|
157442
|
-
*/
|
|
157443
159459
|
function loadVueComponentModulesSync() {
|
|
157444
|
-
const componentModules =
|
|
159460
|
+
const componentModules = {
|
|
159461
|
+
.../* #__PURE__ */ Object.assign({
|
|
159462
|
+
"./gct-control-render.vue": gct_control_render_exports,
|
|
159463
|
+
"./gct-image-render.vue": gct_image_render_exports,
|
|
159464
|
+
"./gct-leftMarker-render.vue": gct_leftMarker_render_exports,
|
|
159465
|
+
"./gct-placeholder-render.vue": gct_placeholder_render_exports,
|
|
159466
|
+
"./gct-rightMarker-render.vue": gct_rightMarker_render_exports,
|
|
159467
|
+
"./gct-signature-render.vue": gct_signature_render_exports,
|
|
159468
|
+
"./gct-space-render.vue": gct_space_render_exports,
|
|
159469
|
+
"./gct-text-render.vue": gct_text_render_exports
|
|
159470
|
+
}),
|
|
159471
|
+
.../* #__PURE__ */ Object.assign({
|
|
159472
|
+
"./pw-barcode-render.vue": pw_barcode_render_exports,
|
|
159473
|
+
"./pw-diagonal-render.vue": pw_diagonal_render_exports,
|
|
159474
|
+
"./pw-image-render.vue": pw_image_render_exports,
|
|
159475
|
+
"./pw-line-render.vue": pw_line_render_exports,
|
|
159476
|
+
"./pw-pagination-render.vue": pw_pagination_render_exports,
|
|
159477
|
+
"./pw-qrcode-render.vue": pw_qrcode_render_exports
|
|
159478
|
+
})
|
|
159479
|
+
};
|
|
157445
159480
|
const vueComponentMap = {};
|
|
157446
159481
|
Object.entries(componentModules).forEach(([filePath, componentModule]) => {
|
|
157447
159482
|
try {
|