ztxkui 3.8.1 → 3.8.3

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/dist/Demo.js CHANGED
@@ -6,7 +6,7 @@ var selectStyle = { width: '200px' };
6
6
  function request(options) {
7
7
  return fetch(options.url + "?" + stringify(options.params), {
8
8
  headers: {
9
- 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6bnVsbCwicmVhbF9uYW1lIjoi6ZmI5Lqa6ZuEIiwiY2xpZW50X3R5cGUiOiJ3ZWIiLCJkYXRhX3JvbGVfaWQiOiIxMzQzNDkwNjg2MjYwMjI4MDk3LDEzNDU5Nzg1MDUzMDIwNTY5NjIsMTQ2ODAzNTM1MTYyNTI4NTYzNCwxNTQyMDc2MzA4NTc4MDI1NDc0IiwiY2xpZW50X2lkIjoic3dvcmQiLCJ1c2VyX3R5cGUiOiJ3ZWIiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSwxNDY3MDE1OTc1NDg0NzYwMDY2LDE0NjgwMzQ0MzcxNTc5NjE3MjksMTQ4MDgyOTMzNzkzOTEzMjQxNyIsInBvc3RfbmFtZSI6bnVsbCwic2NvcGUiOlsiYWxsIl0sImludGVydmlld19pZCI6bnVsbCwiZXhwIjoxNjU4NDc2NTY5LCJvcmdfbmFtZSI6bnVsbCwianRpIjoiMGI2OWZjMTYtODhkMS00YjIxLWIwMWEtYzFkY2Y0MjVmZGVlIiwibWVtYmVyX2lkIjoxLCJjb21wYW55X2lkIjpudWxsLCJzeXN0ZW1faWQiOm51bGw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(response) { return response.json(); });
@@ -23,6 +23,9 @@ function Demo() {
23
23
  tenantId: '000000',
24
24
  isCreateUser: 0,
25
25
  })[0];
26
+ var _g = useState(JSON.stringify({
27
+ status: 50,
28
+ })), params1 = _g[0], setParams1 = _g[1];
26
29
  // 模拟接口请求
27
30
  useEffect(function () {
28
31
  var timeoutId = setTimeout(function () {
@@ -91,23 +94,28 @@ function Demo() {
91
94
  console.log(value, option, fullData);
92
95
  } }),
93
96
  React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E"),
94
- React.createElement(EnhanceSelect, { style: selectStyle, url: "http://192.168.0.83:8000/api/zmdms-user/page", params: JSON.stringify({
95
- status: 50,
96
- companyId: '1397074605412696066',
97
- }), request: request, joinKey: "depName" }),
98
97
  React.createElement("h2", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E\uFF0C\u5E76\u7F13\u5B58\u6570\u636E"),
99
- React.createElement(EnhanceSelect, { style: selectStyle, url: "http://192.168.0.83:8000/api/zmdms-user/page", params: JSON.stringify({
100
- status: 50,
101
- companyId: '1397074605412696066',
102
- }), request: request, isCatch: true }),
103
98
  React.createElement("h2", null, "\u8FDC\u7A0B\u6A21\u7CCA\u641C\u7D22"),
104
99
  React.createElement("button", { onClick: function () { return setValue('1462433051208762629'); } }, "\u4FEE\u6539"),
100
+ React.createElement("p", null, "\u8FDC\u7A0B\u641C\u7D22"),
105
101
  React.createElement(EnhanceSelect, { style: selectStyle,
106
102
  // defaultList={list}
107
103
  placeholder: "\u53EF\u8FDC\u7A0B\u6A21\u7CCA\u641C\u7D22", url: "http://192.168.0.83:8000/api/zmdms-system/employee/page", request: request, remoteSearch: true, isHandAddItem: true, isRemoteSearchDataKey: false, dataKey: "id", titleKey: "empName", value: value, showAll: true, onChange: function (value, option, fullData) {
108
104
  setValue(value);
109
105
  }, params: JSON.stringify(params),
110
106
  // value={value}
111
- mode: "multiple", isPage: true })));
107
+ mode: "multiple", isPage: true,
108
+ // defaultList={defaultList}
109
+ isClickRequest: true }),
110
+ React.createElement("p", null, "\u4E00\u6B21\u6027\u52A0\u8F7D\u6570\u636E"),
111
+ React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u4E00\u6B21\u6027\u52A0\u8F7D\u6570\u636E", url: "http://192.168.0.83:8000/api/zmdms-system/company/list", request: request, dataKey: "id", titleKey: "name", isClickRequest: true }),
112
+ React.createElement("p", null, "\u5F02\u6B65\u83B7\u53D6\u6570\u636E"),
113
+ React.createElement("button", { onClick: function () {
114
+ setParams1(JSON.stringify({
115
+ status: 50,
116
+ companyId: '1414851965111283713',
117
+ }));
118
+ } }, "\u4FEE\u6539"),
119
+ React.createElement(EnhanceSelect, { style: selectStyle, placeholder: "\u5F02\u6B65\u83B7\u53D6\u6570\u636E", url: "http://192.168.0.83:8000/api/zmdms-user/page", params: params1, request: request, joinKey: "depName", dataKey: "id", titleKey: "name", remoteSearch: true, isRemoteSearchDataKey: false, isClickRequest: true })));
112
120
  }
