zmdms-webui 2.4.4 → 2.4.6

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.
@@ -1,6 +1,6 @@
1
1
  import { __assign } from '../_virtual/_tslib.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { useRef, useState, useCallback, useMemo, useImperativeHandle } from 'react';
3
+ import { useRef, useState, useCallback, useMemo, useEffect, useImperativeHandle } from 'react';
4
4
  import { Spin } from 'antd';
5
5
  import './components/FilterPopover.js';
6
6
  import CellOverlay from './components/CellOverlay.js';
@@ -112,6 +112,7 @@ function CanvasTable(props) {
112
112
  }), finalDataSource = _z.finalDataSource, hasSummaryRow = _z.hasSummaryRow;
113
113
  // 自动高度计算(需要在容器尺寸计算之前)
114
114
  var autoHeight = useCanvasTableAutoHeight(isAutoScrollY, autoScrollYMarginBottom, canvasTableId);
115
+ console.log("autoHeight", autoHeight);
115
116
  // 监听容器尺寸变化(提前计算,用于列宽自适应)
116
117
  var containerSize = useContainerSize({
117
118
  containerRef: containerRef,
@@ -161,6 +162,14 @@ function CanvasTable(props) {
161
162
  maxScrollLeft: maxScrollLeft,
162
163
  onScroll: onScroll,
163
164
  }), scrollState = _1.scrollState, setScrollState = _1.setScrollState;
165
+ // 使用 ref 保存最新的滚动位置,确保在组件卸载过程中仍能访问
166
+ var scrollPositionRef = useRef({ x: 0, y: 0 });
167
+ useEffect(function () {
168
+ scrollPositionRef.current = {
169
+ x: scrollState.scrollLeft,
170
+ y: scrollState.scrollTop,
171
+ };
172
+ }, [scrollState.scrollLeft, scrollState.scrollTop]);
164
173
  // 数据变化时重置滚动位置(筛选、排序、数据源更新等操作后)
165
174
  useScrollReset({
166
175
  dataSourceLength: dataSource.length,
@@ -421,9 +430,10 @@ function CanvasTable(props) {
421
430
  },
422
431
  /** 获取滚动条位置信息 */
423
432
  getScrollPosition: function () {
433
+ // 返回 ref 中的值,确保在组件卸载过程中仍能获取到最后的滚动位置
424
434
  return {
425
- x: scrollState.scrollLeft,
426
- y: scrollState.scrollTop,
435
+ x: scrollPositionRef.current.x,
436
+ y: scrollPositionRef.current.y,
427
437
  };
428
438
  },
429
439
  /** 获取当前排序状态 */
@@ -455,8 +465,6 @@ function CanvasTable(props) {
455
465
  state.filters,
456
466
  setState,
457
467
  setScrollState,
458
- scrollState.scrollLeft,
459
- scrollState.scrollTop,
460
468
  ]);
461
469
  return (jsx(Spin, __assign({ spinning: loading }, { children: jsxs("div", __assign({ ref: containerRef, id: canvasTableId, className: "canvas-table-container ".concat(className || ""), tabIndex: 0, style: __assign(__assign({}, style), { position: "relative", width: width || "100%", height: containerHeight, overflow: "hidden", touchAction: "none", outline: "none" }) }, { children: [jsx("canvas", { ref: canvasRef, onMouseDown: handleCanvasMouseDown, onMouseMove: handleCanvasMouseMove, onMouseUp: handleCanvasMouseUp, onMouseLeave: handleCanvasMouseLeave, onContextMenu: handleCanvasContextMenu, style: {
462
470
  display: "block",
@@ -409,7 +409,7 @@ interface ICanvasTableProps<RecordType = any> {
409
409
  /**
410
410
  * 表格ref句柄,用于暴露表格的一些方法
411
411
  */
412
- tableRefHandle?: React__default.Ref<ICanvasTableRefHandle | undefined>;
412
+ tableRefHandle?: React__default.MutableRefObject<ICanvasTableRefHandle | undefined>;
413
413
  /**
414
414
  * 导出excel的一些配置
415
415
  */
@@ -40,7 +40,7 @@ var ElectronSignatures = function (props) {
40
40
  // fmsIsElectronicSealPushLabel = '推送银行',
41
41
  _j = props.fmsIsElectronicSealPushLabel,
42
42
  // fmsIsElectronicSealPushLabel = '推送银行',
43
- fmsIsElectronicSealPushLabel = _j === void 0 ? "加盖银行签章" : _j, isSingleQj = props.isSingleQj, _k = props.isQjUseModal, isQjUseModal = _k === void 0 ? true : _k, defaultJustNeedQj = props.defaultJustNeedQj, isDeleteAllFileWhenJustUseQj = props.isDeleteAllFileWhenJustUseQj, _l = props.isShowQysWhenNeedNotQys, isShowQysWhenNeedNotQys = _l === void 0 ? true : _l, _m = props.isControlNeedQys, isControlNeedQys = _m === void 0 ? true : _m, isDeletePlaceholderFileData = props.isDeletePlaceholderFileData, caseId = props.caseId, resetProps = __rest(props, ["request", "isUnControlled", "contractNumFlowIds", "fileUploadProps", "isShowFileUpload", "otherOptions", "fileBaseUrl", "apiBaseUrl", "electronHandleRef", "onValueChange", "isValidateSuccess", "refreshCode", "onCheckedComparison", "onFileTypeChangeGetItem", "tableScroll", "getCreateTimeHand", "isShowElectronBatchBtn", "isShowDownloadBatchBtn", "isShowBatchDeleteBtn", "batchDownloadZipName", "isShowDoubleSignedBatchBtn", "isShowFileType", "isShowFileTypeMerge", "fmsIsElectronicSealLabel", "fmsIsElectronicSealPushLabel", "isSingleQj", "isQjUseModal", "defaultJustNeedQj", "isDeleteAllFileWhenJustUseQj", "isShowQysWhenNeedNotQys", "isControlNeedQys", "isDeletePlaceholderFileData", "caseId"]);
43
+ fmsIsElectronicSealPushLabel = _j === void 0 ? "加盖银行签章" : _j, isSingleQj = props.isSingleQj, _k = props.isQjUseModal, isQjUseModal = _k === void 0 ? true : _k, defaultJustNeedQj = props.defaultJustNeedQj, isDeleteAllFileWhenJustUseQj = props.isDeleteAllFileWhenJustUseQj, _l = props.isShowQysWhenNeedNotQys, isShowQysWhenNeedNotQys = _l === void 0 ? true : _l, _m = props.isControlNeedQys, isControlNeedQys = _m === void 0 ? true : _m, isDeletePlaceholderFileData = props.isDeletePlaceholderFileData, caseId = props.caseId, _o = props.needOrganizationId, needOrganizationId = _o === void 0 ? true : _o, resetProps = __rest(props, ["request", "isUnControlled", "contractNumFlowIds", "fileUploadProps", "isShowFileUpload", "otherOptions", "fileBaseUrl", "apiBaseUrl", "electronHandleRef", "onValueChange", "isValidateSuccess", "refreshCode", "onCheckedComparison", "onFileTypeChangeGetItem", "tableScroll", "getCreateTimeHand", "isShowElectronBatchBtn", "isShowDownloadBatchBtn", "isShowBatchDeleteBtn", "batchDownloadZipName", "isShowDoubleSignedBatchBtn", "isShowFileType", "isShowFileTypeMerge", "fmsIsElectronicSealLabel", "fmsIsElectronicSealPushLabel", "isSingleQj", "isQjUseModal", "defaultJustNeedQj", "isDeleteAllFileWhenJustUseQj", "isShowQysWhenNeedNotQys", "isControlNeedQys", "isDeletePlaceholderFileData", "caseId", "needOrganizationId"]);
44
44
  var selectRows = useRef(null);
45
45
  var onValueChange = useMemoizedFn(function (info) {
46
46
  _onValueChange && _onValueChange(info);
@@ -63,7 +63,7 @@ var ElectronSignatures = function (props) {
63
63
  // 获得部门信息
64
64
  var getDeptInfo = useCheckedSealInfoList$1(request).getDeptInfo;
65
65
  // 达观操作
66
- var _o = useDg(request), compareHandle = _o.compareHandle, lookCompareHandle = _o.lookCompareHandle;
66
+ var _p = useDg(request), compareHandle = _p.compareHandle, lookCompareHandle = _p.lookCompareHandle;
67
67
  // 存储当前点击的选择比对模板的一些参数
68
68
  var dgInfoRef = useRef({});
69
69
  var myCompareHandle = useMemoizedFn(function (templateId) {
@@ -94,7 +94,7 @@ var ElectronSignatures = function (props) {
94
94
  });
95
95
  });
96
96
  // 基础地址
97
- var _p = useBaseContext(), API_BASE_URL = _p.apiBaseUrl, FILE_BASE_URL = _p.fileBaseUrl;
97
+ var _q = useBaseContext(), API_BASE_URL = _q.apiBaseUrl, FILE_BASE_URL = _q.fileBaseUrl;
98
98
  var apiBaseUrl = _apiBaseUrl || API_BASE_URL;
99
99
  var fileBaseUrl = _fileBaseUrl || FILE_BASE_URL;
100
100
  // 将配置分级处理
@@ -122,16 +122,16 @@ var ElectronSignatures = function (props) {
122
122
  return ((resetProps === null || resetProps === void 0 ? void 0 : resetProps.canEdit) + "" === "1" || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.canEdit) === true);
123
123
  }, [resetProps.canEdit]);
124
124
  // 表格是否处于loading中
125
- var _q = useState(), loading = _q[0], setLoading = _q[1];
125
+ var _r = useState(), loading = _r[0], setLoading = _r[1];
126
126
  // 当前是否处于仅需要群杰印章的状态
127
- var _r = useState(defaultJustNeedQj || false), justNeedQj = _r[0], setJustNeedQj = _r[1];
128
- var _s = useState(""), organizationId = _s[0], setOrganizationId = _s[1];
127
+ var _s = useState(defaultJustNeedQj || false), justNeedQj = _s[0], setJustNeedQj = _s[1];
128
+ var _t = useState(""), organizationId = _t[0], setOrganizationId = _t[1];
129
129
  /**
130
130
  * 通过部门Id获得公司id
131
131
  */
132
132
  useEffect(function () {
133
133
  var _deptId = resetProps.deptId;
134
- if (_deptId) {
134
+ if (_deptId && needOrganizationId) {
135
135
  // 调用接口
136
136
  getDeptInfo({
137
137
  id: _deptId,
@@ -167,7 +167,7 @@ var ElectronSignatures = function (props) {
167
167
  var firstDataType = resetProps.dataType || dataTypeSort[0];
168
168
  // 记录下需要处理的所有数据
169
169
  // TODO: 定义allData 类型
170
- var _t = useState({}), allData = _t[0], setAllData = _t[1];
170
+ var _u = useState({}), allData = _u[0], setAllData = _u[1];
171
171
  // 收集修改数据
172
172
  var onTrackChange = useMemoizedFn(function (dataType, data) {
173
173
  setAllData(function (preAllData) {
@@ -180,12 +180,12 @@ var ElectronSignatures = function (props) {
180
180
  });
181
181
  });
182
182
  // 合并数据(数据最终还是要在一个表格中显示)
183
- var _u = useMergeRecords({
183
+ var _v = useMergeRecords({
184
184
  allData: allData,
185
185
  dataTypeSort: dataTypeSort,
186
186
  isDeleteAllFileWhenJustUseQj: isDeleteAllFileWhenJustUseQj,
187
187
  isDeletePlaceholderFileData: isDeletePlaceholderFileData,
188
- }), mergeRecords = _u.mergeRecords, isHiddenColumns = _u.isHiddenColumns;
188
+ }), mergeRecords = _v.mergeRecords, isHiddenColumns = _v.isHiddenColumns;
189
189
  // 附件归属
190
190
  var fileTypeColumns = useFileTypeColumns({
191
191
  records: mergeRecords,
@@ -701,7 +701,7 @@ var ElectronSignatures = function (props) {
701
701
  });
702
702
  },
703
703
  }); }, []);
704
- var _v = allData[firstDataType] || {}, sameTypeRecords = _v.records, setSameTypeRecords = _v.setRecords, parseCurrentUploadFile = _v.parseCurrentUploadFile;
704
+ var _w = allData[firstDataType] || {}, sameTypeRecords = _w.records, setSameTypeRecords = _w.setRecords, parseCurrentUploadFile = _w.parseCurrentUploadFile;
705
705
  function addFile(info, callback) {
706
706
  var _a;
707
707
  var file = info.file;
@@ -362,6 +362,10 @@ interface IElectronSignaturesProps extends IElectronSignaturesItem, IElectronSig
362
362
  * 表格的scroll配置
363
363
  */
364
364
  tableScroll?: any;
365
+ /**
366
+ * 是否需要获取公司id
367
+ */
368
+ needOrganizationId?: string;
365
369
  }
366
370
  /**
367
371
  * 群杰选中数据相关类型
@@ -412,18 +416,18 @@ interface IChangeValue {
412
416
  /** 经济责任人是否选中 */
413
417
  isCheckedEconomic?: boolean;
414
418
  /** 合同ID */
415
- contractId?: IElectronSignaturesItem['contractId'];
419
+ contractId?: IElectronSignaturesItem["contractId"];
416
420
  /** 后台用于维护当前合同id下附件id(key)与文档id(value)的关系map 后台解绑文档时使用 */
417
- docAttachMap?: IElectronSignaturesItem['docAttachMap'];
421
+ docAttachMap?: IElectronSignaturesItem["docAttachMap"];
418
422
  /** 文档id 列表 */
419
- documentIdList?: IElectronSignaturesItem['documentIdList'];
423
+ documentIdList?: IElectronSignaturesItem["documentIdList"];
420
424
  /** 当前盖过章的附件列表 */
421
- checkAttachIdList?: IElectronSignaturesItem['checkAttachIdList'];
425
+ checkAttachIdList?: IElectronSignaturesItem["checkAttachIdList"];
422
426
  fileList?: any;
423
427
  /** 当前群杰印章相关数据 */
424
- qunjSeal?: IElectronSignaturesItem['qunjSeal'];
428
+ qunjSeal?: IElectronSignaturesItem["qunjSeal"];
425
429
  /** 当前群杰盖章地点发生改变 */
426
- qunjAddress?: IElectronSignaturesItem['qunjAddress'];
430
+ qunjAddress?: IElectronSignaturesItem["qunjAddress"];
427
431
  /** 合同份数是否合理 */
428
432
  qunjCountIsValidate?: boolean;
429
433
  }
@@ -494,7 +498,7 @@ interface IFileUploadProps {
494
498
  onFileChange?: any;
495
499
  children?: React.ReactNode;
496
500
  multiple?: boolean;
497
- type?: ButtonProps['type'];
501
+ type?: ButtonProps["type"];
498
502
  }
499
503
 
500
504
  export { IChangeValue, ICheckQunjItemProps, IElectronSignaturesItem, IElectronSignaturesItemPublic, IElectronSignaturesProps, IFileFieldsName, IFileItem, IFileUploadProps, IQunjProps };
@@ -1,53 +1,53 @@
1
1
  var FILE_FIELDS_NAME = {
2
2
  /** 附件id */
3
- attachId: 'attachId',
3
+ attachId: "attachId",
4
4
  /** 附件名 */
5
- attachName: 'attachName',
5
+ attachName: "attachName",
6
6
  /** 上一版附件id */
7
- oldVersionId: 'oldVersionId',
7
+ oldVersionId: "oldVersionId",
8
8
  /** 上一版附件名 */
9
- oldVersionName: 'oldVersionName',
9
+ oldVersionName: "oldVersionName",
10
10
  /** 附件大小 bite */
11
- attachSize: 'attachSize',
11
+ attachSize: "attachSize",
12
12
  /** 附件类型code */
13
- attachType: 'attachType',
13
+ attachType: "attachType",
14
14
  /** 附件类型名 */
15
- attachTypeName: 'attachTypeName',
15
+ attachTypeName: "attachTypeName",
16
16
  /** 是否存入样板 */
17
- isCustomerReference: 'isCustomerReference',
17
+ isCustomerReference: "isCustomerReference",
18
18
  /** 模板附件id */
19
- templateAttachId: 'templateAttachId',
19
+ templateAttachId: "templateAttachId",
20
20
  /** 模板附件名 */
21
- templateAttachName: 'templateAttachName',
21
+ templateAttachName: "templateAttachName",
22
22
  /** 模板附件大小 */
23
- templateAttachSize: 'templateAttachSize',
23
+ templateAttachSize: "templateAttachSize",
24
24
  /** 比对结果附件id */
25
- compareAttachId: 'compareAttachId',
25
+ compareAttachId: "compareAttachId",
26
26
  /** 比对结果附件名 */
27
- compareAttachName: 'compareAttachName',
27
+ compareAttachName: "compareAttachName",
28
28
  /** 比对结果附件大小 */
29
- compareAttachSize: 'compareAttachSize',
29
+ compareAttachSize: "compareAttachSize",
30
30
  /** 是否添加水印 */
31
- isWatermark: 'isWatermark',
31
+ isWatermark: "isWatermark",
32
32
  /** 是否加盖电子印章 */
33
- isElectronicSeal: 'isElectronicSeal',
33
+ isElectronicSeal: "isElectronicSeal",
34
34
  /** 样板号 */
35
- templateCrNo: 'templateCrNo',
35
+ templateCrNo: "templateCrNo",
36
36
  /** 外部客户产融平台电子印章 */
37
- fmsIsElectronicSeal: 'fmsIsElectronicSeal',
37
+ fmsIsElectronicSeal: "fmsIsElectronicSeal",
38
38
  /** 是否展示外部客户产融平台电子印章勾选框 */
39
- showFmsIsElectronicSeal: 'showFmsIsElectronicSeal',
40
- showFmsIsPushBank: 'showFmsIsPushBank',
39
+ showFmsIsElectronicSeal: "showFmsIsElectronicSeal",
40
+ showFmsIsPushBank: "showFmsIsPushBank",
41
41
  /** 双签件 */
42
- doubleSignedSealInfoDTOList: 'doubleSignedSealInfoDTOList',
42
+ doubleSignedSealInfoDTOList: "doubleSignedSealInfoDTOList",
43
43
  /** 是否推送银行 */
44
- fmsIsPushBank: 'fmsIsPushBank',
44
+ fmsIsPushBank: "fmsIsPushBank",
45
45
  /** 是否添加群杰印章信息 */
46
- isQunj: 'isQunj',
46
+ isQunj: "isQunj",
47
47
  /** 群杰印章盖章地点 */
48
- qunjAddress: 'qunjAddress',
48
+ qunjAddress: "qunjAddress",
49
49
  /** 群杰印章信息 */
50
- qunjSeal: 'qunjSeal',
50
+ qunjSeal: "qunjSeal",
51
51
  };
52
52
 
53
53
  export { FILE_FIELDS_NAME };
@@ -193,6 +193,8 @@ var Table = function (props) {
193
193
  });
194
194
  // 表格验证
195
195
  var _y = useTableValidate(), tableRef = _y.tableRef, getCurrentTable = _y.getCurrentTable, clearErrorClass = _y.clearErrorClass;
196
+ // 使用 ref 缓存最新的滚动位置,确保在组件卸载过程中仍能访问
197
+ var scrollPositionRef = useRef({ x: 0, y: 0 });
196
198
  // 滚动条控制方法
197
199
  var scrollToPosition = useMemoizedFn(function (options) {
198
200
  var _a;
@@ -235,14 +237,17 @@ var Table = function (props) {
235
237
  var _a;
236
238
  var tableBody = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".ant-table-body");
237
239
  if (tableBody) {
238
- return {
240
+ // 更新 ref 缓存
241
+ scrollPositionRef.current = {
239
242
  x: tableBody.scrollLeft,
240
243
  y: tableBody.scrollTop,
241
244
  };
245
+ return scrollPositionRef.current;
242
246
  }
247
+ // 如果 DOM 已销毁,返回最后缓存的位置
243
248
  return {
244
- x: 0,
245
- y: 0,
249
+ x: scrollPositionRef.current.x,
250
+ y: scrollPositionRef.current.y,
246
251
  };
247
252
  });
248
253
  // 虚拟滚动选项
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",