@qmlight/web-platform-components 1.0.0

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.
Files changed (52) hide show
  1. package/AsyncExe/index.tsx +9 -0
  2. package/AsyncExe/src/index.tsx +118 -0
  3. package/AsyncExe/src/lang/en.tsx +11 -0
  4. package/AsyncExe/src/lang/index.tsx +21 -0
  5. package/AsyncExe/src/lang/zh-cn.tsx +11 -0
  6. package/Demo/index.module.less +11 -0
  7. package/Demo/index.tsx +32 -0
  8. package/LICENSE +21 -0
  9. package/README.md +9 -0
  10. package/SearchAssistanceSelect/index.tsx +3 -0
  11. package/SearchAssistanceSelect/src/SearchAssistanceComponent/AdvancedSearch/api/index.js +6 -0
  12. package/SearchAssistanceSelect/src/SearchAssistanceComponent/AdvancedSearch/api/server.js +14 -0
  13. package/SearchAssistanceSelect/src/SearchAssistanceComponent/AdvancedSearch/index.less +23 -0
  14. package/SearchAssistanceSelect/src/SearchAssistanceComponent/AdvancedSearch/index.tsx +115 -0
  15. package/SearchAssistanceSelect/src/SearchAssistanceComponent/AdvancedSearch/popover.tsx +42 -0
  16. package/SearchAssistanceSelect/src/SearchAssistanceComponent/AdvancedSearch/searchboard.tsx +359 -0
  17. package/SearchAssistanceSelect/src/SearchAssistanceComponent/api/server.js +15 -0
  18. package/SearchAssistanceSelect/src/SearchAssistanceComponent/api/tabList/index.js +55 -0
  19. package/SearchAssistanceSelect/src/SearchAssistanceComponent/api/treeData/index.js +26 -0
  20. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/customNode/index.tsx +62 -0
  21. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/customNode/style.less +9 -0
  22. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/customOrg/customModal.tsx +234 -0
  23. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/customOrg/index.tsx +245 -0
  24. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/customOrg/style.less +27 -0
  25. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/dept/index.tsx +104 -0
  26. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/dept/style.less +9 -0
  27. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/dropdownList/index.tsx +74 -0
  28. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/dropdownList/style.less +19 -0
  29. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/recently/index.tsx +86 -0
  30. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/roleList/index.tsx +61 -0
  31. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/search/index.tsx +109 -0
  32. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/subordinate/index.tsx +64 -0
  33. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/tabList/index.tsx +99 -0
  34. package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/tabList/style.less +86 -0
  35. package/SearchAssistanceSelect/src/SearchAssistanceComponent/index.tsx +298 -0
  36. package/SearchAssistanceSelect/src/SearchAssistanceComponent/searchModal.tsx +109 -0
  37. package/SearchAssistanceSelect/src/SearchAssistanceComponent/searchTabs.tsx +153 -0
  38. package/SearchAssistanceSelect/src/SearchAssistanceComponent/style.less +41 -0
  39. package/SearchAssistanceSelect/src/SearchAssistanceComponent/transfer/index.tsx +211 -0
  40. package/SearchAssistanceSelect/src/SearchAssistanceComponent/transfer/searchTransferRight.tsx +93 -0
  41. package/SearchAssistanceSelect/src/SearchAssistanceComponent/transfer/style.less +69 -0
  42. package/SearchAssistanceSelect/src/SearchAssistanceComponent/treeData/index.tsx +407 -0
  43. package/SearchAssistanceSelect/src/SearchAssistanceComponent/treeData/style.less +9 -0
  44. package/SearchAssistanceSelect/src/index.tsx +73 -0
  45. package/SearchAssistanceSelect/src/style.less +29 -0
  46. package/UploadFileMenu/download.ts +15 -0
  47. package/UploadFileMenu/index.tsx +3 -0
  48. package/UploadFileMenu/src/api/index.js +44 -0
  49. package/UploadFileMenu/src/api/server.js +9 -0
  50. package/UploadFileMenu/src/index.tsx +256 -0
  51. package/index.js +10 -0
  52. package/package.json +22 -0
