ztxkui 3.3.13 → 3.3.14

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.
@@ -12,6 +12,7 @@ interface IProps {
12
12
  ZT_API_BASEURL: string;
13
13
  isEdit: boolean;
14
14
  isOnlyQunj: boolean;
15
+ showContranctNum: boolean;
15
16
  handleRef?: any;
16
17
  }
17
18
  declare const QunjSeal: React.FC<IProps>;
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  /**
2
13
  * @author 陈亚雄
3
14
  * @description
@@ -12,21 +23,12 @@ import { Form, Input, InputNumber, SearchContainer, Radio, Button, message, Chec
12
23
  import { SealCheckboxGroup } from './SealCheckbox';
13
24
  // 其他文件
14
25
  var SearchLeft = SearchContainer.SearchLeft, Item = SearchContainer.SearchItem;
15
- // 采购合同 销售合同 双边合同 部门间交易合同
16
- var FLOW_IDS = [
17
- 'scm_order_contract_cght',
18
- 'scm_order_contract_xsht',
19
- 'scm_order_contract_sbht',
20
- 'scm_order_contract_bjjyht',
21
- ];
22
26
  var QunjSeal = function (_a) {
23
- var value = _a.value, onChange = _a.onChange, request = _a.request, flowId = _a.flowId, caseId = _a.caseId, ZT_API_BASEURL = _a.ZT_API_BASEURL, isEdit = _a.isEdit, isOnlyQunj = _a.isOnlyQunj, handleRef = _a.handleRef;
27
+ var value = _a.value, onChange = _a.onChange, request = _a.request, flowId = _a.flowId, caseId = _a.caseId, ZT_API_BASEURL = _a.ZT_API_BASEURL, isEdit = _a.isEdit, isOnlyQunj = _a.isOnlyQunj, showContranctNum = _a.showContranctNum, handleRef = _a.handleRef;
24
28
  var form = Form.useForm()[0];
25
29
  // 是否加盖群杰印章
26
30
  var _b = useState(false), checked = _b[0], setChecked = _b[1];
27
31
  var _c = useState([]), sealList = _c[0], setSealList = _c[1];
28
- // 采购合同 销售合同 双边合同 部门间交易合同 需要展示合同份数 其他的不需要
29
- var showContranctNum = FLOW_IDS.includes("" + flowId);
30
32
  useEffect(function () {
31
33
  request({
32
34
  url: "/api/zmdms-resource/flowqjuse/query-qj-seal-list/" + flowId,
@@ -52,10 +54,13 @@ var QunjSeal = function (_a) {
52
54
  useEffect(function () {
53
55
  var _a;
54
56
  if (value) {
55
- form.setFieldsValue(value);
57
+ form.setFieldsValue(__assign(__assign({}, value), { isTakeOut: "" + value.isTakeOut === '1' ? 1 : 0 }));
56
58
  // 有已勾选群杰用印时 展示群杰组件
57
59
  if (((_a = value.details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
58
60
  setChecked(true);
61
+ form.setFieldsValue({
62
+ needQj: true,
63
+ });
59
64
  }
60
65
  }
61
66
  }, [value, form]);
@@ -10,6 +10,7 @@ interface IProps {
10
10
  value?: any;
11
11
  onChange?: any;
12
12
  isOnlyQunj?: boolean;
13
+ handleRef?: any;
13
14
  }
14
15
  declare const SealCheckbox: React.FC<IProps>;
15
16
  interface ISealProps {
@@ -25,12 +25,18 @@ import sumBy from 'lodash/sumBy';
25
25
  import { Checkbox, InputNumber } from '../../../../index';
26
26
  import { message } from 'antd';
27
27
  var SealCheckbox = function (_a) {
28
- var name = _a.name, id = _a.id, value = _a.value, onChange = _a.onChange, isEdit = _a.isEdit, isOnlyQunj = _a.isOnlyQunj;
28
+ var name = _a.name, id = _a.id, value = _a.value, onChange = _a.onChange, isEdit = _a.isEdit, isOnlyQunj = _a.isOnlyQunj, handleRef = _a.handleRef;
29
29
  var onCheckboxChange = function (e) {
30
30
  onChange &&
31
31
  onChange(__assign(__assign({}, (value || {})), { sealName: e.target.checked ? name : null, sealNo: e.target.checked ? id : null }));
32
32
  };
33
33
  var onNumberChange = function (count) {
34
+ var _a, _b;
35
+ var contractNum = (_b = (_a = handleRef === null || handleRef === void 0 ? void 0 : handleRef.current) === null || _a === void 0 ? void 0 : _a.getData().qunjSeal) === null || _b === void 0 ? void 0 : _b.contranctNum;
36
+ if (!contractNum) {
37
+ message.info('请输入合同份数!');
38
+ return;
39
+ }
34
40
  var num = count;
35
41
  if (count < 0) {
36
42
  num = 0;
@@ -100,7 +106,7 @@ var SealCheckboxGroup = function (_a) {
100
106
  if (Array.isArray(value)) {
101
107
  itemValue = value.find(function (valueItem) { return valueItem.sealNo === item.sealNo; });
102
108
  }
103
- return (React.createElement(SealCheckbox, { key: item === null || item === void 0 ? void 0 : item.sealNo, name: item === null || item === void 0 ? void 0 : item.sealName, id: item === null || item === void 0 ? void 0 : item.sealNo, value: itemValue, isEdit: isEdit, isOnlyQunj: isOnlyQunj, onChange: function (value, type) {
109
+ return (React.createElement(SealCheckbox, { key: item === null || item === void 0 ? void 0 : item.sealNo, name: item === null || item === void 0 ? void 0 : item.sealName, id: item === null || item === void 0 ? void 0 : item.sealNo, value: itemValue, isEdit: isEdit, isOnlyQunj: isOnlyQunj, handleRef: handleRef, onChange: function (value, type) {
104
110
  onChangeHandle(value, index, item.sealNo, type);
105
111
  } }));
106
112
  })));
@@ -37,6 +37,13 @@ var NEED_SAVE_TEMPLATE = [
37
37
  'scm_order_contract_xsht',
38
38
  'scm_order_contract_sbht',
39
39
  ];
40
+ /** 采购合同 销售合同 双边合同 部门间交易合同 */
41
+ var FLOW_IDS = [
42
+ 'scm_order_contract_cght',
43
+ 'scm_order_contract_xsht',
44
+ 'scm_order_contract_sbht',
45
+ 'scm_order_contract_bjjyht',
46
+ ];
40
47
  /**
41
48
  * TodoList
42
49
  * 实现可以上传文件,删除列
@@ -70,6 +77,8 @@ var Sinatures = function (_a) {
70
77
  var _k = useState(false), isTotalSealNumTooMore = _k[0], setIsTotalSealNumTooMore = _k[1];
71
78
  // 单独使用群杰章
72
79
  var isOnlyQunj = !!needQj && !needDg && !needQys;
80
+ // 采购合同 销售合同 双边合同 部门间交易合同 需要展示合同份数 其他的不需要
81
+ var showContranctNum = FLOW_IDS.includes("" + flowId);
73
82
  useEffect(function () {
74
83
  // 判断入参fileList中是否有已勾选电子印章的元素
75
84
  if (Array.isArray(fileList) &&
@@ -83,6 +92,27 @@ var Sinatures = function (_a) {
83
92
  taskId: id,
84
93
  }, index);
85
94
  };
95
+ /** 下载水印附件 */
96
+ var downFileFn = function (_record) {
97
+ var xhr = new XMLHttpRequest();
98
+ xhr.open('GET', ZT_API_BASEURL + "/api/zmdms-resource/seal/download-watermark-attach/" + (_record === null || _record === void 0 ? void 0 : _record.attachId) + "?Zmdms-Auth=bearer " + token, true);
99
+ xhr.responseType = 'blob';
100
+ xhr.onload = function () {
101
+ var _a;
102
+ if (xhr.status === 200 || xhr.status === 201) {
103
+ var link = document.createElement('a');
104
+ link.href = window.URL.createObjectURL(xhr.response);
105
+ link.download = ((_a = _record === null || _record === void 0 ? void 0 : _record.attachName) === null || _a === void 0 ? void 0 : _a.split('.')[0]) + ".pdf";
106
+ // fix Firefox
107
+ link.style.display = 'none';
108
+ document.body.appendChild(link);
109
+ link.click();
110
+ document.body.removeChild(link);
111
+ window.URL.revokeObjectURL(link.href);
112
+ }
113
+ };
114
+ xhr.send();
115
+ };
86
116
  /** 确认盖章 */
