cnhis-design-vue 3.1.13-beta.7 → 3.1.13
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/es/packages/big-table/src/BigTable.vue.d.ts +6 -15
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +11 -2
- package/es/packages/big-table/src/bigTableEmits.js +2 -1
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.d.ts +12 -0
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +91 -0
- package/es/packages/button-print/index.d.ts +15 -1
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +199 -185
- package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +39 -4
- package/es/packages/button-print/src/utils/print.d.ts +41 -0
- package/es/packages/button-print/src/utils/print.js +325 -0
- package/es/packages/fabric-chart/index.d.ts +3 -4
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +3 -4
- package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +21 -12
- package/es/packages/fabric-chart/src/hooks/useBottom.js +2 -3
- package/es/packages/fabric-chart/src/hooks/useCenter.js +33 -11
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.d.ts +2 -2
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +27 -13
- package/es/packages/fabric-chart/src/hooks/useGrid.js +18 -13
- package/es/packages/fabric-chart/src/hooks/useLeft.js +63 -40
- package/es/packages/fabric-chart/src/hooks/useRight.js +2 -2
- package/es/packages/fabric-chart/src/interface.d.ts +6 -3
- package/es/packages/fabric-chart/src/utils/index.d.ts +6815 -6815
- package/es/packages/form-render/index.d.ts +297 -0
- package/es/packages/form-render/src/FormRender.vue.d.ts +297 -0
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +34 -24
- package/es/packages/form-render/src/components/renderer/formItem.js +6 -4
- package/es/packages/form-render/src/hooks/useAnchor.js +3 -3
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -2
- package/es/packages/form-render/src/hooks/useFieldVisitor.js +3 -0
- package/es/packages/form-render/src/hooks/useFormItemDeps.js +2 -3
- package/es/packages/form-render/src/utils/index.d.ts +1 -0
- package/es/packages/form-render/src/utils/index.js +4 -1
- package/es/packages/form-render/style/index.css +25 -7
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.d.ts +4 -0
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +18 -0
- package/es/packages/index.css +193 -9
- package/es/packages/index.d.ts +2 -1
- package/es/packages/index.js +3 -0
- package/es/packages/steps-wheel/index.d.ts +548 -0
- package/es/packages/steps-wheel/index.js +11 -0
- package/es/packages/steps-wheel/src/StepsWheel.js +4 -0
- package/es/packages/steps-wheel/src/StepsWheel.vue.d.ts +547 -0
- package/es/packages/steps-wheel/src/StepsWheel.vue_vue_type_script_setup_true_lang.js +252 -0
- package/es/packages/steps-wheel/style/index.css +161 -0
- package/es/packages/time-line/index.d.ts +1 -0
- package/es/packages/time-line/src/TimeLine.vue.d.ts +1 -0
- package/es/packages/time-line/src/TimeLine.vue_vue_type_script_setup_true_lang.js +6 -1
- package/es/packages/time-line/style/index.css +7 -2
- package/package.json +1 -1
- package/es/packages/button-print/src/utils/print.es.min.d.ts +0 -2
- package/es/packages/button-print/src/utils/print.es.min.js +0 -2532
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, reactive, computed, onMounted, watch, openBlock, createElementBlock, Fragment, createVNode, unref, withCtx, renderSlot, withModifiers, createCommentVNode, createTextVNode, toDisplayString, mergeProps } from 'vue';
|
|
1
|
+
import { defineComponent, reactive, computed, onMounted, onUnmounted, watch, openBlock, createElementBlock, Fragment, createVNode, unref, withCtx, renderSlot, withModifiers, createCommentVNode, createTextVNode, toDisplayString, mergeProps } from 'vue';
|
|
2
2
|
import { useMessage, NDropdown, NButton, NIcon } from 'naive-ui';
|
|
3
3
|
import { ChevronDown } from '@vicons/ionicons5';
|
|
4
|
-
import
|
|
4
|
+
import Print from './utils/print.js';
|
|
5
5
|
import './components/IdentityVerification.js';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import script$1 from './components/IdentityVerification.vue_vue_type_script_setup_true_lang.js';
|
|
@@ -28,6 +28,10 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
default: "\u6253\u5370\u9884\u89C8",
|
|
29
29
|
type: String
|
|
30
30
|
},
|
|
31
|
+
pdfLoadText: {
|
|
32
|
+
default: "\u4E0B\u8F7Dpdf",
|
|
33
|
+
type: String
|
|
34
|
+
},
|
|
31
35
|
formatEditText: {
|
|
32
36
|
default: "\u683C\u5F0F\u7F16\u8F91",
|
|
33
37
|
type: String
|
|
@@ -63,7 +67,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
63
67
|
}) {
|
|
64
68
|
const props = __props;
|
|
65
69
|
const $message = useMessage();
|
|
66
|
-
let printInstance
|
|
70
|
+
let printInstance;
|
|
67
71
|
const state = reactive({
|
|
68
72
|
spinning: false,
|
|
69
73
|
visible: false,
|
|
@@ -84,6 +88,9 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
84
88
|
}, {
|
|
85
89
|
label: props.previewText,
|
|
86
90
|
key: "previewText"
|
|
91
|
+
}, {
|
|
92
|
+
label: props.pdfLoadText,
|
|
93
|
+
key: "downloadPdf"
|
|
87
94
|
}, {
|
|
88
95
|
label: props.formatEditText,
|
|
89
96
|
key: "formatEditText"
|
|
@@ -207,6 +214,28 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
207
214
|
state.visible = false;
|
|
208
215
|
});
|
|
209
216
|
};
|
|
217
|
+
const handleClickPdf = async () => {
|
|
218
|
+
props.prevFn().catch(() => {
|
|
219
|
+
prevFnError();
|
|
220
|
+
return Promise.reject();
|
|
221
|
+
}).then(() => {
|
|
222
|
+
const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
|
|
223
|
+
const queryParams = {
|
|
224
|
+
formatId: state.currentFormatId,
|
|
225
|
+
templateId: getTemplateIdByFormatId(state.currentFormatId),
|
|
226
|
+
print: {
|
|
227
|
+
print: "1",
|
|
228
|
+
type: "1"
|
|
229
|
+
},
|
|
230
|
+
params
|
|
231
|
+
};
|
|
232
|
+
printInstance.printDirect(queryParams, (res) => {
|
|
233
|
+
callLocalServicesSuccessCb(res, "preview");
|
|
234
|
+
}, callLocalServicesErrorCb);
|
|
235
|
+
}).finally(() => {
|
|
236
|
+
state.visible = false;
|
|
237
|
+
});
|
|
238
|
+
};
|
|
210
239
|
const handleClickEdit = () => {
|
|
211
240
|
props.prevFn().catch(() => {
|
|
212
241
|
prevFnError();
|
|
@@ -228,6 +257,9 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
228
257
|
case "formatEditText":
|
|
229
258
|
handleClickEdit();
|
|
230
259
|
break;
|
|
260
|
+
case "downloadPdf":
|
|
261
|
+
handleClickPdf();
|
|
262
|
+
break;
|
|
231
263
|
default:
|
|
232
264
|
state.currentFormatId = key;
|
|
233
265
|
state.visible = false;
|
|
@@ -241,7 +273,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
241
273
|
const instantiatePrintSDK = () => {
|
|
242
274
|
if (printInstance)
|
|
243
275
|
return false;
|
|
244
|
-
printInstance = new
|
|
276
|
+
printInstance = new Print();
|
|
245
277
|
};
|
|
246
278
|
const getDefaultFormatId = (list, key) => {
|
|
247
279
|
if (!(list == null ? void 0 : list.length))
|
|
@@ -395,6 +427,9 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
395
427
|
onMounted(() => {
|
|
396
428
|
state.isInited = false;
|
|
397
429
|
});
|
|
430
|
+
onUnmounted(() => {
|
|
431
|
+
printInstance == null ? void 0 : printInstance.destroy();
|
|
432
|
+
});
|
|
398
433
|
watch(() => props.params, (val) => {
|
|
399
434
|
if (!(val == null ? void 0 : val.length))
|
|
400
435
|
return false;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnyObject, Func } from '../../../../../es/src/types';
|
|
2
|
+
export default class Print {
|
|
3
|
+
private readonly webview;
|
|
4
|
+
private currentMessageHandler?;
|
|
5
|
+
constructor();
|
|
6
|
+
private readonly messageHandlerStack;
|
|
7
|
+
private messageHandler;
|
|
8
|
+
private postMessage;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
_testConnection(): Promise<unknown>;
|
|
11
|
+
_queryServicesPrint(params: AnyObject): Promise<any>;
|
|
12
|
+
_callPrintWithFile(queryParams: AnyObject): Promise<any>;
|
|
13
|
+
_handleResult(data: AnyObject, errorCallbackFn?: Func): false | AnyObject;
|
|
14
|
+
_handleResultTest(result: any, errorCallbackFn?: Func): boolean;
|
|
15
|
+
_handleEventQueryPrintData(templateId: string, formatId: string, params: AnyObject, errorCallbackFn?: Func): Promise<false | {
|
|
16
|
+
file: any;
|
|
17
|
+
printerName: any;
|
|
18
|
+
pageCount: any;
|
|
19
|
+
formatId: string;
|
|
20
|
+
}>;
|
|
21
|
+
_handleQueryPrintDataResult(printData: AnyObject, formatId: string, errorCallbackFn?: Func): false | {
|
|
22
|
+
file: any;
|
|
23
|
+
printerName: any;
|
|
24
|
+
pageCount: any;
|
|
25
|
+
formatId: string;
|
|
26
|
+
};
|
|
27
|
+
_handleEventDirect({ templateId, formatId, params, cmdid, print, printdlgshow, nobillnode }: AnyObject): Promise<any>;
|
|
28
|
+
_handleEventEditFormat({ templateId, formatId, params, token }: AnyObject): Promise<any>;
|
|
29
|
+
preview({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
|
|
30
|
+
printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func): Promise<false | undefined>;
|
|
31
|
+
print({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
|
|
32
|
+
queryPrintData({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | {
|
|
33
|
+
file: any;
|
|
34
|
+
printerName: any;
|
|
35
|
+
pageCount: any;
|
|
36
|
+
formatId: string;
|
|
37
|
+
}>;
|
|
38
|
+
printFileData({ formatId, file, printerName }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | AnyObject>;
|
|
39
|
+
editPrintFormat({ templateId, formatId, params, token }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
|
|
40
|
+
addPrintFormat({ templateId, params, token }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
const PRINT_ORIGIN = "http://127.0.0.1:11111";
|
|
4
|
+
const EDIT_LOCAL_URL = `${PRINT_ORIGIN}/services/print`;
|
|
5
|
+
const PRINT_URL = `${PRINT_ORIGIN}/PrintLocal`;
|
|
6
|
+
const PRINT_CMD_ID = "7";
|
|
7
|
+
const PREVIEW_CMD_ID = "8";
|
|
8
|
+
const PRINTER_NAME_DEFAULT = "Default";
|
|
9
|
+
const testHttpFn = axios.create({
|
|
10
|
+
timeout: 1e3,
|
|
11
|
+
withCredentials: false
|
|
12
|
+
});
|
|
13
|
+
const httpFn = axios.create({ withCredentials: false });
|
|
14
|
+
class Print {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.messageHandlerStack = [];
|
|
17
|
+
var _a;
|
|
18
|
+
const _window = window;
|
|
19
|
+
this.webview = (_a = _window.chrome) == null ? void 0 : _a.webview;
|
|
20
|
+
if (!this.webview)
|
|
21
|
+
return;
|
|
22
|
+
this.currentMessageHandler = this.messageHandler.bind(this);
|
|
23
|
+
this.webview.addEventListener("message", this.currentMessageHandler);
|
|
24
|
+
}
|
|
25
|
+
messageHandler(e) {
|
|
26
|
+
const handler = this.messageHandlerStack.pop();
|
|
27
|
+
if (!handler)
|
|
28
|
+
return console.log("\u5F53\u524D\u56DE\u6267", e, "\u6CA1\u6709\u53EF\u7528\u7684handler");
|
|
29
|
+
const { resolve, reject } = handler;
|
|
30
|
+
try {
|
|
31
|
+
console.log(e);
|
|
32
|
+
resolve(JSON.parse(e.data));
|
|
33
|
+
} catch (e2) {
|
|
34
|
+
reject(e2);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async postMessage(data) {
|
|
38
|
+
if (!this.webview)
|
|
39
|
+
return Promise.reject();
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
this.messageHandlerStack.push({ resolve, reject });
|
|
42
|
+
this.webview.postMessage(data);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
destroy() {
|
|
46
|
+
if (this.webview && this.currentMessageHandler) {
|
|
47
|
+
this.webview.removeEventListener("message", this.currentMessageHandler);
|
|
48
|
+
this.currentMessageHandler = void 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
_testConnection() {
|
|
52
|
+
if (this.webview)
|
|
53
|
+
return Promise.resolve(true);
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
testHttpFn({
|
|
56
|
+
url: `${PRINT_ORIGIN}/test`,
|
|
57
|
+
method: "get",
|
|
58
|
+
withCredentials: false,
|
|
59
|
+
params: {
|
|
60
|
+
inputdata: {
|
|
61
|
+
result: "success"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}).then(({ data }) => {
|
|
65
|
+
if (data.result !== "success") {
|
|
66
|
+
resolve(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
resolve(true);
|
|
70
|
+
}).catch((err) => {
|
|
71
|
+
resolve(false);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
_queryServicesPrint(params) {
|
|
76
|
+
if (this.webview) {
|
|
77
|
+
return this.postMessage({ exec: "print", data: { inputData: params } });
|
|
78
|
+
}
|
|
79
|
+
return httpFn({
|
|
80
|
+
url: EDIT_LOCAL_URL,
|
|
81
|
+
method: "get",
|
|
82
|
+
params: {
|
|
83
|
+
inputData: JSON.stringify(params)
|
|
84
|
+
}
|
|
85
|
+
}).then(({ data }) => {
|
|
86
|
+
return data;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
_callPrintWithFile(queryParams) {
|
|
90
|
+
const defaultQueryParams = {
|
|
91
|
+
cmdid: PRINT_CMD_ID,
|
|
92
|
+
flag: "1"
|
|
93
|
+
};
|
|
94
|
+
const params = {
|
|
95
|
+
inputData: JSON.stringify(Object.assign({}, defaultQueryParams, queryParams))
|
|
96
|
+
};
|
|
97
|
+
if (this.webview) {
|
|
98
|
+
return this.postMessage({ exec: "print", data: transformData(params) });
|
|
99
|
+
}
|
|
100
|
+
return httpFn({
|
|
101
|
+
url: PRINT_URL,
|
|
102
|
+
method: "post",
|
|
103
|
+
data: params,
|
|
104
|
+
transformRequest: [transformData]
|
|
105
|
+
}).then(({ data }) => {
|
|
106
|
+
return data;
|
|
107
|
+
});
|
|
108
|
+
function transformData(oldData) {
|
|
109
|
+
let newStr = "";
|
|
110
|
+
for (const item in oldData) {
|
|
111
|
+
newStr += encodeURIComponent(item) + "=" + encodeURIComponent(oldData[item]) + "&";
|
|
112
|
+
}
|
|
113
|
+
newStr = newStr.slice(0, -1);
|
|
114
|
+
return newStr;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
_handleResult(data, errorCallbackFn) {
|
|
118
|
+
if (data.result !== "success") {
|
|
119
|
+
const message = data.message || data.Message;
|
|
120
|
+
const errorMsgObj = {
|
|
121
|
+
type: "printError",
|
|
122
|
+
message,
|
|
123
|
+
result: data.result,
|
|
124
|
+
errinfo: data.errinfo
|
|
125
|
+
};
|
|
126
|
+
errorCallbackFn == null ? void 0 : errorCallbackFn(errorMsgObj);
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return data;
|
|
130
|
+
}
|
|
131
|
+
_handleResultTest(result, errorCallbackFn) {
|
|
132
|
+
if (!result) {
|
|
133
|
+
console.log("notInstalledApp");
|
|
134
|
+
errorCallbackFn == null ? void 0 : errorCallbackFn({
|
|
135
|
+
type: "notInstalledApp",
|
|
136
|
+
message: "\u8BF7\u6253\u5F00\u6253\u5370\u670D\u52A1\u5668\u63D2\u4EF6"
|
|
137
|
+
});
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
async _handleEventQueryPrintData(templateId, formatId, params, errorCallbackFn) {
|
|
143
|
+
const queryParams = {
|
|
144
|
+
templateId,
|
|
145
|
+
formatId,
|
|
146
|
+
params,
|
|
147
|
+
cmdid: PRINT_CMD_ID
|
|
148
|
+
};
|
|
149
|
+
const printData = await this._queryServicesPrint(queryParams);
|
|
150
|
+
return this._handleQueryPrintDataResult(printData, formatId, errorCallbackFn);
|
|
151
|
+
}
|
|
152
|
+
_handleQueryPrintDataResult(printData, formatId, errorCallbackFn) {
|
|
153
|
+
if (!(printData == null ? void 0 : printData.file)) {
|
|
154
|
+
try {
|
|
155
|
+
const message = printData.message || printData.Message;
|
|
156
|
+
console.log(message);
|
|
157
|
+
errorCallbackFn == null ? void 0 : errorCallbackFn({
|
|
158
|
+
type: "queryPrintDataFailure",
|
|
159
|
+
message
|
|
160
|
+
});
|
|
161
|
+
} catch (err) {
|
|
162
|
+
console.log(err);
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
file: printData.file,
|
|
168
|
+
printerName: printData.defprinter,
|
|
169
|
+
pageCount: printData.pagecount,
|
|
170
|
+
formatId
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
async _handleEventDirect({
|
|
174
|
+
templateId,
|
|
175
|
+
formatId,
|
|
176
|
+
params,
|
|
177
|
+
cmdid,
|
|
178
|
+
print,
|
|
179
|
+
printdlgshow = "1",
|
|
180
|
+
nobillnode = "1"
|
|
181
|
+
}) {
|
|
182
|
+
const queryParams = {
|
|
183
|
+
templateId,
|
|
184
|
+
formatId,
|
|
185
|
+
params,
|
|
186
|
+
cmdid,
|
|
187
|
+
nobillnode,
|
|
188
|
+
printdlgshow
|
|
189
|
+
};
|
|
190
|
+
if (print) {
|
|
191
|
+
try {
|
|
192
|
+
print = JSON.parse(print);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
}
|
|
195
|
+
queryParams.print = print;
|
|
196
|
+
}
|
|
197
|
+
return await this._queryServicesPrint(queryParams);
|
|
198
|
+
}
|
|
199
|
+
async _handleEventEditFormat({ templateId, formatId = "", params = "", token }) {
|
|
200
|
+
const DEFAULT_PARAMS = {};
|
|
201
|
+
let formatParams = {};
|
|
202
|
+
try {
|
|
203
|
+
formatParams = Object.assign({}, DEFAULT_PARAMS, JSON.parse(params));
|
|
204
|
+
} catch (error) {
|
|
205
|
+
formatParams = DEFAULT_PARAMS;
|
|
206
|
+
}
|
|
207
|
+
const queryParams = {
|
|
208
|
+
templateId,
|
|
209
|
+
formatId,
|
|
210
|
+
cmdid: "9",
|
|
211
|
+
token,
|
|
212
|
+
params: JSON.stringify(formatParams)
|
|
213
|
+
};
|
|
214
|
+
return await this._queryServicesPrint(queryParams);
|
|
215
|
+
}
|
|
216
|
+
async preview({ templateId, formatId, params = "" }, successCallbackFn, errorCallbackFn) {
|
|
217
|
+
const testResult = await this._testConnection();
|
|
218
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
219
|
+
return false;
|
|
220
|
+
const result = await this._handleEventDirect({
|
|
221
|
+
templateId,
|
|
222
|
+
formatId,
|
|
223
|
+
params,
|
|
224
|
+
cmdid: PREVIEW_CMD_ID
|
|
225
|
+
});
|
|
226
|
+
if (!result)
|
|
227
|
+
return false;
|
|
228
|
+
const handledResult = this._handleResult(result, errorCallbackFn);
|
|
229
|
+
if (!handledResult)
|
|
230
|
+
return false;
|
|
231
|
+
successCallbackFn && successCallbackFn(handledResult);
|
|
232
|
+
}
|
|
233
|
+
async printDirect({ templateId, formatId, params = "", print, printdlgshow, nobillnode }, successCallbackFn, errorCallbackFn) {
|
|
234
|
+
const testResult = await this._testConnection();
|
|
235
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
236
|
+
return false;
|
|
237
|
+
const result = await this._handleEventDirect({
|
|
238
|
+
templateId,
|
|
239
|
+
formatId,
|
|
240
|
+
params,
|
|
241
|
+
cmdid: PRINT_CMD_ID,
|
|
242
|
+
print,
|
|
243
|
+
printdlgshow,
|
|
244
|
+
nobillnode
|
|
245
|
+
});
|
|
246
|
+
if (!result)
|
|
247
|
+
return false;
|
|
248
|
+
const handledResult = this._handleResult(result, errorCallbackFn);
|
|
249
|
+
if (!handledResult)
|
|
250
|
+
return false;
|
|
251
|
+
successCallbackFn && successCallbackFn(handledResult);
|
|
252
|
+
}
|
|
253
|
+
async print({ templateId, formatId, params = "" }, successCallbackFn, errorCallbackFn) {
|
|
254
|
+
const testResult = await this._testConnection();
|
|
255
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
256
|
+
return false;
|
|
257
|
+
const printData = await this.queryPrintData({ templateId, formatId, params }, void 0, errorCallbackFn);
|
|
258
|
+
if (!printData)
|
|
259
|
+
return false;
|
|
260
|
+
const handledResult = this.printFileData({
|
|
261
|
+
formatId,
|
|
262
|
+
file: printData.file,
|
|
263
|
+
printerName: printData.printerName
|
|
264
|
+
}, void 0, errorCallbackFn);
|
|
265
|
+
if (!handledResult)
|
|
266
|
+
return false;
|
|
267
|
+
successCallbackFn && successCallbackFn(handledResult);
|
|
268
|
+
}
|
|
269
|
+
async queryPrintData({ templateId, formatId, params = "" }, successCallbackFn, errorCallbackFn) {
|
|
270
|
+
const testResult = await this._testConnection();
|
|
271
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
272
|
+
return false;
|
|
273
|
+
const result = await this._handleEventQueryPrintData(templateId, formatId, params, errorCallbackFn);
|
|
274
|
+
if (!result)
|
|
275
|
+
return false;
|
|
276
|
+
successCallbackFn && successCallbackFn(result);
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
279
|
+
async printFileData({ formatId, file, printerName = PRINTER_NAME_DEFAULT }, successCallbackFn, errorCallbackFn) {
|
|
280
|
+
const testResult = await this._testConnection();
|
|
281
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
282
|
+
return false;
|
|
283
|
+
const result = await this._callPrintWithFile({
|
|
284
|
+
formatId,
|
|
285
|
+
printname: printerName,
|
|
286
|
+
file
|
|
287
|
+
});
|
|
288
|
+
const handledResult = this._handleResult(result, errorCallbackFn);
|
|
289
|
+
if (!handledResult)
|
|
290
|
+
return false;
|
|
291
|
+
successCallbackFn && successCallbackFn(handledResult);
|
|
292
|
+
return handledResult;
|
|
293
|
+
}
|
|
294
|
+
async editPrintFormat({ templateId, formatId, params, token }, successCallbackFn, errorCallbackFn) {
|
|
295
|
+
const testResult = await this._testConnection();
|
|
296
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
297
|
+
return false;
|
|
298
|
+
const result = await this._handleEventEditFormat({
|
|
299
|
+
templateId,
|
|
300
|
+
formatId,
|
|
301
|
+
params,
|
|
302
|
+
token
|
|
303
|
+
});
|
|
304
|
+
const handledResult = this._handleResult(result, errorCallbackFn);
|
|
305
|
+
if (!handledResult)
|
|
306
|
+
return false;
|
|
307
|
+
successCallbackFn && successCallbackFn(handledResult);
|
|
308
|
+
}
|
|
309
|
+
async addPrintFormat({ templateId, params, token }, successCallbackFn, errorCallbackFn) {
|
|
310
|
+
const testResult = await this._testConnection();
|
|
311
|
+
if (!this._handleResultTest(testResult, errorCallbackFn))
|
|
312
|
+
return false;
|
|
313
|
+
const result = await this._handleEventEditFormat({
|
|
314
|
+
templateId,
|
|
315
|
+
params,
|
|
316
|
+
token
|
|
317
|
+
});
|
|
318
|
+
const handledResult = this._handleResult(result, errorCallbackFn);
|
|
319
|
+
if (!handledResult)
|
|
320
|
+
return false;
|
|
321
|
+
successCallbackFn && successCallbackFn(handledResult);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export { Print as default };
|
|
@@ -30,9 +30,8 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
30
30
|
originY: import("vue").ComputedRef<number>;
|
|
31
31
|
xCellWidth: import("vue").ComputedRef<number>;
|
|
32
32
|
yCellHeight: import("vue").ComputedRef<number>;
|
|
33
|
-
xScaleList: import("vue").ComputedRef<number[]>;
|
|
34
33
|
iconsWidth: import("vue").ComputedRef<any>;
|
|
35
|
-
|
|
34
|
+
xScaleList: import("vue").ComputedRef<any[]>;
|
|
36
35
|
breatheYCell: import("vue").ComputedRef<number>;
|
|
37
36
|
pulseYCell: import("vue").ComputedRef<number>;
|
|
38
37
|
temperatureYCell: import("vue").ComputedRef<number>;
|
|
@@ -50,9 +49,9 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
50
49
|
endY: number;
|
|
51
50
|
}>;
|
|
52
51
|
propItems: any;
|
|
53
|
-
cumputedX: (value: string | number) =>
|
|
52
|
+
cumputedX: (value: string | number) => any;
|
|
54
53
|
cumputedY: (type: import("./src/interface").IPointType, scaleValueList: number[], value: string | number) => number;
|
|
55
|
-
getXValue: (pointX: number) => string;
|
|
54
|
+
getXValue: (pointX: number) => string | undefined;
|
|
56
55
|
getYValue: (type: import("./src/interface").IPointType, pointY: number) => number;
|
|
57
56
|
pointTipProps: {
|
|
58
57
|
show: boolean;
|
|
@@ -30,9 +30,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
30
30
|
originY: import("vue").ComputedRef<number>;
|
|
31
31
|
xCellWidth: import("vue").ComputedRef<number>;
|
|
32
32
|
yCellHeight: import("vue").ComputedRef<number>;
|
|
33
|
-
xScaleList: import("vue").ComputedRef<number[]>;
|
|
34
33
|
iconsWidth: import("vue").ComputedRef<any>;
|
|
35
|
-
|
|
34
|
+
xScaleList: import("vue").ComputedRef<any[]>;
|
|
36
35
|
breatheYCell: import("vue").ComputedRef<number>;
|
|
37
36
|
pulseYCell: import("vue").ComputedRef<number>;
|
|
38
37
|
temperatureYCell: import("vue").ComputedRef<number>;
|
|
@@ -50,9 +49,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
50
49
|
endY: number;
|
|
51
50
|
}>;
|
|
52
51
|
propItems: any;
|
|
53
|
-
cumputedX: (value: string | number) =>
|
|
52
|
+
cumputedX: (value: string | number) => any;
|
|
54
53
|
cumputedY: (type: import("./interface").IPointType, scaleValueList: number[], value: string | number) => number;
|
|
55
|
-
getXValue: (pointX: number) => string;
|
|
54
|
+
getXValue: (pointX: number) => string | undefined;
|
|
56
55
|
getYValue: (type: import("./interface").IPointType, pointY: number) => number;
|
|
57
56
|
pointTipProps: {
|
|
58
57
|
show: boolean;
|
|
@@ -91,25 +91,35 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
91
91
|
const yCellHeight = computed(() => {
|
|
92
92
|
return (endY.value - originY.value) / gridYNumber.value;
|
|
93
93
|
});
|
|
94
|
+
const iconsWidth = computed(() => {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
const { left } = props.data;
|
|
97
|
+
return ((_a = left.icons) == null ? void 0 : _a.show) && (((_b = left.icons) == null ? void 0 : _b.width) || 100) || 0;
|
|
98
|
+
});
|
|
94
99
|
const xScaleList = computed(() => {
|
|
95
100
|
const { top } = props.data;
|
|
96
101
|
const dateList = top.date.list;
|
|
97
|
-
const
|
|
102
|
+
const times = top.xScalevalue.times;
|
|
103
|
+
let left = originX.value - xCellWidth.value;
|
|
104
|
+
function getDate(date) {
|
|
105
|
+
return String(date).length < 9 ? `20${date}` : date;
|
|
106
|
+
}
|
|
98
107
|
const timeList = dateList.map((item) => {
|
|
99
|
-
return
|
|
100
|
-
|
|
108
|
+
return times.map((v) => {
|
|
109
|
+
left += xCellWidth.value;
|
|
110
|
+
const start = new Date(`${getDate(item)} ${v.start}`).getTime();
|
|
111
|
+
const end = new Date(`${getDate(item)} ${v.end}`).getTime();
|
|
112
|
+
return {
|
|
113
|
+
start,
|
|
114
|
+
end,
|
|
115
|
+
left,
|
|
116
|
+
center: left + xCellWidth.value / 2,
|
|
117
|
+
scaleCell: (end - start) / xCellWidth.value
|
|
118
|
+
};
|
|
101
119
|
});
|
|
102
120
|
});
|
|
103
121
|
return timeList.flat();
|
|
104
122
|
});
|
|
105
|
-
const iconsWidth = computed(() => {
|
|
106
|
-
var _a, _b;
|
|
107
|
-
const { left } = props.data;
|
|
108
|
-
return ((_a = left.icons) == null ? void 0 : _a.show) && (((_b = left.icons) == null ? void 0 : _b.width) || 100) || 0;
|
|
109
|
-
});
|
|
110
|
-
const xScaleCell = computed(() => {
|
|
111
|
-
return xScaleList.value[1] - xScaleList.value[0];
|
|
112
|
-
});
|
|
113
123
|
const breatheYCell = computed(() => {
|
|
114
124
|
var _a;
|
|
115
125
|
const { yScaleValue, spaceGridNumber = 5 } = props.data.left;
|
|
@@ -219,7 +229,6 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
219
229
|
xCellWidth: xCellWidth.value,
|
|
220
230
|
yCellHeight: yCellHeight.value,
|
|
221
231
|
xScaleList: xScaleList.value,
|
|
222
|
-
xScaleCell: xScaleCell.value,
|
|
223
232
|
breatheYCell: breatheYCell.value,
|
|
224
233
|
pulseYCell: pulseYCell.value,
|
|
225
234
|
temperatureYCell: temperatureYCell.value,
|
|
@@ -5,7 +5,6 @@ import { defaultBorderStyle, drawTextGroup, defaultTextStyle, defaultRectStyle,
|
|
|
5
5
|
function useBottom(canvas, propItems) {
|
|
6
6
|
const {
|
|
7
7
|
xScaleList,
|
|
8
|
-
xScaleCell,
|
|
9
8
|
originX,
|
|
10
9
|
endX,
|
|
11
10
|
endY,
|
|
@@ -19,7 +18,7 @@ function useBottom(canvas, propItems) {
|
|
|
19
18
|
function drawBottom() {
|
|
20
19
|
var _a, _b, _c;
|
|
21
20
|
if (!breathingHeight || !bottom) {
|
|
22
|
-
const bottomBorder = new fabric.Line([iconsWidth, endY - 1,
|
|
21
|
+
const bottomBorder = new fabric.Line([iconsWidth, endY - 1, endX, endY - 1], {
|
|
23
22
|
...defaultBorderStyle
|
|
24
23
|
});
|
|
25
24
|
canvas.value.add(bottomBorder);
|
|
@@ -35,7 +34,7 @@ function useBottom(canvas, propItems) {
|
|
|
35
34
|
let text = "";
|
|
36
35
|
bottomBreathingList.forEach((v, i) => {
|
|
37
36
|
const time = new Date(v.time).getTime();
|
|
38
|
-
if (time >= item && time < +item +
|
|
37
|
+
if (time >= item && time < +item + item.scaleCell)
|
|
39
38
|
text = v.value;
|
|
40
39
|
});
|
|
41
40
|
const style = flag ? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { reactive, onMounted, nextTick } from 'vue';
|
|
2
2
|
import { fabric } from '../utils/index.js';
|
|
3
|
-
import { defaultStyle, drawPoint,
|
|
3
|
+
import { drawLine, defaultStyle, drawPoint, defaultTextStyle } from './useDraw.js';
|
|
4
4
|
import useGrid from './useGrid.js';
|
|
5
5
|
import { useShadow } from './useShadow.js';
|
|
6
6
|
import { TEMPERATURE_MENU, PAIN_MENU } from './constant.js';
|
|
@@ -48,6 +48,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
48
48
|
maiboPoints.clear();
|
|
49
49
|
otherPoints.clear();
|
|
50
50
|
left.yScaleValue.forEach((scaleValue) => {
|
|
51
|
+
drawPositionLine(scaleValue);
|
|
51
52
|
scaleValue.dataList.forEach((item, dataIndex) => {
|
|
52
53
|
drawPolyLine(item, dataIndex, scaleValue);
|
|
53
54
|
});
|
|
@@ -55,6 +56,14 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
55
56
|
drawOverlapPoint();
|
|
56
57
|
setCanvasEvent();
|
|
57
58
|
}
|
|
59
|
+
function drawPositionLine(scaleValue) {
|
|
60
|
+
if (scaleValue.type !== "temperature" || !scaleValue.positionLine)
|
|
61
|
+
return;
|
|
62
|
+
const y = cumputedY(scaleValue.type, scaleValue.list, scaleValue.positionLine.value);
|
|
63
|
+
const line = drawLine([originX, y, endX, y], scaleValue.positionLine);
|
|
64
|
+
canvas.value.add(line);
|
|
65
|
+
canvas.value.renderAll();
|
|
66
|
+
}
|
|
58
67
|
function drawShaDow(target) {
|
|
59
68
|
var _a, _b;
|
|
60
69
|
const pulseObj = left.yScaleValue.find((item) => item.type === "pulse");
|
|
@@ -127,15 +136,27 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
127
136
|
}, []);
|
|
128
137
|
const { createShadowLines } = useShadow();
|
|
129
138
|
newData.forEach((item) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
var _a2, _b2, _c, _d;
|
|
140
|
+
if (((_a2 = pulseObj.shadow) == null ? void 0 : _a2.mode) == "color") {
|
|
141
|
+
const points = item.map((v) => ({ x: v[0], y: v[1] }));
|
|
142
|
+
const polygon = new fabric.Polygon(points, {
|
|
133
143
|
...defaultStyle,
|
|
134
|
-
...pulseObj.
|
|
144
|
+
...((_b2 = pulseObj.shadow) == null ? void 0 : _b2.style) || {}
|
|
135
145
|
});
|
|
136
|
-
shadowLinesCache.add(
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
shadowLinesCache.add(polygon);
|
|
147
|
+
canvas.value.add(polygon);
|
|
148
|
+
} else {
|
|
149
|
+
const shadowLines = createShadowLines(item, (_c = pulseObj.shadow) == null ? void 0 : _c.style._angle, (_d = pulseObj.shadow) == null ? void 0 : _d.style.space);
|
|
150
|
+
shadowLines.forEach((l) => {
|
|
151
|
+
var _a3;
|
|
152
|
+
Object.assign(l, {
|
|
153
|
+
...defaultStyle,
|
|
154
|
+
...((_a3 = pulseObj.shadow) == null ? void 0 : _a3.style) || {}
|
|
155
|
+
});
|
|
156
|
+
shadowLinesCache.add(l);
|
|
157
|
+
});
|
|
158
|
+
canvas.value.add(...shadowLines);
|
|
159
|
+
}
|
|
139
160
|
canvas.value.renderAll();
|
|
140
161
|
});
|
|
141
162
|
}
|
|
@@ -150,7 +171,6 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
150
171
|
pointMenuProps.point = { x, y };
|
|
151
172
|
pointMenuProps.show = true;
|
|
152
173
|
const { type } = ((_a = event.target) == null ? void 0 : _a.origin) || {};
|
|
153
|
-
console.log(999, type);
|
|
154
174
|
if (event.target && (type === "temperature" || type === "pain")) {
|
|
155
175
|
if (type === "temperature") {
|
|
156
176
|
pointMenuProps.list = [...TEMPERATURE_MENU];
|
|
@@ -489,8 +509,10 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
489
509
|
return text;
|
|
490
510
|
}
|
|
491
511
|
function isLimit(time) {
|
|
492
|
-
const
|
|
493
|
-
const
|
|
512
|
+
const [minScale] = xScaleList;
|
|
513
|
+
const maxScale = xScaleList.at(-1);
|
|
514
|
+
const minMinute = minScale.start;
|
|
515
|
+
const maxMinute = maxScale.end;
|
|
494
516
|
const getTime = new Date(time).getTime();
|
|
495
517
|
return getTime >= minMinute && getTime <= maxMinute;
|
|
496
518
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IPropItems, IPointType } from '../interface';
|
|
2
2
|
export declare function useCumputedPoint(propItems: IPropItems): {
|
|
3
|
-
cumputedX: (value: number | string) =>
|
|
3
|
+
cumputedX: (value: number | string) => any;
|
|
4
4
|
cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
|
|
5
|
-
getXValue: (pointX: number) => string;
|
|
5
|
+
getXValue: (pointX: number) => string | undefined;
|
|
6
6
|
getYValue: (type: IPointType, pointY: number) => number;
|
|
7
7
|
};
|