113
121
  export default Demo;
@@ -56,6 +56,7 @@ function BasicDemo() {
56
56
  dayjs('2022-05-31'),
57
57
  ]), rangeValue = _b[0], setRangeValue = _b[1];
58
58
  var _c = useState(false), loading = _c[0], setLoading = _c[1];
59
+ var _d = useState(), iValue = _d[0], setIValue = _d[1];
59
60
  return (React.createElement(Container, { loading: loading, isFlex: true },
60
61
  React.createElement(Button, { onClick: function () {
61
62
  setLoading(true);
@@ -176,6 +177,8 @@ function BasicDemo() {
176
177
  } }, "\u8DF3\u8F6C"),
177
178
  React.createElement(Button, { type: "link", onClick: function () {
178
179
  console.log(111);
179
- }, showCopy: true }, "\u6211\u662F\u4E00\u4E2A\u94FE\u63A51111111111111111111")));
180
+ console.log(iValue);
181
+ }, showCopy: true }, "\u6211\u662F\u4E00\u4E2A\u94FE\u63A51111111111111111111"),
182
+ React.createElement(Input, { value: iValue, onChange: function (e) { return setIValue(e.target.value); } })));
180
183
  }
181
184
  export default BasicDemo;
@@ -130,6 +130,7 @@ var FormDemo = function () {
130
130
  React.createElement(SearchRight, { onSearchHandle: function () {
131
131
  var _a;
132
132
  (_a = handleRef.current) === null || _a === void 0 ? void 0 : _a.setToggleHandle(false);
133
+ console.log(form.getFieldsValue());
133
134
  }, onResetHandle: function () { } })))));
134
135
  };
135
136
  export default FormDemo;
@@ -588,14 +588,16 @@ var TableDemo = function () {
588
588
  },
589
589
  },
