ydb-components-material 0.1.139 → 0.1.141
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/build/docs/404.html +3 -3
- package/build/docs/_demos/:uuid +3 -3
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/{umi.e7fd5197.js → umi.cd30b05c.js} +1 -1
- package/build/docs/~demos/:uuid.html +3 -3
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/dist/BizComps.js +1 -1
- package/dist/BizComps.js.map +1 -1
- package/es/components/file-list/index.d.ts +2 -0
- package/es/components/file-list/index.js +39 -15
- package/es/components/file-list/item.d.ts +3 -0
- package/es/components/file-list/item.js +200 -117
- package/es/components/file-list/sign.js +13 -87
- package/es/components/file-list/signUtil.js +20 -4
- package/lib/components/file-list/index.d.ts +2 -0
- package/lib/components/file-list/index.js +38 -13
- package/lib/components/file-list/item.d.ts +3 -0
- package/lib/components/file-list/item.js +199 -116
- package/lib/components/file-list/sign.js +11 -85
- package/lib/components/file-list/signUtil.js +20 -4
- package/lowcode/file-list/meta.ts +29 -0
- package/lowcode_es/file-list/meta.js +27 -0
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/file-list/meta.js +27 -0
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import React, { useEffect
|
|
5
|
-
import { initSignPageMethod
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { initSignPageMethod } from "./signUtil";
|
|
6
5
|
import closeIcon from "./icon/close.svg";
|
|
7
6
|
function SignPage(props) {
|
|
8
7
|
var userInfo = props.userInfo,
|
|
9
8
|
file = props.file,
|
|
10
|
-
getRes = props.getRes,
|
|
11
9
|
handleClose = props.handleClose,
|
|
10
|
+
fileList = props.fileList,
|
|
11
|
+
parentPageUrl = props.parentPageUrl,
|
|
12
|
+
toSign = props.toSign,
|
|
12
13
|
token = props.token,
|
|
13
14
|
tokenTY = props.tokenTY,
|
|
14
15
|
baseUrl = props.baseUrl,
|
|
@@ -17,22 +18,9 @@ function SignPage(props) {
|
|
|
17
18
|
closeLoading = props.closeLoading,
|
|
18
19
|
_props$showClose = props.showClose,
|
|
19
20
|
showClose = _props$showClose === void 0 ? true : _props$showClose;
|
|
20
|
-
var _useState = useState(''),
|
|
21
|
-
srcUrl = _useState[0],
|
|
22
|
-
setSrcUrl = _useState[1];
|
|
23
|
-
var _useState2 = useState(''),
|
|
24
|
-
documentId = _useState2[0],
|
|
25
|
-
setDocumentId = _useState2[1];
|
|
26
|
-
var _useState3 = useState(''),
|
|
27
|
-
contractId = _useState3[0],
|
|
28
|
-
setContractId = _useState3[1];
|
|
29
|
-
var _useState4 = useState(''),
|
|
30
|
-
name = _useState4[0],
|
|
31
|
-
setName = _useState4[1];
|
|
32
|
-
var timerRef = useRef(null);
|
|
33
21
|
var init = /*#__PURE__*/function () {
|
|
34
22
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
|
-
var fileObj, res,
|
|
23
|
+
var fileObj, res, pageUrl;
|
|
36
24
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
37
25
|
while (1) switch (_context.prev = _context.next) {
|
|
38
26
|
case 0:
|
|
@@ -49,16 +37,17 @@ function SignPage(props) {
|
|
|
49
37
|
tokenTY: tokenTY,
|
|
50
38
|
baseUrl: baseUrl,
|
|
51
39
|
env: env,
|
|
52
|
-
isPC: isPC
|
|
40
|
+
isPC: isPC,
|
|
41
|
+
fileList: fileList,
|
|
42
|
+
parentPageUrl: parentPageUrl
|
|
53
43
|
});
|
|
54
44
|
case 1:
|
|
55
45
|
res = _context.sent;
|
|
56
|
-
|
|
46
|
+
pageUrl = res.pageUrl;
|
|
57
47
|
closeLoading();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
setName(nameVal);
|
|
48
|
+
if (toSign) {
|
|
49
|
+
toSign(pageUrl);
|
|
50
|
+
}
|
|
62
51
|
console.log(res);
|
|
63
52
|
case 2:
|
|
64
53
|
case "end":
|
|
@@ -70,66 +59,9 @@ function SignPage(props) {
|
|
|
70
59
|
return _ref.apply(this, arguments);
|
|
71
60
|
};
|
|
72
61
|
}();
|
|
73
|
-
var getSignedFile = /*#__PURE__*/function () {
|
|
74
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(documentIdVal, contractIdVal, nameVal) {
|
|
75
|
-
var newFile, finalFile;
|
|
76
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
77
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
78
|
-
case 0:
|
|
79
|
-
_context2.next = 1;
|
|
80
|
-
return getSignRes(documentIdVal, contractIdVal, nameVal, true, {
|
|
81
|
-
token: token,
|
|
82
|
-
tokenTY: tokenTY,
|
|
83
|
-
baseUrl: baseUrl,
|
|
84
|
-
env: env,
|
|
85
|
-
isPC: isPC
|
|
86
|
-
});
|
|
87
|
-
case 1:
|
|
88
|
-
newFile = _context2.sent;
|
|
89
|
-
console.log(newFile, '签署完毕后的');
|
|
90
|
-
if (newFile) {
|
|
91
|
-
// 关闭轮询定时
|
|
92
|
-
handleClearInterval();
|
|
93
|
-
// 关闭弹框
|
|
94
|
-
handleClose();
|
|
95
|
-
// 将手写签批后的新文件 传给
|
|
96
|
-
finalFile = _extends({}, file, {
|
|
97
|
-
fileId: newFile.fileId,
|
|
98
|
-
fileName: nameVal,
|
|
99
|
-
fileUrl: newFile.fileUrlList[2],
|
|
100
|
-
isSigned: true
|
|
101
|
-
});
|
|
102
|
-
console.log('finalFile---', finalFile);
|
|
103
|
-
getRes(finalFile);
|
|
104
|
-
}
|
|
105
|
-
case 2:
|
|
106
|
-
case "end":
|
|
107
|
-
return _context2.stop();
|
|
108
|
-
}
|
|
109
|
-
}, _callee2);
|
|
110
|
-
}));
|
|
111
|
-
return function getSignedFile(_x, _x2, _x3) {
|
|
112
|
-
return _ref2.apply(this, arguments);
|
|
113
|
-
};
|
|
114
|
-
}();
|
|
115
|
-
var handleClearInterval = function handleClearInterval() {
|
|
116
|
-
clearInterval(timerRef.current);
|
|
117
|
-
timerRef.current = null;
|
|
118
|
-
};
|
|
119
62
|
useEffect(function () {
|
|
120
63
|
init();
|
|
121
64
|
}, []);
|
|
122
|
-
useEffect(function () {
|
|
123
|
-
if (srcUrl && documentId && contractId && name && !timerRef.current) {
|
|
124
|
-
handleClearInterval();
|
|
125
|
-
timerRef.current = setInterval(function () {
|
|
126
|
-
getSignedFile(documentId, contractId, name);
|
|
127
|
-
}, 3000);
|
|
128
|
-
}
|
|
129
|
-
return function () {
|
|
130
|
-
handleClearInterval();
|
|
131
|
-
};
|
|
132
|
-
}, [srcUrl, documentId, contractId, name]);
|
|
133
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
134
66
|
className: "sign_page"
|
|
135
67
|
}, showClose && /*#__PURE__*/React.createElement("img", {
|
|
@@ -137,12 +69,6 @@ function SignPage(props) {
|
|
|
137
69
|
src: closeIcon,
|
|
138
70
|
alt: "",
|
|
139
71
|
onClick: handleClose
|
|
140
|
-
}), /*#__PURE__*/React.createElement("iframe", {
|
|
141
|
-
src: srcUrl,
|
|
142
|
-
id: "iframe",
|
|
143
|
-
frameborder: "0",
|
|
144
|
-
height: "100%",
|
|
145
|
-
width: "100%"
|
|
146
72
|
}));
|
|
147
73
|
}
|
|
148
74
|
export default SignPage;
|
|
@@ -18,12 +18,12 @@ export function initSignPageMethod(_x, _x2, _x3) {
|
|
|
18
18
|
// 【第 1 步】上传要手写签批的文件
|
|
19
19
|
function _initSignPageMethod() {
|
|
20
20
|
_initSignPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, config) {
|
|
21
|
-
var fileName, docId, contrId, flag, pageUrl, params;
|
|
21
|
+
var fileName, fileId, originalUrl, fileUrl, docId, contrId, flag, pageUrl, params;
|
|
22
22
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
23
23
|
while (1) switch (_context.prev = _context.next) {
|
|
24
24
|
case 0:
|
|
25
25
|
console.log('fileObj', fileObj, userInfo);
|
|
26
|
-
fileName = fileObj.fileName; // 【第 1 步】上传要手写签批的文件
|
|
26
|
+
fileName = fileObj.fileName, fileId = fileObj.fileId, originalUrl = fileObj.originalUrl, fileUrl = fileObj.fileUrl; // 【第 1 步】上传要手写签批的文件
|
|
27
27
|
_context.next = 1;
|
|
28
28
|
return uploadSignFile(fileObj, config);
|
|
29
29
|
case 1:
|
|
@@ -63,7 +63,7 @@ function _initSignPageMethod() {
|
|
|
63
63
|
return _context.abrupt("return", false);
|
|
64
64
|
case 6:
|
|
65
65
|
_context.next = 7;
|
|
66
|
-
return getSignUrl(userInfo, config);
|
|
66
|
+
return getSignUrl(userInfo, config, fileName, fileId, originalUrl || fileUrl);
|
|
67
67
|
case 7:
|
|
68
68
|
pageUrl = _context.sent;
|
|
69
69
|
if (pageUrl) {
|
|
@@ -212,8 +212,19 @@ function getContractSignUrl(contractIdVal, userInfo, config) {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
// 保存签批信息
|
|
216
|
+
function setSignInfo(fileName, tokenTY, fileId, fileUrl) {
|
|
217
|
+
sessionStorage.setItem(tokenTY, JSON.stringify({
|
|
218
|
+
contractId: contractId,
|
|
219
|
+
documentId: documentId,
|
|
220
|
+
fileName: fileName,
|
|
221
|
+
fileId: fileId,
|
|
222
|
+
fileUrl: fileUrl
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
|
|
215
226
|
// 【第 4 步】获取签 pi 页面
|
|
216
|
-
function getSignUrl(userInfo, config) {
|
|
227
|
+
function getSignUrl(userInfo, config, fileName, fileId, fileUrl) {
|
|
217
228
|
// uni.showLoading({ title: '加载中' })
|
|
218
229
|
var params = {
|
|
219
230
|
contractId: contractId,
|
|
@@ -238,12 +249,17 @@ function getSignUrl(userInfo, config) {
|
|
|
238
249
|
autoClosePage: true,
|
|
239
250
|
// 操作完成自动关闭页面
|
|
240
251
|
language: 'ZH_CN',
|
|
252
|
+
callbackPage: config.parentPageUrl,
|
|
241
253
|
deviceType: config.isPC || 'H5' // 取值范围:PC(返回 PC 页面),H5(返回 H5 页面);不传值默认为:根据请求的 UserAgent 自动判断返回的页面类型。
|
|
242
254
|
};
|
|
243
255
|
return new Promise(function (resolve) {
|
|
244
256
|
signurl(params, config).then(function (res) {
|
|
245
257
|
console.log(res, '页面结果');
|
|
246
258
|
if (res.data.code == 0) {
|
|
259
|
+
if (config.fileList) {
|
|
260
|
+
setSignInfo(fileName, config.tokenTY, fileId, fileUrl);
|
|
261
|
+
localStorage.setItem(config.tokenTY, JSON.stringify(config.fileList));
|
|
262
|
+
}
|
|
247
263
|
resolve(res.data.signUrl);
|
|
248
264
|
} else {
|
|
249
265
|
resolve(false);
|
|
@@ -54,18 +54,34 @@ var FileList = function FileList(_ref) {
|
|
|
54
54
|
valChange = _ref.valChange,
|
|
55
55
|
saveSignerInfo = _ref.saveSignerInfo,
|
|
56
56
|
applySeal = _ref.applySeal,
|
|
57
|
-
signInfoMap = _ref.signInfoMap
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
signInfoMap = _ref.signInfoMap,
|
|
58
|
+
parentPageUrl = _ref.parentPageUrl,
|
|
59
|
+
toSign = _ref.toSign;
|
|
60
|
+
var _useState = (0, _react.useState)(fileList),
|
|
61
|
+
fileArray = _useState[0],
|
|
62
|
+
setFileArray = _useState[1];
|
|
63
|
+
(0, _react.useEffect)(function () {
|
|
64
|
+
var stored = localStorage.getItem(tokenTY);
|
|
65
|
+
console.log('fileList-stored', stored);
|
|
66
|
+
if (stored) {
|
|
67
|
+
try {
|
|
68
|
+
setFileArray(JSON.parse(stored));
|
|
69
|
+
} catch (e) {}
|
|
70
|
+
} else {
|
|
71
|
+
setFileArray(fileList);
|
|
72
|
+
}
|
|
73
|
+
}, [fileList]);
|
|
74
|
+
var _useState2 = (0, _react.useState)(false),
|
|
75
|
+
showMerge = _useState2[0],
|
|
76
|
+
setShowMerge = _useState2[1];
|
|
77
|
+
var _useState3 = (0, _react.useState)({
|
|
62
78
|
materialName: '',
|
|
63
79
|
fileList: [],
|
|
64
80
|
index: 0,
|
|
65
81
|
subIndex: 0
|
|
66
82
|
}),
|
|
67
|
-
curMerge =
|
|
68
|
-
setCurMerge =
|
|
83
|
+
curMerge = _useState3[0],
|
|
84
|
+
setCurMerge = _useState3[1];
|
|
69
85
|
var convertNumbersToChinese = function convertNumbersToChinese(str) {
|
|
70
86
|
// 定义基础映射关系
|
|
71
87
|
var digitMap = {
|
|
@@ -103,13 +119,13 @@ var FileList = function FileList(_ref) {
|
|
|
103
119
|
|
|
104
120
|
// 拼接材料的提示文案 - 二级材料
|
|
105
121
|
var getTipTextForSubMaterial = function getTipTextForSubMaterial(item, index, subIndex) {
|
|
106
|
-
var subMaterials =
|
|
122
|
+
var subMaterials = fileArray[index].subMaterials;
|
|
107
123
|
console.log('getTipTextForSubMaterial', item, index, subIndex);
|
|
108
124
|
console.log('subMaterials', subMaterials);
|
|
109
125
|
var materialSize = item.materialSize,
|
|
110
126
|
materialSpec = item.materialSpec,
|
|
111
127
|
materialType = item.materialType;
|
|
112
|
-
var groupId =
|
|
128
|
+
var groupId = fileArray[index].subMaterials[subIndex].groupId;
|
|
113
129
|
if (!materialSpec) return '';
|
|
114
130
|
var formatText = materialSpec.split(',').map(function (i) {
|
|
115
131
|
return MATERIAL_FORMAT[i];
|
|
@@ -151,7 +167,7 @@ var FileList = function FileList(_ref) {
|
|
|
151
167
|
var handleChange = function handleChange(value, fileIndex, index, subIndex) {
|
|
152
168
|
console.log('handleChange', value, fileIndex, index, subIndex);
|
|
153
169
|
// 先找到一级目录
|
|
154
|
-
var oneLevelItem =
|
|
170
|
+
var oneLevelItem = fileArray[index];
|
|
155
171
|
// 如果subIndex有值。再去找一下二级目录
|
|
156
172
|
if (subIndex !== undefined) {
|
|
157
173
|
// value为空,说明删除了
|
|
@@ -197,8 +213,9 @@ var FileList = function FileList(_ref) {
|
|
|
197
213
|
}
|
|
198
214
|
}
|
|
199
215
|
}
|
|
200
|
-
console.log('fileList--------res',
|
|
201
|
-
valChange(
|
|
216
|
+
console.log('fileList--------res', fileArray);
|
|
217
|
+
valChange(fileArray);
|
|
218
|
+
setFileArray([].concat(fileArray));
|
|
202
219
|
};
|
|
203
220
|
|
|
204
221
|
// 如果 文件列表中都是图片,且数量大于1 判断需要合并
|
|
@@ -229,7 +246,7 @@ var FileList = function FileList(_ref) {
|
|
|
229
246
|
style: (0, _extends2["default"])({}, style, {
|
|
230
247
|
width: '100%'
|
|
231
248
|
})
|
|
232
|
-
},
|
|
249
|
+
}, fileArray.map(function (item, index) {
|
|
233
250
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
234
251
|
className: "file_level_one"
|
|
235
252
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -283,11 +300,13 @@ var FileList = function FileList(_ref) {
|
|
|
283
300
|
className: "tip"
|
|
284
301
|
}, getTipTextForSubMaterial(item, index, subIndex)), child.fileList.map(function (file, i) {
|
|
285
302
|
return /*#__PURE__*/_react["default"].createElement(_item["default"], {
|
|
303
|
+
key: file.fileId || i,
|
|
286
304
|
index: index,
|
|
287
305
|
subIndex: subIndex,
|
|
288
306
|
fileIndex: i,
|
|
289
307
|
file: file,
|
|
290
308
|
fileConfig: child,
|
|
309
|
+
fileList: fileArray,
|
|
291
310
|
maxFileSize: item.materialSize,
|
|
292
311
|
spec: item.materialSpec,
|
|
293
312
|
userInfo: userInfo,
|
|
@@ -305,6 +324,8 @@ var FileList = function FileList(_ref) {
|
|
|
305
324
|
valChange: handleChange,
|
|
306
325
|
openLoading: openLoading,
|
|
307
326
|
closeLoading: closeLoading,
|
|
327
|
+
parentPageUrl: parentPageUrl,
|
|
328
|
+
toSign: toSign,
|
|
308
329
|
saveSignerInfo: saveSignerInfo,
|
|
309
330
|
style: {
|
|
310
331
|
marginBottom: '12px'
|
|
@@ -315,12 +336,14 @@ var FileList = function FileList(_ref) {
|
|
|
315
336
|
className: "tip"
|
|
316
337
|
}, getTipText(item)), item.fileList.map(function (file, i) {
|
|
317
338
|
return /*#__PURE__*/_react["default"].createElement(_item["default"], {
|
|
339
|
+
key: file.fileId || i,
|
|
318
340
|
index: index,
|
|
319
341
|
fileIndex: i,
|
|
320
342
|
signerInfo: signerInfo || {},
|
|
321
343
|
signInfoMap: signInfoMap,
|
|
322
344
|
file: file,
|
|
323
345
|
fileConfig: item,
|
|
346
|
+
fileList: fileArray,
|
|
324
347
|
maxFileSize: item.materialSize,
|
|
325
348
|
spec: item.materialSpec,
|
|
326
349
|
userInfo: userInfo,
|
|
@@ -330,12 +353,14 @@ var FileList = function FileList(_ref) {
|
|
|
330
353
|
baseUrl: baseUrl,
|
|
331
354
|
env: env,
|
|
332
355
|
isPC: isPC,
|
|
356
|
+
toSign: toSign,
|
|
333
357
|
disabled: disabled,
|
|
334
358
|
download: download,
|
|
335
359
|
applySeal: applySeal,
|
|
336
360
|
valChange: handleChange,
|
|
337
361
|
openLoading: openLoading,
|
|
338
362
|
closeLoading: closeLoading,
|
|
363
|
+
parentPageUrl: parentPageUrl,
|
|
339
364
|
saveSignerInfo: saveSignerInfo,
|
|
340
365
|
style: {
|
|
341
366
|
marginBottom: '12px'
|
|
@@ -19,6 +19,9 @@ export interface FileItemProps {
|
|
|
19
19
|
userInfo: object;
|
|
20
20
|
style?: object;
|
|
21
21
|
signerInfo?: object;
|
|
22
|
+
fileList: Array<object>;
|
|
23
|
+
parentPageUrl?: string;
|
|
24
|
+
toSign?: (url: string) => void;
|
|
22
25
|
openLoading: () => void;
|
|
23
26
|
applySeal: () => void;
|
|
24
27
|
closeLoading: () => void;
|