ztxkui 10.0.95 → 10.0.97
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/components/TranslationButton/DownFile.d.ts +7 -0
- package/dist/components/TranslationButton/DownFile.js +97 -0
- package/dist/components/TranslationButton/PreviewFile.d.ts +5 -0
- package/dist/components/TranslationButton/PreviewFile.js +75 -0
- package/dist/components/TranslationButton/TranslationButton.d.ts +34 -0
- package/dist/components/TranslationButton/TranslationButton.js +247 -0
- package/dist/components/TranslationButton/demoComponents/index.d.ts +3 -0
- package/dist/components/TranslationButton/demoComponents/index.js +9 -0
- package/dist/components/TranslationButton/hooks.d.ts +8 -0
- package/dist/components/TranslationButton/hooks.js +143 -0
- package/dist/components/TranslationButton/index.d.ts +4 -0
- package/dist/components/TranslationButton/index.js +4 -0
- package/dist/components/Upload/utils.d.ts +8 -1
- package/dist/components/Upload/utils.js +56 -4
- package/dist/components/UploadCustom/hooks/useDg.d.ts +6 -0
- package/dist/components/UploadCustom/hooks/useDg.js +57 -0
- package/dist/components/business/Signatures/components/CodeModal.d.ts +3 -0
- package/dist/components/business/Signatures/components/CodeModal.js +159 -0
- package/dist/components/electron-signatures/content.d.ts +9 -0
- package/dist/components/electron-signatures/content.js +1126 -0
- package/dist/components/electron-signatures/demoComponents/data.d.ts +58 -0
- package/dist/components/electron-signatures/demoComponents/data.js +1307 -0
- package/dist/components/electron-signatures/demoComponents/detail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/detail.js +283 -0
- package/dist/components/electron-signatures/demoComponents/index.d.ts +2 -0
- package/dist/components/electron-signatures/demoComponents/index.js +27 -0
- package/dist/components/electron-signatures/demoComponents/index_old.d.ts +3 -0
- package/dist/components/electron-signatures/demoComponents/index_old.js +502 -0
- package/dist/components/electron-signatures/demoComponents/jgqrd.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/jgqrd.js +135 -0
- package/dist/components/electron-signatures/demoComponents/making.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/making.js +211 -0
- package/dist/components/electron-signatures/demoComponents/makingData.d.ts +663 -0
- package/dist/components/electron-signatures/demoComponents/makingData.js +1164 -0
- package/dist/components/electron-signatures/demoComponents/newDetail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/newDetail.js +283 -0
- package/dist/components/electron-signatures/demoComponents/preview.d.ts +3 -0
- package/dist/components/electron-signatures/demoComponents/preview.js +9 -0
- package/dist/components/electron-signatures/demoComponents/singleQjDetail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/singleQjDetail.js +530 -0
- package/dist/components/electron-signatures/demoComponents/singleQjMaking.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/singleQjMaking.js +219 -0
- package/dist/components/electron-signatures/demoComponents/test.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/test.js +119 -0
- package/dist/components/electron-signatures/dgComponents/contract-comparison.d.ts +39 -0
- package/dist/components/electron-signatures/dgComponents/contract-comparison.js +53 -0
- package/dist/components/electron-signatures/dgComponents/file-comparison-btn.d.ts +11 -0
- package/dist/components/electron-signatures/dgComponents/file-comparison-btn.js +180 -0
- package/dist/components/electron-signatures/dgComponents/new-contract-comparison.d.ts +45 -0
- package/dist/components/electron-signatures/dgComponents/new-contract-comparison.js +68 -0
- package/dist/components/electron-signatures/dgComponents/useContractColumns.d.ts +21 -0
- package/dist/components/electron-signatures/dgComponents/useContractColumns.js +171 -0
- package/dist/components/electron-signatures/electron-signatures-fragment.d.ts +8 -0
- package/dist/components/electron-signatures/electron-signatures-fragment.js +344 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.d.ts +52 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.js +513 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-detail.d.ts +8 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-detail.js +59 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-download.d.ts +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-download.js +89 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.d.ts +9 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.js +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.d.ts +15 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.js +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item.d.ts +20 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item.js +47 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-list.d.ts +11 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-list.js +191 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-setting.d.ts +15 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-setting.js +10 -0
- package/dist/components/electron-signatures/electronComponents/last-qys-modal.d.ts +7 -0
- package/dist/components/electron-signatures/electronComponents/last-qys-modal.js +42 -0
- package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.d.ts +3 -0
- package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.js +45 -0
- package/dist/components/electron-signatures/electronComponents/useElectronColumns.d.ts +30 -0
- package/dist/components/electron-signatures/electronComponents/useElectronColumns.js +380 -0
- package/dist/components/electron-signatures/electronComponents/useFetchElectronData.d.ts +20 -0
- package/dist/components/electron-signatures/electronComponents/useFetchElectronData.js +169 -0
- package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.d.ts +3 -0
- package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.js +38 -0
- package/dist/components/electron-signatures/fileComponents/file-operation.d.ts +7 -0
- package/dist/components/electron-signatures/fileComponents/file-operation.js +67 -0
- package/dist/components/electron-signatures/fileComponents/file-type-select.d.ts +12 -0
- package/dist/components/electron-signatures/fileComponents/file-type-select.js +10 -0
- package/dist/components/electron-signatures/fileComponents/file-upload.d.ts +11 -0
- package/dist/components/electron-signatures/fileComponents/file-upload.js +146 -0
- package/dist/components/electron-signatures/fileComponents/fileUtils.d.ts +17 -0
- package/dist/components/electron-signatures/fileComponents/fileUtils.js +36 -0
- package/dist/components/electron-signatures/fileComponents/new-file-operation.d.ts +10 -0
- package/dist/components/electron-signatures/fileComponents/new-file-operation.js +73 -0
- package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.d.ts +13 -0
- package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.js +45 -0
- package/dist/components/electron-signatures/fileComponents/useFileColumns.d.ts +38 -0
- package/dist/components/electron-signatures/fileComponents/useFileColumns.js +329 -0
- package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.d.ts +19 -0
- package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.js +72 -0
- package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.d.ts +30 -0
- package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.js +134 -0
- package/dist/components/electron-signatures/hooks/useMergeRecords.d.ts +17 -0
- package/dist/components/electron-signatures/hooks/useMergeRecords.js +49 -0
- package/dist/components/electron-signatures/hooks/useParseElectronListData.d.ts +49 -0
- package/dist/components/electron-signatures/hooks/useParseElectronListData.js +111 -0
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.d.ts +102 -0
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.js +365 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.d.ts +40 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.js +139 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.d.ts +36 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.js +48 -0
- package/dist/components/electron-signatures/hooks/useParseQunjListData.d.ts +56 -0
- package/dist/components/electron-signatures/hooks/useParseQunjListData.js +204 -0
- package/dist/components/electron-signatures/hooks/useParseQunjSingleData.d.ts +34 -0
- package/dist/components/electron-signatures/hooks/useParseQunjSingleData.js +110 -0
- package/dist/components/electron-signatures/hooks/useParseRecords.d.ts +65 -0
- package/dist/components/electron-signatures/hooks/useParseRecords.js +165 -0
- package/dist/components/electron-signatures/index.d.ts +13 -0
- package/dist/components/electron-signatures/index.js +54 -0
- package/dist/components/electron-signatures/index_old.d.ts +9 -0
- package/dist/components/electron-signatures/index_old.js +966 -0
- package/dist/components/electron-signatures/interface.d.ts +849 -0
- package/dist/components/electron-signatures/interface.js +57 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-apply.d.ts +6 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-apply.js +8 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-check.d.ts +21 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-check.js +41 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-detail.d.ts +35 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-detail.js +267 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-list.d.ts +24 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-list.js +346 -0
- package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.d.ts +20 -0
- package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.js +63 -0
- package/dist/components/electron-signatures/qunjComponents/useQunjColumns.d.ts +36 -0
- package/dist/components/electron-signatures/qunjComponents/useQunjColumns.js +321 -0
- package/dist/components/electron-signatures/translateComponents/TranslateButton.d.ts +10 -0
- package/dist/components/electron-signatures/translateComponents/TranslateButton.js +44 -0
- package/dist/components/electron-signatures/translateComponents/useTranslateCom.d.ts +22 -0
- package/dist/components/electron-signatures/translateComponents/useTranslateCom.js +50 -0
- package/dist/components/electron-signatures/utils.d.ts +26 -0
- package/dist/components/electron-signatures/utils.js +67 -0
- package/dist/components/utils/ZtxkContext.d.ts +16 -0
- package/dist/components/utils/ZtxkContext.js +4 -0
- package/dist/components/utils/useMemoizedFn.d.ts +6 -0
- package/dist/components/utils/useMemoizedFn.js +22 -0
- package/dist/components/utils/usePrevious.d.ts +3 -0
- package/dist/components/utils/usePrevious.js +13 -0
- package/dist/index.css +686 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +105 -87
- package/dist/request.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
2
|
+
/**
|
|
3
|
+
* 附件相关操作 下载 预览 删除
|
|
4
|
+
*/
|
|
5
|
+
import React, { memo } from 'react';
|
|
6
|
+
import { Button, Popconfirm, Checkbox } from '../../../index';
|
|
7
|
+
import { downloadFileCallBack, previewFile, batchPreviewFile, } from 'ztxkutils/dist/fileOperation';
|
|
8
|
+
import { getToken } from 'ztxkutils/dist/authority';
|
|
9
|
+
import { dangerouslySetXss } from 'ztxkutils/dist/tools';
|
|
10
|
+
import { downloadFile } from './fileUtils';
|
|
11
|
+
import { isImage } from '../../utils/upload';
|
|
12
|
+
import FileUpload from './file-upload';
|
|
13
|
+
import TranslationButton from '../translateComponents/TranslateButton';
|
|
14
|
+
var FileOperation = function (props) {
|
|
15
|
+
var isDownload = props.isDownload, isPreview = props.isPreview, isEdit = props.isEdit, isWater = props.isWater, records = props.records, isDelete = props.isDelete, fileName = props.fileName, _a = props.fileId, fileId = _a === void 0 ? '' : _a, _b = props.preFileId, preFileId = _b === void 0 ? '' : _b, _c = props.preFileName, preFileName = _c === void 0 ? '' : _c, _d = props.apiBaseUrl, apiBaseUrl = _d === void 0 ? '' : _d, _e = props.fileBaseUrl, fileBaseUrl = _e === void 0 ? '' : _e, onDelete = props.onDelete, onWatermarkChange = props.onWatermarkChange, organizationId = props.organizationId, isReplaceFile = props.isReplaceFile, fileList = props.fileList, onFileReplace = props.onFileReplace, _f = props.showAddWater, showAddWater = _f === void 0 ? true : _f, request = props.request, previewUrl = props.previewUrl, isTranslation = props.isTranslation, record = props.record, realIndex = props.realIndex, setRecords = props.setRecords, isNeedDg = props.isNeedDg;
|
|
16
|
+
var previewBtn = function (attachId, previewTitle, fileName) {
|
|
17
|
+
return (React.createElement(Button, { type: "link", onClick: function () {
|
|
18
|
+
// 实现批量预览,只针对图片
|
|
19
|
+
var result = isImage(fileName);
|
|
20
|
+
if (result) {
|
|
21
|
+
var allImage = (Array.isArray(records) ? records : [])
|
|
22
|
+
.filter(function (item) { return isImage(item.attachName) && item.attachId !== attachId; })
|
|
23
|
+
.map(function (item) { return item.attachId; });
|
|
24
|
+
batchPreviewFile(fileBaseUrl, attachId + "," + allImage, {
|
|
25
|
+
titleName: fileName,
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
previewFile(fileBaseUrl, attachId, {
|
|
30
|
+
titleName: dangerouslySetXss(fileName),
|
|
31
|
+
});
|
|
32
|
+
} }, previewTitle));
|
|
33
|
+
};
|
|
34
|
+
function onFileChange(info) {
|
|
35
|
+
onFileReplace && onFileReplace(info, fileId);
|
|
36
|
+
}
|
|
37
|
+
return (React.createElement("div", { className: "file-operation--wrap" },
|
|
38
|
+
React.createElement("p", { className: "file-operation--title" }, fileName),
|
|
39
|
+
showAddWater && isEdit && fileId && (React.createElement("div", { className: "file-operation--isWater" },
|
|
40
|
+
React.createElement(Checkbox, { checked: isWater, onChange: function (e) {
|
|
41
|
+
onWatermarkChange && onWatermarkChange(e.target.checked);
|
|
42
|
+
} }, i18next.t('添加水印')))),
|
|
43
|
+
React.createElement("div", { className: "file-operation--list" },
|
|
44
|
+
isReplaceFile && (React.createElement(FileUpload, { fileList: fileList, apiBaseUrl: apiBaseUrl, onFileChange: onFileChange, type: "link" }, i18next.t('替换'))),
|
|
45
|
+
isDownload && fileId ? (React.createElement(Button, { type: "link", onClick: function () {
|
|
46
|
+
downloadFileCallBack(apiBaseUrl, fileId, dangerouslySetXss(fileName) || i18next.t('附件'), {
|
|
47
|
+
addWaterMark: false,
|
|
48
|
+
});
|
|
49
|
+
} }, i18next.t('下载'))) : null,
|
|
50
|
+
isPreview && fileId && previewBtn(fileId, i18next.t('预览'), fileName),
|
|
51
|
+
isPreview &&
|
|
52
|
+
preFileId &&
|
|
53
|
+
previewBtn(preFileId, i18next.t('上一版'), preFileName),
|
|
54
|
+
(!isEdit && isDownload && fileId && isWater) ||
|
|
55
|
+
(!isEdit && !showAddWater) ? (React.createElement(Button, { type: "link", onClick: function () {
|
|
56
|
+
var token = getToken();
|
|
57
|
+
downloadFile(fileId, dangerouslySetXss(fileName) || i18next.t('附件'), {
|
|
58
|
+
API_BASEURL: apiBaseUrl,
|
|
59
|
+
authToken: token ? token : '',
|
|
60
|
+
organizationId: organizationId,
|
|
61
|
+
});
|
|
62
|
+
} }, i18next.t('下载水印版'))) : null,
|
|
63
|
+
isDelete && (fileId || fileName) && (React.createElement(Popconfirm, { title: i18next.t('是否删除该条数据?'), cancelText: i18next.t('否'), okText: i18next.t('是'), onConfirm: onDelete },
|
|
64
|
+
React.createElement(Button, { type: "link" }, i18next.t('删除')))),
|
|
65
|
+
isNeedDg && (React.createElement(TranslationButton, { request: request, previewUrl: previewUrl, isTranslation: isTranslation, record: record, realIndex: realIndex, setRecords: setRecords })))));
|
|
66
|
+
};
|
|
67
|
+
export default memo(FileOperation);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 附件类型下拉框
|
|
3
|
+
*/
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
|
+
import { EnhanceSelect } from '../../../index';
|
|
6
|
+
var FileTypeSelect = function (props) {
|
|
7
|
+
var list = props.list, value = props.value, onChange = props.onChange;
|
|
8
|
+
return (React.createElement(EnhanceSelect, { list: list, dataKey: "dictKey", titleKey: "dictValue", value: value, onChange: onChange, dropdownMatchSelectWidth: 160 }));
|
|
9
|
+
};
|
|
10
|
+
export default memo(FileTypeSelect);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 附件上传按钮
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { IFileUploadProps } from '../interface';
|
|
6
|
+
declare const _default: React.NamedExoticComponent<IFileUploadProps>;
|
|
7
|
+
export default _default;
|
|
8
|
+
/**
|
|
9
|
+
* 附件上传前的控制
|
|
10
|
+
*/
|
|
11
|
+
export declare function useBeforeUpload(props: Partial<IFileUploadProps>): (file: any, fileList: any[]) => any;
|
|
@@ -0,0 +1,146 @@
|
|
|
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
|
+
};
|
|
12
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
13
|
+
/**
|
|
14
|
+
* 附件上传按钮
|
|
15
|
+
*/
|
|
16
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
17
|
+
import { Upload } from 'antd';
|
|
18
|
+
import { Button, message } from '../../../index';
|
|
19
|
+
import useBaseContext from '../../utils/useBaseContext';
|
|
20
|
+
import useLastest from '../../utils/useLastest';
|
|
21
|
+
import { getToken } from 'ztxkutils/dist/authority';
|
|
22
|
+
import { formatUnit, getFileExtension } from '../utils';
|
|
23
|
+
var FileUpload = function (props) {
|
|
24
|
+
var apiBaseUrl = props.apiBaseUrl, headers = props.headers, data = props.data, isPublic = props.isPublic, acceptList = props.acceptList, maxSize = props.maxSize, beforeUpload = props.beforeUpload, disAllowDuplicateFile = props.disAllowDuplicateFile, fileList = props.fileList, onFileChange = props.onFileChange, children = props.children, _a = props.multiple, multiple = _a === void 0 ? true : _a, _b = props.type, type = _b === void 0 ? 'primary' : _b;
|
|
25
|
+
var _c = useState(false), loading = _c[0], setLoading = _c[1];
|
|
26
|
+
// 取接口地址
|
|
27
|
+
var defaultApiBaseUrl = useBaseContext().apiBaseUrl;
|
|
28
|
+
var _d = useBasicInfo({
|
|
29
|
+
apiBaseUrl: apiBaseUrl || defaultApiBaseUrl,
|
|
30
|
+
headers: headers,
|
|
31
|
+
data: data,
|
|
32
|
+
isPublic: isPublic,
|
|
33
|
+
}), fileAction = _d.fileAction, fileHeaders = _d.fileHeaders, fileData = _d.fileData;
|
|
34
|
+
// 文件上传前的判断处理
|
|
35
|
+
var beforeUploadHandle = useBeforeUpload({
|
|
36
|
+
acceptList: acceptList,
|
|
37
|
+
maxSize: maxSize,
|
|
38
|
+
beforeUpload: beforeUpload,
|
|
39
|
+
disAllowDuplicateFile: disAllowDuplicateFile,
|
|
40
|
+
fileList: fileList,
|
|
41
|
+
});
|
|
42
|
+
var onChange = useCallback(function (info) {
|
|
43
|
+
setLoading(true);
|
|
44
|
+
var file = info.file;
|
|
45
|
+
if (file.status === 'done' || file.status === 'error') {
|
|
46
|
+
setLoading(false);
|
|
47
|
+
}
|
|
48
|
+
if (file.status === 'error') {
|
|
49
|
+
message.info(i18next.t('该 {{slot0}} 附件上传失败,请重新上传!', {
|
|
50
|
+
slot0: file.name,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
onFileChange && onFileChange(info);
|
|
54
|
+
}, [onFileChange]);
|
|
55
|
+
return (React.createElement(Upload, { action: fileAction, headers: fileHeaders, data: fileData, showUploadList: false, beforeUpload: beforeUploadHandle, onChange: onChange, disabled: loading, multiple: multiple, className: "electron-file-upload" },
|
|
56
|
+
React.createElement(Button, { type: type, loading: loading }, children)));
|
|
57
|
+
};
|
|
58
|
+
export default memo(FileUpload);
|
|
59
|
+
function useBasicInfo(props) {
|
|
60
|
+
var action = props.action, _a = props.apiBaseUrl, apiBaseUrl = _a === void 0 ? '' : _a, headers = props.headers, data = props.data, isPublic = props.isPublic;
|
|
61
|
+
// 文件上传路径
|
|
62
|
+
var fileAction = action ? action : createUploadFileLink({ apiBaseUrl: apiBaseUrl });
|
|
63
|
+
// 文件上传头部参数
|
|
64
|
+
var fileHeaders = useMemo(function () {
|
|
65
|
+
return __assign({ 'Zmdms-Auth': getToken() || '' }, headers);
|
|
66
|
+
}, [headers]);
|
|
67
|
+
// 其余参数
|
|
68
|
+
var fileData = useMemo(function () {
|
|
69
|
+
var newData = __assign({}, data);
|
|
70
|
+
// 如果是公用的 上传的时候 需要传递这个参数
|
|
71
|
+
if (isPublic) {
|
|
72
|
+
newData.isAuth = '2';
|
|
73
|
+
}
|
|
74
|
+
return newData;
|
|
75
|
+
}, [data, isPublic]);
|
|
76
|
+
return {
|
|
77
|
+
fileAction: fileAction,
|
|
78
|
+
fileHeaders: fileHeaders,
|
|
79
|
+
fileData: fileData,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function createUploadFileLink(options) {
|
|
83
|
+
var apiBaseUrl = options.apiBaseUrl;
|
|
84
|
+
return apiBaseUrl + "/api/zmdms-resource/oss/endpoint/put-file-attach";
|
|
85
|
+
}
|
|
86
|
+
// 默认限制的文件类型
|
|
87
|
+
var NO_ACCEPT = ['exe'];
|
|
88
|
+
/**
|
|
89
|
+
* 附件上传前的控制
|
|
90
|
+
*/
|
|
91
|
+
export function useBeforeUpload(props) {
|
|
92
|
+
var acceptList = props.acceptList, _a = props.maxSize, maxSize = _a === void 0 ? 104857600 : _a, beforeUpload = props.beforeUpload, disAllowDuplicateFile = props.disAllowDuplicateFile, fileList = props.fileList;
|
|
93
|
+
var maxSizeStr = formatUnit(maxSize);
|
|
94
|
+
var fileListRef = useLastest(fileList);
|
|
95
|
+
return useCallback(function (file, fileList) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
var fileName = file.name, fileSize = file.size;
|
|
98
|
+
// 获取文件后缀
|
|
99
|
+
var _c = getFileExtension(fileName), fileExtension = _c[1];
|
|
100
|
+
if (beforeUpload) {
|
|
101
|
+
var result = beforeUpload(file, fileList);
|
|
102
|
+
if (result) {
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (disAllowDuplicateFile &&
|
|
107
|
+
((_b = (_a = fileListRef.current) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, function (item) { return item.name === fileName || item.attachName === fileName; }))) {
|
|
108
|
+
message.warning(i18next.t('不能上传同名附件!'));
|
|
109
|
+
return Upload.LIST_IGNORE;
|
|
110
|
+
}
|
|
111
|
+
// 文件大小
|
|
112
|
+
if (fileSize === 0) {
|
|
113
|
+
message.warning(i18next.t('不能上传空文件!'));
|
|
114
|
+
return Upload.LIST_IGNORE;
|
|
115
|
+
}
|
|
116
|
+
// 获取支持的附件类型
|
|
117
|
+
var ACCEPT = acceptList ? acceptList : [];
|
|
118
|
+
ACCEPT = ACCEPT.map(function (a) { return a.toLowerCase(); });
|
|
119
|
+
// 默认支持任何格式的文件,但是不支持exe
|
|
120
|
+
if (ACCEPT.length > 0 && !ACCEPT.includes(fileExtension)) {
|
|
121
|
+
message.warning(i18next.t('不支持 {{fileExtension}} 文件格式', {
|
|
122
|
+
fileExtension: fileExtension,
|
|
123
|
+
}));
|
|
124
|
+
return Upload.LIST_IGNORE;
|
|
125
|
+
}
|
|
126
|
+
if (ACCEPT.length === 0 && NO_ACCEPT.includes(fileExtension)) {
|
|
127
|
+
message.warning(i18next.t('不支持 {{fileExtension}} 文件格式', {
|
|
128
|
+
fileExtension: fileExtension,
|
|
129
|
+
}));
|
|
130
|
+
return Upload.LIST_IGNORE;
|
|
131
|
+
}
|
|
132
|
+
// 文件大小限制
|
|
133
|
+
if (maxSize && fileSize > maxSize) {
|
|
134
|
+
message.warning(i18next.t('文件超出 {{maxSizeStr}}!', { maxSizeStr: maxSizeStr }));
|
|
135
|
+
return Upload.LIST_IGNORE;
|
|
136
|
+
}
|
|
137
|
+
return Promise.resolve(file);
|
|
138
|
+
}, [
|
|
139
|
+
acceptList,
|
|
140
|
+
maxSize,
|
|
141
|
+
maxSizeStr,
|
|
142
|
+
beforeUpload,
|
|
143
|
+
fileListRef,
|
|
144
|
+
disAllowDuplicateFile,
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface IOptions {
|
|
2
|
+
API_BASEURL: string;
|
|
3
|
+
authToken?: string;
|
|
4
|
+
organizationId?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 附件下载方法
|
|
8
|
+
* @param fileId 附件id
|
|
9
|
+
* @param fileName 附件名称
|
|
10
|
+
* @param options
|
|
11
|
+
* @param options.API_BASEURL {string} 接口请求的前缀地址 必传
|
|
12
|
+
* @param options.authToken {string} token 非必传
|
|
13
|
+
* @param options.waterMark {boolean | string} 是否添加水印 是否指定水印名称 非必传
|
|
14
|
+
* @param options.open boolean 是否不需要登录信息
|
|
15
|
+
*/
|
|
16
|
+
export declare function downloadFile(fileId: string, fileName: string, options: IOptions): Promise<unknown>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 附件下载方法
|
|
3
|
+
* @param fileId 附件id
|
|
4
|
+
* @param fileName 附件名称
|
|
5
|
+
* @param options
|
|
6
|
+
* @param options.API_BASEURL {string} 接口请求的前缀地址 必传
|
|
7
|
+
* @param options.authToken {string} token 非必传
|
|
8
|
+
* @param options.waterMark {boolean | string} 是否添加水印 是否指定水印名称 非必传
|
|
9
|
+
* @param options.open boolean 是否不需要登录信息
|
|
10
|
+
*/
|
|
11
|
+
export function downloadFile(fileId, fileName, options) {
|
|
12
|
+
var API_BASEURL = options.API_BASEURL, authToken = options.authToken, organizationId = options.organizationId;
|
|
13
|
+
return new Promise(function (resolve, reject) {
|
|
14
|
+
var xhr = new XMLHttpRequest();
|
|
15
|
+
// 获取请求基础数据
|
|
16
|
+
xhr.open('GET', API_BASEURL + "/api/zmdms-resource/seal/download-watermark-attach/" + fileId + "?watermarkOrganizationType=12&watermarkOrganizationId=" + organizationId + "&Zmdms-Auth=bearer " + authToken, true);
|
|
17
|
+
xhr.responseType = 'blob';
|
|
18
|
+
xhr.onload = function () {
|
|
19
|
+
if (xhr.status === 200 || xhr.status === 201) {
|
|
20
|
+
var link = document.createElement('a');
|
|
21
|
+
link.href = window.URL.createObjectURL(xhr.response);
|
|
22
|
+
link.download = (fileName === null || fileName === void 0 ? void 0 : fileName.split('.')[0]) + ".pdf";
|
|
23
|
+
// fix Firefox
|
|
24
|
+
link.style.display = 'none';
|
|
25
|
+
document.body.appendChild(link);
|
|
26
|
+
link.click();
|
|
27
|
+
document.body.removeChild(link);
|
|
28
|
+
window.URL.revokeObjectURL(link.href);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
xhr.onerror = function (err) {
|
|
32
|
+
reject(err);
|
|
33
|
+
};
|
|
34
|
+
xhr.send();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 附件相关操作 下载 预览 删除
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { IFileOperationProps } from '../interface';
|
|
6
|
+
declare const _default: React.NamedExoticComponent<IFileOperationProps & {
|
|
7
|
+
currentDate?: any;
|
|
8
|
+
isWorlflowCompleted?: any;
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
2
|
+
/**
|
|
3
|
+
* 附件相关操作 下载 预览 删除
|
|
4
|
+
*/
|
|
5
|
+
import React, { memo } from 'react';
|
|
6
|
+
import { Button } from '../../../index';
|
|
7
|
+
import { previewFile, batchPreviewFile, } from 'ztxkutils/dist/fileOperation';
|
|
8
|
+
import { dangerouslySetXss } from 'ztxkutils/dist/tools';
|
|
9
|
+
import { isImage } from '../../utils/upload';
|
|
10
|
+
import FileUpload from './file-upload';
|
|
11
|
+
var FileOperation = function (props) {
|
|
12
|
+
var isDownload = props.isDownload, isPreview = props.isPreview, isEdit = props.isEdit, isWater = props.isWater, records = props.records, isDelete = props.isDelete, fileName = props.fileName, _a = props.fileId, fileId = _a === void 0 ? '' : _a, _b = props.preFileId, preFileId = _b === void 0 ? '' : _b, _c = props.preFileName, preFileName = _c === void 0 ? '' : _c, _d = props.apiBaseUrl, apiBaseUrl = _d === void 0 ? '' : _d, _e = props.fileBaseUrl, fileBaseUrl = _e === void 0 ? '' : _e, onDelete = props.onDelete, onWatermarkChange = props.onWatermarkChange, organizationId = props.organizationId, isReplaceFile = props.isReplaceFile, fileList = props.fileList, onFileReplace = props.onFileReplace, _f = props.showAddWater, showAddWater = _f === void 0 ? true : _f, request = props.request, previewUrl = props.previewUrl, isTranslation = props.isTranslation, record = props.record, realIndex = props.realIndex, setRecords = props.setRecords, isNeedDg = props.isNeedDg, currentDate = props.currentDate, isWorlflowCompleted = props.isWorlflowCompleted;
|
|
13
|
+
var previewBtn = function (attachId, previewTitle, fileName) {
|
|
14
|
+
return (React.createElement(Button, { type: "link", style: {
|
|
15
|
+
whiteSpace: 'normal',
|
|
16
|
+
height: 'auto',
|
|
17
|
+
lineHeight: '20px',
|
|
18
|
+
textAlign: 'left',
|
|
19
|
+
}, onClick: function () {
|
|
20
|
+
// 实现批量预览,只针对图片
|
|
21
|
+
var result = isImage(fileName);
|
|
22
|
+
if (result) {
|
|
23
|
+
var allImage = (Array.isArray(records) ? records : [])
|
|
24
|
+
.filter(function (item) { return isImage(item.attachName) && item.attachId !== attachId; })
|
|
25
|
+
.map(function (item) { return item.attachId; });
|
|
26
|
+
batchPreviewFile(fileBaseUrl, attachId + "," + allImage, {
|
|
27
|
+
titleName: fileName,
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
previewFile(fileBaseUrl, attachId, {
|
|
32
|
+
titleName: dangerouslySetXss(fileName),
|
|
33
|
+
});
|
|
34
|
+
} }, previewTitle));
|
|
35
|
+
};
|
|
36
|
+
function onFileChange(info) {
|
|
37
|
+
onFileReplace && onFileReplace(info, fileId);
|
|
38
|
+
}
|
|
39
|
+
// 是否显示有盖章件
|
|
40
|
+
var isShowSeal = (record === null || record === void 0 ? void 0 : record.isElectronicSeal) + '' === '1';
|
|
41
|
+
// 是否显示重要文件
|
|
42
|
+
var isImportant = (record === null || record === void 0 ? void 0 : record.isImportant) + '' === '1';
|
|
43
|
+
// 是否显示水印
|
|
44
|
+
var isWatermark = (record === null || record === void 0 ? void 0 : record.isWatermark) + '' === '1';
|
|
45
|
+
// 待审核
|
|
46
|
+
var unAudited = (record === null || record === void 0 ? void 0 : record.isOther) + '' === '1';
|
|
47
|
+
// 已审核
|
|
48
|
+
var isAudited = (record === null || record === void 0 ? void 0 : record.isOther) + '' === '2';
|
|
49
|
+
// 是否显示有双签件
|
|
50
|
+
var doubleSignedSealInfoDTOListKey = 'doubleSignedSealInfoDTOList';
|
|
51
|
+
var isShowSign = (record === null || record === void 0 ? void 0 : record[doubleSignedSealInfoDTOListKey]) &&
|
|
52
|
+
Array.isArray(record === null || record === void 0 ? void 0 : record[doubleSignedSealInfoDTOListKey]) &&
|
|
53
|
+
(record === null || record === void 0 ? void 0 : record[doubleSignedSealInfoDTOListKey].length) > 0;
|
|
54
|
+
return (React.createElement("div", { className: "file-operation--wrap" },
|
|
55
|
+
React.createElement("div", { className: "file-operation--title", style: { textAlign: 'left' } }, previewBtn(fileId, fileName || '', fileName)),
|
|
56
|
+
React.createElement("div", { className: "file-operation--date-container" },
|
|
57
|
+
React.createElement("div", null, currentDate),
|
|
58
|
+
React.createElement("div", { className: "file-operation--list" },
|
|
59
|
+
isReplaceFile && (React.createElement(FileUpload, { fileList: fileList, apiBaseUrl: apiBaseUrl, onFileChange: onFileChange, type: "link" }, i18next.t('替换'))),
|
|
60
|
+
isPreview &&
|
|
61
|
+
preFileId &&
|
|
62
|
+
previewBtn(preFileId, i18next.t('上一版'), preFileName))),
|
|
63
|
+
isWorlflowCompleted ? (React.createElement("div", { className: "file-operation--label" },
|
|
64
|
+
isImportant ? React.createElement("span", null, i18next.t('重要')) : null,
|
|
65
|
+
isShowSeal ? React.createElement("span", null, i18next.t('有盖章件')) : null,
|
|
66
|
+
isShowSign ? React.createElement("span", null, i18next.t('有双签件')) : null,
|
|
67
|
+
isWatermark ? React.createElement("span", null, i18next.t('水印')) : null,
|
|
68
|
+
isAudited ? React.createElement("span", null, i18next.t('已审核')) : null,
|
|
69
|
+
unAudited ? React.createElement("span", null, i18next.t('未审核')) : null)) : (React.createElement("div", { className: "file-operation--label" },
|
|
70
|
+
isAudited ? React.createElement("span", null, i18next.t('已审核')) : null,
|
|
71
|
+
unAudited ? React.createElement("span", null, i18next.t('未审核')) : null))));
|
|
72
|
+
};
|
|
73
|
+
export default memo(FileOperation);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IElectronSignaturesProps, IElectronSignaturesItem } from '../interface';
|
|
2
|
+
interface IOptions {
|
|
3
|
+
request?: IElectronSignaturesProps['request'];
|
|
4
|
+
fileTypeKey?: IElectronSignaturesItem['fileTypeKey'];
|
|
5
|
+
fileTypeFilterList?: IElectronSignaturesItem['fileTypeFilterList'];
|
|
6
|
+
fileTypeList?: IElectronSignaturesItem['fileTypeList'];
|
|
7
|
+
useOutsideFileTypeList?: IElectronSignaturesItem['useOutsideFileTypeList'];
|
|
8
|
+
isAllowedPatchFileType?: IElectronSignaturesItem['isAllowedPatchFileType'];
|
|
9
|
+
}
|
|
10
|
+
export default function useFetchFileTypeData(options: IOptions): {
|
|
11
|
+
fileTypeFetchList: any;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import useServiceName from '../../../hooks/useServiceName';
|
|
3
|
+
var defaultFileType = [];
|
|
4
|
+
// 获取附件类型
|
|
5
|
+
export default function useFetchFileTypeData(options) {
|
|
6
|
+
var request = options.request, fileTypeKey = options.fileTypeKey, fileTypeFilterList = options.fileTypeFilterList, fileTypeList = options.fileTypeList, useOutsideFileTypeList = options.useOutsideFileTypeList, isAllowedPatchFileType = options.isAllowedPatchFileType;
|
|
7
|
+
var _a = (useServiceName() || {}).mdmServiceName, mdmServiceName = _a === void 0 ? '/zmdms-mdm-data' : _a;
|
|
8
|
+
var _b = useState(), fileTypeFetchList = _b[0], setFileType = _b[1];
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
if (!isAllowedPatchFileType) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (useOutsideFileTypeList) {
|
|
14
|
+
setFileType(fileTypeList || defaultFileType);
|
|
15
|
+
}
|
|
16
|
+
}, [fileTypeList, isAllowedPatchFileType, useOutsideFileTypeList]);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
if (useOutsideFileTypeList) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!isAllowedPatchFileType) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var params = {
|
|
25
|
+
code: fileTypeKey || 'scm_attach_type',
|
|
26
|
+
status: 50,
|
|
27
|
+
};
|
|
28
|
+
request === null || request === void 0 ? void 0 : request({
|
|
29
|
+
url: "/api" + mdmServiceName + "/dict-biz/dictionary",
|
|
30
|
+
params: params,
|
|
31
|
+
method: 'GET',
|
|
32
|
+
}).then(function (res) {
|
|
33
|
+
if (res.status === 200 && res.data.code === 200) {
|
|
34
|
+
var result = fileTypeFilterList
|
|
35
|
+
? (res.data.data || []).filter(function (item) { return !fileTypeFilterList.includes(item.dictValue); })
|
|
36
|
+
: res.data.data;
|
|
37
|
+
setFileType(result);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
+
}, [useOutsideFileTypeList, isAllowedPatchFileType]);
|
|
42
|
+
return {
|
|
43
|
+
fileTypeFetchList: fileTypeFetchList,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ColumnsType } from 'antd/es/table';
|
|
2
|
+
import { ITrackAllData, IFileItem, IElectronSignaturesItemPublic, IFileUploadProps, IElectronSignaturesItem } from '../interface';
|
|
3
|
+
interface IOptions {
|
|
4
|
+
/** 所有数据类型合并之后的数据 */
|
|
5
|
+
records: IFileItem[];
|
|
6
|
+
/** 所有数据类型的排序规则 */
|
|
7
|
+
dataTypeSort: string[];
|
|
8
|
+
/** 所有数据类型的相关操作 */
|
|
9
|
+
allData: ITrackAllData;
|
|
10
|
+
/** 是否显示上传附件按钮 */
|
|
11
|
+
isShowFileUpload?: IElectronSignaturesItemPublic['isShowFileUpload'];
|
|
12
|
+
apiBaseUrl?: IElectronSignaturesItemPublic['apiBaseUrl'];
|
|
13
|
+
fileBaseUrl?: IElectronSignaturesItemPublic['fileBaseUrl'];
|
|
14
|
+
/** 不做这么复杂了 好像实现不了 默认就只有一组 另外一组就是展示模式 */
|
|
15
|
+
firstDataType: string;
|
|
16
|
+
fileUploadProps?: IFileUploadProps;
|
|
17
|
+
onValueChange?: IElectronSignaturesItem['onValueChange'];
|
|
18
|
+
onFileTypeChangeGetItem: any;
|
|
19
|
+
getCreateTimeHand: any;
|
|
20
|
+
isSingleQj?: IElectronSignaturesItemPublic['isSingleQj'];
|
|
21
|
+
justNeedQj?: any;
|
|
22
|
+
setJustNeedQj?: any;
|
|
23
|
+
isShowFileType?: IElectronSignaturesItemPublic['isShowFileType'];
|
|
24
|
+
isDeleteAllFileWhenJustUseQj?: IElectronSignaturesItemPublic['isDeleteAllFileWhenJustUseQj'];
|
|
25
|
+
currentIsEditMemo?: boolean;
|
|
26
|
+
isControlNeedQys?: IElectronSignaturesItemPublic['isControlNeedQys'];
|
|
27
|
+
organizationId?: string;
|
|
28
|
+
onFileReplace: any;
|
|
29
|
+
isToggleQys?: boolean;
|
|
30
|
+
isTranslation?: boolean;
|
|
31
|
+
request?: any;
|
|
32
|
+
previewUrl?: string;
|
|
33
|
+
isNeedDg?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export default function useFileColumns(options: IOptions): {
|
|
36
|
+
fileColumns: ColumnsType<any>;
|
|
37
|
+
};
|
|
38
|
+
export {};
|