590
590
  {
591
- title: '编辑字段1',
591
+ title: '编辑字段11',
592
592
  width: 220,
593
593
  dataIndex: 'test3',
594
594
  key: 'test3',
595
595
  // 普通的输入框
596
596
  editable: true,
597
+ required: true,
597
598
  validate: {
598
599
  validate: function (value, record, index, title) {
600
+ console.log(value);
599
601
  if (Object.keys(tableConfig).length === 2 || !value) {
600
602
  return Promise.reject({
601
603
  errorFields: [
@@ -916,7 +918,7 @@ var TableDemo = function () {
916
918
  // initColumns={columns}
917
919
  columns: columns, dataSource: records, rowKey: "id", tableHandleRef: tableHandleRef,
918
920
  // 配置表格列
919
- configInfo: tableConfig,
921
+ // configInfo={tableConfig}
920
922
  // 添加动态列配置
921
923
  showColumnDynamic: true, showColumnDynamicKey: "testkey",
922
924
  // onDynamicChange={onDynamicChange}
@@ -127,6 +127,10 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
127
127
  * 是否需要选中复制到剪切板
128
128
  */
129
129
  isCopy?: boolean;
130
+ /**
131
+ * 是否点击时才请求
132
+ */
133
+ isClickRequest?: boolean;
130
134
  }
131
135
  /**
132
136
  * 增强下拉框功能组件
@@ -143,6 +147,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
143
147
  * { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
144
148
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
145
149
  */
146
- declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, ...restProps }: IProps<VT>): JSX.Element;
150
+ declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, ...restProps }: IProps<VT>): JSX.Element;
147
151
  declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
148
152
  export default _default;
@@ -100,7 +100,7 @@ function textContent(children) {
100
100
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
101
101
  */
102
102
  function EnhanceSelect(_a) {
103
- var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 60000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus"]);
103
+ var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 60000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, isClickRequest = _a.isClickRequest, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest"]);
104
104
  var currentClick = useRef(true);
105
105
  // 下拉数据源
106
106
  var _k = useFetchState([]), selectList = _k[0], setSelectList = _k[1];
@@ -124,6 +124,8 @@ function EnhanceSelect(_a) {
124
124
  var _u = useState(0), count = _u[0], setCount = _u[1];
125
125
  // 手动清空数据
126
126
  var handleClearDataRef = useRef(false);
127
+ // 是否自动请求
128
+ var isAutoRequest = useRef(false); // 请求过了
127
129
  // 处理value
128
130
  var newValue = useMemo(function () {
129
131
  var _a, _b;
@@ -370,24 +372,18 @@ function EnhanceSelect(_a) {
370
372
  }
371
373
  }, [list, setSelectList]);
372
374
  // 2、如果是走接口请求的,url必须传递
373
- useEffect(function () {
375
+ var sendRequest = useCallback(function () {
374
376
  if (!url || remoteSearch) {
375
377
  return;
376
378
  }
377
- // console.log('TEST: 异步获取');
378
379
  if (isCatch) {
379
- // 如果是走缓存的话,那么先往缓存数据中取,有没有当前数据,如果没有就发请求
380
380
  if (enhanceSelectCatchObj) {
381
381
  enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
382
382
  ? enhanceSelectCatchObj[url]
383
383
  : {};
384
384
  var catchData = enhanceSelectCatchObj[url];
385
385
  var catchDataKey = params ? JSON.stringify(params) : 'single';
386
- if (catchData[catchDataKey]) {
387
- // 读取缓存数据
388
- setSelectList(catchData[catchDataKey]);
389
- }
390
- else {
386
+ if (!catchData[catchDataKey]) {
391
387
  // 发送接口请求,并设置缓存数据
392
388
  getDataHandle(request, { url: url, params: params, method: method, timeout: timeout }, {
393
389
  appointObj: {
@@ -399,7 +395,6 @@ function EnhanceSelect(_a) {
399
395
  }
400
396
  }
401
397
  else {
402
- // 直接发送接口请求
403
398
  getDataHandle(request, {
404
399
  url: url,
405
400
  params: params,
@@ -408,19 +403,119 @@ function EnhanceSelect(_a) {
408
403
  });
409
404
  }
410
405
  }, [
411
- url,
412
- params,
406
+ getDataHandle,
407
+ isCatch,
413
408
  method,
414
- timeout,
409
+ params,
415
410
  request,
411
+ timeout,
412
+ url,
413
+ remoteSearch,
414
+ ]);
415
+ useEffect(function () {
416
+ if (!url || remoteSearch) {
417
+ return;
418
+ }
419
+ // console.log('TEST: 异步获取');
420
+ if (isCatch) {
421
+ // 如果是走缓存的话,那么先往缓存数据中取,有没有当前数据,如果没有就发请求
422
+ if (enhanceSelectCatchObj) {
423
+ enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
424
+ ? enhanceSelectCatchObj[url]
425
+ : {};
426
+ var catchData = enhanceSelectCatchObj[url];
427
+ var catchDataKey = params ? JSON.stringify(params) : 'single';
428
+ if (catchData[catchDataKey]) {
429
+ // 读取缓存数据
430
+ setSelectList(catchData[catchDataKey]);
431
+ }
432
+ else {
433
+ if (isClickRequest) {
434
+ isAutoRequest.current = false;
435
+ return;
436
+ }
437
+ // 发送接口请求,并设置缓存数据
438
+ sendRequest();
439
+ // getDataHandle(
440
+ // request,
441
+ // { url, params, method, timeout },
442
+ // {
443
+ // appointObj: {
444
+ // obj: catchData,
445
+ // key: catchDataKey,
446
+ // },
447
+ // }
448
+ // );
449
+ }
450
+ }
451
+ }
452
+ else {
453
+ if (isClickRequest) {
454
+ return;
455
+ }
456
+ // 直接发送接口请求
457
+ sendRequest();
458
+ // getDataHandle(request, {
459
+ // url,
460
+ // params,
461
+ // method,
462
+ // timeout,
463
+ // });
464
+ }
465
+ }, [
466
+ // url,
467
+ // params,
468
+ // method,
469
+ // timeout,
470
+ // request,
471
+ // isCatch,
472
+ // setSelectList,
473
+ // getDataHandle,
474
+ // remoteSearch,
416
475
  isCatch,
417
- setSelectList,
418
- getDataHandle,
476
+ isClickRequest,
477
+ params,
419
478
  remoteSearch,
479
+ sendRequest,
480
+ setSelectList,
481
+ url,
420
482
  ]);
421
483
  // 3、远程搜索,url必须传递
422
484
  // 关于远程查询,最好的做法还是后台根据主键再去查一次详情数据,这样就能保证
423
485
  // 查出来的数据就能保证不止一条
486
+ var sendRemoteRequest = useCallback(function () {
487
+ if (!url || !remoteSearch) {
488
+ return;
489
+ }
490
+ if (firstLoading) {
491
+ // console.log('已经通过id访问了');
492
+ return;
493
+ }
494
+ if (!isRemoteSearchDataKey) {
495
+ setFirstLoading(true);
496
+ return;
497
+ }
498
+ if (!restProps.value) {
499
+ // console.log('第一次请求数据');
500
+ getRemoteDataHandle('', '');
501
+ }
502
+ else {
503
+ if (typeof restProps.value === 'string' ||
504
+ (Array.isArray(restProps.value) && restProps.value.length > 0)) {
505
+ // console.log('第二次请求数据,默认为需要根据主键去请求', restProps.value);
506
+ setFirstLoading(true);
507
+ getRemoteDataHandle('', restProps.value);
508
+ }
509
+ }
510
+ }, [
511
+ url,
512
+ remoteSearch,
513
+ firstLoading,
514
+ isRemoteSearchDataKey,
515
+ setFirstLoading,
516
+ restProps.value,
517
+ getRemoteDataHandle,
518
+ ]);
424
519
  useEffect(function () {
425
520
  if (!url || !remoteSearch) {
426
521
  return;
@@ -437,6 +532,10 @@ function EnhanceSelect(_a) {
437
532
  setFirstLoading(true);
438
533
  return;
439
534
  }
535
+ if (isClickRequest) {
536
+ isAutoRequest.current = false;
537
+ return;
538
+ }
440
539
  if (!restProps.value) {
441
540
  // console.log('第一次请求数据');
442
541
  getRemoteDataHandle('', '');
@@ -457,11 +556,33 @@ function EnhanceSelect(_a) {
457
556
  firstLoading,
458
557
  isRemoteSearchDataKey,
459
558
  setFirstLoading,
559
+ isClickRequest,
560
+ ]);
561
+ var sendRemoteRequest1 = useCallback(function () {
562
+ if (!url || !remoteSearch) {
563
+ return;
564
+ }
565
+ // console.log('TEST: 远程搜索');
566
+ // 这种情况不需要启用远程搜索key值
567
+ if (!isRemoteSearchDataKey) {
568
+ getRemoteDataHandle('', '');
569
+ setFirstLoading(true);
570
+ }
571
+ }, [
572
+ url,
573
+ remoteSearch,
574
+ setFirstLoading,
575
+ getRemoteDataHandle,
576
+ isRemoteSearchDataKey,
460
577
  ]);
461
578
  useEffect(function () {
462
579
  if (!url || !remoteSearch) {
463
580
  return;
464
581
  }
582
+ if (isClickRequest) {
583
+ isAutoRequest.current = false;
584
+ return;
585
+ }
465
586
  // console.log('TEST: 远程搜索');
466
587
  // 这种情况不需要启用远程搜索key值
467
588
  if (!isRemoteSearchDataKey) {
@@ -474,6 +595,7 @@ function EnhanceSelect(_a) {
474
595
  setFirstLoading,
475
596
  getRemoteDataHandle,
476
597
  isRemoteSearchDataKey,
598
+ isClickRequest,
477
599
  ]);
478
600
  // 数据合并
479
601
  function concatData(originalData, newData) {
@@ -663,13 +785,13 @@ function EnhanceSelect(_a) {
663
785
  };
664
786
  // 焦点事件
665
787
  var onFocusHandle = function (e) {
666
- // console.log('焦点事件');
788
+ console.log('焦点事件');
667
789
  setIsOpen(true);
668
790
  currentClick.current = false;
669
791
  onFocus && onFocus(e);
670
792
  };
671
793
  var onBlurHandle = function (e) {
672
- // console.log('失去焦点事件');
794
+ console.log('失去焦点事件');
673
795
  setIsOpen(false);
674
796
  currentClick.current = false;
675
797
  onBlur && onBlur(e);
@@ -700,6 +822,12 @@ function EnhanceSelect(_a) {
700
822
  // 点击时
701
823
  var onClickHandle = function (e) {
702
824
  // console.log('点击事件', currentClick.current);
825
+ if (!isAutoRequest.current && isClickRequest) {
826
+ isAutoRequest.current = true;
827
+ sendRequest();
828
+ sendRemoteRequest();
829
+ sendRemoteRequest1();
830
+ }
703
831
  if (currentClick.current) {
704
832
  console.log(e.nativeEvent.target.getAttribute('class'));
705
833
  var className = '';
@@ -734,6 +862,10 @@ function EnhanceSelect(_a) {
734
862
  };
735
863
  return (React.createElement(Select, __assign({ defaultValue: showAll ? '' : undefined, allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : onSearchHandleInner, onChange: onChangeHandle, optionLabelProp: "title", loading: loading, onFocus: onFocusHandle, onBlur: onBlurHandle, onClear: onClearHandle, onSelect: onSelectHandle, onClick: onClickHandle,
736
864
  // getPopupContainer={(trigger) => trigger || document.body}
737
- open: isOpen, onPopupScroll: onPopupScrollHandle }, restProps, { value: newValue, disabled: remoteSearch ? restProps.disabled : loading || restProps.disabled }), renderSelectOption()));
865
+ open: isOpen, onPopupScroll: onPopupScrollHandle }, restProps, { value: newValue,
866
+ // 这里需要注释掉,因为修改了一部分逻辑
867
+ disabled: remoteSearch || isClickRequest
868
+ ? restProps.disabled
869
+ : loading || restProps.disabled }), renderSelectOption()));
738
870
  }
739
871
  export default memo(EnhanceSelect);
@@ -14,6 +14,11 @@ import Modal from '../Modal';
14
14
  import { Input as AntInput } from 'antd';
15
15
  import classNames from 'classnames';
16
16
  function Input(props) {
17
+ // const onBlur = (e) => {
18
+ // props.onBlur && props.onBlur(e);
19
+ // e.target.value = e.target.value.trim();
20
+ // props.onChange && props.onChange(e);
21
+ // };
17
22
  return React.createElement(AntInput, __assign({}, props));
18
23
  }
19
24
  var TextArea = React.forwardRef(function (props, ref) {
@@ -40,12 +40,6 @@ var DgColumns = function (_a) {
40
40
  return newRecords;
41
41
  });
42
42
  }
43
- /** 获取taskId */
44
- var getTaskId = function (id, index) {
45
- handleRef.current.setTemplateData({
46
- taskId: id,
47
- }, index);
48
- };
49
43
  var dgColumns = [
50
44
  {
51
45
  title: '存入样板',
@@ -74,7 +68,7 @@ var DgColumns = function (_a) {
74
68
  key: 'compareAttachId',
75
69
  fixed: 'left',
76
70
  render: function (text, record, index) {
77
- return record.attachType === '001' ? (React.createElement(CompareResult, { record: record, index: index, request: request, getTaskId: getTaskId, isEdit: isEdit })) : ('');
71
+ return record.attachType === '001' ? (React.createElement(CompareResult, { record: record, index: index, request: request })) : ('');
78
72
  },
79
73
  },
80
74
  ];
@@ -7,8 +7,6 @@ interface IProps {
7
7
  record: any;
8
8
  index: number;
9
9
  request?: any;
10
- getTaskId: (id: any, index: number) => void;
11
- isEdit: boolean;
12
10
  }
13
11
  declare const CompareResult: React.FC<IProps>;
14
12
  export default CompareResult;
@@ -7,7 +7,7 @@ import React, { useState } from 'react';
7
7
  // ztxkui公共组件
8
8
  import { Button, message } from '../../../../index';
9
9
  var CompareResult = function (_a) {
10
- var record = _a.record, index = _a.index, request = _a.request, isEdit = _a.isEdit, getTaskId = _a.getTaskId;
10
+ var record = _a.record, index = _a.index, request = _a.request;
11
11
  // 设置查看比对结果按钮的loading状态
12
12
  var _b = useState(false), resultLoading = _b[0], setResultLoading = _b[1];
13
13
  var viewCompareResult = function () {
@@ -25,6 +25,8 @@ interface IProps {
25
25
  /** 查看盖章页面 */
26
26
  viewSealPageFn: any;
27
27
  showContranctNum: boolean;
28
+ request: any;
29
+ needSaveTemplate: boolean;
28
30
  }
29
31
  declare const _default: React.NamedExoticComponent<IProps>;
30
32
  export default _default;
@@ -15,10 +15,12 @@ var __assign = (this && this.__assign) || function () {
15
15
  };
16
16
  import React, { memo } from 'react';
17
17
  import { Table, Button } from '../../../../index';
18
+ import { Switch } from 'antd';
18
19
  // 自定义组件
19
20
  import AttachOperation from './AttachOperation';
21
+ import CompareResult from './CompareResult';
20
22
  var DetailTable = function (_a) {
21
- var needQj = _a.needQj, needQys = _a.needQys, records = _a.records, qunjSeal = _a.qunjSeal, electronicSeal = _a.electronicSealIdList, ZT_API_BASEURL = _a.ZT_API_BASEURL, ZT_FILE_BASEURL = _a.ZT_FILE_BASEURL, token = _a.token, viewSealPageFn = _a.viewSealPageFn, contractId = _a.contractId, electronicList = _a.electronicList, sealList = _a.sealList, querySealStatus = _a.querySealStatus, showContranctNum = _a.showContranctNum;
23
+ var needQj = _a.needQj, needQys = _a.needQys, records = _a.records, qunjSeal = _a.qunjSeal, electronicSeal = _a.electronicSealIdList, ZT_API_BASEURL = _a.ZT_API_BASEURL, ZT_FILE_BASEURL = _a.ZT_FILE_BASEURL, token = _a.token, viewSealPageFn = _a.viewSealPageFn, contractId = _a.contractId, electronicList = _a.electronicList, sealList = _a.sealList, querySealStatus = _a.querySealStatus, showContranctNum = _a.showContranctNum, request = _a.request, needSaveTemplate = _a.needSaveTemplate;
22
24
  var authToken = token || '';
23
25
  /** 下载水印附件 */
24
26
  var downFileFn = function (_record) {
@@ -71,6 +73,42 @@ var DetailTable = function (_a) {
71
73
  React.createElement(AttachOperation, { ZT_API_BASEURL: ZT_API_BASEURL, ZT_FILE_BASEURL: ZT_FILE_BASEURL, token: authToken, attachId: record === null || record === void 0 ? void 0 : record.attachId, attachName: record === null || record === void 0 ? void 0 : record.attachName, attachSize: record === null || record === void 0 ? void 0 : record.attachSize })));
72
74
  },
73
75
  },
76
+ {
77
+ title: '合同',
78
+ key: 'needDg',
79
+ dataIndex: 'needDg',
80
+ children: [
81
+ {
82
+ title: '合同比对模板',
83
+ key: 'templateAttachId',
84
+ dataIndex: 'templateAttachId',
85
+ width: 160,
86
+ render: function (text, record, index) {
87
+ return record.attachTypeName === '合同本身' ? (React.createElement(React.Fragment, null,
88
+ React.createElement("div", { style: { textOverflow: 'ellipsis', overflow: 'hidden' }, title: record.templateAttachName || '' }, record.templateAttachName || ''),
89
+ React.createElement("div", null, record.templateCrNo || ''))) : ('');
90
+ },
91
+ },
92
+ {
93
+ title: '合同比对结果',
94
+ key: 'compareAttachId',
95
+ dataIndex: 'compareAttachId',
96
+ width: 100,
97
+ render: function (text, record, index) {
98
+ return record.attachTypeName === '合同本身' ? (React.createElement(CompareResult, { record: record, index: index, request: request })) : ('');
99
+ },
100
+ },
101
+ {
102
+ title: '保存为模板',
103
+ key: 'templateAttachId',
104
+ dataIndex: 'templateAttachId',
105
+ width: 90,
106
+ render: function (text, record, index) {
107
+ return needSaveTemplate ? (React.createElement(Switch, { checked: !!record.isCustomerReference, disabled: true })) : ('');
108
+ },
109
+ },
110
+ ],
111
+ },
74
112
  {
75
113
  title: '水印',
76
114
  key: 'isWatermark',
@@ -84,7 +122,7 @@ var DetailTable = function (_a) {
84
122
  title: '电子印章',
85
123
  key: 'electronicSeal',
86
124
  dataIndex: 'electronicSeal',
87
- width: '20%',
125
+ width: 230,
88
126
  render: function (value, row, index) {
89
127
  var obj = {
90
128
  children: (React.createElement("div", { style: { height: '100%', padding: '10px 0' } },
@@ -13,6 +13,6 @@ var TemplateAttach = function (_a) {
13
13
  React.createElement("div", null,
14
14
  React.createElement(Button, { type: "link", disabled: !isEdit, onClick: function () {
15
15
  openCustomerModalHandle && openCustomerModalHandle(index);
16
- } }, "\u9009\u62E9\u6BD4\u5BF9\u6A21\u7248"))));
16
+ } }, "\u9009\u62E9\u6BD4\u5BF9\u6A21\u677F"))));
17
17
  };
18
18
  export default TemplateAttach;
@@ -240,12 +240,6 @@ var Sinatures = function (_a) {
240
240
  getQunjSealList();
241
241
  }
242
242
  }, [getElectronicList, getQunjSealList, needQj, needQys]);
243
- /** 获取taskId */
244
- var getTaskId = function (id, index) {
245
- handleRef.current.setTemplateData({
246
- taskId: id,
247
- }, index);
248
- };
249
243
  /** 指定签署位置 */
250
244
  var checkSealFn = function () {
251
245
  // 已勾选的附件中存在attachId为空的标识
@@ -424,11 +418,11 @@ var Sinatures = function (_a) {
424
418
  dataIndex: 'compareAttachId',
425
419
  width: 150,
426
420
  render: function (text, record, index) {
427
- return record.attachTypeName === '合同本身' ? (React.createElement(CompareResult, { record: record, index: index, request: request, getTaskId: getTaskId, isEdit: isEdit })) : ('');
421
+ return record.attachTypeName === '合同本身' ? (React.createElement(CompareResult, { record: record, index: index, request: request })) : ('');
428
422
  },
429
423
  },
430
424
  {
431
- title: '保存为模版',
425
+ title: '保存为模板',
432
426
  key: 'templateAttachId',
433
427
  dataIndex: 'templateAttachId',
434
428
  width: 110,
@@ -763,6 +757,8 @@ var Sinatures = function (_a) {
763
757
  needQj: needQj,
764
758
  needQys: needQys,
765
759
  showContranctNum: showContranctNum,
760
+ request: request,
761
+ needSaveTemplate: NEED_SAVE_TEMPLATE.includes("" + flowId),
766
762
  };
767
763
  return (React.createElement(React.Fragment, null, isEdit ? (React.createElement(Table, { columns: columnsLast, rowKey: "attachId", dataSource: records, scroll: { x: 'max-content' } })) : (React.createElement(DetailTable, __assign({}, detail)))));
768
764
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.8.1",
3
+ "version": "3.8.3",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",