87
117
  var checkSealFn = function () {
88
118
  // 已勾选的要加盖电子印章的附件id列表
@@ -251,7 +281,9 @@ var Sinatures = function (_a) {
251
281
  dataIndex: 'isWatermark',
252
282
  width: 100,
253
283
  render: function (text, record, index) {
254
- return (React.createElement(Checkbox, { checked: text, disabled: !isEdit, onChange: function (e) { return onCheckboxChangeHandle(e, 'isWatermark', index); } }, "\u662F"));
284
+ return (React.createElement(React.Fragment, null,
285
+ React.createElement(Checkbox, { checked: text, disabled: !isEdit, onChange: function (e) { return onCheckboxChangeHandle(e, 'isWatermark', index); } }, "\u662F"),
286
+ !isEdit && (React.createElement(Button, { type: "link", onClick: function () { return downFileFn(record); } }, "\u4E0B\u8F7D\u6C34\u5370\u9644\u4EF6"))));
255
287
  },
256
288
  },
257
289
  {
@@ -260,7 +292,7 @@ var Sinatures = function (_a) {
260
292
  dataIndex: 'qunjSeal',
261
293
  render: function (value, row, index) {
262
294
  var obj = {
263
- children: (React.createElement(QunjSeal, { value: qunjSeal, onChange: qunjSealChangeHandle, request: request, flowId: flowId, caseId: caseId, ZT_API_BASEURL: ZT_API_BASEURL, isEdit: isEdit, handleRef: handleRef, isOnlyQunj: isOnlyQunj })),
295
+ children: (React.createElement(QunjSeal, { value: qunjSeal, onChange: qunjSealChangeHandle, request: request, flowId: flowId, caseId: caseId, ZT_API_BASEURL: ZT_API_BASEURL, isEdit: isEdit, handleRef: handleRef, isOnlyQunj: isOnlyQunj, showContranctNum: showContranctNum })),
264
296
  props: {},
265
297
  };
266
298
  obj.props['rowSpan'] = index === 0 ? records.length : 0;
@@ -397,13 +429,12 @@ var Sinatures = function (_a) {
397
429
  /** 签章组件相关校验 */
398
430
  validateSealFn: function () {
399
431
  var _a;
432
+ // 是否有勾选加盖电子印章
433
+ var hasElectronicSeal = records.some(function (item) { return !!item.isElectronicSeal; });
400
434
  // 勾选加盖电子印章时未勾选电子印章
401
- if (innerElectronicSeal.length === 0) {
402
- var isElectronicSeal = records.filter(function (item) { return !!item.isElectronicSeal; });
403
- if (isElectronicSeal.length > 0) {
404
- message.warning('请勾选电子印章!');
405
- return false;
406
- }
435
+ if (innerElectronicSeal.length === 0 && hasElectronicSeal) {
436
+ message.warning('请勾选加盖电子印章所需要的印章列表[表格右侧]!');
437
+ return false;
407
438
  }
408
439
  // 超过4倍禁止提交审批
409
440
  if (needQj && isTotalSealNumTooMore) {
@@ -411,13 +442,13 @@ var Sinatures = function (_a) {
411
442
  return false;
412
443
  }
413
444
  // 没有确认盖章
414
- if (needQys && !contractId) {
445
+ if (needQys && hasElectronicSeal && !contractId) {
415
446
  message.warning('请点击确认盖章按钮,确认盖章位置后方可提交!');
416
447
  return false;
417
448
  }
418
449
  if (innerQunjSeal.needQj) {
419
450
  // 合同份数为空
420
- if (!(innerQunjSeal === null || innerQunjSeal === void 0 ? void 0 : innerQunjSeal.contranctNum)) {
451
+ if (!(innerQunjSeal === null || innerQunjSeal === void 0 ? void 0 : innerQunjSeal.contranctNum) && showContranctNum) {
421
452
  message.warning('请填写合同份数!');
422
453
  return false;
423
454
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.3.13",
3
+ "version": "3.3.14",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",