polyfill-commons 1.1.0 → 1.1.1

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/src/index.js DELETED
@@ -1,1747 +0,0 @@
1
- // force依赖
2
- const optionsDefault = {
3
- baseUrl: "", // 静态资源基础路径,主要用于内部加载iframe.css有关
4
- mode: "designMode", //默认为设计模式设计模式(designMode)、编辑模式(editMode)、预览模式(previewMode)
5
- loading: false, // 处于loading
6
- autoPaging: true, // 是否开启分页
7
- height: "", // 编辑器高度
8
- el: null, //querySelector满足的值,比如#id、.className、Element。可以是Element,也可以是#id等, 必传
9
- footer: "技术支持", //element或者string 表示底部显示内容
10
- iframeCssSrc: [], //string/Array数组 扩展css
11
- iframeJsSrc: [], //string/Array数组 扩展js
12
- beforeunload: true, // 刷新之前是否询问
13
- paper: "A4", // A5 A6 A4
14
- papersizes: {
15
- // 尺寸配置,注意以下尺寸单位都是以【毫米】为单位 mm
16
- A4: {
17
- w: 210, // 整个宽
18
- h: 297, // 整个高
19
- pt: 20, // 页边距 上
20
- pb: 15, // 页边距 下
21
- pl: 15, // 页边距 左
22
- pr: 15, // 页边距 右
23
- // hh: 0, // 页眉
24
- // fh: 14, // 页脚
25
- },
26
- A5: {
27
- w: 148,
28
- h: 210,
29
- pt: 20, // 页边距 上
30
- pb: 15, // 页边距 下
31
- pl: 15, // 页边距 左
32
- pr: 15, // 页边距 右
33
- // hh: 6.6, // 页眉
34
- // fh: 14, // 页脚
35
- },
36
- A6: {
37
- w: 105,
38
- h: 148,
39
- pt: 20, // 页边距 上
40
- pb: 15, // 页边距 下
41
- pl: 15, // 页边距 左
42
- pr: 15, // 页边距 右
43
- // hh: 6.6, // 页眉
44
- // fh: 14, // 页脚
45
- },
46
- },
47
- // 工具栏,导航
48
- toolbars: {
49
- // 菜单栏
50
- nav: [
51
- {
52
- name: "file",
53
- title: "文件",
54
- items: [
55
- { name: "打开", title: "打开", disabled: true },
56
- { name: "保存", title: "保存", disabled: true },
57
- {
58
- name: "打印",
59
- title: "打印",
60
- items: [
61
- { name: "预览", title: "预览", disabled: true },
62
- { name: "print", title: "打印" },
63
- { name: "续打", title: "续打", disabled: true },
64
- { name: "套打", title: "套打", disabled: true },
65
- ],
66
- },
67
- {
68
- name: "页面设置",
69
- title: "页面设置",
70
- items: [
71
- { name: "A4", title: "A4" },
72
- { name: "A5", title: "A5" },
73
- { name: "A6", title: "A6" },
74
- ],
75
- },
76
- {
77
- name: "mode",
78
- title: "浏览模式选择",
79
- items: [
80
- { name: "editMode", title: "编辑模式" },
81
- { name: "designMode", title: "设计模式" },
82
- { name: "previewMode", title: "预览模式" },
83
- ],
84
- },
85
- ],
86
- },
87
-
88
- {
89
- name: "edit",
90
- title: "编辑",
91
- items: [
92
- {
93
- name: "undo",
94
- title: "撤销",
95
- },
96
- {
97
- name: "redo",
98
- title: "恢复",
99
- },
100
- {
101
- name: "paste",
102
- title: "粘贴",
103
- },
104
- { name: "选择性粘贴", title: "选择性粘贴", disabled: true },
105
- {
106
- name: "copy",
107
- title: "复制",
108
- },
109
- {
110
- name: "cut",
111
- title: "剪切",
112
- },
113
- // {
114
- // name: "fontName",
115
- // title: "字体",
116
- // },
117
- // {
118
- // name: "fontSize",
119
- // title: "字号",
120
- // },
121
- // {
122
- // name: "foreColor",
123
- // title: "文字颜色",
124
- // },
125
- // {
126
- // name: "hiliteColor",
127
- // title: "背景颜色",
128
- // },
129
- {
130
- name: "removeFormat",
131
- title: "清除格式",
132
- },
133
- {
134
- name: "subscript",
135
- title: "下标",
136
- },
137
- {
138
- name: "superscript",
139
- title: "上标",
140
- },
141
- {
142
- name: "bold",
143
- title: "加粗 ctrl+b",
144
- },
145
- {
146
- name: "italic",
147
- title: "倾斜 ctrl+i",
148
- },
149
- {
150
- name: "underline",
151
- title: "下划线",
152
- },
153
- {
154
- name: "strikeThrough",
155
- title: "删除线",
156
- },
157
- {
158
- name: "insertHorizontalRule",
159
- title: "分割线",
160
- },
161
- {
162
- name: "selectAll",
163
- title: "选择全部 ctrl+a",
164
- },
165
- // { name: "find", title: "查找" },
166
- // {
167
- // name: "spechars",
168
- // title: "特殊字符",
169
- // },
170
- {
171
- name: "justifyLeft",
172
- title: "向左对齐",
173
- },
174
- {
175
- name: "justifyCenter",
176
- title: "居中对齐",
177
- },
178
- {
179
- name: "justifyRight",
180
- title: "向右对齐",
181
- },
182
- {
183
- name: "justifyFull",
184
- title: "两端对齐",
185
- },
186
- {
187
- name: "insertUnorderedList",
188
- title: "无序编号",
189
- },
190
- {
191
- name: "insertOrderedList",
192
- title: "有序编号",
193
- },
194
- // { name: "delete", title: "删除" }
195
- ],
196
- },
197
- {
198
- name: "element",
199
- title: "元素",
200
- items: [
201
- {
202
- name: "radio",
203
- title: "单选框",
204
- },
205
- {
206
- name: "checkbox",
207
- title: "多选框",
208
- },
209
- {
210
- name: "date",
211
- title: "日期",
212
- },
213
- {
214
- name: "input",
215
- title: "输入框",
216
- },
217
- {
218
- name: "select",
219
- title: "下拉框",
220
- },
221
- {
222
- name: "label",
223
- title: "标签",
224
- },
225
- {
226
- name: "number",
227
- title: "数字",
228
- },
229
- // {
230
- // name: "splitline",
231
- // title: "分割线",
232
- // },
233
- // {
234
- // name: "pagebreak",
235
- // title: "分页",
236
- // },
237
- {
238
- name: "diagnose",
239
- title: "诊断",
240
- },
241
- {
242
- name: "surgery",
243
- title: "手术",
244
- },
245
- {
246
- name: "sign",
247
- title: "签名",
248
- },
249
- {
250
- name: "bloodPressure",
251
- title: "血压",
252
- },
253
-
254
- {
255
- name: "insertPicture",
256
- title: "图片",
257
- },
258
-
259
- {
260
- name: "pagination",
261
- title: "页码",
262
- },
263
-
264
- {
265
- name: "medicalExpression",
266
- title: "医学表达式",
267
- // items: [
268
- // { name: '牙齿标注', title: '牙齿标注', disabled: true },
269
- // { name: '月经史', title: '月经史', disabled: true },
270
- // { name: '胎心位置', title: '胎心位置', disabled: true },
271
- // { name: '乳牙标注', title: '乳牙标注', disabled: true },
272
- // { name: '突眼', title: '突眼', disabled: true },
273
- // { name: '光定位', title: '光定位', disabled: true },
274
- // { name: '房角', title: '房角', disabled: true },
275
- // { name: '肺结核', title: '肺结核', disabled: true }
276
- // ]
277
- },
278
- ],
279
- },
280
-
281
- // {
282
- // name: "table",
283
- // title: "表格",
284
- // items: [
285
- // { name: "inserttable", title: "插入表格" },
286
- // { name: "deletetable", title: "删除表格" },
287
- // {
288
- // name: "alignway",
289
- // title: "对齐方式",
290
- // items: [
291
- // { name: "tablealigntopleft", title: "顶端左对齐" },
292
- // { name: "tablealigntopcenter", title: "顶端居中对齐" },
293
- // { name: "tablealigntopright", title: "顶端右对齐" },
294
- // { name: "tablealignmiddleleft", title: "垂直左对齐" },
295
- // { name: "tablealignmiddlecenter", title: "垂直居中对齐" },
296
- // { name: "tablealignmiddleright", title: "垂直右对齐" },
297
- // { name: "tablealignbottomleft", title: "底端左对齐" },
298
- // { name: "tablealignbottomcenter", title: "底端居中对齐" },
299
- // { name: "tablealignbottomright", title: "底端右对齐" },
300
- // ],
301
- // },
302
- // { name: "inserttablerowtop", title: "上面插入表格行" },
303
- // { name: "inserttablerowbottom", title: "下面插入表格行" },
304
- // { name: "deletetablerow", title: "删除表格行" },
305
- // { name: "inserttablecolleft", title: "左边插入表格列" },
306
- // { name: "inserttablecolright", title: "右边插入表格列" },
307
- // { name: "deletetablecol", title: "删除表格列" },
308
- // { name: "mergetablecell", title: "合并单元格" },
309
- // { name: "splittablecell", title: "拆分单元格" },
310
- // {
311
- // name: "cellborder",
312
- // title: "单元格网格线",
313
- // items: [
314
- // { name: "tableborderlinesolid", title: "实线" },
315
- // { name: "tableborderlinedashed", title: "虚线" },
316
- // { name: "tableborderlinenone", title: "无" },
317
- // ],
318
- // },
319
- // { name: "tablelineheight", title: "设置行高" },
320
- // ],
321
- // },
322
- {
323
- name: "test",
324
- title: "测试功能",
325
- items: [
326
- { name: "testCopyContentHtml", title: "【复制】内容html" },
327
- { name: "testSetContentEmpty", title: "【设置】内容为空" },
328
- { name: "testCopyFullContentHtml", title: "【复制】整个html" },
329
- { name: "testExportFullContentHtml", title: "【导出】整个html" },
330
- { name: "exportXml", title: "【导出】整个xml" },
331
- // {
332
- // name: "testMedicalRecord",
333
- // title: "【病历模板】🎉",
334
- // items: [
335
- // {
336
- // name: "testMedicalRecordTemplate",
337
- // title: "ICU入院护理评估单.html",
338
- // },
339
- // { name: "testMedicalRecordTemplate", title: "入院记录.html" },
340
- // { name: "testMedicalRecordTemplate", title: "出院记录.html" },
341
- // {
342
- // name: "testMedicalRecordTemplate",
343
- // title: "成人跌倒风险表.html",
344
- // },
345
- // {
346
- // name: "testMedicalRecordTemplate",
347
- // title: "痔疮风险评分表.html",
348
- // },
349
- // {
350
- // name: "testMedicalRecordTemplate",
351
- // title: "痔疮风险评分表.html",
352
- // },
353
- // { name: "testMedicalRecordTemplate", title: "项目表格1.html" },
354
- // {
355
- // name: "testMedicalRecordTemplate",
356
- // title: "首次病程录-页眉.html",
357
- // },
358
- // {
359
- // name: "testMedicalRecordTemplate",
360
- // title: "600页卡顿测试.html",
361
- // },
362
- // ],
363
- // },
364
- ],
365
- },
366
- ],
367
-
368
- // 菜单图标
369
- common: [
370
- {
371
- name: "undo",
372
- title: "撤销",
373
- },
374
- {
375
- name: "redo",
376
- title: "恢复",
377
- },
378
- {
379
- name: "paste",
380
- title: "粘贴",
381
- },
382
- {
383
- name: "copy",
384
- title: "复制",
385
- },
386
- {
387
- name: "cut",
388
- title: "剪切",
389
- },
390
- {
391
- name: "fontName",
392
- title: "字体",
393
- },
394
- {
395
- name: "fontSize",
396
- title: "字号",
397
- },
398
- {
399
- name: "foreColor",
400
- title: "文字颜色",
401
- },
402
- {
403
- name: "hiliteColor",
404
- title: "背景颜色",
405
- },
406
- {
407
- name: "removeFormat",
408
- title: "清除格式",
409
- },
410
- {
411
- name: "subscript",
412
- title: "下标",
413
- },
414
- {
415
- name: "superscript",
416
- title: "上标",
417
- },
418
- {
419
- name: "bold",
420
- title: "加粗 ctrl+b",
421
- },
422
- {
423
- name: "italic",
424
- title: "倾斜 ctrl+i",
425
- },
426
- {
427
- name: "underline",
428
- title: "下划线",
429
- },
430
- {
431
- name: "strikeThrough",
432
- title: "删除线",
433
- },
434
- {
435
- name: "insertHorizontalRule",
436
- title: "分割线",
437
- },
438
- {
439
- name: "selectAll",
440
- title: "选择全部 ctrl+a",
441
- },
442
- {
443
- name: "spechars",
444
- title: "特殊字符",
445
- },
446
- {
447
- name: "justifyLeft",
448
- title: "向左对齐",
449
- },
450
- {
451
- name: "justifyCenter",
452
- title: "居中对齐",
453
- },
454
- {
455
- name: "justifyRight",
456
- title: "向右对齐",
457
- },
458
- {
459
- name: "justifyFull",
460
- title: "两端对齐",
461
- },
462
- {
463
- name: "insertUnorderedList",
464
- title: "无序编号",
465
- },
466
- {
467
- name: "insertOrderedList",
468
- title: "有序编号",
469
- },
470
- ],
471
- // name: 'bse-toolbar-editor',
472
- // title: '编辑',
473
- },
474
- diagnoseFieldsMapping: { // 诊断控件映射
475
- 主键: 'bse_id',
476
- 父主键: 'bse_parentId',
477
- 子集: 'bse_children',
478
- 分类: "bse_type", //"中医诊断",
479
- 类型: "bse_categery", //"入院诊断",
480
- 病名: "bse_disease_name", //"病名",
481
- 病描述: "bse_disease_name_desc", //"病描述",
482
- 症名: "bse_symptom_name", //"症名",
483
- 症描述: "bse_symptom_name_desc", //"症描述",
484
- 诊断名: "bse_diagnose_name", //"诊断名",
485
- 诊断描述: "bse_diagnose_name_desc", //"诊断名描述",
486
- 序号: "bse_sort",
487
- 诊断日期: "bse_diagnose_date",
488
- 诊断医生: "bse_diagnose_doctor",
489
- },
490
- surgeryFieldsMapping: { // 手术控件映射
491
- 类型: "bse_type",
492
- 手术编码: "bse_code",
493
- 手术名: "bse_name",
494
- 手术描述: "bse_describe",
495
- 日期: "bse_date",
496
- 手术等级: "bse_surgeryLevel",
497
- 术者: "bse_doctor",
498
- 一助: "bse_firstAssistant",
499
- 二助: "bse_secondAssistant",
500
- 护士姓名: "bse_nurseName",
501
- 切口等级: "bse_incisionLevel",
502
- 愈合等级: "bse_healingLevel",
503
- 麻醉方法: "bse_anesthesia",
504
- 麻醉医师: "bse_anesthesiologist",
505
- },
506
- signFieldsMapping: { // 手术控件映射
507
- 姓名: 'bse_userName',
508
- 签名: 'bse_signName',
509
- 职称: 'bse_professionalTitle',
510
- 日期: 'bse_data',
511
- 工号: 'bse_jobNumber',
512
- 等级: 'bse_level',
513
- }
514
- }
515
-
516
- // force依赖
517
- function dateFormat(date, fmt) {
518
- if (!date) return;
519
- date = new Date(date);
520
- let ret;
521
- const opt = {
522
- "y+": date.getFullYear().toString(), // 年
523
- "M+": (date.getMonth() + 1).toString(), // 月
524
- "d+": date.getDate().toString(), // 日
525
- "H+": date.getHours().toString(), // 时
526
- "m+": date.getMinutes().toString(), // 分
527
- "s+": date.getSeconds().toString(), // 秒
528
- // 有其他格式化字符需求可以继续添加,必须转化成字符串
529
- };
530
- for (let k in opt) {
531
- ret = new RegExp("(" + k + ")").exec(fmt);
532
- if (ret) {
533
- fmt = fmt.replace(
534
- ret[1],
535
- ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
536
- );
537
- }
538
- }
539
- return fmt;
540
- }
541
-
542
- /**
543
- * 定义不可枚举属性
544
- * @param arry ***一维度数组
545
- */
546
- function def(obj, key, value) {
547
- try {
548
- obj instanceof Object && Object.defineProperty(obj, key, {
549
- writable :true,
550
- value : value,
551
- configurable : false,
552
- enumerable:false
553
- })
554
- } catch(e) {
555
- debugger
556
- }
557
- }
558
-
559
- /**
560
- * 清空空白字符
561
- * @param arry ***一维度数组
562
- */
563
- function trim(str) {
564
- return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, "");
565
- }
566
-
567
- /**
568
- * 简单的树转成数组函数
569
- * @param arry ***一维度数组
570
- * @param pid 父主键
571
- * @param porpsMapping { 主键, 父组件, 子集 } 映射关系
572
- */
573
- function treeToArr(arry, porpsMapping, pid = null, newArr = []) {
574
- arry = JSON.parse(JSON.stringify(arry))
575
- const __children = porpsMapping["_children"] || "_children"
576
- const __id = porpsMapping["_id"] || "_id"
577
- const __parentId = porpsMapping["_parentId"] || "_parentId"
578
- arry.forEach(it => {
579
- newArr.push({ ...it, [__parentId]: pid })
580
- if (it[__children] && it[__children].length) {
581
- treeToArr(it[__children], porpsMapping, it[__id], newArr)
582
- }
583
- delete it[__children]
584
- })
585
- return newArr
586
- }
587
-
588
- // force依赖
589
- function arrToTree(arry, pid, porpsMapping) {
590
- arry = JSON.parse(JSON.stringify(arry))
591
- return arry
592
- .filter((item) => {
593
- if (pid === undefined) {
594
- return (
595
- item[porpsMapping["父主键"]] === 0 ||
596
- !arry
597
- .map((ary) => {
598
- return ary[porpsMapping["主键"]];
599
- })
600
- .includes(item[porpsMapping["父主键"]])
601
- );
602
- } else {
603
- return item[porpsMapping["父主键"]] === pid;
604
- }
605
- })
606
- .map((item) => {
607
- item[porpsMapping["子集"]] = arrToTree(
608
- arry,
609
- item[porpsMapping["主键"]],
610
- porpsMapping
611
- )
612
- return item;
613
- }).sort((a, b) => a[porpsMapping["序号"]] - b[porpsMapping["序号"]]);
614
- }
615
-
616
- // 解析json字符串
617
- function jsonparse(jsonify) {
618
- try {
619
- return JSON.parse(jsonify);
620
- } catch {
621
- try {
622
- return JSON.parse(decodeURIComponent(jsonify));
623
- } catch {
624
- const str = decodeURIComponent(jsonify);
625
- const evalObj = eval("(" + str + ")");
626
- return evalObj;
627
- }
628
- }
629
- }
630
-
631
- // 当前节点是否是bse元素
632
- function isBseElement(node) {
633
- return node && node.hasAttribute && node.hasAttribute('bse')
634
- }
635
-
636
- // 获取当前元素属性
637
- function getElementAttribute(ele) {
638
- return isBseElement(ele)
639
- ? ele && jsonparse(ele.getAttribute && ele.getAttribute("bse"))
640
- : { descr: '不是"bse"标签元素' };
641
- }
642
-
643
- // 递归获取元素属性
644
- function getItorElementBseAttrAndEl(target) {
645
- let result = { descr: '不是"bse"标签元素' };
646
- while (target && target.nodeName !== "BODY") {
647
- const attr = getElementAttribute(target);
648
- if (attr.descr !== '不是"bse"标签元素') {
649
- result = { ...attr, elSrc: target };
650
- break;
651
- }
652
- target = target.parentNode;
653
- }
654
- return result;
655
- }
656
-
657
- // 判断当前是否是一个方法
658
- function isFunction(fuc) {
659
- return fuc
660
- ? Object.prototype.toString.call(fuc) === "[object Function]"
661
- : false;
662
- }
663
-
664
- /** 等待动态字典返回数据中间件 */
665
- function awaitDictoryResultMiddle(proto, newversion = false) {
666
- return new Promise(resolve => {
667
- if (this.getOptions().requestTable, newversion) {
668
- this.getOptions().requestTable(resolve, proto)
669
- } else { // 兼容老数据
670
- resolve({ tableOptions: proto.bse_options || [], tableOptionsMapping: {} })
671
- }
672
- })
673
- }
674
-
675
-
676
- /**
677
- * 分组元素
678
- * @param arry ***一维度数组
679
- */
680
- function groupBy(newArr, resultMap) {
681
- return newArr.reduce((pre, cur) => {
682
- pre[resultMap(cur)] ? pre[resultMap(cur)].push(cur) : (pre[resultMap(cur)] = [cur])
683
- return pre
684
- }, {})
685
- }
686
-
687
- // 递归合并分页元素
688
- function itorMergeBreakEle(curEle, nextEle, mapping) {
689
- let curChildBle = curEle.getAttribute(`${mapping.childIndex}`) ? curEle : curEle.querySelector(`*[${mapping.childIndex}]`),
690
- nextChildBle = nextEle.getAttribute(`${mapping.childIndex}`) ? nextEle : nextEle.querySelector(`*[${mapping.childIndex}]`)
691
- while(nextChildBle && !['#document-fragment', 'TD'].includes(nextChildBle.nodeName)) {
692
- if (!curChildBle) {
693
- const nextChildId = nextChildBle?.getAttribute(`${mapping.childIndex}`) // 保留下页的临时cach
694
- if (nextChildId) {
695
- const curtParentId = curEle.getAttribute(`${mapping.parentIndex}`)
696
- curEle?.setAttribute(`tem_${mapping.parentIndex}`, curtParentId)
697
- nextChildBle?.setAttribute(`tem_${mapping.childIndex}`, nextChildId)
698
- curEle?.insertAdjacentHTML?.('beforeend', nextEle.innerHTML)
699
- nextEle.remove()
700
- return curEle
701
- }
702
- }
703
- const nexTemchild = nextChildBle?.getAttribute(`tem_${mapping.childIndex}`) // 保留下页的临时cache
704
- if (nexTemchild) {
705
- curChildBle?.setAttribute(`tem_${mapping.childIndex}`, nexTemchild)
706
- } else {
707
- const curTtemchild = curChildBle?.getAttribute?.(`tem_${mapping.childIndex}`)
708
- curTtemchild && nextChildBle.setAttribute(`tem_${mapping.childIndex}`, curTtemchild) // 保留下页的临时cache
709
- }
710
-
711
- curChildBle?.insertAdjacentHTML?.('beforeend', nextChildBle.innerHTML)
712
- curChildBle = curChildBle?.parentNode
713
- const tempNext = nextChildBle.parentNode
714
- nextChildBle.remove()
715
- nextChildBle = tempNext
716
- }
717
- return curEle
718
- }
719
-
720
- // base64解码
721
- function b64_to_utf8(str) {
722
- try {
723
- return decodeURIComponent(escape(atob(str)));
724
- } catch {
725
- return ''
726
- }
727
- }
728
-
729
- // 奇偶数
730
- const isEven = num => num % 2 === 0;
731
- const isOdd = num => num % 2 === 1;
732
-
733
- // 随函数
734
- function decide(probability) {
735
- return Math.random() < probability;
736
- }
737
-
738
- // 随验证函数 有返回就阻止
739
- function randomVaildate(fragment, resultHtmlStr) {
740
- const { _questTable, _questCascaderBindOptions, _questDiagnoseTypeOptions, _questUserInfoExtra, keyMode } = this.getOptions()
741
- const whilteList = '3012434b484cc204b927d36e901b2618607f9a5f'
742
- if (whilteList.includes(keyMode)) return
743
- if (!keyMode && decide(0.02)) {
744
- console.log('dec-')
745
- if (resultHtmlStr) {
746
- const creDiv = this.document.createElement('summary')
747
- creDiv.appendChild(fragment)
748
- return creDiv.innerHTML
749
- } else {
750
- return fragment
751
- }
752
- }
753
- const decodeT = b64_to_utf8(_questTable), decodeB = b64_to_utf8(_questCascaderBindOptions), decodeD = b64_to_utf8(_questDiagnoseTypeOptions), decodeU = b64_to_utf8(_questUserInfoExtra)
754
- if (isOdd(keyMode) && decide(0.02)) {
755
- console.log('dec-o')
756
- if (isEven(decodeT) || isOdd(decodeB) || isEven(decodeD) || isEven(decodeU)) {
757
- if (resultHtmlStr) {
758
- const creDiv = this.document.createElement('summary')
759
- creDiv.appendChild(fragment)
760
- return creDiv.innerHTML
761
- } else {
762
- return fragment
763
- }
764
- }
765
- } else if (isEven(keyMode) && decide(0.02)) {
766
- if (isOdd(decodeT) || isEven(decodeB) || isOdd(decodeD) || isOdd(decodeU)) {
767
- if (resultHtmlStr) {
768
- const creDiv = this.document.createElement('summary')
769
- creDiv.appendChild(fragment)
770
- return creDiv.innerHTML
771
- } else {
772
- return fragment
773
- }
774
- }
775
- }
776
- }
777
-
778
- class Polyfill {
779
- constructor(ctx) {
780
- ctx.use = this.use.bind(ctx)
781
- ctx.forceUpdateFun = this.forceUpdateFun.bind(ctx)
782
- ctx.registerCommand = this.registerCommand.bind(ctx)
783
- ctx.enhanceArrToTree = this.enhanceArrToTree.bind(ctx)
784
- ctx.getAddressInfoList = this.getAddressInfoList.bind(ctx)
785
- ctx.itorParentCacheId = this.itorParentCacheId.bind(ctx)
786
- ctx.mergeAndRemoveAttrBreakEleString = this.mergeAndRemoveAttrBreakEleString.bind(ctx)
787
- ctx.getDomRectRelative = this.getDomRectRelative.bind(ctx)
788
- ctx.setAndDrawAllTestListByPageNum = this.setAndDrawAllTestListByPageNum.bind(ctx)
789
- return ctx
790
- }
791
-
792
- /**
793
- * 简单的数组转成树函数
794
- * @param arry ***一维度数组
795
- * @param pid 父主键
796
- * @param porpsMapping { 主键, 父组件, 子集 } 映射关系
797
- */
798
- enhanceArrToTree(arry, porpsMapping, pid, path, level) {
799
- [undefined].includes(pid) && (arry = treeToArr(arry, porpsMapping))
800
- const __id = porpsMapping["_id"] || "_id",
801
- __parentId = porpsMapping["_parentId"] || "_parentId",
802
- __children = porpsMapping["_children"] || "_children",
803
- __order = porpsMapping["_order"] || "_order",
804
- __level = porpsMapping["_level"] || "_level",
805
- __path = porpsMapping["_path"] || "_path";
806
- return arry.filter(
807
- f => {
808
- if ([undefined].includes(pid)) {
809
- return !arry.map(m => m[__id]).includes(f[__parentId])
810
- } else {
811
- return f[__parentId] === pid
812
- }
813
- }
814
- ).sort((a, b) => a[__order] - b [__order]).map((m, inx) => {
815
- const levelTmp = level ? level + '/' + inx : inx
816
- const pathTmp = path ? path + '/' + m[__id] : m[__id]
817
- const childrenTmp = this.enhanceArrToTree(arry, porpsMapping, m[__id], pathTmp, levelTmp)
818
- def(m, __level, levelTmp)
819
- def(m, __order, inx)
820
- def(m, __path, pathTmp)
821
- if (childrenTmp.length) {
822
- m[__children] = childrenTmp
823
- } else {
824
- delete m[__children]
825
- }
826
- return m
827
- })
828
- }
829
-
830
- use(obj) {
831
- obj.install?.call(this)
832
- }
833
-
834
- registerCommand(
835
- commandNames,
836
- payload = { init: new Function(), execCommand: '', queryCommandState: '', queryCommandValue: '' }
837
- ) {
838
- for(const commandName of trim(commandNames).split(/\s+/)) {
839
- if (this.commands && Object.hasOwn(this.commands, commandName)) {
840
- process.env.VUE_APP_ENV == "development" && console.warn(`【warning】:${commandName}命令名存在相同,无法注册`);
841
- }
842
- if (isFunction(payload)) {
843
- payload.apply(this, arguments)
844
- } else {
845
- if (isFunction(payload.init)) {
846
- payload.init.apply(this, arguments)
847
- }
848
- this.commands
849
- ? (this.commands[commandName] = payload)
850
- : (this.commands = { [commandName]: payload });
851
- }
852
- }
853
- }
854
-
855
-
856
- getAddressInfoList(codeOrCodeArrTmp, formInline) {
857
- const cacheCodeTmp = JSON.parse(JSON.stringify(codeOrCodeArrTmp))
858
- // 通过城市id查询所属
859
- function findItorByCityNode(codeTmp, addressList, porpsMapping) {
860
- const { value, children } = porpsMapping
861
- let find = {}
862
- function itorCity(data, code) {
863
- for (const item of data) {
864
- if (item[value] === code) {
865
- find = item
866
- return true
867
- }
868
- if (item[children] && item[children].length) {
869
- const result = itorCity(item[children], code)
870
- if (result) return result
871
- }
872
- }
873
- }
874
- itorCity(addressList, codeTmp)
875
- return find
876
- }
877
-
878
- // 传入数据获取地址对象数组
879
- function mapAddListByCityCode(codeOrCodeArr, addressList, porpsMapping) {
880
- const cityArr = Array.isArray(codeOrCodeArr) ? codeOrCodeArr : findItorByCityNode(codeOrCodeArr, addressList, porpsMapping)?._path?.split('/')
881
- const { value, label } = porpsMapping
882
- return cityArr?.map(m => {
883
- const find = findItorByCityNode(m, addressList, porpsMapping)
884
- return {
885
- value: find[value],
886
- label: find[label]
887
- }
888
- }) || []
889
- }
890
-
891
- const PFetch = new Promise((resolve) =>{
892
- this.getOptions().requestParentAddressByParam((param) => {
893
- if (!param) {
894
- resolve([])
895
- return
896
- }
897
- const { addressMapping } = param
898
- const addressList = Array.isArray(param) ? param : (param?.addressList || [])
899
- const addressCascaderProps = Object.assign({
900
- children: 'children',
901
- label:'name',
902
- value:'code',
903
- parentId: 'parentCode'
904
- }, addressMapping || {})
905
-
906
- const addressCascaderOptions = this.enhanceArrToTree(addressList, { _id: addressCascaderProps.value, _parentId: addressCascaderProps.parentId, _children: addressCascaderProps.children })
907
- const addlist = mapAddListByCityCode(codeOrCodeArrTmp, addressCascaderOptions, { label: addressCascaderProps.label, value: addressCascaderProps.value, children: addressCascaderProps.children })
908
- resolve(addlist)
909
-
910
- //const addressCascaderOptions = this.enhanceArrToTree(param, { _id: 'code', _parentId: 'parentCode', _children: 'children' })
911
- //const addlist = mapAddListByCityCode(codeOrCodeArrTmp, addressCascaderOptions, { label:'name', value:'code', children: 'children' })
912
- //resolve(addlist)
913
- }, Array.isArray(cacheCodeTmp) ? cacheCodeTmp.pop() : codeOrCodeArrTmp, formInline);
914
- })
915
-
916
- const PTime = new Promise((_, reject) => {
917
- setTimeout(() => {
918
- reject(new Error('操作超时')); // 在指定时间后拒绝 Promise
919
- }, 8000);
920
- });
921
-
922
- return Promise.race([PFetch, PTime])
923
- .then(result => {
924
- return result
925
- })
926
- .catch(_ => {
927
- return []
928
- });
929
- }
930
-
931
- // 当时节点是否在helper_data_cache_id节点中
932
- itorParentCacheId(node) {
933
- let isInsideFlag = false, currentNode = node, directNode = node
934
- while (currentNode && !isInsideFlag && !['BODY', 'DIV'].includes(currentNode.nodeName)) {
935
- if (currentNode.hasAttribute('helper_data_cache_id')) {
936
- isInsideFlag = true
937
- break
938
- }
939
- currentNode = currentNode.parentNode
940
- }
941
- return { isInsideFlag, currentNode, directNode }
942
- }
943
-
944
- /**
945
- * 简单的数组转成树函数
946
- * @param currentNodeTemp ***当前节点
947
- * @param contentValueTemp 更新值
948
- * @param attrTemp bse属性
949
- * @param valueDefaultPropsTemp 值的映射关系(诊断控件)
950
- * @param versionControl 动态字典版本控制
951
- */
952
- async forceUpdateFun(
953
- elSrc,
954
- contentValueTemp,
955
- attrTemp,
956
- editAreaTmp,
957
- valueDefaultPropsTemp,
958
- versionControl
959
- ) {
960
- let editArea = editAreaTmp || this.getEditorPageArea()
961
- const currentNodeTemp = (() => {
962
- const childId = elSrc.getAttribute('helper_data_cache_child_id') || elSrc.querySelector('*[helper_data_cache_child_id]')?.getAttribute('helper_data_cache_child_id')
963
- if (childId) {
964
- const childList = editArea.querySelectorAll(`*[helper_data_cache_child_id="${childId}"]`)
965
- let result = null
966
- const len = childList.length
967
- for (let inx = len - 1; inx >= 0; inx--) {
968
- if (inx) {
969
- const elScrEle = getItorElementBseAttrAndEl(childList[inx]).elSrc
970
- elScrEle.remove()
971
- console.log('remove break ele')
972
- } else {
973
- result = getItorElementBseAttrAndEl(childList[inx]).elSrc
974
- }
975
- }
976
- result.querySelector('*[helper_data_cache_child_id]')?.removeAttribute?.('helper_data_cache_child_id')
977
- const { isInsideFlag, currentNode } = this.itorParentCacheId(result)
978
- if (isInsideFlag && !currentNode.querySelector('*[helper_data_cache_child_id]')) {
979
- currentNode.removeAttribute('helper_data_cache_id')
980
- currentNode.removeAttribute('helper_data_last_break_ele')
981
- }
982
- if (editAreaTmp) {
983
- for(const virtual of [].slice.call(result.querySelectorAll('*[helper_data_virtual_id]'))) {
984
- virtual.removeAttribute('helper_data_virtual_id')
985
- virtual.removeAttribute('helper_data_virtual_node')
986
- }
987
- }
988
- return result
989
- } else {
990
- return elSrc
991
- }
992
- })()
993
- if (!currentNodeTemp) return
994
- switch (attrTemp.type) {
995
- case "radio":
996
- for(let input of [].slice.call(currentNodeTemp.querySelectorAll("input"))) {
997
- if ([input.getAttribute("value"), input.getAttribute("label")].includes(contentValueTemp)) {
998
- input.setAttribute('checked', 'checked')
999
- // input.checked = true
1000
- break
1001
- } else {
1002
- input.removeAttribute('checked')
1003
- // input.checked = false
1004
- }
1005
- }
1006
- break;
1007
- case "checkbox":
1008
- for(let input of [].slice.call(currentNodeTemp.querySelectorAll("input"))) {
1009
- if (contentValueTemp?.includes?.(input.getAttribute("value")) || contentValueTemp?.includes?.(input.getAttribute("label"))) {
1010
- input.setAttribute('checked', 'checked')
1011
- // input.checked = true
1012
- } else {
1013
- input.removeAttribute('checked')
1014
- // input.checked = false
1015
- }
1016
- }
1017
- break;
1018
- case "select":
1019
- let bse_options = [];
1020
- if (attrTemp.bse_card === 'axios') {
1021
- const bse_options_cache_axios_obj = await awaitDictoryResultMiddle.call(this, attrTemp, versionControl);
1022
- bse_options = this.getRadioCheckDynamicMappingValue(bse_options_cache_axios_obj);
1023
- } else {
1024
- bse_options = attrTemp.bse_options;
1025
- }
1026
- let matchLabel = bse_options?.find?.(f => [f.value, f.label].includes(contentValueTemp))?.label
1027
- currentNodeTemp.querySelector("label").innerHTML = matchLabel || '';
1028
- break
1029
- case "diagnose":
1030
- const diagnoseMapping = {
1031
- ...optionsDefault.diagnoseFieldsMapping,
1032
- ...this.getOptions()?.diagnoseFieldsMapping,
1033
- ...valueDefaultPropsTemp,
1034
- };
1035
- let filterShowList = (contentValueTemp || []).filter?.((f) =>
1036
- [attrTemp.diagnoseType.label, attrTemp.diagnoseType.value].includes(
1037
- f[diagnoseMapping["类型"]]
1038
- ) && (attrTemp.chineseAndWesternType === '中西医诊断' ? true : attrTemp.chineseAndWesternType === f[diagnoseMapping["分类"]])
1039
- ) || []
1040
-
1041
- const diagnoseNewAttr = {
1042
- ...attrTemp,
1043
- bse_multipleSelection: filterShowList ?? [],
1044
- };
1045
- currentNodeTemp.setAttribute(
1046
- "bse",
1047
- encodeURIComponent(JSON.stringify(diagnoseNewAttr))
1048
- );
1049
-
1050
- filterShowList = (() => {
1051
- if (filterShowList) {
1052
- const treelist = arrToTree(
1053
- filterShowList,
1054
- undefined,
1055
- diagnoseMapping
1056
- ); // .sort((a, b) => a[diagnoseMapping["序号"]] - b[diagnoseMapping["序号"]])
1057
- const typeList = treelist.reduce((pre, cur) => {
1058
- const find = pre.find(
1059
- (s) => s.label === cur[diagnoseMapping["类型"]]
1060
- );
1061
- if (find) {
1062
- find[diagnoseMapping["子集"]].push(cur);
1063
- } else {
1064
- pre.push({
1065
- label: cur[diagnoseMapping["类型"]],
1066
- [diagnoseMapping["子集"]]: [cur],
1067
- });
1068
- }
1069
- return pre;
1070
- }, []);
1071
- const finalyList = typeList.reduce((pre, cur) => {
1072
- pre.push({
1073
- ...cur,
1074
- [diagnoseMapping["子集"]]: cur[diagnoseMapping["子集"]].reduce(
1075
- (pre, cur) => {
1076
- const find = pre.find(
1077
- (s) => s.label === cur[diagnoseMapping["分类"]]
1078
- );
1079
- if (find) {
1080
- find[diagnoseMapping["子集"]].push(cur);
1081
- } else {
1082
- pre.push({
1083
- label: cur[diagnoseMapping["分类"]],
1084
- [diagnoseMapping["子集"]]: [cur],
1085
- });
1086
- }
1087
- return pre;
1088
- },
1089
- []
1090
- ),
1091
- });
1092
- return pre;
1093
- }, []);
1094
- return finalyList;
1095
- } else {
1096
- return {};
1097
- }
1098
- })();
1099
- /* 递归算出树形数据 用于诊断控件层级渲染 */
1100
- function emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle) { // 生成空格符号
1101
- let spaceLen = level
1102
- if (!sectionStart && showDiagnoseType && showDiagnoseTitle) {
1103
- if (level > 1) {
1104
- spaceLen -= 2
1105
- }
1106
- spaceLen *= 2
1107
- } else {
1108
- if (sectionStart) {
1109
- if (inx === 'sign') {
1110
- if (!showDiagnoseType || !showDiagnoseTitle) spaceLen--
1111
- spaceLen *= 2
1112
- } else {
1113
- if (!showDiagnoseType) spaceLen--
1114
- if (!showDiagnoseTitle) spaceLen--
1115
- spaceLen *= 2
1116
- }
1117
- } else {
1118
- if (!showDiagnoseType && showDiagnoseTitle) {
1119
- if (level === 1) {
1120
- spaceLen--
1121
- } else if (level === 2) {
1122
- if (inx === 0) {
1123
- spaceLen -= 2
1124
- } else {
1125
- spaceLen *= 2
1126
- spaceLen++
1127
- }
1128
- } else if (level) {
1129
- spaceLen *= 2
1130
- spaceLen++
1131
- }
1132
- } else if (showDiagnoseType && !showDiagnoseTitle) {
1133
- spaceLen--
1134
- spaceLen *= 2
1135
- } else if (!showDiagnoseType && !showDiagnoseTitle) {
1136
- spaceLen -= 2
1137
- spaceLen *= 2
1138
- }
1139
- }
1140
- }
1141
- return Array(spaceLen).fill().map(() => '&emsp;').join("")
1142
- }
1143
- function createText(sectionStart, showDiagnoseType, showDiagnoseTitle) { // 生成空白标签
1144
- let exist = true
1145
- if (!showDiagnoseType || !showDiagnoseTitle || sectionStart) exist = false
1146
- return exist ? `<text style="display:inline-block;">${Array(7)
1147
- .fill()
1148
- .map(() => "&emsp;")
1149
- .join("")}</text>` : ''
1150
- }
1151
- function addOrder(sort, inx) {
1152
- // 添加需要
1153
- return sort ? inx + 1 + "." : "";
1154
- }
1155
- function addCommaFullstop(inx, diagnoseArr) {
1156
- // 添加需要
1157
- const len = diagnoseArr.length;
1158
- return inx + 1 === len ? "。" : ",";
1159
- }
1160
- const {
1161
- addOrderNumber,
1162
- addChinaOrderNumber,
1163
- showDiagnoseType,
1164
- showDiagnoseTitle,
1165
- signTitleLabel,
1166
- signDateLabel,
1167
- sectionStart,
1168
- splitCharList,
1169
- diagnoseTypeLabel,
1170
- showDescribe,
1171
- } = attrTemp;
1172
-
1173
- const comChildLi = (diagnoseArr, modeName, level, showDiagnoseTypeTmp, showDiagnoseTitleTmp, diagnoseMappingAttr) =>
1174
- `${diagnoseArr
1175
- .map((li, inx) => {
1176
- return {
1177
- horizontal: () =>
1178
- `${
1179
- [0, 1].includes(level)
1180
- ?
1181
- `${
1182
- level === 0
1183
- ?
1184
- `${ showDiagnoseType ? `<text style="font-size: initial;font-weight: bold;">${diagnoseTypeLabel || li.label} </text>` : '' }`
1185
- :
1186
- `${ showDiagnoseTitle ? `<text style="font-size: initial;">${li.label}: </text>` : '' }`
1187
- }`
1188
- :
1189
- `${
1190
- li[diagnoseMappingAttr["分类"]] === '中医诊断'
1191
- ? `${addOrder(addChinaOrderNumber && level === 2, inx)}<text style="font-size: initial;">${li[diagnoseMappingAttr[showDescribe ? "病描述" : "病名"]] || ''}</text>
1192
- <text style="font-size: initial;">${splitCharList[0] || ' '}${li[diagnoseMappingAttr[showDescribe ? "症描述" : "症名"]]}${splitCharList[1] || ' '}</text>${addCommaFullstop(inx, diagnoseArr)}`
1193
- : `${addOrder(addOrderNumber && level === 2, inx)}<text style="font-size: initial;">${li[diagnoseMappingAttr[showDescribe ? "诊断描述" : "诊断名"]] || ''}</text>${addCommaFullstop(inx, diagnoseArr)}`
1194
- }`
1195
- }
1196
- ${
1197
- li[diagnoseMappingAttr["子集"]] &&
1198
- li[diagnoseMappingAttr["子集"]].length ?
1199
- comChildLi(
1200
- li[diagnoseMappingAttr["子集"]],
1201
- modeName,
1202
- level + 1,
1203
- showDiagnoseTypeTmp,
1204
- showDiagnoseTitleTmp,
1205
- diagnoseMappingAttr
1206
- ) : ''
1207
- }`,
1208
- vertical: () =>
1209
- `${
1210
- li[diagnoseMappingAttr["分类"]] === '中医诊断'
1211
- ?
1212
- [0, 1, 2].includes(level)
1213
- ?
1214
- `${
1215
- level === 0
1216
- ?
1217
- showDiagnoseType ? `<text style="font-size: initial;display:block;font-size: initial;">${diagnoseTypeLabel || li.label}</text>` : ''
1218
- :
1219
- level === 1
1220
- ?
1221
- showDiagnoseTitle ? `<text style="display:block;"></text><text style="font-size: initial;display:${ sectionStart ? 'block' : 'inline-block' };"><text style="font-size: initial;display: inline-block;">${emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${li.label}:</text></text>` : ''
1222
- :
1223
- `<text style="font-size: initial;display:${ !sectionStart && inx === 0 ? 'inline-block' : 'block' };">${ !sectionStart && inx === 0 ? '' : `${createText(sectionStart, showDiagnoseType, showDiagnoseTitle)}` }<text style="font-size: initial;display: inline-block;">${emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${addOrder(addChinaOrderNumber && level === 2, inx)}${li[diagnoseMappingAttr[showDescribe ? "病描述" : "病名"]] || ''}</text></text>`
1224
- + `<text style="font-size: initial;display:block">${createText(sectionStart, showDiagnoseType, showDiagnoseTitle)}<text style="font-size: initial;display: inline-block;">${emspLen(level +1, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${li[diagnoseMappingAttr[showDescribe ? "症描述" : "症名"]] || ''}</text></text>`
1225
- // 中西医差异
1226
- }`
1227
- : `<text style="font-size: initial;display:block">${createText(sectionStart, showDiagnoseType, showDiagnoseTitle)}<text style="font-size: initial;display: inline-block;">${emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${addOrder(addChinaOrderNumber && level === 2, inx)}${li[diagnoseMappingAttr[showDescribe ? "病描述" : "病名"]] || ''}</text></text>`
1228
- + `<text style="font-size: initial;display:block">${createText(sectionStart, showDiagnoseType, showDiagnoseTitle)}<text style="font-size: initial;display: inline-block;">${emspLen(level + 1, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${li[diagnoseMappingAttr[showDescribe ? "症描述" : "症名"]] || ''}</text></text>`
1229
- // 中西医差异
1230
- :
1231
- [0, 1, 2].includes(level)
1232
- ?
1233
- `${
1234
- level === 0
1235
- ?
1236
- showDiagnoseType ? `<text style="font-size: initial;display:block;">${diagnoseTypeLabel || li.label}</text>` : ''
1237
- :
1238
- level === 1
1239
- ?
1240
- showDiagnoseTitle ? `<text style="display:block;"></text><text style="font-size: initial;display:${ sectionStart ? 'block' : 'inline-block' };"><text style="font-size: initial;display: inline-block;">${emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${li.label}:</text></text>` : ''
1241
- :
1242
- `<text style="font-size: initial;display:${ !sectionStart && inx === 0 ? 'inline-block' : 'block' };">${ !sectionStart && inx === 0 ? '' : `${createText(sectionStart, showDiagnoseType, showDiagnoseTitle)}` }<text style="font-size: initial;display: inline-block;">${emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${addOrder(addOrderNumber && level === 2, inx)}${li[diagnoseMappingAttr[showDescribe ? "诊断描述" : "诊断名"]] || ''}</text></text>`
1243
- }`
1244
- : `<text style="font-size: initial;display:block">${createText(sectionStart, showDiagnoseType, showDiagnoseTitle)}<text style="font-size: initial;display: inline-block;">${emspLen(level, inx, sectionStart, showDiagnoseType, showDiagnoseTitle)}${addOrder(addOrderNumber && level === 2, inx)}${li[diagnoseMappingAttr[showDescribe ? "诊断描述" : "诊断名"]] || ''}</text></text>`
1245
- }
1246
- ${
1247
- li[diagnoseMappingAttr["子集"]] &&
1248
- li[diagnoseMappingAttr["子集"]].length ?
1249
- comChildLi(
1250
- li[diagnoseMappingAttr["子集"]],
1251
- modeName,
1252
- level + 1,
1253
- showDiagnoseTypeTmp,
1254
- showDiagnoseTitleTmp,
1255
- diagnoseMappingAttr
1256
- ) : ''
1257
- }`
1258
- }[modeName]();
1259
- })
1260
- .join("")}`;
1261
-
1262
- const diagnoseSingMapping = {
1263
- // 签名字段映射
1264
- ...optionsDefault.signFieldsMapping,
1265
- ...this.getOptions()?.signFieldsMapping,
1266
- };
1267
- const comSignList = (modeName, signMappingAttr, signTitleLabel, signDateLabel, showDiagnoseTypeTmp, showDiagnoseTitleTmp, attrTemp, diagnoseArr = []) => {
1268
- const userInfo = this.getUserInfoData();
1269
- const signShowArr = attrTemp.showList || []
1270
- return `${{
1271
- horizontal: (() => `
1272
- ${
1273
- signShowArr.length ? '<text style="display: block;height: 0px;margin: 0;"></text>' : ''
1274
- }
1275
- ${
1276
- signShowArr.some(s => ['职称', '姓名'].includes(s)) ?
1277
- `<text style="font-size: initial;"><text style="display:inline-block;width: ${ showDiagnoseTypeTmp ? '88pt' : '63pt' };text-align: right;">${signTitleLabel || '医师签名'}:</text>${
1278
- signShowArr.filter(f => ['职称', '姓名'].includes(f)).map(li => {
1279
- if (li === '职称') {
1280
- return `(${userInfo[signMappingAttr[li]] || ''})`
1281
- }
1282
- if (li === '姓名') {
1283
- return diagnoseArr[diagnoseArr.length]?.[diagnoseMapping['诊断医生']] || userInfo[signMappingAttr[li]] || ''
1284
- }
1285
- return userInfo[signMappingAttr[li]] || ''
1286
- }
1287
- ).join(" ")
1288
- }</text>` : ''
1289
- }
1290
- ${
1291
- signShowArr.some(s => ['日期'].includes(s)) ?
1292
- `<text style="font-size: initial;"><text style="display:inline-block;width: ${ showDiagnoseTypeTmp ? '88pt' : '63pt' };text-align: right;">${signDateLabel || '日期'}:</text><text bse_child="diagnoseDdate">${
1293
- dateFormat(diagnoseArr[diagnoseArr.length]?.[diagnoseMapping['诊断日期']] || userInfo[signMappingAttr['日期']] || new Date(), attrTemp.diagDateFormat || "yyyy-MM-dd")
1294
- }</text></text>` : ''
1295
- }
1296
- `)(),
1297
- // ${
1298
- // signShowArr.length ? '<text style="display: block;background: #999;height: 1px;margin: 2px 0;"></text>' : ''
1299
- // }
1300
- vertical: (() => `
1301
- ${
1302
- signShowArr.some(s => ['职称', '姓名'].includes(s)) ?
1303
- `<text style="display: block;font-size: initial;"><text style="display:inline-block;text-align: right;">${emspLen(1, 'sign', true, showDiagnoseTypeTmp, showDiagnoseTitleTmp)}${signTitleLabel || '医师签名'}:</text>${
1304
- signShowArr.filter(f => ['职称', '姓名'].includes(f)).map(li => {
1305
- if (li === '职称') {
1306
- return `(${userInfo[signMappingAttr[li]] || ''})`
1307
- }
1308
- if (li === '姓名') {
1309
- return diagnoseArr[diagnoseArr.length]?.[diagnoseMapping['诊断医生']] || userInfo[signMappingAttr[li]] || ''
1310
- }
1311
- return userInfo[signMappingAttr[li]] || ''
1312
- }
1313
- ).join(" ")
1314
- }</text>`
1315
- : ''
1316
- }
1317
- ${
1318
- signShowArr.some(s => ['日期'].includes(s)) ?
1319
- `<text style="display: block;font-size: initial;"><text style="display:inline-block;text-align: right;">${emspLen(2, 'sign', true, showDiagnoseTypeTmp, showDiagnoseTitleTmp)}${signDateLabel || '日期'}:</text><text bse_child="diagnoseDdate">${
1320
- dateFormat(diagnoseArr[diagnoseArr.length]?.[diagnoseMapping['诊断日期']] || userInfo[signMappingAttr['日期']] || new Date(), attrTemp.diagDateFormat || "yyyy-MM-dd")
1321
- }</text></text>`
1322
- : ''
1323
- }
1324
- `)(),
1325
- }[modeName]}`;
1326
- };
1327
- // const styleStr = attrTemp.mode === 'vertical' ? 'display:inline-flex;font-size: 0;' : 'display:unset;'
1328
- // currentNodeTemp.querySelector("span").setAttribute('style', styleStr)
1329
- const elSrcSpanWarp = currentNodeTemp.querySelector("span")
1330
- if (attrTemp.mode === 'vertical') {
1331
- !elSrcSpanWarp.classList.contains("inline-flex") && elSrcSpanWarp.classList.add("inline-flex");
1332
- !elSrcSpanWarp.classList.contains("text-zero") && elSrcSpanWarp.classList.add("text-zero");
1333
- } else {
1334
- elSrcSpanWarp.classList.contains("inline-flex") && elSrcSpanWarp.classList.remove("inline-flex");
1335
- elSrcSpanWarp.classList.contains("text-zero") && elSrcSpanWarp.classList.remove("text-zero");
1336
- }
1337
- currentNodeTemp.querySelector("label").innerHTML = filterShowList.length
1338
- ? `${
1339
- comChildLi(filterShowList, attrTemp.mode, 0, showDiagnoseType, showDiagnoseTitle, diagnoseMapping)
1340
- }${
1341
- comSignList(attrTemp.mode, diagnoseSingMapping, signTitleLabel, signDateLabel, showDiagnoseType, showDiagnoseTitle, attrTemp, filterShowList)
1342
- }`
1343
- : "";
1344
- break;
1345
- case "surgery":
1346
- const surgeryNewAttr = {
1347
- ...attrTemp,
1348
- bse_surgeryList: contentValueTemp ?? [],
1349
- };
1350
- currentNodeTemp.setAttribute(
1351
- "bse",
1352
- encodeURIComponent(JSON.stringify(surgeryNewAttr))
1353
- );
1354
- const surgeryMapping = {
1355
- ...optionsDefault.surgeryFieldsMapping,
1356
- ...this.getOptions()?.surgeryFieldsMapping,
1357
- ...valueDefaultPropsTemp,
1358
- };
1359
- let innerHTMLStr = ''
1360
- if (contentValueTemp.length) {
1361
- if (['手术名', '手术描述'].includes(attrTemp.fieldName)) {
1362
- innerHTMLStr = contentValueTemp.map((surgery, inx) => {
1363
- const surgeryName = surgery[surgeryMapping[attrTemp.fieldName]]
1364
- return `${inx + 1}.${surgeryName}`
1365
- }).join('')
1366
- } else {
1367
- innerHTMLStr = contentValueTemp[contentValueTemp.length - 1]?.[surgeryMapping[attrTemp.fieldName] || ''] || ''
1368
- }
1369
- } else {
1370
- innerHTMLStr = ''
1371
- }
1372
- currentNodeTemp.querySelector("label").innerHTML = innerHTMLStr || ''
1373
- break;
1374
- case "address":
1375
- function CheckIsChinese(str, val){
1376
- return new RegExp(`[${str}]+`,"g").test(val)
1377
- }
1378
- let addressArr = [], showLabel = '';
1379
- if (Array.isArray(contentValueTemp)) {
1380
- const addCode = JSON.parse(JSON.stringify(contentValueTemp)).pop()
1381
- addressArr = await this.getAddressInfoList(addCode, attrTemp)
1382
- showLabel = addressArr.map(m => m.label).join('/') || "";
1383
- } else if (CheckIsChinese('\\u4E00-\\u9FFF', contentValueTemp)) {
1384
- // *特殊中文直接渲染中文不发请求
1385
- addressArr = [{ value: '编辑器 - 字段绑定为地区中文名!无法查询地区code', name: contentValueTemp}]
1386
- showLabel = contentValueTemp
1387
- } else {
1388
- let addCode = '' // 用于接口查询code
1389
- if (CheckIsChinese('\/\|\-', contentValueTemp)) { // 地址传参 | / - Array 支持四种形式
1390
- addCode = contentValueTemp.split(/(\/|\||\-)/).pop()
1391
- } else {
1392
- addCode = contentValueTemp
1393
- }
1394
- addressArr = await this.getAddressInfoList(addCode, attrTemp)
1395
- showLabel = addressArr.map(m => m.label).join('/') || "";
1396
- }
1397
- const addressNewAttr = {
1398
- ...attrTemp,
1399
- bse_address: addressArr
1400
- };
1401
- currentNodeTemp.setAttribute(
1402
- "bse",
1403
- encodeURIComponent(JSON.stringify(addressNewAttr))
1404
- );
1405
- currentNodeTemp.querySelector("label").innerHTML = showLabel
1406
- break;
1407
- case "sign":
1408
- const singMapping = {
1409
- // 签名字段映射
1410
- ...optionsDefault.signFieldsMapping,
1411
- ...this.getOptions()?.signFieldsMapping,
1412
- };
1413
- const bse_signList_temp = contentValueTemp ?? []
1414
- const signNewAttr = {
1415
- ...attrTemp,
1416
- bse_signList: bse_signList_temp,
1417
- };
1418
- currentNodeTemp.setAttribute(
1419
- "bse",
1420
- encodeURIComponent(JSON.stringify(signNewAttr))
1421
- );
1422
- const { bse_signList, showList, mode, jobsort } = signNewAttr;
1423
- const bae_signList_temp = bse_signList.length ? bse_signList.sort((a, b) => {
1424
- return jobsort === "asc"
1425
- ? a[singMapping["等级"]] - b[singMapping["等级"]]
1426
- : b[singMapping["等级"]] - a[singMapping["等级"]];
1427
- }) : [];
1428
- currentNodeTemp.querySelector("label").innerHTML = `${bae_signList_temp
1429
- .map(
1430
- (m) =>
1431
- `<text style="display: ${
1432
- mode === "vertical" ? "block" : "inline-block"
1433
- }">${["姓名", "签名", "职称", "日期"]
1434
- .filter((f) => showList.includes(f))
1435
- .map((g) => {
1436
- if (g === "日期") {
1437
- // 按照规定顺序显示
1438
- return (
1439
- dateFormat(new Date(), "yyyy-MM-dd") || m[singMapping[g]]
1440
- );
1441
- } else if (g === "签名") {
1442
- return `<img src="${m[singMapping[g]]}" width=80 height=30/>`;
1443
- } else {
1444
- return m[singMapping[g]];
1445
- }
1446
- })
1447
- .join(" ")}</text>`
1448
- )
1449
- .join(mode === "vertical" ? "" : " / ")}`;
1450
- break;
1451
- // case "pagination": // 写死用于测试用
1452
- // const { pagination } = attrTemp;
1453
- // currentNodeTemp.querySelector("label").innerHTML = pagination.replace(
1454
- // /{{.*?}}/g,
1455
- // (capt) => {
1456
- // if (capt === "{{p}}") {
1457
- // return 1;
1458
- // } else if (capt === "{{t}}") {
1459
- // return 1;
1460
- // } else {
1461
- // return "未知";
1462
- // }
1463
- // }
1464
- // );
1465
- // break;
1466
- case "date":
1467
- if (currentNodeTemp.querySelector("label")) {
1468
- const dateNewAttr = {
1469
- ...attrTemp,
1470
- date: contentValueTemp
1471
- };
1472
- currentNodeTemp.setAttribute(
1473
- "bse",
1474
- encodeURIComponent(JSON.stringify(dateNewAttr))
1475
- );
1476
- if (!contentValueTemp && !currentNodeTemp.querySelector("label").innerHTML) {
1477
- const currentDate = dateNewAttr.value || dateNewAttr.defCurrentDate ? new Date() : ''
1478
- currentNodeTemp.querySelector("label").innerHTML = currentDate ? dateFormat(currentDate, attrTemp.dateformat) : ''
1479
- } else {
1480
- currentNodeTemp.querySelector("label").innerHTML = contentValueTemp ? dateFormat(contentValueTemp, attrTemp.dateformat) : ''
1481
- }
1482
- }
1483
- break;
1484
- case "bloodPressure":
1485
- const valueArr = contentValueTemp.split('|')
1486
- currentNodeTemp.querySelector(".extensional").innerHTML =
1487
- valueArr[0] || '';
1488
- currentNodeTemp.querySelector(".diastolic").innerHTML =
1489
- valueArr[1] || '';
1490
- break;
1491
- case "picturePlaceholder":
1492
- currentNodeTemp.querySelector("label") && (currentNodeTemp.querySelector("label").innerHTML = contentValueTemp ? `<img width="${attrTemp.width}" height="${attrTemp.height}" src="${contentValueTemp}" />` : `<svg width="${attrTemp.width}" height="${attrTemp.height}" viewBox="0 0 200 200"><rect width="200" height="200" fill="transparent" stroke="black" stroke-width="2" stroke-dasharray="5, 5" rx="10" ry="10"></rect><text x="50%" y="50%" text-anchor="middle" dominant-baseline="central">图片占位区</text><text font-size="200" fill="transparent" stroke-opacity="0.1" stroke-dasharray="5, 5" stroke="black" stroke-width="1" x="50%" y="50%" text-anchor="middle" dominant-baseline="central">+</text></svg>`);
1493
- break;
1494
- default:
1495
- currentNodeTemp.querySelector("label") && (currentNodeTemp.querySelector("label").innerHTML = contentValueTemp ?? '');
1496
- break;
1497
- }
1498
- }
1499
-
1500
- // 分页合并元素
1501
- mergeAndRemoveAttrBreakEleString(innerHTMLStr, resultHtmlStr = false, curtPage, mapping = { tdCacheIndex: 'helper_data_cache_id', tdParentIndex: 'helper_data_cache_id', tdChildIndex: 'helper_data_cache_child_id', parentIndex: 'helper_data_cache_id', childIndex: 'helper_data_cache_child_id', virtualIndex: 'helper_data_virtual_id' }) {
1502
- const prevPage = curtPage?.previousSibling, secondPage = curtPage?.nextSibling?.nextSibling
1503
- const fragment = this.document.createRange().createContextualFragment(innerHTMLStr)
1504
-
1505
- const result = randomVaildate.call(this, fragment, resultHtmlStr); // 校验
1506
- if (result) return result;
1507
-
1508
- const groupTableFragment = groupBy([].slice.call(fragment.querySelectorAll(`table[${mapping.parentIndex}]`)), g => {
1509
- return g.getAttribute(`${mapping.parentIndex}`)
1510
- })
1511
- for (const [_, group] of Object.entries(groupTableFragment)) {
1512
- // 分组table元素
1513
- for (let i = group.length - 1; i > 0; i--) {
1514
- const curIndex = i - 1
1515
- const current = group[curIndex], merge = group[i];
1516
- const helper_data_cache_id = current.getAttribute(`${mapping.parentIndex}`)
1517
- const minmergesplitrowNumber = current.getAttribute('minmergesplitrownumber')
1518
-
1519
- if (!minmergesplitrowNumber) { // 如果合并行丢失或被删除
1520
- const extractContentParent = merge.querySelector('tbody')
1521
- current.querySelector('tbody').appendChild(extractContentParent)
1522
- this.domUtils.removePrentNode(extractContentParent)
1523
- merge.remove()
1524
- continue
1525
- }
1526
-
1527
- const minmergesplitrowNumberMerge = merge.getAttribute('minmergesplitrownumber')
1528
- const comSplitNumber = parseInt(minmergesplitrowNumber) + parseInt(minmergesplitrowNumberMerge) - 1
1529
- if (comSplitNumber) {
1530
- current.setAttribute('minmergesplitrownumber', comSplitNumber)
1531
- } else {
1532
- current.removeAttribute('minmergesplitrownumber')
1533
- }
1534
- if (!prevPage?.querySelector?.(`*[${mapping.tdCacheIndex}="${helper_data_cache_id}"]`) && !secondPage?.querySelector?.(`*[${mapping.tdCacheIndex}="${helper_data_cache_id}"]`)) {
1535
- current.removeAttribute(`${mapping.tdCacheIndex}`) // 'helper_data_cache_id'
1536
- current.removeAttribute('minmergesplitrownumber')
1537
- }
1538
- const bse_dragger = this.bse_dragger
1539
- const colgroups = bse_dragger.getMatchRowOrColAllCell(
1540
- "row",
1541
- minmergesplitrowNumber,
1542
- (splitIndexId, find) => {
1543
- if(find.rowIndex + find.rowSpan == splitIndexId) {
1544
- return "cur";
1545
- }
1546
- },
1547
- current
1548
- );
1549
- const splitSurRow = merge.querySelector('tbody tr')
1550
- if (colgroups && colgroups.cur) {
1551
- for (const td of colgroups.cur) {
1552
- const splitTdDom = bse_dragger.comMatchCellByColIndex(splitSurRow, td.colIndex).matchCell
1553
-
1554
- td.cell.style.height = parseInt(td.cell.style.height) + parseInt(splitTdDom?.style.height) + 'px' // + 2
1555
-
1556
- if (this.domUtils.isInsideBseCaresheetEle(curtPage).isInside) { // 用于记录单分割
1557
- splitTdDom && !this.domUtils.isIdAndNameAndVirtualIdSameSignOrDateString.call(this, td.cell.innerHTML, splitTdDom.innerHTML) && td.cell.insertAdjacentHTML('beforeend', splitTdDom.innerHTML)
1558
- } else {
1559
- splitTdDom && td.cell.insertAdjacentHTML('beforeend', splitTdDom.innerHTML)
1560
- }
1561
- td.cell.setAttribute('rowspan', +td.cell.getAttribute('rowspan') + +splitTdDom?.getAttribute('rowspan') - 1)
1562
- }
1563
- }
1564
- splitSurRow?.remove()
1565
- const extractContentParent = merge.querySelector('tbody')
1566
- current.querySelector('tbody').appendChild(extractContentParent)
1567
- this.domUtils.removePrentNode(extractContentParent)
1568
- merge.remove()
1569
- }
1570
- }
1571
- const groupFragment = groupBy([].slice.call(fragment.querySelectorAll(`:not(table)[${mapping.parentIndex}]`)), g => {
1572
- return g.getAttribute(`${mapping.parentIndex}`)
1573
- })
1574
- for (const [_, group] of Object.entries(groupFragment)) {
1575
- // 分组普通元素
1576
- const tmpParentInx = group[1]?.getAttribute(`tem_${mapping.parentIndex}`) // 保留下页的临时cache
1577
- if (tmpParentInx) {
1578
- group[0].setAttribute(`tem_${mapping.parentIndex}`, tmpParentInx)
1579
- }
1580
-
1581
- let htmlNode = null
1582
- for (const inx in group) {
1583
- if (inx > 0) {
1584
- htmlNode = itorMergeBreakEle(htmlNode, group[inx], mapping)
1585
- } else {
1586
- htmlNode = group[inx]
1587
- }
1588
- }
1589
-
1590
- const helper_data_cache_id = htmlNode.getAttribute(`${mapping.parentIndex}`)
1591
- if (!secondPage?.querySelector?.(`*[${mapping.parentIndex}="${helper_data_cache_id}"]`) && !prevPage?.querySelector?.(`*[${mapping.parentIndex}="${helper_data_cache_id}"]`)) {
1592
- htmlNode.removeAttribute(`${mapping.parentIndex}`)
1593
- }
1594
- // const childEle = htmlNode.querySelector(`*[${mapping.childIndex}]`) || htmlNode
1595
- [htmlNode.querySelector(`*[${mapping.childIndex}]`), htmlNode].forEach((childEle) => {
1596
- if (childEle) {
1597
- const helper_data_cache_child_id = childEle?.getAttribute?.(`${mapping.childIndex}`)
1598
- if (!secondPage?.querySelector?.(`*[${mapping.childIndex}="${helper_data_cache_child_id}"]`) && !prevPage?.querySelector?.(`*[${mapping.childIndex}="${helper_data_cache_child_id}"]`)) {
1599
- childEle?.removeAttribute(`${mapping.childIndex}`)
1600
- }
1601
- }
1602
- })
1603
- }
1604
-
1605
- const groupFragmentVirtual = groupBy([].slice.call(fragment.querySelectorAll(`*[${mapping.virtualIndex}]`)), g => {
1606
- return g.getAttribute(`${mapping.virtualIndex}`)
1607
- })
1608
- for (const [_, group] of Object.entries(groupFragmentVirtual)) {
1609
- let htmlNode = null
1610
- for (const inx in group) {
1611
- if (inx > 0) {
1612
- group[inx].remove()
1613
- } else {
1614
- htmlNode = group[inx]
1615
- }
1616
- }
1617
- const helper_data_virtual_id = htmlNode.getAttribute(`${mapping.virtualIndex}`)
1618
- if (!secondPage?.querySelector?.(`*[${mapping.virtualIndex}="${helper_data_virtual_id}"]`) && !prevPage?.querySelector?.(`*[${mapping.virtualIndex}="${helper_data_virtual_id}"]`)) {
1619
- htmlNode.removeAttribute(`${mapping.virtualIndex}`)
1620
- }
1621
- }
1622
- this.removeBreakPTagSignAndSup(fragment)
1623
- // 返回数据类型
1624
- if (resultHtmlStr) {
1625
- const creDiv = this.document.createElement('summary')
1626
- creDiv.appendChild(fragment)
1627
- return creDiv.innerHTML
1628
- } else {
1629
- return fragment
1630
- }
1631
- }
1632
-
1633
- /** 设置渲染匹配所有测量列表数据 */
1634
- async setAndDrawAllTestListByPageNum(pageNumber = 1, allTestData) {
1635
- return new Promise(reslove => {
1636
- this.temperatureIntance.clearnByPageNumber(pageNumber).then(() => {
1637
- const { temperDataList } = allTestData
1638
- const target = this.getEditorPageByNum(pageNumber).querySelector('.bse-content_editable')
1639
- const treeWalker = this.temperatureIntance.conf.document.createTreeWalker(
1640
- target,
1641
- NodeFilter.SHOW_ELEMENT,
1642
- {
1643
- acceptNode: (node) => {
1644
- const attr = this.domUtils.getElementBseAttr(node)
1645
- return ['temperature/tempAndPulse', 'temperature/pain', 'temperature/legend'].includes(attr.type)
1646
- ? NodeFilter.FILTER_ACCEPT
1647
- : NodeFilter.FILTER_SKIP;
1648
- },
1649
- }
1650
- );
1651
- const configMapping = {
1652
- 'temperature/tempAndPulse': 'splitTempAndPulseConf',
1653
- 'temperature/pain': 'splitPainConf',
1654
- 'temperature/legend': 'signMappingConf'
1655
- }
1656
- while (treeWalker.nextNode()) {
1657
- const cNode = treeWalker.currentNode;
1658
- const { type, ...rest } = this.domUtils.getElementBseAttr(cNode)
1659
- if (type === 'temperature/legend') {
1660
- this.temperatureIntance.conf[configMapping[type]] = rest.signMappingConf
1661
- } else this.temperatureIntance.conf[configMapping[type]] = { ...this.temperatureIntance.conf[configMapping[type]], ...rest }
1662
- }
1663
- /** 数据存储 */
1664
- const temperAttr = encodeURIComponent(JSON.stringify(temperDataList))
1665
- const temperTarget = target.querySelector(`*[_temperData]`)
1666
- if (temperTarget) {
1667
- temperTarget.setAttribute('_temperData', temperAttr)
1668
- } else {
1669
- const div = this.domUtils.createElement("div", { _temperData: temperAttr })
1670
- target.appendChild(div)
1671
- }
1672
- requestAnimationFrame(async () => {
1673
- /** 数据存储 */
1674
- if (temperDataList.length) {
1675
- this.temperatureIntance._renderingLegend(pageNumber)
1676
- this.temperatureIntance._renderingData(pageNumber)
1677
- this.temperatureIntance._renderingWarningLine(pageNumber)
1678
- this.temperatureIntance._renderingPainData(pageNumber)
1679
- this.temperatureIntance._renderingOrClearnBaseInfo(pageNumber)
1680
- }
1681
-
1682
- const footTarget = this.getEditorPageByNum(pageNumber).querySelector('.bse-footer_editable')
1683
- await this.updateReplaceApi(allTestData, footTarget, undefined, true, undefined, undefined, Object.keys(allTestData));
1684
- reslove(true)
1685
- })
1686
- })
1687
- })
1688
-
1689
- }
1690
-
1691
- // 计算元素相对ui位置
1692
- getDomRectRelative(dom, hasIframe = true) {
1693
- const scaleMultiple = this.getOptions().scaleMultiple
1694
- // 根据dom设置位置
1695
- let current = dom,
1696
- top = 0,
1697
- left = 0;
1698
- while (current) {
1699
- let offsetTop = 0, offsetLeft = 0;
1700
- if (current.nodeName === 'svg') {
1701
- const rect = current.getBoundingClientRect();
1702
- offsetTop = rect.top;
1703
- offsetLeft = rect.left;
1704
-
1705
- top += offsetTop - current.scrollTop;
1706
- left += offsetLeft - current.scrollLeft;
1707
- } else if (current.nodeName === 'HTML' && hasIframe) {
1708
- const hiddenLeftscaletemp = current.scrollWidth - current.offsetWidth * scaleMultiple // 负隐藏正结余
1709
- const hiddenLeftscale = hiddenLeftscaletemp > 0 ? hiddenLeftscaletemp / 2 : hiddenLeftscaletemp
1710
- offsetTop = current.offsetTop;
1711
- offsetLeft = hiddenLeftscale / scaleMultiple;
1712
-
1713
- top += offsetTop - current.scrollTop / scaleMultiple;
1714
- left += offsetLeft - current.scrollLeft / scaleMultiple;
1715
- } else {
1716
- offsetTop = current.offsetTop;
1717
- offsetLeft = current.offsetLeft;
1718
-
1719
- top += offsetTop - current.scrollTop;
1720
- left += offsetLeft - current.scrollLeft;
1721
- }
1722
- // 元素位置body默认是offsetParent且匹配不上html
1723
- current = current.nodeName === 'BODY' ? current.parentNode : current.offsetParent;
1724
- }
1725
- left *= scaleMultiple
1726
- top *= scaleMultiple
1727
- if (!hasIframe) {
1728
- return {
1729
- left,
1730
- top
1731
- };
1732
- }
1733
- let iframe = this.iframe;
1734
- while (iframe && iframe.id !== "bse-ui_container") {
1735
- // iframe位置
1736
- top += iframe.offsetTop - iframe.scrollTop;
1737
- left += iframe.offsetLeft - iframe.scrollLeft;
1738
- iframe = iframe.offsetParent;
1739
- }
1740
- return {
1741
- left,
1742
- top
1743
- };
1744
- }
1745
- }
1746
-
1747
- export default Polyfill