xh-lab-rc 0.13.2 → 0.15.0

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import './style.less';
3
3
  interface IndexProps {
4
4
  onSave?: (imgList: any) => void;
5
+ isMultiple?: boolean;
5
6
  }
6
- declare const LabAltimeter: ({ onSave }: IndexProps) => React.JSX.Element;
7
+ declare const LabAltimeter: ({ onSave, isMultiple }: IndexProps) => React.JSX.Element;
7
8
  export default LabAltimeter;
@@ -7,8 +7,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
7
7
  /*
8
8
  * @Author: xqy
9
9
  * @Date: 2024-04-23 13:43:55
10
- * @LastEditors: wusum
11
- * @LastEditTime: 2024-05-11 13:51:03
10
+ * @LastEditors: xqy
11
+ * @LastEditTime: 2024-06-25 18:53:40
12
12
  * @Description: 高拍仪
13
13
  */
14
14
  import { Iconfont } from "../components";
@@ -20,7 +20,9 @@ import React, { useEffect, useState } from 'react';
20
20
  import SetupModal from "./SetupModal";
21
21
  import "./style.less";
22
22
  var LabAltimeter = function LabAltimeter(_ref) {
23
- var onSave = _ref.onSave;
23
+ var onSave = _ref.onSave,
24
+ _ref$isMultiple = _ref.isMultiple,
25
+ isMultiple = _ref$isMultiple === void 0 ? true : _ref$isMultiple;
24
26
  var _useState = useState(false),
25
27
  _useState2 = _slicedToArray(_useState, 2),
26
28
  setUpVisible = _useState2[0],
@@ -413,6 +415,11 @@ var LabAltimeter = function LabAltimeter(_ref) {
413
415
  var selectList = newImgList.filter(function (item) {
414
416
  return item.isChecked === true;
415
417
  }); //选中的文件上传
418
+ //多选/单选区分
419
+ if (!isMultiple && (selectList === null || selectList === void 0 ? void 0 : selectList.length) > 1) {
420
+ message.warning('只能勾选一条数据,请重新选择!');
421
+ return;
422
+ }
416
423
  onSave === null || onSave === void 0 || onSave(selectList);
417
424
  };
418
425
  useEffect(function () {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './style.less';
3
3
  import type { IGtreeProps } from './typing';
4
- declare const LabGroupTree: ({ treeData, GBeforeIcon, showLine, showIcon, isShowNum, treeProperties, onExpand, onSelect, childTitleNode, extraNodeProps, ...restProps }: IGtreeProps) => React.JSX.Element;
4
+ declare const LabGroupTree: ({ treeData, GBeforeIcon, showLine, showIcon, isShowNum, isCustomTree, treeProperties, onExpand, onSelect, childTitleNode, extraNodeProps, ...restProps }: IGtreeProps) => React.JSX.Element;
5
5
  export default LabGroupTree;
@@ -2,26 +2,27 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
- var _excluded = ["treeData", "GBeforeIcon", "showLine", "showIcon", "isShowNum", "treeProperties", "onExpand", "onSelect", "childTitleNode", "extraNodeProps"];
6
+ var _excluded = ["treeData", "GBeforeIcon", "showLine", "showIcon", "isShowNum", "isCustomTree", "treeProperties", "onExpand", "onSelect", "childTitleNode", "extraNodeProps"];
8
7
  /*
9
8
  * @Author: xqy
10
9
  * @Date: 2024-03-18 16:23:10
11
10
  * @LastEditors: xqy
12
- * @LastEditTime: 2024-05-11 11:23:37
11
+ * @LastEditTime: 2024-06-06 15:08:52
13
12
  * @Description:专业组树形
14
13
  */
15
14
  import { Iconfont } from "../components";
16
15
  import { Tree } from 'antd';
17
- import React, { useEffect, useState } from 'react';
16
+ import React, { useMemo } from 'react';
18
17
  import "./style.less";
19
18
  var IconTypes = {
20
19
  '1': 'icon-jian',
21
20
  // 检验专业组
22
21
  '2': 'icon-guan',
23
22
  // 管理专业组
24
- '4': 'icon-ke' // 科室
23
+ '4': 'icon-ke',
24
+ // 科室
25
+ '10': 'icon-lei' //公共分类
25
26
  };
26
27
  var LabGroupTree = function LabGroupTree(_ref) {
27
28
  var _ref$treeData = _ref.treeData,
@@ -46,6 +47,8 @@ var LabGroupTree = function LabGroupTree(_ref) {
46
47
  showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
47
48
  _ref$isShowNum = _ref.isShowNum,
48
49
  isShowNum = _ref$isShowNum === void 0 ? true : _ref$isShowNum,
50
+ _ref$isCustomTree = _ref.isCustomTree,
51
+ isCustomTree = _ref$isCustomTree === void 0 ? false : _ref$isCustomTree,
49
52
  treeProperties = _ref.treeProperties,
50
53
  onExpand = _ref.onExpand,
51
54
  _onSelect = _ref.onSelect,
@@ -53,10 +56,7 @@ var LabGroupTree = function LabGroupTree(_ref) {
53
56
  _ref$extraNodeProps = _ref.extraNodeProps,
54
57
  extraNodeProps = _ref$extraNodeProps === void 0 ? [] : _ref$extraNodeProps,
55
58
  restProps = _objectWithoutProperties(_ref, _excluded);
56
- var _useState = useState([]),
57
- _useState2 = _slicedToArray(_useState, 2),
58
- treeList = _useState2[0],
59
- setTreeList = _useState2[1];
59
+ // const [treeList, setTreeList] = useState([]);
60
60
  //构造标题的结构
61
61
  var customTitle = function customTitle(nodeData) {
62
62
  var NAME = nodeData.NAME,
@@ -128,32 +128,43 @@ var LabGroupTree = function LabGroupTree(_ref) {
128
128
 
129
129
  //递归treeList往树节点添加额外参数
130
130
  var recursTree = function recursTree(data, extraNodeProps) {
131
- if (data && data.length) {
132
- data.map(function (item) {
131
+ if (data && data !== null && data !== void 0 && data.length) {
132
+ var newData = data.map(function (item) {
133
133
  //查找匹配的节点
134
134
  var matchingNode = extraNodeProps.find(function (i) {
135
135
  return i.NODE_TYPE === item.NODE_TYPE;
136
136
  });
137
+ var nodeItem = _objectSpread({}, item);
138
+
139
+ // 匹配的话将额外的属性添加到树节点中
137
140
  if (matchingNode) {
138
- return _objectSpread(_objectSpread(_objectSpread({}, item), matchingNode), {}, {
139
- CHILDREN: recursTree(item.CHILDREN, extraNodeProps)
140
- });
141
- } else {
142
- return _objectSpread(_objectSpread({}, item), {}, {
143
- CHILDREN: recursTree(item.CHILDREN, extraNodeProps)
144
- });
141
+ nodeItem = _objectSpread(_objectSpread({}, item), matchingNode);
145
142
  }
143
+ nodeItem.CHILDREN = recursTree(item.CHILDREN, extraNodeProps);
144
+ return nodeItem;
146
145
  });
146
+ return newData;
147
147
  }
148
148
  return data;
149
149
  };
150
- useEffect(function () {
151
- //是否需要自定义
152
- if (extraNodeProps && extraNodeProps.length) {
150
+ var treeList = useMemo(function () {
151
+ if (!isCustomTree) {
152
+ //默认的4-NODE_TYPE,不可选中
153
+ var labProps = {
154
+ NODE_TYPE: '4',
155
+ selectable: false
156
+ };
157
+ var isExist = extraNodeProps === null || extraNodeProps === void 0 ? void 0 : extraNodeProps.find(function (i) {
158
+ return i.NODE_TYPE === '4';
159
+ });
160
+ if (!isExist || !(extraNodeProps !== null && extraNodeProps !== void 0 && extraNodeProps.length)) {
161
+ //找不到,添加默认值
162
+ extraNodeProps.push(labProps);
163
+ }
153
164
  var newTreeData = recursTree(treeData, extraNodeProps);
154
- setTreeList(newTreeData);
165
+ return newTreeData;
155
166
  }
156
- setTreeList(treeData);
167
+ return treeData;
157
168
  }, [treeData, extraNodeProps]);
158
169
  return /*#__PURE__*/React.createElement(Tree, _extends({
159
170
  rootClassName: "lab-group-tree",
@@ -31,4 +31,6 @@ export interface IGtreeProps {
31
31
  isShowNum?: boolean;
32
32
  /**匹配NODE_TYPE层级,添加除原数据额外的树节点参数 */
33
33
  extraNodeProps?: any;
34
+ /**是否自定义树的数据结构 */
35
+ isCustomTree?: boolean;
34
36
  }
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import './style.less';
3
+ interface PdfViewerProps {
4
+ src: string;
5
+ timeout?: number;
6
+ printSpacingTime?: number;
7
+ onTimeoutCallback?: () => void;
8
+ onBeforePrintCallback?: () => void;
9
+ onAfterPrintCallback?: () => void;
10
+ }
11
+ declare const LabPdfView: ({ src, timeout, printSpacingTime, onBeforePrintCallback, onAfterPrintCallback, onTimeoutCallback, }: PdfViewerProps) => React.JSX.Element;
12
+ export default LabPdfView;
@@ -0,0 +1,98 @@
1
+ /*
2
+ * @Descripttion:
3
+ * @Author: wusum
4
+ * @Date: 2024-04-11 16:50:48
5
+ * @LastEditors: wusum
6
+ * @LastEditTime: 2024-06-05 11:49:19
7
+ */
8
+ import * as React from 'react';
9
+ import { useEffect, useRef } from 'react';
10
+ import "./style.less";
11
+ var LabPdfView = function LabPdfView(_ref) {
12
+ var src = _ref.src,
13
+ _ref$timeout = _ref.timeout,
14
+ timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout,
15
+ _ref$printSpacingTime = _ref.printSpacingTime,
16
+ printSpacingTime = _ref$printSpacingTime === void 0 ? 500 : _ref$printSpacingTime,
17
+ onBeforePrintCallback = _ref.onBeforePrintCallback,
18
+ onAfterPrintCallback = _ref.onAfterPrintCallback,
19
+ onTimeoutCallback = _ref.onTimeoutCallback;
20
+ var pdfIframe = useRef();
21
+ var isTimeout = false;
22
+ var isWork = false;
23
+ var interval, interval1, interval2;
24
+ // 加载完成后,已经可以操作iframeWindow
25
+ // 需要确保pdfjs已经基本完成初始化
26
+ // 采用定时轮询
27
+ var loadSuccessPrint = function loadSuccessPrint() {
28
+ if (isTimeout) return;
29
+ setTimeout(function () {
30
+ if (isTimeout) return;
31
+ isWork = true;
32
+ pdfIframe.current.contentWindow.PDFViewerApplication.triggerPrinting();
33
+ }, printSpacingTime);
34
+ };
35
+ var loadPdfDocument = function loadPdfDocument(iframeWindow) {
36
+ if (iframeWindow.PDFViewerApplication.pdfDocument === null) {
37
+ console.info('Loading pdfDocument...');
38
+ } else {
39
+ console.info('Loading pdfDocument Success!');
40
+ clearInterval(interval2);
41
+ loadSuccessPrint();
42
+ }
43
+ };
44
+ var loadPDFViewerApplication = function loadPDFViewerApplication(iframeWindow) {
45
+ if (isTimeout) return;
46
+ if (iframeWindow.PDFViewerApplication === null) {
47
+ console.info('Loading PDFViewerApplication...');
48
+ } else {
49
+ console.info('Loading PDFViewerApplication Success!');
50
+ clearInterval(interval);
51
+ interval2 = setInterval(function () {
52
+ loadPdfDocument(iframeWindow);
53
+ }, 100);
54
+ }
55
+ };
56
+ useEffect(function () {
57
+ var iframeWindow = pdfIframe.current.contentWindow;
58
+ if (iframeWindow) {
59
+ // 监听iframe中的事件
60
+ iframeWindow.addEventListener('load', function () {
61
+ interval = setInterval(function () {
62
+ loadPDFViewerApplication(iframeWindow);
63
+ }, 100);
64
+ });
65
+ iframeWindow.onbeforeprint = function () {
66
+ onBeforePrintCallback === null || onBeforePrintCallback === void 0 || onBeforePrintCallback();
67
+ };
68
+ iframeWindow.onafterprint = function () {
69
+ onAfterPrintCallback === null || onAfterPrintCallback === void 0 || onAfterPrintCallback();
70
+ };
71
+ //超时
72
+ setTimeout(function () {
73
+ clearInterval(interval);
74
+ clearInterval(interval1);
75
+ clearInterval(interval2);
76
+ isTimeout = true;
77
+ if (isWork) return;
78
+ onTimeoutCallback === null || onTimeoutCallback === void 0 || onTimeoutCallback();
79
+ }, timeout);
80
+ }
81
+ return function () {
82
+ clearInterval(interval);
83
+ clearInterval(interval1);
84
+ clearInterval(interval2);
85
+ };
86
+ }, []);
87
+ return /*#__PURE__*/React.createElement("div", {
88
+ className: "lab-pdf-print"
89
+ }, /*#__PURE__*/React.createElement("iframe", {
90
+ ref: pdfIframe,
91
+ style: {
92
+ width: '100%',
93
+ height: '100%'
94
+ },
95
+ src: "/statics/pdfjs/web/viewer.html?file=".concat(src)
96
+ }));
97
+ };
98
+ export default LabPdfView;
@@ -0,0 +1,10 @@
1
+ .lab-pdf-print {
2
+ display: flex;
3
+ width: 0;
4
+ height: 0;
5
+
6
+ iframe {
7
+ outline: 0;
8
+ border: 0;
9
+ }
10
+ }
@@ -1,21 +1,22 @@
1
1
  import * as React from 'react';
2
- import { SHOWMODE } from './enum/index';
3
2
  import './style.less';
4
3
  interface PdfViewerProps {
5
4
  src: string;
5
+ pdfjsSrc?: string;
6
6
  fileId?: string;
7
7
  showMode: SHOWMODE;
8
8
  isShowCheck?: boolean;
9
9
  checkedKey?: any[];
10
- selectBookMask?: any;
11
- selectedNode?: string[];
10
+ selectedBookId?: any;
12
11
  timeout?: number;
13
- printSpacingTime?: number;
14
- onIdsChange?: (string: any, Array: any) => void;
15
- onChangeBookmarkDatas?: (any: any) => void;
12
+ onCheckingBookIds?: (string: any, Array: any) => void;
13
+ onSelectIngBookmark?: (any: any) => any;
14
+ onGetAllBookmarkDatas?: (any: any) => void;
16
15
  onTimeoutCallback?: () => void;
17
- onBeforePrintCallback?: () => void;
18
- onAfterPrintCallback?: () => void;
19
16
  }
20
- declare const LabPdfView: ({ src, onIdsChange, isShowCheck, checkedKey, selectBookMask, fileId, onChangeBookmarkDatas, onBeforePrintCallback, onAfterPrintCallback, onTimeoutCallback, showMode, timeout, printSpacingTime, }: PdfViewerProps) => React.JSX.Element;
17
+ declare const enum SHOWMODE {
18
+ NormalMode = 0,// 预览模式
19
+ BookMarkMode = 1
20
+ }
21
+ declare const LabPdfView: ({ src, pdfjsSrc, isShowCheck, checkedKey, selectedBookId, fileId, showMode, timeout, onCheckingBookIds, onGetAllBookmarkDatas, onSelectIngBookmark, onTimeoutCallback, }: PdfViewerProps) => React.JSX.Element;
21
22
  export default LabPdfView;