@@ -0,0 +1,9 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2024-03-07 13:43:18
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-03-07 13:43:18
6
+ */
7
+ import AsyncExe from './src/index';
8
+
9
+ export default AsyncExe;
@@ -0,0 +1,118 @@
1
+ import React, { useRef, useImperativeHandle, forwardRef, useState, useEffect } from 'react';
2
+ import dayjs from 'dayjs';
3
+ import {
4
+ Message,
5
+ Notification,
6
+ createUidKey,
7
+ setGlobalContext,
8
+ removeGlobalContext,
9
+ } from '@/utils';
10
+ import { getUserInfo } from '@/utils/cookies';
11
+ import { DcpModal, Progress } from 'dcp-design-react';
12
+ import { useTool } from '@/hooks';
13
+ import { t } from './lang';
14
+
15
+ type AsyncExeProps = {
16
+ asyncId: string;
17
+ asyncName: string;
18
+ operationName: string;
19
+ fetch: any;
20
+ onFinish: (data: any) => void;
21
+ children?: React.ReactNode;
22
+ };
23
+
24
+ export interface AsyncExeRef {
25
+ handleAsync: () => void;
26
+ }
27
+
28
+ const AsyncExe = forwardRef<AsyncExeRef, AsyncExeProps>((props, ref) => {
29
+ const { asyncId, asyncName, operationName, fetch, onFinish } = props;
30
+ const asyncexeRef = useRef<AsyncExeRef>({ handleAsync: () => {} });
31
+ const [showProgressModal, setShowProgressModal] = useState<boolean>(false);
32
+ const [progress, setProgress] = useState<number>(0);
33
+ const { attachWsEvent, removeWsEvent } = useTool();
34
+ const wsCodeIdRef = useRef<string>(createUidKey());
35
+ const [progressStatus, setProgressStatus] = useState<
36
+ 'normal' | 'success' | 'exception' | 'active' | undefined
37
+ >('normal');
38
+
39
+ // 实现异步处理逻辑
40
+ const handleAsync = async () => {
41
+ wsCodeIdRef.current = createUidKey();
42
+ setProgress(0);
43
+ setProgressStatus('normal');
44
+ try {
45
+ const currentTime = dayjs().format('HH:mm:ss');
46
+ const asyncNameAddTime = `${asyncName}_${currentTime}`;
47
+ setGlobalContext({
48
+ wsCodeId: wsCodeIdRef.current,
49
+ asyncId,
50
+ asyncName: asyncNameAddTime,
51
+ loginName: getUserInfo().loginName,
52
+ });
53
+ const res = await fetch.api(fetch.params);
54
+ if (res.code === 200) {
55
+ Message(t('asyncExe.asyncMessage'), 'success', 2);
56
+ setShowProgressModal(true);
57
+ removeGlobalContext(['wsCodeId', 'asyncId', 'asyncName', 'loginName']);
58
+ }
59
+ } catch (error) {
60
+ // ...
61
+ }
62
+ };
63
+
64
+ asyncexeRef.current.handleAsync = handleAsync;
65
+
66
+ const closeModal = () => {
67
+ setShowProgressModal(false);
68
+ };
69
+
70
+ const handleWebSocketData = (data: any) => {
71
+ const jdtWithoutPercent = data.jdt.replace('%', '');
72
+ const wsCodeId = wsCodeIdRef.current;
73
+ if (data.jdid === wsCodeId && data.jdt) {
74
+ setProgress(jdtWithoutPercent);
75
+ if (data.jdt === '100%') {
76
+ onFinish(data.res);
77
+ setShowProgressModal(false);
78
+ }
79
+ if (jdtWithoutPercent < 0) {
80
+ setProgress(100);
81
+ setProgressStatus('exception');
82
+ onFinish(data.res);
83
+ Notification(data.res.msg, 'error', 0);
84
+ }
85
+ }
86
+ };
87
+
88
+ useEffect(() => {
89
+ attachWsEvent(asyncId, handleWebSocketData);
90
+ return () => {
91
+ removeWsEvent(asyncId, handleWebSocketData);
92
+ };
93
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94
+ }, []);
95
+
96
+ useImperativeHandle(ref, () => asyncexeRef.current);
97
+
98
+ return (
99
+ <>
100
+ {props.children}
101
+ <DcpModal
102
+ visible={showProgressModal}
103
+ title={operationName}
104
+ width="30%"
105
+ height="20%"
106
+ showFullScreen={false}
107
+ destroyOnClose
108
+ onClose={() => closeModal()}
109
+ >
110
+ <Progress percent={progress} size="small" status={progressStatus} />
111
+ </DcpModal>
112
+ </>
113
+ );
114
+ });
115
+
116
+ AsyncExe.displayName = 'AsyncExe';
117
+
118
+ export default AsyncExe;
@@ -0,0 +1,11 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2020-05-02 09:16:35
4
+ * @Last Modified by: 张馨元
5
+ * @Last Modified time: 2024-04-24 10:48:15
6
+ */
7
+ export default {
8
+ asyncExe: {
9
+ asyncMessage: 'The operation succeeded. Please wait...',
10
+ },
11
+ };
@@ -0,0 +1,21 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2020-05-14 19:27:24
4
+ * @Last Modified by: 张馨元
5
+ * @Last Modified time: 2024-04-24 11:06:13
6
+ */
7
+ import { t, mergeTranslations } from '@/locale';
8
+
9
+ import enLocale from './en';
10
+ import zhLocale from './zh-cn';
11
+
12
+ const messages = {
13
+ en: enLocale,
14
+ [`zh-cn`]: zhLocale,
15
+ };
16
+
17
+ for (const key in messages) {
18
+ mergeTranslations(key, messages[key]);
19
+ }
20
+
21
+ export { t };
@@ -0,0 +1,11 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2020-05-02 09:16:35
4
+ * @Last Modified by: 张馨元
5
+ * @Last Modified time: 2024-04-25 14:39:46
6
+ */
7
+ export default {
8
+ asyncExe: {
9
+ asyncMessage: '操作成功,请稍候',
10
+ },
11
+ };
@@ -0,0 +1,11 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2024-03-07 12:15:55
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-03-07 12:16:22
6
+ */
7
+ .box {
8
+ width: 200px;
9
+ height: 100px;
10
+ background-color: @primaryColor;
11
+ }
package/Demo/index.tsx ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2024-03-07 10:58:14
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-03-07 12:18:21
6
+ */
7
+ import React from "react";
8
+ import { useLocale } from "@/hooks";
9
+ import { createUidKey } from "@/utils";
10
+
11
+ // import { Test } from '@/components';
12
+
13
+ import css from "./index.module.less";
14
+
15
+ type IProps = {
16
+ name: string;
17
+ };
18
+
19
+ const Demo: React.FC<IProps> = (props) => {
20
+ const { t } = useLocale();
21
+
22
+ return (
23
+ <>
24
+ <div className={css.box}>
25
+ demo 组件示例 {createUidKey()} - {props.name} - {t("app.global.title")}
26
+ </div>
27
+ {/* <Test /> */}
28
+ </>
29
+ );
30
+ };
31
+
32
+ export default Demo;
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 QM-Design
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 说明
2
+
3
+ - 匹配平台框架使用的业务组件库。
4
+
5
+ ### 使用
6
+
7
+ 1. 必须使用在平台前端框架中
8
+ 2. 使用 `yarn` 安装依赖包
9
+ 3. 组件使用方式,查看平台组件库文档
@@ -0,0 +1,3 @@
1
+ import SearchAssistanceSelect from './src';
2
+
3
+ export default SearchAssistanceSelect;
@@ -0,0 +1,6 @@
1
+ import axios from '@/api/fetch';
2
+ import SERVER from './server';
3
+
4
+ export const getOrgTypeList = (params) => {
5
+ return axios.post(`${SERVER.QFC_BASE}/orgtype/page`, params);
6
+ };
@@ -0,0 +1,14 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2021-07-20 16:37:14
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2022-12-10 22:37:39
6
+ */
7
+ import env from '@/config/envMaps';
8
+ const { prefix } = env;
9
+
10
+ export default {
11
+ QFC_BASE: `${prefix}/dcp-base-user`,
12
+ QFC_PUBLIC: `${prefix}/dcp-base-public`,
13
+ QFC_AUTH: `${prefix}/dcp-base-auth`,
14
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2021-07-20 15:07:47
4
+ * @Last Modified by: 谭冬洋
5
+ * @Last Modified time: 2024-08-Th 09:28:47
6
+ */
7
+ .tdy_row {
8
+ // .ant-popover {
9
+ // width: 100%;
10
+ // left: 0 !important;
11
+ // z-index: 10;
12
+ // .ant-popover-inner-content:has(> .tdy_popover) {
13
+ // width: 100%;
14
+ // }
15
+ // }
16
+ .ant-btn:has(> .tdy_popover_btn) {
17
+ background: transparent;
18
+ color: @primaryColor;
19
+ border-color: #d9d9d9;
20
+ text-shadow: none;
21
+ box-shadow: none;
22
+ }
23
+ }
@@ -0,0 +1,115 @@
1
+ /*
2
+ * @Author: 谭冬洋
3
+ * @Date: 2024-08-13 16:25:44
4
+ * @LastEditors: 谭冬洋
5
+ * @LastEditTime: 2024-08-26 13:40:02
6
+ * @FilePath: \faw-component\src\modules\AdvancedSearch\index.tsx
7
+ */
8
+ import React, { useRef, useState, memo, useEffect } from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import { Input, Row, Col } from 'dcp-design-react';
11
+ import SearchBoard from './searchboard';
12
+ import { SearchOutlined } from '@/icons';
13
+ import FixedPopover from './popover';
14
+ import './index.less';
15
+ const { Search } = Input;
16
+
17
+ const AdvancedSearch: React.FC<any> = ({
18
+ type = 'default', // 高级搜索的类型
19
+ span = 24, // 宽度
20
+ offset = 0, // 偏移量
21
+ fetchHandle = () => {}, // 更改参数
22
+ }) => {
23
+ const childRef = useRef<any>();
24
+
25
+ const [value, setValue] = useState<string | number | readonly string[] | undefined>(undefined); // 搜索框内容
26
+
27
+ const [open, setOpen] = useState(false); // Popover显示隐藏状态
28
+
29
+ // 显示隐藏Popover
30
+ const togglePopover = () => setOpen(!open);
31
+
32
+ // 关闭Popover
33
+ const onClose = () => setOpen(false);
34
+
35
+ // 筛选 发接口 返回数据
36
+ const onSearch = () => {
37
+ // if (!data && !value) return false;
38
+ if (childRef.current) {
39
+ fetchHandle({ type, params: childRef.current.getFormValue()! });
40
+ onClose(); // 关闭Popover
41
+ }
42
+ };
43
+
44
+ // 修改筛选框值
45
+ const changeValue = (value) => setValue(value);
46
+
47
+ return (
48
+ <>
49
+ <Row className={'tdy_row'}>
50
+ <Col span={span} offset={offset}>
51
+ <Search
52
+ // suffix={<SearchOutlined onClick={onSearch} />}
53
+ // enterButton={
54
+ // // <Popover
55
+ // // placement="bottom"
56
+ // // className="tdy_popover_btn"
57
+ // // content={
58
+ // // <SearchBoard
59
+ // // size={size}
60
+ // // type={type}
61
+ // // value={value}
62
+ // // onSearch={onSearch}
63
+ // // changeValue={changeValue}
64
+ // // onClose={onClose}
65
+ // // />
66
+ // // }
67
+ // // open={open}
68
+ // // arrowPointAtCenter
69
+ // // getPopupContainer={() => {
70
+ // // return document.getElementsByClassName('tdy_popover_wrap')[0];
71
+ // // }}
72
+
73
+ // // // getPopupContainer={() => ref?.current ?? document.body}
74
+ // // >
75
+ // <span className="tdy_popover_btn" onClick={togglePopover}>
76
+ // 高级检索
77
+ // </span>
78
+ // // </Popover>
79
+ // }
80
+ onSearch={onSearch}
81
+ allowClear
82
+ value={value}
83
+ onChange={(e) => {
84
+ setValue(e.target.value);
85
+ }}
86
+ />
87
+ </Col>
88
+ </Row>
89
+ <FixedPopover onClose={onClose} open={open}>
90
+ <SearchBoard
91
+ type={type}
92
+ value={value}
93
+ onSearch={onSearch}
94
+ changeValue={changeValue}
95
+ onClose={onClose}
96
+ ref={childRef}
97
+ />
98
+ </FixedPopover>
99
+ </>
100
+ );
101
+ };
102
+
103
+ AdvancedSearch.propTypes = {
104
+ type: PropTypes.string,
105
+ span: PropTypes.number,
106
+ offset: PropTypes.number,
107
+ fetchHandle: PropTypes.func.isRequired,
108
+ };
109
+
110
+ export default memo(AdvancedSearch, (oldProps, newProps) => {
111
+ if (oldProps.type !== newProps.type) {
112
+ return false;
113
+ }
114
+ return true;
115
+ });
@@ -0,0 +1,42 @@
1
+ /*
2
+ * @Author: 谭冬洋
3
+ * @Date: 2024-08-26 10:07:12
4
+ * @LastEditors: 谭冬洋
5
+ * @LastEditTime: 2024-08-26 11:17:22
6
+ * @FilePath: \faw-component\src\modules\AdvancedSearch\popover.tsx
7
+ */
8
+ import React from 'react';
9
+ import PropTypes from 'prop-types';
10
+
11
+ const FixedPopover = ({ children, onClose = () => {}, open = false }) => {
12
+ return (
13
+ <div
14
+ className="hight-search"
15
+ style={{
16
+ position: 'absolute',
17
+ width: '100%',
18
+ height: open ? 'auto' : 0,
19
+ boxSizing: 'border-box',
20
+ overflow: 'hidden',
21
+ top: 47,
22
+ left: 0,
23
+ padding: open ? '30px 10px' : 0,
24
+ backgroundColor: 'white',
25
+ border: '1px solid rgb(238, 238, 238)',
26
+ borderWidth: open ? 1 : 0,
27
+ zIndex: 10,
28
+ transition: '.1s',
29
+ }}
30
+ >
31
+ {children}
32
+ </div>
33
+ );
34
+ };
35
+
36
+ FixedPopover.propTypes = {
37
+ children: PropTypes.node,
38
+ onClose: PropTypes.func,
39
+ open: PropTypes.bool,
40
+ };
41
+
42
+ export default FixedPopover;