ztxkui 3.2.10 → 3.2.13

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.
@@ -73,13 +73,15 @@ function BasicDemo() {
73
73
  React.createElement(InputNumber, { value: value, onChange: function (value) {
74
74
  console.log(value, 1);
75
75
  setValue(value);
76
- }, precision: 4, formatterType: "currency", style: { width: '300px' } }),
76
+ }, precision: 0,
77
+ // formatterType="currency"
78
+ style: { width: '300px' } }),
77
79
  React.createElement(AntInputNumber, { value: value, onChange: function (value) {
78
80
  console.log(value, 1);
79
81
  setValue(value);
80
82
  }, formatter: function (value) {
81
83
  return ("$ " + value).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
82
- }, parser: function (value) { return value.replace(/\$\s?|(,*)/g, ''); }, style: { width: '300px' } }),
84
+ }, precision: 0, parser: function (value) { return value.replace(/\$\s?|(,*)/g, ''); }, style: { width: '300px' } }),
83
85
  React.createElement("div", null,
84
86
  React.createElement(Tag, null, "\u4F60\u597D"),
85
87
  React.createElement(Tag, { type: "normal" }, "\u4F60\u597D"),
@@ -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
@@ -11,6 +22,18 @@ import Table from 'components/Table';
11
22
  // store
12
23
  // 自定义组件
13
24
  // 其他文件
25
+ import axios from 'axios';
26
+ function request(options) {
27
+ return axios({
28
+ baseURL: 'http://192.168.0.83:8000',
29
+ url: options.url,
30
+ headers: __assign({ 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6bnVsbCwicmVhbF9uYW1lIjoi6ZmI5Lqa6ZuEIiwiY2xpZW50X3R5cGUiOiJ3ZWIiLCJkYXRhX3JvbGVfaWQiOiIxMzQzNDkwNjg2MjYwMjI4MDk3LDEzNDU5Nzg1MDUzMDIwNTY5NjIsMTQ2ODAzNTM1MTYyNTI4NTYzNCwxNTQyMDc2MzA4NTc4MDI1NDc0IiwiY2xpZW50X2lkIjoic3dvcmQiLCJ1c2VyX3R5cGUiOiJ3ZWIiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSwxNDY3MDE1OTc1NDg0NzYwMDY2LDE0NjgwMzQ0MzcxNTc5NjE3MjksMTQ4MDgyOTMzNzkzOTEzMjQxNyIsInBvc3RfbmFtZSI6bnVsbCwic2NvcGUiOlsiYWxsIl0sImludGVydmlld19pZCI6bnVsbCwiZXhwIjoxNjU5MDU2NTgxLCJvcmdfbmFtZSI6bnVsbCwianRpIjoiYzI5NDlhYmQtNTRlYS00ODhkLTg2MzQtMzEyYTZkMzdhZjE0IiwibWVtYmVyX2lkIjoxLCJjb21wYW55X2lkIjpudWxsLCJzeXN0ZW1faWQiOm51bGwsImRlcHRfbmFtZSI6bnVsbCwiYXZhdGFyIjoiIiwiZGF0YV9yb2xlX25hbWUiOiJudWxsLGFkbWluLGFkbWluLGFkbWluIiwiYXV0aG9yaXRpZXMiOlsiYWRtaW4iLCJ1c2VyIiwiYWRtaW5pc3RyYXRvciJdLCJyb2xlX25hbWUiOiJhZG1pbmlzdHJhdG9yLHVzZXIsYWRtaW4sYWRtaW4iLCJyZXN1bWVfdGVtcGxhdGUiOm51bGwsImxpY2Vuc2UiOiJwb3dlcmVkIGJ5IHptZG1zIiwicG9zdF9pZCI6IiIsInVzZXJfaWQiOiIxNDEyOTUzODA0MzMzNTU1NzE0Iiwib3JnX2lkIjpudWxsLCJuaWNrX25hbWUiOiLpmYjkuprpm4QiLCJjb21wYW55X25hbWUiOm51bGwsImRlcHRfaWQiOiIiLCJoYW5kbGVfaHJfbmFtZSI6bnVsbCwiYWNjb3VudCI6ImNoZW55eCIsInJlc3VtZV9pZCI6bnVsbH0.oekbQq3Q_7PWmPgR_A1G48oN9pE2pzDMSSvmkdqg6KM' }, options.headers),
31
+ method: options.method,
32
+ data: options.data,
33
+ });
34
+ }
35
+ var sealIdList = ['2980019783467188885', '2982231505305256230'];
36
+ var keywordList = ['测试', '测试'];
14
37
  var dataSource1 = new Array(10).fill('1').map(function (item, index) { return ({
15
38
  test1: "\u6D4B\u8BD5\u4E00" + index,
16
39
  test2: "\u6D4B\u8BD5\u4E8C" + index,
@@ -53,7 +76,7 @@ var PrintContainerDemo = function () {
53
76
  setDataSource(dataSource1);
54
77
  }, 3000);
55
78
  }, []);
56
- return (React.createElement(PrintContainer, { isAddExportPage: true, loading: loading },
79
+ return (React.createElement(PrintContainer, { isAddExportPage: true, loading: loading, request: request, sealIdList: sealIdList, keywordList: keywordList, showHandSeal: true, showAutoSeal: true },
57
80
  React.createElement("div", { className: "html2canvas-container-page" },
58
81
  "1",
59
82
  React.createElement(Table, { columns: columns, dataSource: dataSource, rowKey: "id", scroll: {
@@ -659,7 +659,7 @@ var TableDemo = function () {
659
659
  lowMinTip: function (record, index) {
660
660
  return "\u7B2C" + (index + 1) + "\u884C\uFF0C\u4F4E\u4E8E\u6700\u5C0F\u503C\uFF0C\u5DF2\u4FEE\u6539\u6210\u6700\u5C0F\u503C";
661
661
  },
662
- precision: 3,
662
+ precision: 0,
663
663
  formatterType: 'currency',
664
664
  onBlur: function () {
665
665
  setBtnLoading(false);
@@ -57,6 +57,6 @@ function InputNumber(props) {
57
57
  onOverRangeHandle();
58
58
  onPressEnter && onPressEnter(e);
59
59
  };
60
- return (React.createElement(AntInputNumber, __assign({ formatter: formatter || _formatter, parser: parser || _parser, precision: precision || _precision, onChange: onChangeHandle, onBlur: onBlurHandle, onPressEnter: onPressEnterHandle }, restProps)));
60
+ return (React.createElement(AntInputNumber, __assign({ formatter: formatter || _formatter, parser: parser || _parser, precision: precision !== null && precision !== void 0 ? precision : _precision, onChange: onChangeHandle, onBlur: onBlurHandle, onPressEnter: onPressEnterHandle }, restProps)));
61
61
  }
62
62
  export default InputNumber;
@@ -16,6 +16,18 @@ interface IProps {
16
16
  loading?: boolean;
17
17
  /** 导出pdf文件名 */
18
18
  pdfName?: string;
19
+ /**请求方法 */
20
+ request?: any;
21
+ /** 印章id */
22
+ sealIdList?: string[];
23
+ /** 关键字 */
24
+ keywordList?: string[];
25
+ /** 手动盖章 */
26
+ showHandSeal?: boolean;
27
+ /** 自动盖章 */
28
+ showAutoSeal?: boolean;
29
+ /** 盖章是否需要水印 */
30
+ needWatermark?: number;
19
31
  }
20
32
  declare const PrintContainer: React.FC<IProps>;
21
33
  export default PrintContainer;
@@ -10,19 +10,31 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
10
10
  import React, { useEffect, useRef, useState } from 'react';
11
11
  // redux
12
12
  // ztxkui公共组件
13
- import { Button, Spin } from '../../index';
13
+ import { Button, Spin, message } from '../../index';
14
14
  // 路由配置
15
15
  // store
16
16
  // 自定义组件
17
17
  // 其他文件
18
- import { addWaterHandle, removeWaterHandle, printCurrentDom, htmlToPdf, } from 'ztxkutils/dist/print';
18
+ import { addWaterHandle, removeWaterHandle, printCurrentDom, htmlToPdf, htmlToPdfForExport, } from 'ztxkutils/dist/print';
19
+ // 将base64转换为文件
20
+ function dataURLtoFile(dataurl, filename) {
21
+ var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
22
+ while (n--) {
23
+ u8arr[n] = bstr.charCodeAt(n);
24
+ }
25
+ return new File([u8arr], filename, { type: mime });
26
+ }
19
27
  var PrintContainer = function (_a) {
20
- var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d;
21
- var _e = useState(false), showWater = _e[0], setShowWater = _e[1];
22
- var _f = useState(false), pdfShowWater = _f[0], setPdfShowWater = _f[1];
28
+ var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, keywordList = _a.keywordList, showHandSeal = _a.showHandSeal, showAutoSeal = _a.showAutoSeal, _e = _a.needWatermark, needWatermark = _e === void 0 ? 0 : _e;
29
+ var _f = useState(false), showWater = _f[0], setShowWater = _f[1];
30
+ var _g = useState(false), pdfShowWater = _g[0], setPdfShowWater = _g[1];
23
31
  var containerRef = useRef();
24
32
  var allDomRef = useRef();
25
- var _g = useState(false), spinning = _g[0], setSpinning = _g[1];
33
+ var _h = useState(false), spinning = _h[0], setSpinning = _h[1];
34
+ // 确认盖章后,会得到一个合同id 这个之后盖章要用
35
+ var _j = useState(), currentContractId = _j[0], setCurrentContractId = _j[1];
36
+ // 盖章后会得到一个预览地址,这个地址耀保存,同一个合同id,不能重复盖章接口
37
+ var _k = useState(), currentViewUrl = _k[0], setCurrentViewUrl = _k[1];
26
38
  useEffect(function () {
27
39
  setSpinning(loading);
28
40
  }, [loading]);
@@ -122,6 +134,171 @@ var PrintContainer = function (_a) {
122
134
  var onCloseHandle = function () {
123
135
  window.close();
124
136
  };
137
+ // 确认盖章位置
138
+ var onSurePositionHandle = function () {
139
+ setSpinning(true);
140
+ setTimeout(function () {
141
+ htmlToPdfForExport({
142
+ dom: containerRef.current,
143
+ isShowPage: isAddExportPage,
144
+ })
145
+ .then(function (option) {
146
+ var pdfBase64 = option.pdfBase64;
147
+ var files = Array.isArray(pdfBase64)
148
+ ? pdfBase64.map(function (base64) { return dataURLtoFile(base64, pdfName + ".pdf"); })
149
+ : [];
150
+ var formData = new FormData();
151
+ files.forEach(function (file, i) {
152
+ formData.append("fileList[" + i + "]", file);
153
+ });
154
+ if (Array.isArray(sealIdList)) {
155
+ sealIdList.forEach(function (sealId, i) {
156
+ formData.append("sealIdList[" + i + "]", sealId);
157
+ });
158
+ }
159
+ request({
160
+ url: '/api/zmdms-resource/seal/confirm-seal-position',
161
+ method: 'POST',
162
+ data: formData,
163
+ headers: {
164
+ 'Content-Type': 'multipart/form-data',
165
+ },
166
+ })
167
+ .then(function (res) {
168
+ var _a;
169
+ setSpinning(false);
170
+ console.log(res);
171
+ if (res.status === 200 && res.data.code === 200) {
172
+ var data = (res.data || {}).data;
173
+ setCurrentContractId(data === null || data === void 0 ? void 0 : data.contractId);
174
+ // 重新确认盖章位置后,要清空当前保存的盖章url
175
+ setCurrentViewUrl('');
176
+ if (data === null || data === void 0 ? void 0 : data.preSignUrl) {
177
+ window.open(data === null || data === void 0 ? void 0 : data.preSignUrl);
178
+ }
179
+ else {
180
+ message.info("\u672A\u80FD\u8FD4\u56DE\u76D6\u7AE0\u94FE\u63A5\uFF01");
181
+ }
182
+ }
183
+ else {
184
+ message.info(((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.msg) || '接口请求失败!');
185
+ }
186
+ })
187
+ .catch(function (err) {
188
+ var _a, _b;
189
+ setSpinning(false);
190
+ message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '接口调用失败!');
191
+ });
192
+ })
193
+ .catch(function () {
194
+ setSpinning(false);
195
+ });
196
+ });
197
+ };
198
+ // 盖章
199
+ var onSealHandle = function () {
200
+ if (currentViewUrl) {
201
+ window.open(currentViewUrl);
202
+ return;
203
+ }
204
+ setSpinning(true);
205
+ request({
206
+ url: '/api/zmdms-resource/seal/final-seal',
207
+ method: 'POST',
208
+ data: {
209
+ contractId: currentContractId,
210
+ sealIdList: sealIdList,
211
+ needWatermark: needWatermark,
212
+ },
213
+ heaers: {
214
+ 'Content-Type': 'application/json',
215
+ },
216
+ })
217
+ .then(function (res) {
218
+ var _a;
219
+ console.log(res);
220
+ setSpinning(false);
221
+ if (res.status === 200 && res.data.code === 200) {
222
+ var data = (res.data || {}).data;
223
+ if (data === null || data === void 0 ? void 0 : data.viewUrl) {
224
+ setCurrentViewUrl(data === null || data === void 0 ? void 0 : data.viewUrl);
225
+ window.open(data === null || data === void 0 ? void 0 : data.viewUrl);
226
+ }
227
+ else {
228
+ message.info("\u672A\u80FD\u8FD4\u56DE\u76D6\u7AE0\u94FE\u63A5\uFF01");
229
+ }
230
+ }
231
+ else {
232
+ message.info(((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.msg) || '接口请求失败!');
233
+ }
234
+ })
235
+ .catch(function (err) {
236
+ var _a, _b;
237
+ setSpinning(false);
238
+ message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '接口调用失败!');
239
+ });
240
+ };
241
+ // 自动盖章
242
+ var onAutoSealHandle = function () {
243
+ setSpinning(true);
244
+ setTimeout(function () {
245
+ htmlToPdfForExport({
246
+ dom: containerRef.current,
247
+ isShowPage: isAddExportPage,
248
+ })
249
+ .then(function (option) {
250
+ var pdfBase64 = option.pdfBase64;
251
+ var files = Array.isArray(pdfBase64)
252
+ ? pdfBase64.map(function (base64) { return dataURLtoFile(base64, pdfName + ".pdf"); })
253
+ : [];
254
+ var formData = new FormData();
255
+ files.forEach(function (file, i) {
256
+ formData.append("fileList[" + i + "]", file);
257
+ });
258
+ if (Array.isArray(sealIdList) && Array.isArray(keywordList)) {
259
+ sealIdList.forEach(function (sealId, i) {
260
+ var keyword = keywordList[i];
261
+ formData.append("sealPositionInfoList[" + i + "].sealId", sealId);
262
+ formData.append("sealPositionInfoList[" + i + "].keyword", keyword);
263
+ });
264
+ }
265
+ request({
266
+ url: '/api/zmdms-resource/seal/auto-seal',
267
+ method: 'POST',
268
+ data: formData,
269
+ headers: {
270
+ 'Content-Type': 'multipart/form-data',
271
+ },
272
+ })
273
+ .then(function (res) {
274
+ var _a;
275
+ setSpinning(false);
276
+ console.log(res);
277
+ if (res.status === 200 && res.data.code === 200) {
278
+ var data = (res.data || {}).data;
279
+ setCurrentContractId(data === null || data === void 0 ? void 0 : data.contractId);
280
+ if (data === null || data === void 0 ? void 0 : data.preSignUrl) {
281
+ window.open(data === null || data === void 0 ? void 0 : data.preSignUrl);
282
+ }
283
+ else {
284
+ message.info("\u672A\u80FD\u8FD4\u56DE\u76D6\u7AE0\u94FE\u63A5\uFF01");
285
+ }
286
+ }
287
+ else {
288
+ message.info(((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.msg) || '接口请求失败!');
289
+ }
290
+ })
291
+ .catch(function (err) {
292
+ var _a, _b;
293
+ setSpinning(false);
294
+ message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '接口调用失败!');
295
+ });
296
+ })
297
+ .catch(function () {
298
+ setSpinning(false);
299
+ });
300
+ });
301
+ };
125
302
  return (React.createElement(Spin, { spinning: spinning },
126
303
  React.createElement("div", { className: "print-container--header" },
127
304
  React.createElement("div", { className: "print-container--header__content" },
@@ -131,6 +308,10 @@ var PrintContainer = function (_a) {
131
308
  React.createElement(Button, { type: "primary", onClick: onPrintHandle }, "\u6253\u5370"),
132
309
  React.createElement(Button, { type: "primary", onClick: onPdfWaterHandle }, !pdfShowWater ? '添加导出PDF水印' : '移除导出PDF水印'),
133
310
  React.createElement(Button, { type: "primary", onClick: onPdfHandle }, "\u5BFC\u51FAPDF"),
311
+ showHandSeal && (React.createElement(React.Fragment, null,
312
+ React.createElement(Button, { type: "primary", onClick: onSurePositionHandle }, "\u786E\u8BA4\u76D6\u7AE0\u4F4D\u7F6E"),
313
+ currentContractId && (React.createElement(Button, { type: "primary", onClick: onSealHandle }, "\u76D6\u7AE0")))),
314
+ showAutoSeal && (React.createElement(Button, { type: "primary", onClick: onAutoSealHandle }, "\u81EA\u52A8\u76D6\u7AE0")),
134
315
  React.createElement(Button, { type: "primary", onClick: onCloseHandle }, "\u5173\u95ED"))),
135
316
  React.createElement("div", { className: "print-container--content", ref: containerRef }, children)));
136
317
  };
@@ -190,7 +190,7 @@ function useColumns(props) {
190
190
  width: 52,
191
191
  fixed: 'left',
192
192
  align: 'center',
193
- render: function (text, render, index) { return (React.createElement(TableAddDelColumn, { onAddAndDelHandle: function (type) { return onAddAndDelHandle(type, index); }, hideAddIcon: hideAddIcon, hideDelIcon: hideDelIcon })); },
193
+ render: function (text, render, index) { return (React.createElement(TableAddDelColumn, { onAddAndDelHandle: function (type) { return onAddAndDelHandle(type, index); }, hideAddIcon: hideAddIcon, addIconText: addIconText, hideDelIcon: hideDelIcon, delIconText: delIconText })); },
194
194
  };
195
195
  _newColumns.unshift(newColumn);
196
196
  }
@@ -7,6 +7,8 @@ interface IProps {
7
7
  record: any;
8
8
  index: number;
9
9
  request?: any;
10
+ getTaskId: (id: any, index: number) => void;
11
+ isEdit: boolean;
10
12
  }
11
13
  declare const CompareResult: React.FC<IProps>;
12
14
  export default CompareResult;
@@ -7,12 +7,56 @@ 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;
10
+ var record = _a.record, index = _a.index, request = _a.request, isEdit = _a.isEdit, getTaskId = _a.getTaskId;
11
11
  // 设置查看比对结果按钮的loading状态
12
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
12
+ var _b = useState(false), resultLoading = _b[0], setResultLoading = _b[1];
13
+ // 设置合同比对按钮的loading状态
14
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
15
+ // 设置查看结果按钮是否显示
16
+ var _d = useState(false), isShow = _d[0], setIsShow = _d[1];
13
17
  var onClickHandle = function () {
14
- console.log('查看比对结果', index, record);
18
+ console.log('合同比对', index, record);
15
19
  setLoading(true);
20
+ try {
21
+ if (!record.templateAttachId) {
22
+ message.info('请选择客户样板');
23
+ return;
24
+ }
25
+ var params = {
26
+ leftAttachId: record.attachId,
27
+ rightAttachId: record.templateAttachId,
28
+ };
29
+ // 发起比对任务
30
+ request({
31
+ url: "/api/zmdms-resource/seal/create-compare-task/" + params.leftAttachId + "/" + params.rightAttachId,
32
+ method: 'GET',
33
+ })
34
+ .then(function (res) {
35
+ var _a;
36
+ if (res.status === 200 && res.data.code === 200) {
37
+ getTaskId((_a = res.data.data) === null || _a === void 0 ? void 0 : _a.taskId, index);
38
+ setIsShow(true);
39
+ message.success('操作成功');
40
+ }
41
+ else {
42
+ message.error(res.data.msg || '出错了');
43
+ }
44
+ })
45
+ .catch(function (error) {
46
+ var _a, _b;
47
+ message.error(((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '请求失败!');
48
+ });
49
+ }
50
+ catch (err) {
51
+ //
52
+ }
53
+ finally {
54
+ setLoading(false);
55
+ }
56
+ };
57
+ var viewCompareResult = function () {
58
+ console.log('查看比对结果', index, record);
59
+ setResultLoading(true);
16
60
  try {
17
61
  var task_id = record.taskId;
18
62
  if (task_id) {
@@ -23,11 +67,14 @@ var CompareResult = function (_a) {
23
67
  })
24
68
  .then(function (res) {
25
69
  var _a;
26
- if (res.status === 200 &&
27
- res.data.code === 200 &&
28
- ((_a = res.data.data[0]) === null || _a === void 0 ? void 0 : _a.url)) {
29
- // 比对文件预览
30
- window.open(res.data.data[0].url);
70
+ if (res.status === 200 && res.data.code === 200) {
71
+ if ((_a = res.data.data[0]) === null || _a === void 0 ? void 0 : _a.url) {
72
+ // 比对文件预览
73
+ window.open(res.data.data[0].url);
74
+ }
75
+ else {
76
+ message.info('文件比对中,请稍后再试!');
77
+ }
31
78
  }
32
79
  else {
33
80
  message.error(res.data.msg || '出错了');
@@ -46,10 +93,11 @@ var CompareResult = function (_a) {
46
93
  //
47
94
  }
48
95
  finally {
49
- setLoading(false);
96
+ setResultLoading(false);
50
97
  }
51
98
  };
52
99
  return (React.createElement(React.Fragment, null,
53
- React.createElement(Button, { type: "link", onClick: onClickHandle, loading: loading }, "\u67E5\u770B\u6BD4\u5BF9\u7ED3\u679C")));
100
+ React.createElement(Button, { type: "primary", size: "small", disabled: !isEdit, onClick: onClickHandle, loading: loading }, "\u5408\u540C\u6BD4\u5BF9"),
101
+ React.createElement("div", null, isShow || record.taskId ? (React.createElement(Button, { type: "link", onClick: viewCompareResult, loading: resultLoading }, "\u67E5\u770B\u6BD4\u5BF9\u7ED3\u679C")) : (''))));
54
102
  };
55
103
  export default CompareResult;
@@ -12,6 +12,7 @@ var ElectronicSeal = function (_a) {
12
12
  useEffect(function () {
13
13
  var params = {
14
14
  deptId: deptId,
15
+ size: 200,
15
16
  };
16
17
  if (flowId) {
17
18
  params.flowId = flowId;
@@ -12,10 +12,19 @@ import { Form, Input, InputNumber, SearchContainer, Radio, Button, message, } fr
12
12
  import { SealCheckboxGroup } from './SealCheckbox';
13
13
  // 其他文件
14
14
  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
+ ];
15
22
  var QunjSeal = function (_a) {
16
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, handleRef = _a.handleRef;
17
24
  var form = Form.useForm()[0];
18
25
  var _b = useState([]), sealList = _b[0], setSealList = _b[1];
26
+ // 采购合同 销售合同 双边合同 部门间交易合同 需要展示合同份数 其他的不需要
27
+ var showContranctNum = FLOW_IDS.includes("" + flowId);
19
28
  useEffect(function () {
20
29
  request({
21
30
  url: "/api/zmdms-resource/flowqjuse/query-qj-seal-list/" + flowId,
@@ -61,9 +70,9 @@ var QunjSeal = function (_a) {
61
70
  React.createElement(SearchLeft, null,
62
71
  React.createElement(Item, { name: "vertifyCode", label: "\u7FA4\u6770\u9A8C\u8BC1\u7801", width: "all" },
63
72
  React.createElement(Input, { disabled: true })),
64
- React.createElement(Item, { name: "contranctNum", label: "\u5408\u540C\u4EFD\u6570", width: "all" },
65
- React.createElement(InputNumber, { disabled: !isEdit, min: 0 })),
66
- React.createElement(Button, { type: "primary", size: "small", style: { marginLeft: '6px' }, onClick: querySealStatus }, "\u67E5\u8BE2\u7528\u5370\u72B6\u6001"),
73
+ showContranctNum ? (React.createElement(Item, { name: "contranctNum", label: "\u5408\u540C\u4EFD\u6570", width: "all" },
74
+ React.createElement(InputNumber, { disabled: !isEdit, min: 0 }))) : (''),
75
+ !!value.vertifyCode ? (React.createElement(Button, { type: "primary", size: "small", style: { marginLeft: '6px' }, onClick: querySealStatus }, "\u67E5\u8BE2\u7528\u5370\u72B6\u6001")) : (''),
67
76
  React.createElement(Item, { name: "isTakeOut", label: "", noBorder: true, width: "all" },
68
77
  React.createElement(Radio.Group, { style: { padding: '0 6px' }, disabled: !isEdit },
69
78
  React.createElement(Radio, { value: 0 }, "\u5185\u90E8\u7528\u5370"),
@@ -42,23 +42,29 @@ var SealCheckbox = function (_a) {
42
42
  var SealCheckboxGroup = function (_a) {
43
43
  var value = _a.value, onChange = _a.onChange, sealList = _a.sealList, handleRef = _a.handleRef, isEdit = _a.isEdit;
44
44
  var onChangeHandle = function (_value, index) {
45
- var _a, _b;
45
+ var _a, _b, _c, _d;
46
46
  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;
47
47
  var valueArr = Array.isArray(value) ? __spreadArray([], value) : [];
48
48
  valueArr.splice(index, 1, _value);
49
49
  var totalSealNum = sumBy(valueArr, 'sealCount');
50
50
  onChange && onChange(valueArr);
51
- if (totalSealNum > contractNum * 4) {
52
- message.warning('您的用印次数远超超过合理次数范围,请修改。');
53
- return;
54
- }
55
- if (totalSealNum > contractNum * 3) {
56
- message.warning('您的用印次数超过合理次数范围,请慎重确认!');
57
- return;
58
- }
59
- if (totalSealNum > contractNum * 2) {
60
- message.warning('您的用印次数已超过2倍合同数量,请确认用印数量是否正确。');
61
- return;
51
+ if (contractNum) {
52
+ if (totalSealNum > contractNum * 4) {
53
+ (_c = handleRef === null || handleRef === void 0 ? void 0 : handleRef.current) === null || _c === void 0 ? void 0 : _c.getData('4');
54
+ message.warning('您的用印次数远超超过合理次数范围,请修改。');
55
+ return;
56
+ }
57
+ else {
58
+ (_d = handleRef === null || handleRef === void 0 ? void 0 : handleRef.current) === null || _d === void 0 ? void 0 : _d.getData('enable');
59
+ }
60
+ if (totalSealNum > contractNum * 3) {
61
+ message.warning('您的用印次数超过合理次数范围,请慎重确认!');
62
+ return;
63
+ }
64
+ if (totalSealNum > contractNum * 2) {
65
+ message.warning('您的用印次数已超过2倍合同数量,请确认用印数量是否正确。');
66
+ return;
67
+ }
62
68
  }
63
69
  };
64
70
  return (React.createElement("div", null, Array.isArray(sealList) &&
@@ -1,11 +1,13 @@
1
+ /**
2
+ * @author 陈亚雄
3
+ * @description 合同模板
4
+ */
1
5
  import React from 'react';
2
6
  interface IProps {
3
7
  record: any;
4
8
  index: number;
5
9
  /** 点击客户样板 */
6
10
  openCustomerModalHandle?: any;
7
- getTaskId: (id: any, index: number) => void;
8
- request?: any;
9
11
  isEdit: boolean;
10
12
  }
11
13
  declare const TemplateAttach: React.FC<IProps>;
@@ -2,61 +2,17 @@
2
2
  * @author 陈亚雄
3
3
  * @description 合同模板
4
4
  */
5
- import { message } from 'antd';
6
- import React, { useState } from 'react';
7
- // redux
5
+ import React from 'react';
8
6
  // ztxkui公共组件
9
7
  import { Button } from '../../../../index';
10
8
  var TemplateAttach = function (_a) {
11
- var record = _a.record, openCustomerModalHandle = _a.openCustomerModalHandle, index = _a.index, request = _a.request, getTaskId = _a.getTaskId, isEdit = _a.isEdit;
12
- // 设置合同比对按钮的loading状态
13
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
14
- var onClickHandle = function () {
15
- console.log('合同比对', index, record);
16
- setLoading(true);
17
- try {
18
- if (!record.templateAttachId) {
19
- message.info('请选择客户样板');
20
- return;
21
- }
22
- var params = {
23
- leftAttachId: record.attachId,
24
- rightAttachId: record.templateAttachId,
25
- };
26
- // 发起比对任务
27
- request({
28
- url: "/api/zmdms-resource/seal/create-compare-task/" + params.leftAttachId + "/" + params.rightAttachId,
29
- method: 'GET',
30
- })
31
- .then(function (res) {
32
- var _a;
33
- if (res.status === 200 && res.data.code === 200) {
34
- getTaskId((_a = res.data.data) === null || _a === void 0 ? void 0 : _a.taskId, index);
35
- message.success('操作成功');
36
- }
37
- else {
38
- message.error(res.data.msg || '出错了');
39
- }
40
- })
41
- .catch(function (error) {
42
- var _a, _b;
43
- message.error(((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '请求失败!');
44
- });
45
- }
46
- catch (err) {
47
- //
48
- }
49
- finally {
50
- setLoading(false);
51
- }
52
- };
9
+ var record = _a.record, openCustomerModalHandle = _a.openCustomerModalHandle, index = _a.index, isEdit = _a.isEdit;
53
10
  return (React.createElement("div", null,
54
11
  React.createElement("div", null, record.templateAttachName || ''),
55
12
  React.createElement("div", null, record.templateCrNo || ''),
56
13
  React.createElement("div", null,
57
14
  React.createElement(Button, { type: "link", disabled: !isEdit, onClick: function () {
58
15
  openCustomerModalHandle && openCustomerModalHandle(index);
59
- } }, "\u9009\u62E9\u5BA2\u6237\u6837\u677F")),
60
- React.createElement(Button, { type: "primary", size: "small", disabled: !isEdit, onClick: onClickHandle, loading: loading }, "\u5408\u540C\u6BD4\u5BF9")));
16
+ } }, "\u9009\u62E9\u5BA2\u6237\u6837\u677F"))));
61
17
  };
62
18
  export default TemplateAttach;
@@ -60,6 +60,8 @@ var Sinatures = function (_a) {
60
60
  var _h = useState(docAttachMap), attachMap = _h[0], setAttachMap = _h[1];
61
61
  // 文档id列表
62
62
  var _j = useState(documentIdList), documentIds = _j[0], setDocumentIds = _j[1];
63
+ // 总用印次数超过4倍
64
+ var _k = useState(false), isTotalSealNumTooMore = _k[0], setIsTotalSealNumTooMore = _k[1];
63
65
  useEffect(function () {
64
66
  // 判断入参fileList中是否有已勾选电子印章的元素
65
67
  if (Array.isArray(fileList) &&
@@ -142,7 +144,7 @@ var Sinatures = function (_a) {
142
144
  if (contractId || contract_id) {
143
145
  request({
144
146
  url: '/api/zmdms-resource/seal/view-seal-state',
145
- data: { contractId: contractId || contract_id },
147
+ data: { contractId: contractId || contract_id, canEdit: canEdit },
146
148
  method: 'POST',
147
149
  })
148
150
  .then(function (res) {
@@ -167,6 +169,8 @@ var Sinatures = function (_a) {
167
169
  var columns = [
168
170
  {
169
171
  title: '序号',
172
+ key: 'orderNum',
173
+ dataIndex: 'orderNum',
170
174
  width: 62,
171
175
  fixed: 'left',
172
176
  render: function (text, record, index) { return "" + (index + 1); },
@@ -202,7 +206,7 @@ var Sinatures = function (_a) {
202
206
  dataIndex: 'templateAttachId',
203
207
  width: 220,
204
208
  render: function (text, record, index) {
205
- return record.attachTypeName === '合同本身' ? (React.createElement(TemplateAttach, { record: record, request: request, index: index, openCustomerModalHandle: openCustomerModalHandle, getTaskId: getTaskId, isEdit: isEdit })) : ('');
209
+ return record.attachTypeName === '合同本身' ? (React.createElement(TemplateAttach, { record: record, index: index, openCustomerModalHandle: openCustomerModalHandle, isEdit: isEdit })) : ('');
206
210
  },
207
211
  },
208
212
  {
@@ -211,7 +215,7 @@ var Sinatures = function (_a) {
211
215
  dataIndex: 'compareAttachId',
212
216
  width: 100,
213
217
  render: function (text, record, index) {
214
- return record.attachTypeName === '合同本身' ? (React.createElement(CompareResult, { record: record, index: index, request: request })) : ('');
218
+ return record.attachTypeName === '合同本身' ? (React.createElement(CompareResult, { record: record, index: index, request: request, getTaskId: getTaskId, isEdit: isEdit })) : ('');
215
219
  },
216
220
  },
217
221
  {
@@ -276,10 +280,14 @@ var Sinatures = function (_a) {
276
280
  columnsLast = columnsLast.filter(function (item) { return item.key !== 'qunjSeal'; });
277
281
  }
278
282
  if (!needDg && !needQys) {
279
- columnsLast = columnsLast.filter(function (item) { return item.key !== 'attachId'; });
283
+ columnsLast = columnsLast.filter(function (item) {
284
+ return !['attachId', 'orderNum', 'attachTypeName'].includes(item.key);
285
+ });
280
286
  }
281
287
  if (!needDg) {
282
- columnsLast = columnsLast.filter(function (item) { return !['templateAttachId', 'compareAttachId'].includes(item.key); });
288
+ columnsLast = columnsLast.filter(function (item) {
289
+ return !['attachTypeName', 'templateAttachId', 'compareAttachId'].includes(item.key);
290
+ });
283
291
  }
284
292
  if (!needQys) {
285
293
  columnsLast = columnsLast.filter(function (item) {
@@ -287,7 +295,7 @@ var Sinatures = function (_a) {
287
295
  });
288
296
  }
289
297
  // 上传组件的数据
290
- var _k = useState(), originFileList = _k[0], setOriginFileList = _k[1];
298
+ var _l = useState(), originFileList = _l[0], setOriginFileList = _l[1];
291
299
  // 是否存入样板 添加水印 电子印章发生改变触发事件
292
300
  function onCheckboxChangeHandle(e, type, index) {
293
301
  if (type === 'isElectronicSeal') {
@@ -354,15 +362,25 @@ var Sinatures = function (_a) {
354
362
  * 暴露方法给外部调用
355
363
  */
356
364
  useImperativeHandle(handleRef, function () { return ({
357
- getData: function () { return ({
358
- fileList: records,
359
- qunjSeal: innerQunjSeal,
360
- electronicSealIdList: innerElectronicSeal,
361
- checkAttachIdList: sealedIds,
362
- docAttachMap: attachMap,
363
- documentIdList: documentIds,
364
- contractId: contractId,
365
- }); },
365
+ getData: function (flag) {
366
+ // 超过4倍禁止提交审批
367
+ if (flag === '4') {
368
+ setIsTotalSealNumTooMore(true);
369
+ }
370
+ else if (flag === 'enable') {
371
+ setIsTotalSealNumTooMore(false);
372
+ }
373
+ return {
374
+ fileList: records,
375
+ qunjSeal: innerQunjSeal,
376
+ electronicSealIdList: innerElectronicSeal,
377
+ checkAttachIdList: sealedIds,
378
+ docAttachMap: attachMap,
379
+ documentIdList: documentIds,
380
+ contractId: contractId,
381
+ isTotalSealNumTooMore: isTotalSealNumTooMore,
382
+ };
383
+ },
366
384
  /** 更新数据 */
367
385
  setTemplateData: function (data, index) {
368
386
  setRecords(function (preRecords) {
package/dist/index.css CHANGED
@@ -1811,7 +1811,7 @@ template {
1811
1811
  align-items: center;
1812
1812
  }
1813
1813
  .print-container--header .print-container--header__content > button {
1814
- margin-right: 10px;
1814
+ margin-right: 5px;
1815
1815
  }
1816
1816
 
1817
1817
  .print-container--content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.2.10",
3
+ "version": "3.2.13",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",
@@ -23,7 +23,7 @@
23
23
  "react-infinite-scroll-component": "^6.1.0",
24
24
  "react-resizable": "^3.0.4",
25
25
  "react-to-print": "^2.14.7",
26
- "ztxkutils": "^2.6.2"
26
+ "ztxkutils": "^2.7.17"
27
27
  },
28
28
  "scripts": {
29
29
  "analyze": "source-map-explorer 'dist/static/js/*.js'",