ztxkui 3.9.8 → 3.9.10

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.
@@ -29,7 +29,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
29
29
  * @author 陈亚雄
30
30
  * @description 电子签章组件
31
31
  */
32
- import React, { useImperativeHandle, useCallback, useState, useMemo, useEffect, } from 'react';
32
+ import React, { useImperativeHandle, useCallback, useState, useMemo, useEffect, useRef, } from 'react';
33
33
  // redux
34
34
  // ztxkui公共组件
35
35
  import { Table, Upload, message, Button, Modal, Checkbox, Form, } from '../../../index';
@@ -111,6 +111,11 @@ var Sinatures = function (_a) {
111
111
  var _t = useState(false), tbloading = _t[0], setTbLoading = _t[1];
112
112
  // 仅需要群杰印章
113
113
  var _u = useState(false), isOnlyQj = _u[0], setIsOnlyQj = _u[1];
114
+ // 存放onSigValuesChange缓存回调方法
115
+ var fnRef = useRef();
116
+ useEffect(function () {
117
+ fnRef.current = onSigValuesChange;
118
+ }, [onSigValuesChange]);
114
119
  useEffect(function () {
115
120
  // 是否有勾选加盖电子印章
116
121
  if (isInit) {
@@ -232,6 +237,11 @@ var Sinatures = function (_a) {
232
237
  fileList.filter(function (item) { return item.isElectronicSeal; }).length > 0) {
233
238
  setCheckSealVisible(true);
234
239
  }
240
+ // 判断入参fileList中是否有仅需要群杰
241
+ if (Array.isArray(fileList) &&
242
+ fileList.some(function (item) { return item.attachId === '123456789'; })) {
243
+ setIsOnlyQj(true);
244
+ }
235
245
  }, [fileList]);
236
246
  useEffect(function () {
237
247
  if (needQys) {
@@ -620,7 +630,7 @@ var Sinatures = function (_a) {
620
630
  // 上传组件的数据
621
631
  var _v = useState(), originFileList = _v[0], setOriginFileList = _v[1];
622
632
  /** 签章组件onChange事件 */
623
- var sigValuesChange = function (type, value) {
633
+ var sigValuesChange = useCallback(function (type, value) {
624
634
  var _a, _b;
625
635
  var info = (_b = (_a = handleRef === null || handleRef === void 0 ? void 0 : handleRef.current) === null || _a === void 0 ? void 0 : _a.getData) === null || _b === void 0 ? void 0 : _b.call(_a);
626
636
  if (type === 'clearContractPrevInfo') {
@@ -641,7 +651,7 @@ var Sinatures = function (_a) {
641
651
  info[type] = value;
642
652
  }
643
653
  return __assign(__assign({}, otherParams), info);
644
- };
654
+ }, [handleRef, otherParams]);
645
655
  // 是否存入样板 添加水印 电子印章发生改变触发事件
646
656
  function onSwitchChangeHandle(value, type, index) {
647
657
  if (type === 'isElectronicSeal') {
@@ -696,20 +706,22 @@ var Sinatures = function (_a) {
696
706
  });
697
707
  });
698
708
  console.log(successFileList_1);
709
+ var getNewRecord_2 = function (data) {
710
+ if (data === void 0) { data = []; }
711
+ var newRecords = __spreadArray(__spreadArray([], data), successFileList_1).filter(function (item) { return item.attachId !== '123456789'; });
712
+ return newRecords;
713
+ };
699
714
  setRecords(function (preRecords) {
700
- var _records = __spreadArray(__spreadArray([], preRecords), successFileList_1).filter(function (item) { return item.attachId !== '123456789'; });
701
- if (onSigValuesChange) {
702
- onSigValuesChange(sigValuesChange('fileList', _records));
703
- }
704
- return _records;
715
+ return getNewRecord_2(preRecords);
705
716
  });
717
+ if (typeof fnRef.current === 'function') {
718
+ fnRef.current(sigValuesChange('fileList', getNewRecord_2(records)));
719
+ }
706
720
  }
707
721
  if (filelist.every(function (item) { return item.status === 'error'; })) {
708
722
  message.error('文件上传失败!');
709
723
  }
710
- },
711
- // eslint-disable-next-line react-hooks/exhaustive-deps
712
- [setRecords]);
724
+ }, [records, setRecords, sigValuesChange]);
713
725
  /** 群杰印章修改 */
714
726
  function qunjSealChangeHandle(value) {
715
727
  qunjSealChange && qunjSealChange(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.9.8",
3
+ "version": "3.9.10",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",