super-page-runtime 2.0.22 → 2.0.27
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/es/components/runtime/utils/api/api-util.js +13 -5
- package/dist/es/components/runtime/utils/api/page-expose-util.js +5 -1
- package/dist/es/components/runtime/utils/assemblys-config.js +22 -7
- package/dist/es/components/runtime/utils/barcode-util.d.ts +8 -0
- package/dist/es/components/runtime/utils/barcode-util.js +36 -0
- package/dist/es/components/runtime/utils/common-util.js +1 -1
- package/dist/es/components/runtime/utils/events/event-util.d.ts +14 -0
- package/dist/es/components/runtime/utils/events/event-util.js +95 -32
- package/dist/es/components/runtime/utils/events/print-label.d.ts +5 -0
- package/dist/es/components/runtime/utils/events/print-label.js +153 -0
- package/dist/es/components/runtime/utils/events/standard-event.d.ts +3 -0
- package/dist/es/components/runtime/utils/events/standard-event.js +128 -52
- package/dist/es/components/runtime/utils/form/scan-util.js +191 -0
- package/dist/es/components/runtime/utils/page-helper-util.js +19 -2
- package/dist/es/components/runtime/utils/page-init-util.d.ts +1 -1
- package/dist/es/components/runtime/utils/page-init-util.js +21 -20
- package/dist/es/components/runtime/utils/table-utils.js +1 -10
- package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue.js +4 -0
- package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +96 -0
- package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +1 -1
- package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue.js +4 -0
- package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue2.js +179 -0
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +95 -62
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +16 -10
- package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +3 -2
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +25 -1
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +77 -39
- package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +24 -1
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +21 -3
- package/dist/es/components/runtime/views/assemblys/object-render.vue.js +4 -1
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +3 -0
- package/dist/es/components/runtime/views/super-page.vue.js +59 -38
- package/package.json +4 -3
|
@@ -2,9 +2,9 @@ import http from "agilebuilder-ui/src/utils/request";
|
|
|
2
2
|
import { useRoute } from "vue-router";
|
|
3
3
|
import { getAdditionalParamMap } from "./events/standard-event.js";
|
|
4
4
|
import { PageDimensions } from "./interfaces/page-design-types.js";
|
|
5
|
-
import { formatVariableValue, setVariableValue } from "./page-helper-util.js";
|
|
5
|
+
import { formatVariableValue, setVariableValue, getFormPropName } from "./page-helper-util.js";
|
|
6
6
|
function queryPageDesignByCode(pageCode) {
|
|
7
|
-
return http.get("/component/super-page-design/runtime/" + pageCode);
|
|
7
|
+
return http.get(window["$vueApp"].config.globalProperties.baseAPI + "/component/super-page-design/runtime/" + pageCode);
|
|
8
8
|
}
|
|
9
9
|
function convertToPageContext(pageDesign, pageRequest) {
|
|
10
10
|
if (pageDesign == null) {
|
|
@@ -49,9 +49,9 @@ function convertToPageContext(pageDesign, pageRequest) {
|
|
|
49
49
|
system: {}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
if (pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "link") {
|
|
52
|
+
if (pageDesign.props && pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "link") {
|
|
53
53
|
pageContext.workflowCode = pageDesign.props.linkWorkflowCode;
|
|
54
|
-
} else if (pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "create") {
|
|
54
|
+
} else if (pageDesign.props && pageDesign.props.activeWorkflow && pageDesign.props.workflowSource && pageDesign.props.workflowSource === "create") {
|
|
55
55
|
pageContext.workflowCode = pageDesign.props.createWorkflowCode;
|
|
56
56
|
}
|
|
57
57
|
if (pageDesign.variables) {
|
|
@@ -111,15 +111,21 @@ function getRequestObject(pageRequest) {
|
|
|
111
111
|
;
|
|
112
112
|
return requestObj;
|
|
113
113
|
}
|
|
114
|
-
function getFormModelFields(pageContext, formItemConfigure) {
|
|
114
|
+
function getFormModelFields(pageContext, formItemConfigure, prop) {
|
|
115
115
|
if (!formItemConfigure) {
|
|
116
116
|
return ["temp"];
|
|
117
117
|
}
|
|
118
118
|
const entity = pageContext.entity;
|
|
119
|
-
|
|
120
|
-
let propName =
|
|
119
|
+
let propsBase;
|
|
120
|
+
let propName = prop;
|
|
121
|
+
if (!prop) {
|
|
122
|
+
propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
|
|
123
|
+
propName = propsBase.prop;
|
|
124
|
+
}
|
|
121
125
|
let fields = null;
|
|
122
|
-
if (
|
|
126
|
+
if (prop) {
|
|
127
|
+
fields = ["data", prop];
|
|
128
|
+
} else if (!propName || !propName.startsWith("${")) {
|
|
123
129
|
fields = ["page", formItemConfigure.uuid];
|
|
124
130
|
} else {
|
|
125
131
|
propName = propName.substring(2, propName.length - 1);
|
|
@@ -128,9 +134,8 @@ function getFormModelFields(pageContext, formItemConfigure) {
|
|
|
128
134
|
fields = [formItemConfigure.uuid];
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
|
-
debugger;
|
|
132
137
|
if (entity.data.ID == void 0 && entity.data.ID == void 0) {
|
|
133
|
-
if (propsBase.defaultValue) {
|
|
138
|
+
if (propsBase && propsBase.defaultValue) {
|
|
134
139
|
let defaultValue = formatVariableValue(pageContext, propsBase.defaultValue);
|
|
135
140
|
if (defaultValue != null && defaultValue != void 0) {
|
|
136
141
|
let isMultiple = false;
|
|
@@ -149,7 +154,7 @@ function getFormModelFields(pageContext, formItemConfigure) {
|
|
|
149
154
|
return fields;
|
|
150
155
|
}
|
|
151
156
|
function getPermissionCodes(configure, pageContext) {
|
|
152
|
-
if (!pageContext ||
|
|
157
|
+
if (!pageContext || !configure) {
|
|
153
158
|
return "true";
|
|
154
159
|
}
|
|
155
160
|
const codes = [];
|
|
@@ -182,10 +187,10 @@ function queryPageSuperGrids(pageDesign, pageContext, publishVersion) {
|
|
|
182
187
|
const additionalParamMap = getAdditionalParamMap(pageContext);
|
|
183
188
|
let additionalParamMapJson;
|
|
184
189
|
const pageCode = pageContext.code;
|
|
185
|
-
if (additionalParamMap) {
|
|
190
|
+
if (additionalParamMap && Object.keys(additionalParamMap) > 0) {
|
|
186
191
|
additionalParamMapJson = JSON.stringify(additionalParamMap);
|
|
187
192
|
}
|
|
188
|
-
return http.post("/component/super-page-design/super-grids", {
|
|
193
|
+
return http.post(window["$vueApp"].config.globalProperties.baseAPI + "/component/super-page-design/super-grids", {
|
|
189
194
|
tableRuntimes,
|
|
190
195
|
additionalParamMapJson,
|
|
191
196
|
pageCode,
|
|
@@ -205,19 +210,15 @@ function packageFormRules(pageContext, configure) {
|
|
|
205
210
|
const prop = configure.props && configure.props.base ? configure.props.base.prop : null;
|
|
206
211
|
if (prop) {
|
|
207
212
|
const propName = getFormPropName(prop);
|
|
213
|
+
if (!pageContext.rules) {
|
|
214
|
+
pageContext.rules = {};
|
|
215
|
+
}
|
|
208
216
|
if (!pageContext.rules[propName]) {
|
|
209
217
|
pageContext.rules[propName] = [];
|
|
210
218
|
}
|
|
211
219
|
pageContext.rules[propName] = configure.props.rules;
|
|
212
220
|
}
|
|
213
221
|
}
|
|
214
|
-
function getFormPropName(prop) {
|
|
215
|
-
if (prop && prop.indexOf("${") >= 0) {
|
|
216
|
-
return prop.substring(prop.indexOf(".") + 1, prop.lastIndexOf("}"));
|
|
217
|
-
} else {
|
|
218
|
-
return prop;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
222
|
export {
|
|
222
223
|
convertToPageContext,
|
|
223
224
|
getFormModelFields,
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { getBaseUrl } from "./common-util.js";
|
|
2
2
|
import http from "agilebuilder-ui/src/utils/request";
|
|
3
3
|
import eventBus from "./eventBus.js";
|
|
4
|
-
function getDataTypeMap(backendUrl, tableName) {
|
|
5
|
-
return new Promise((resolve, reject) => {
|
|
6
|
-
getDataTypeMapRequest(backendUrl, tableName).then((dataTypeMap) => {
|
|
7
|
-
resolve(dataTypeMap);
|
|
8
|
-
}).catch(() => {
|
|
9
|
-
reject(new Error("获得数据表:" + tableName + "的字段类型集合失败"));
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
4
|
function getDataTypeMapRequest(backendUrl, tableName) {
|
|
14
5
|
const baseUrl = getBaseUrl(backendUrl);
|
|
15
6
|
return http.get(baseUrl + "/dsc/commons/tables/" + tableName + "/data-types");
|
|
@@ -18,6 +9,6 @@ function popupToPage(params) {
|
|
|
18
9
|
eventBus.$emit(params.pageCode + "_open-dialog", params);
|
|
19
10
|
}
|
|
20
11
|
export {
|
|
21
|
-
|
|
12
|
+
getDataTypeMapRequest,
|
|
22
13
|
popupToPage
|
|
23
14
|
};
|
package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineComponent, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import "agilebuilder-ui";
|
|
3
|
+
import { handleEvent } from "../../../../utils/events/event-util.js";
|
|
4
|
+
import _sfc_main$1 from "../button/button-runtime.vue2.js";
|
|
5
|
+
const _hoisted_1 = { key: 1 };
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "printlabel-runtime",
|
|
8
|
+
props: {
|
|
9
|
+
pageContext: {},
|
|
10
|
+
configure: {}
|
|
11
|
+
},
|
|
12
|
+
setup(__props) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
15
|
+
const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
|
|
16
|
+
const showDropdown = ref(false);
|
|
17
|
+
if (designProperty.value.template && designProperty.value.template.length > 1) {
|
|
18
|
+
showDropdown.value = true;
|
|
19
|
+
}
|
|
20
|
+
const runtimeStyle = runtimeInfo.style;
|
|
21
|
+
const runtimeClass = runtimeInfo.class;
|
|
22
|
+
return (_ctx, _cache) => {
|
|
23
|
+
const _component_el_button = resolveComponent("el-button");
|
|
24
|
+
const _component_ArrowDown = resolveComponent("ArrowDown");
|
|
25
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
26
|
+
const _component_el_text = resolveComponent("el-text");
|
|
27
|
+
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
28
|
+
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
29
|
+
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
30
|
+
return !showDropdown.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
31
|
+
key: 0,
|
|
32
|
+
configure: _ctx.configure,
|
|
33
|
+
pageContext: _ctx.pageContext
|
|
34
|
+
}, null, 8, ["configure", "pageContext"])) : (openBlock(), createBlock(_component_el_dropdown, {
|
|
35
|
+
key: 1,
|
|
36
|
+
class: normalizeClass(unref(runtimeClass)),
|
|
37
|
+
style: normalizeStyle(unref(runtimeStyle)),
|
|
38
|
+
placement: designProperty.value.placement,
|
|
39
|
+
"split-button": designProperty.value.splitButton,
|
|
40
|
+
disabled: designProperty.value.state === "disabled",
|
|
41
|
+
type: designProperty.value.buttonType,
|
|
42
|
+
size: designProperty.value.size,
|
|
43
|
+
trigger: designProperty.value.trigger
|
|
44
|
+
}, {
|
|
45
|
+
dropdown: withCtx(() => [
|
|
46
|
+
createVNode(_component_el_dropdown_menu, null, {
|
|
47
|
+
default: withCtx(() => [
|
|
48
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(designProperty.value.template, (item, index) => {
|
|
49
|
+
return openBlock(), createBlock(_component_el_dropdown_item, {
|
|
50
|
+
key: item,
|
|
51
|
+
onClick: ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "click", { menuItem: item })
|
|
52
|
+
}, {
|
|
53
|
+
default: withCtx(() => [
|
|
54
|
+
createTextVNode(toDisplayString(item.label), 1)
|
|
55
|
+
]),
|
|
56
|
+
_: 2
|
|
57
|
+
}, 1032, ["onClick"]);
|
|
58
|
+
}), 128))
|
|
59
|
+
]),
|
|
60
|
+
_: 1
|
|
61
|
+
})
|
|
62
|
+
]),
|
|
63
|
+
default: withCtx(() => [
|
|
64
|
+
designProperty.value.triggerElement === "button" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
65
|
+
!designProperty.value.splitButton ? (openBlock(), createBlock(_component_el_button, {
|
|
66
|
+
key: 0,
|
|
67
|
+
size: designProperty.value.size,
|
|
68
|
+
type: designProperty.value.buttonType,
|
|
69
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "menuClick"))
|
|
70
|
+
}, {
|
|
71
|
+
default: withCtx(() => [
|
|
72
|
+
createTextVNode(toDisplayString(designProperty.value.title), 1)
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["size", "type"])) : (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(designProperty.value.title), 1))
|
|
76
|
+
], 64)) : (openBlock(), createBlock(_component_el_text, { key: 1 }, {
|
|
77
|
+
default: withCtx(() => [
|
|
78
|
+
createTextVNode(toDisplayString(designProperty.value.title) + " ", 1),
|
|
79
|
+
createVNode(_component_el_icon, null, {
|
|
80
|
+
default: withCtx(() => [
|
|
81
|
+
createVNode(_component_ArrowDown)
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
})
|
|
85
|
+
]),
|
|
86
|
+
_: 1
|
|
87
|
+
}))
|
|
88
|
+
]),
|
|
89
|
+
_: 1
|
|
90
|
+
}, 8, ["class", "style", "placement", "split-button", "disabled", "type", "size", "trigger"]));
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
export {
|
|
95
|
+
_sfc_main as default
|
|
96
|
+
};
|
|
@@ -22,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
22
|
justify: designProperty.value.flexJustify,
|
|
23
23
|
gutter: designProperty.value.flexGutter,
|
|
24
24
|
align: designProperty.value.alignItems,
|
|
25
|
-
style: normalizeStyle(unref(runtimeStyle)),
|
|
25
|
+
style: normalizeStyle([{ "display": "flex" }, unref(runtimeStyle)]),
|
|
26
26
|
class: normalizeClass(unref(runtimeClass))
|
|
27
27
|
}, {
|
|
28
28
|
default: withCtx(() => [
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, onMounted, watch, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import qrcode from "qrcode";
|
|
3
|
+
import JsBarcode from "jsbarcode";
|
|
4
|
+
import { getFormModelFields } from "../../../../utils/page-init-util.js";
|
|
5
|
+
import { generateCodeByRule } from "../../../../utils/barcode-util.js";
|
|
6
|
+
import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
|
|
7
|
+
import { handleEvent } from "../../../../utils/events/event-util.js";
|
|
8
|
+
import "agilebuilder-ui/src/utils/request";
|
|
9
|
+
const _hoisted_1 = ["src"];
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "barcode-runtime",
|
|
12
|
+
props: {
|
|
13
|
+
pageContext: {},
|
|
14
|
+
configure: {}
|
|
15
|
+
},
|
|
16
|
+
setup(__props, { expose: __expose }) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const entity = props.pageContext.entity ? props.pageContext.entity : {};
|
|
19
|
+
let dynamicFields = getFormModelFields(props.pageContext, props.configure);
|
|
20
|
+
const dynamicModelMethod = computed({
|
|
21
|
+
get() {
|
|
22
|
+
return getVariableValue(entity, dynamicFields);
|
|
23
|
+
},
|
|
24
|
+
set(value) {
|
|
25
|
+
setVariableValue(entity, dynamicFields, value);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
29
|
+
const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
|
|
30
|
+
const runtimeStyle = runtimeInfo.style;
|
|
31
|
+
const runtimeClass = runtimeInfo.class;
|
|
32
|
+
const headerStyle = runtimeInfo.headerStyle;
|
|
33
|
+
const qrUrl = ref("");
|
|
34
|
+
const barcode = ref(null);
|
|
35
|
+
const barcodeFormat = ref(designProperty.value.brCodeFormat ?? "CODE128");
|
|
36
|
+
const watchVariableNames = ref([]);
|
|
37
|
+
onMounted(() => {
|
|
38
|
+
if (designProperty.value.generateRule) {
|
|
39
|
+
if (designProperty.value.generateRuleType === "fixed") {
|
|
40
|
+
handleFixedFormat();
|
|
41
|
+
} else {
|
|
42
|
+
handleSelectedRule();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (dynamicModelMethod.value) {
|
|
46
|
+
createCode(dynamicModelMethod.value);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
function getValue() {
|
|
50
|
+
return getVariableValue(entity, dynamicFields);
|
|
51
|
+
}
|
|
52
|
+
function setValue(value) {
|
|
53
|
+
return setVariableValue(entity, dynamicFields, value);
|
|
54
|
+
}
|
|
55
|
+
function handleFixedFormat() {
|
|
56
|
+
watchVariableNames.value = Array.from(
|
|
57
|
+
designProperty.value.generateRule.matchAll(/\$\{(\w+)\}/g),
|
|
58
|
+
(m) => m[1]
|
|
59
|
+
);
|
|
60
|
+
watchVariableNames.value.forEach((name) => {
|
|
61
|
+
watch(
|
|
62
|
+
() => props.pageContext.entity.data[name],
|
|
63
|
+
(newValue, oldValue) => {
|
|
64
|
+
if (newValue !== void 0 && newValue !== null) {
|
|
65
|
+
generateFixedFormatCode();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function handleSelectedRule() {
|
|
72
|
+
const rule = JSON.parse(
|
|
73
|
+
'[{"fieldName":"-1","fixedValue":"|"},{"fixedValue":"","fieldLength":"10","suppliement":"x","fieldName":"passenger"},{"fixedValue":"","fieldLength":"","suppliement":"","fieldName":"passengerNumber"},{"fixedValue":"AAA","fieldLength":"","suppliement":"","fieldName":"-1"}]'
|
|
74
|
+
);
|
|
75
|
+
rule.forEach((item) => {
|
|
76
|
+
if (item.fieldName !== "-1" && item.fieldName !== -1) {
|
|
77
|
+
watchVariableNames.value.push(item.fieldName);
|
|
78
|
+
watch(
|
|
79
|
+
() => props.pageContext.entity.data[item.fieldName],
|
|
80
|
+
(newValue, oldValue) => {
|
|
81
|
+
if (newValue !== void 0 && newValue !== null) {
|
|
82
|
+
const codeValue = generateCodeByRule(rule, props.pageContext.entity.data);
|
|
83
|
+
if (codeValue) {
|
|
84
|
+
generateCode(codeValue);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function generateFixedFormatCode() {
|
|
93
|
+
let allVariablesPresent = true;
|
|
94
|
+
watchVariableNames.value.forEach((name) => {
|
|
95
|
+
if (!props.pageContext.entity.data[name]) {
|
|
96
|
+
allVariablesPresent = false;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (allVariablesPresent) {
|
|
101
|
+
let barCodeValue = replaceVariables(
|
|
102
|
+
designProperty.value.generateRule,
|
|
103
|
+
props.pageContext.entity.data
|
|
104
|
+
);
|
|
105
|
+
generateCode(barCodeValue);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function generateCode(value) {
|
|
109
|
+
createCode(value);
|
|
110
|
+
setValue(value);
|
|
111
|
+
handleEvent(value, props.pageContext, props.configure, "change", {
|
|
112
|
+
entity
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function createCode(value) {
|
|
116
|
+
if (designProperty.value.type === "QR-code") {
|
|
117
|
+
createQrCode(value);
|
|
118
|
+
} else {
|
|
119
|
+
createBarCode(value);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function createBarCode(codeValue) {
|
|
123
|
+
try {
|
|
124
|
+
JsBarcode(barcode.value, codeValue, { format: barcodeFormat.value });
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error("生成条形码时发生错误:", error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function createQrCode(codeValue) {
|
|
130
|
+
qrcode.toDataURL(codeValue, (err, url) => {
|
|
131
|
+
if (err) {
|
|
132
|
+
console.error(err);
|
|
133
|
+
} else {
|
|
134
|
+
qrUrl.value = url;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function replaceVariables(template, variables) {
|
|
139
|
+
const regex = /\$\{(\w+)\}/g;
|
|
140
|
+
return template.replace(regex, (match, keyword) => {
|
|
141
|
+
return variables.hasOwnProperty(keyword) ? variables[keyword] : match;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
__expose({
|
|
145
|
+
getValue,
|
|
146
|
+
setValue
|
|
147
|
+
});
|
|
148
|
+
return (_ctx, _cache) => {
|
|
149
|
+
const _component_el_form_item = resolveComponent("el-form-item");
|
|
150
|
+
return openBlock(), createBlock(_component_el_form_item, {
|
|
151
|
+
required: designProperty.value.required ? true : false,
|
|
152
|
+
class: normalizeClass(unref(runtimeClass)),
|
|
153
|
+
"label-width": designProperty.value.labelWidth,
|
|
154
|
+
style: normalizeStyle(unref(runtimeStyle))
|
|
155
|
+
}, {
|
|
156
|
+
label: withCtx(() => [
|
|
157
|
+
designProperty.value.tittleShow ? (openBlock(), createElementBlock("div", {
|
|
158
|
+
key: 0,
|
|
159
|
+
style: normalizeStyle({ ...unref(headerStyle) })
|
|
160
|
+
}, toDisplayString(designProperty.value.title), 5)) : createCommentVNode("", true)
|
|
161
|
+
]),
|
|
162
|
+
default: withCtx(() => [
|
|
163
|
+
designProperty.value.type === "QR-code" ? (openBlock(), createElementBlock("img", {
|
|
164
|
+
key: 0,
|
|
165
|
+
src: qrUrl.value
|
|
166
|
+
}, null, 8, _hoisted_1)) : (openBlock(), createElementBlock("canvas", {
|
|
167
|
+
key: 1,
|
|
168
|
+
ref_key: "barcode",
|
|
169
|
+
ref: barcode
|
|
170
|
+
}, null, 512))
|
|
171
|
+
]),
|
|
172
|
+
_: 1
|
|
173
|
+
}, 8, ["required", "class", "label-width", "style"]);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
export {
|
|
178
|
+
_sfc_main as default
|
|
179
|
+
};
|