kn-cli 1.0.91 → 1.0.93
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/package.json +1 -1
- package/readme.md +3 -0
- package/src/.DS_Store +0 -0
- package/templates/template_admin/.gitignore +6 -0
- package/templates/template_admin/public/index.html +5 -2
- package/templates/template_admin/public/src/_antd.less +7 -1
- package/templates/template_admin/public/src/components/menu/index.jsx +47 -100
- package/templates/template_admin/public/src/components/menu/topMenu/index.jsx +119 -0
- package/templates/template_admin/public/src/dictionary/index.js +4 -1
- package/templates/template_admin/public/src/hooks/index.jsx +4 -1
- package/templates/template_admin/public/src/hooks/useRouteMenu.jsx +232 -0
- package/templates/template_admin/public/src/provider/menu.jsx +261 -10
- package/templates/template_admin/public/src/route.jsx +18 -9
- package/templates/template_app/.gitignore +6 -0
- package/templates/template_oa/.gitignore +6 -0
- package/templates/template_oa/jsconfig.json +5 -1
- package/templates/template_oa/public/src/components/dialog/index.jsx +237 -0
- package/templates/template_oa/public/src/components/{Empty → empty}/index.jsx +9 -0
- package/templates/{template_oa_jwt/public/src/components/FormRow → template_oa/public/src/components/formRow}/index.jsx +25 -3
- package/templates/{template_oa_jwt/public/src/components/FormTable → template_oa/public/src/components/formTable}/index.jsx +39 -1
- package/templates/template_oa/public/src/components/iconFont/index.jsx +22 -0
- package/templates/template_oa/public/src/components/{IFrame → iframe}/index.jsx +18 -4
- package/templates/template_oa/public/src/components/{Layout/Basic → layout/basic}/index.jsx +7 -1
- package/templates/{template_oa_jwt/public/src/components/Layout/CenterBody → template_oa/public/src/components/layout/centerBody}/index.jsx +2 -0
- package/templates/{template_oa_jwt/public/src/components/Layout/FormBlock → template_oa/public/src/components/layout/formBlock}/index.jsx +3 -1
- package/templates/template_oa/public/src/components/{Layout → layout}/index.jsx +12 -6
- package/templates/{template_oa_jwt/public/src/components/Layout/Provider → template_oa/public/src/components/layout/provider}/index.jsx +4 -0
- package/templates/template_oa/public/src/components/{Link → link}/index.jsx +16 -0
- package/templates/template_oa/public/src/components/{Nav → nav}/index.jsx +8 -2
- package/templates/{template_oa_jwt/public/src/components/Page/PageLoading → template_oa/public/src/components/page/pageLoading}/index.jsx +25 -4
- package/templates/template_oa/public/src/components/{Popup → popup}/index.jsx +13 -0
- package/templates/template_oa/public/src/components/{Select/DepSelect → select/depSelect}/index.jsx +15 -0
- package/templates/template_oa/public/src/components/{Select/StaffSelect → select/staffSelect}/index.jsx +27 -0
- package/templates/template_oa/public/src/components/title/index.jsx +3 -0
- package/templates/template_oa/public/src/components/{Toast → toast}/index.jsx +21 -1
- package/templates/template_oa/public/src/components/{Upload → upload}/index.jsx +41 -3
- package/templates/template_oa/public/src/hooks/index.jsx +1 -0
- package/templates/template_oa/public/src/hooks/useDelay.jsx +5 -0
- package/templates/template_oa/public/src/hooks/useImageLoader.jsx +1 -2
- package/templates/template_oa/public/src/hooks/useLoading.jsx +5 -1
- package/templates/template_oa/public/src/hooks/usePreload.jsx +2 -1
- package/templates/template_oa/public/src/hooks/useScrollTop.jsx +12 -0
- package/templates/template_oa/public/src/hooks/useSearch.jsx +28 -2
- package/templates/template_oa/public/src/hooks/useUpdate.jsx +5 -0
- package/templates/template_oa/public/src/index.jsx +15 -1
- package/templates/template_oa/public/src/pages/video/index.jsx +17 -13
- package/templates/template_oa/public/src/provider/app.jsx +33 -2
- package/templates/template_oa/public/src/route.jsx +4 -2
- package/templates/template_oa/public/src/services/common.js +11 -0
- package/templates/template_oa/public/src/services/index.js +44 -2
- package/templates/template_oa/public/src/type.js +48 -0
- package/templates/template_oa/public/src/utils/index.js +34 -17
- package/templates/template_oa_jwt/.gitignore +6 -0
- package/templates/template_oa_jwt/jsconfig.json +5 -1
- package/templates/template_oa_jwt/public/src/components/dialog/index.jsx +237 -0
- package/templates/template_oa_jwt/public/src/components/{Empty → empty}/index.jsx +9 -0
- package/templates/{template_oa/public/src/components/FormRow → template_oa_jwt/public/src/components/formRow}/index.jsx +25 -3
- package/templates/{template_oa/public/src/components/FormTable → template_oa_jwt/public/src/components/formTable}/index.jsx +41 -2
- package/templates/template_oa_jwt/public/src/components/formTable/index.less +18 -0
- package/templates/template_oa_jwt/public/src/components/iconFont/index.jsx +22 -0
- package/templates/template_oa_jwt/public/src/components/{IFrame → iframe}/index.jsx +15 -0
- package/templates/template_oa_jwt/public/src/components/{Layout/Basic → layout/basic}/index.jsx +11 -6
- package/templates/{template_oa/public/src/components/Layout/CenterBody → template_oa_jwt/public/src/components/layout/centerBody}/index.jsx +2 -0
- package/templates/{template_oa/public/src/components/Layout/FormBlock → template_oa_jwt/public/src/components/layout/formBlock}/index.jsx +3 -1
- package/templates/template_oa_jwt/public/src/components/{Layout → layout}/index.jsx +10 -4
- package/templates/{template_oa/public/src/components/Layout/Provider → template_oa_jwt/public/src/components/layout/provider}/index.jsx +4 -0
- package/templates/template_oa_jwt/public/src/components/{Link → link}/index.jsx +16 -0
- package/templates/template_oa_jwt/public/src/components/{Nav → nav}/index.jsx +11 -5
- package/templates/{template_oa/public/src/components/Page/PageLoading → template_oa_jwt/public/src/components/page/pageLoading}/index.jsx +25 -4
- package/templates/template_oa_jwt/public/src/components/{Popup → popup}/index.jsx +13 -0
- package/templates/template_oa_jwt/public/src/components/{Select/DepSelect → select/depSelect}/index.jsx +15 -0
- package/templates/template_oa_jwt/public/src/components/{Select/StaffSelect → select/staffSelect}/index.jsx +27 -0
- package/templates/template_oa_jwt/public/src/components/title/index.jsx +3 -0
- package/templates/template_oa_jwt/public/src/components/{Toast → toast}/index.jsx +21 -1
- package/templates/template_oa_jwt/public/src/components/{Upload → upload}/index.jsx +41 -3
- package/templates/template_oa_jwt/public/src/dictionary/index.js +2 -0
- package/templates/template_oa_jwt/public/src/hooks/index.jsx +2 -2
- package/templates/template_oa_jwt/public/src/hooks/useDelay.jsx +5 -0
- package/templates/template_oa_jwt/public/src/hooks/useImageLoader.jsx +1 -2
- package/templates/template_oa_jwt/public/src/hooks/useLoading.jsx +5 -1
- package/templates/template_oa_jwt/public/src/hooks/usePreload.jsx +2 -1
- package/templates/template_oa_jwt/public/src/hooks/useScrollTop.jsx +12 -0
- package/templates/template_oa_jwt/public/src/hooks/useSearch.jsx +28 -2
- package/templates/template_oa_jwt/public/src/hooks/useUpdate.jsx +5 -0
- package/templates/template_oa_jwt/public/src/pages/demo/index.jsx +17 -11
- package/templates/template_oa_jwt/public/src/provider/app.jsx +30 -1
- package/templates/template_oa_jwt/public/src/route.jsx +4 -2
- package/templates/template_oa_jwt/public/src/services/common.js +13 -1
- package/templates/template_oa_jwt/public/src/services/index.js +52 -8
- package/templates/template_oa_jwt/public/src/services/token.js +7 -0
- package/templates/template_oa_jwt/public/src/utils/index.js +62 -22
- package/templates/template_offcial/.gitignore +6 -0
- package/templates/template_admin/public/src/components/topMenu/index.jsx +0 -267
- package/templates/template_oa/public/src/components/Alert/index.jsx +0 -0
- package/templates/template_oa/public/src/components/Alert/index.less +0 -0
- package/templates/template_oa/public/src/components/Auth/index.jsx +0 -44
- package/templates/template_oa/public/src/components/Dialog/index.jsx +0 -150
- package/templates/template_oa/public/src/components/Footer/index.jsx +0 -17
- package/templates/template_oa/public/src/components/Footer/index.less +0 -28
- package/templates/template_oa/public/src/components/IconFont/index.jsx +0 -10
- package/templates/template_oa/public/src/components/Loading/index.jsx +0 -14
- package/templates/template_oa/public/src/components/Loading/index.less +0 -85
- package/templates/template_oa_jwt/public/src/components/Alert/index.jsx +0 -0
- package/templates/template_oa_jwt/public/src/components/Alert/index.less +0 -0
- package/templates/template_oa_jwt/public/src/components/Auth/index.jsx +0 -44
- package/templates/template_oa_jwt/public/src/components/Dialog/index.jsx +0 -150
- package/templates/template_oa_jwt/public/src/components/Footer/index.jsx +0 -17
- package/templates/template_oa_jwt/public/src/components/Footer/index.less +0 -28
- package/templates/template_oa_jwt/public/src/components/IconFont/index.jsx +0 -10
- package/templates/template_oa_jwt/public/src/components/Loading/index.jsx +0 -16
- package/templates/template_oa_jwt/public/src/components/Loading/index.less +0 -96
- /package/templates/template_admin/public/src/components/{topMenu → menu/topMenu}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Dialog → dialog}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Empty → empty}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{FormRow → formRow}/index.less +0 -0
- /package/templates/{template_oa_jwt/public/src/components/FormTable → template_oa/public/src/components/formTable}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{IconFont → iconFont}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{IFrame → iframe}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Layout/FormBlock → layout/formBlock}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Layout → layout}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Link → link}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Nav → nav}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Popup → popup}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Select/StaffSelect → select/staffSelect}/index.less +0 -0
- /package/templates/template_oa/public/src/components/{Toast → toast}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Dialog → dialog}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Empty → empty}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{FormRow → formRow}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{IconFont → iconFont}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{IFrame → iframe}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Layout/FormBlock → layout/formBlock}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Layout → layout}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Link → link}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Nav → nav}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Popup → popup}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Select/StaffSelect → select/staffSelect}/index.less +0 -0
- /package/templates/template_oa_jwt/public/src/components/{Toast → toast}/index.less +0 -0
|
@@ -1,7 +1,46 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React ,{useImperativeHandle,useState,forwardRef} from 'react';
|
|
3
|
+
|
|
4
|
+
// @ts-ignore
|
|
2
5
|
import uuid from 'js-uuid';
|
|
6
|
+
|
|
7
|
+
// @ts-ignore
|
|
3
8
|
import styles from './index.less';
|
|
4
9
|
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} ColumnsOptions
|
|
13
|
+
* @property {string} formItemName
|
|
14
|
+
* @property {(record:any,index:number,event:any)=>void} onDel
|
|
15
|
+
* @property {(record:any,index:number,event:any)=>void} onAdd
|
|
16
|
+
* @property {(record:any,index:number,event:any)=>void} onCopy
|
|
17
|
+
* @property {(initValue:[],event:any)=>void} onReset
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 表格表单组件
|
|
22
|
+
* @param {Object} props
|
|
23
|
+
* @param {JSX.Element|any} props.Table - Table组件,一般为antd的Table组件
|
|
24
|
+
* @param {Object} props.form - Form组件
|
|
25
|
+
* @param {string} props.formItemName - 表格FormItem的name
|
|
26
|
+
* @param {boolean} [props.saveLast=false] - 是否当没有数据时,默认保留一行数据
|
|
27
|
+
* @param {Object[]} [props.initialValue] - 初始数据
|
|
28
|
+
*
|
|
29
|
+
* @param {(record:object,index:number)=>object[]} [props.onCopy] - 点击复制的回调
|
|
30
|
+
* @param {(record:object,index:number)=>object[]} [props.onAdd] - 点击添加的回调
|
|
31
|
+
*
|
|
32
|
+
* @param {(value:any)=>void} [props.onChange] - 数据发生变动时的回调
|
|
33
|
+
* @param {(value:any)=>void} [props.onRefresh] - 刷新时的回调
|
|
34
|
+
*
|
|
35
|
+
* @param {(options:ColumnsOptions)=>[]} props.columns - 获取列配置数据的回调
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} [props.newdata] - 添加新行的数据模版
|
|
38
|
+
* @param {Object} [props.antTableOptions] - antd的Table扩展参数
|
|
39
|
+
*
|
|
40
|
+
* @param {any} ref
|
|
41
|
+
*
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
5
44
|
const TableFormItem =(props,ref)=> {
|
|
6
45
|
const {Table,form,formItemName,saveLast} = props;
|
|
7
46
|
const getNewId=()=>{
|
|
@@ -121,7 +160,6 @@ const TableFormItem =(props,ref)=> {
|
|
|
121
160
|
}));
|
|
122
161
|
|
|
123
162
|
return (
|
|
124
|
-
|
|
125
163
|
<Table
|
|
126
164
|
className={styles.table}
|
|
127
165
|
{...{rowKey: '_rowKey',...props.antTableOptions}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import styles from'./index.less';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* iconFont图标
|
|
9
|
+
* @param {object} props
|
|
10
|
+
* @param {string} [props.icon] - 图标名称
|
|
11
|
+
* @param {string} [props.className] - 扩展类名
|
|
12
|
+
* @param {()=>void} [props.onClick] - 点击回调
|
|
13
|
+
*
|
|
14
|
+
* @returns {JSX.Element}
|
|
15
|
+
*/
|
|
16
|
+
const IconFont=(props)=>{
|
|
17
|
+
const {icon,className,...others} = props;
|
|
18
|
+
return (
|
|
19
|
+
<span {...others} className={`iconfont icon-${icon} ${styles.iconBox} ${className||''}`} ></span>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
export default IconFont;
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useEffect,useState,useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
// @ts-ignore
|
|
2
5
|
import styles from './index.less';
|
|
3
6
|
|
|
7
|
+
/**
|
|
8
|
+
* iframe组件
|
|
9
|
+
* @param {object} props
|
|
10
|
+
* @param {string} props.name - iframe的唯一名称
|
|
11
|
+
* @param {string} props.url - url地址
|
|
12
|
+
*
|
|
13
|
+
* @param {string} [props.className] - 扩展样式名
|
|
14
|
+
*
|
|
15
|
+
* @returns {JSX.Element}
|
|
16
|
+
*/
|
|
4
17
|
const Iframe=(props)=>{
|
|
5
|
-
const {className=''}=props;
|
|
18
|
+
const {className='',name,url}=props;
|
|
6
19
|
const ref = useRef();
|
|
7
20
|
const [height,setHeight] = useState('0px');
|
|
8
21
|
|
|
9
22
|
useEffect(()=>{
|
|
10
23
|
window.addEventListener('message',(e)=>{
|
|
11
24
|
if(e?.data?.msg==='resize'){
|
|
12
|
-
if(e.data.id===
|
|
25
|
+
if(e.data.id===name){
|
|
13
26
|
setHeight(e.data.height+2+'px');
|
|
14
27
|
}
|
|
15
28
|
}else if(e?.data?.msg==='link'){
|
|
16
29
|
location.href=e.data.url;
|
|
17
30
|
}else if(e?.data?.msg==='server'){
|
|
31
|
+
// @ts-ignore
|
|
18
32
|
const url = `${OA_KSSO_HOST}?target=${encodeURIComponent(location.href)}`;
|
|
19
33
|
location.href=url;
|
|
20
34
|
}else{
|
|
@@ -27,9 +41,9 @@ const Iframe=(props)=>{
|
|
|
27
41
|
<iframe
|
|
28
42
|
className={`${styles.iframeWrap} ${className}`}
|
|
29
43
|
sandbox='allow-same-origin allow-scripts'
|
|
30
|
-
name={
|
|
44
|
+
name={name}
|
|
31
45
|
ref={ref}
|
|
32
|
-
src={
|
|
46
|
+
src={url}
|
|
33
47
|
style={{width:'100%',height:height,verticalAlign:'bottom'}}
|
|
34
48
|
scrolling="none"
|
|
35
49
|
frameBorder="0"
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import {Outlet} from 'react-router-dom';
|
|
3
|
-
|
|
5
|
+
|
|
6
|
+
import Iframe from '@/components/iframe';
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
4
9
|
import styles from './index.less';
|
|
5
10
|
|
|
6
11
|
|
|
@@ -8,6 +13,7 @@ const LayoutBasic=(props)=>{
|
|
|
8
13
|
const {nav=""} = props;
|
|
9
14
|
return (
|
|
10
15
|
<section className={styles.htmlWrap}>
|
|
16
|
+
{/* @ts-ignore */}
|
|
11
17
|
<Iframe name='header' url={OA_MENU_HOST} className={styles.iframeHeader} />
|
|
12
18
|
<section className={styles.headerSpace}></section>
|
|
13
19
|
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// @ts-ignore
|
|
5
4
|
import {Outlet} from 'react-router-dom';
|
|
6
|
-
|
|
7
|
-
import LayoutBasic from './Basic';
|
|
8
|
-
import LayoutCenterBody from './CenterBody';
|
|
5
|
+
// @ts-ignore
|
|
9
6
|
import zhCN from 'antd/lib/locale/zh_CN';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import { ConfigProvider } from 'antd';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import ProviderApp from '@/provider/app';
|
|
12
|
+
|
|
13
|
+
import LayoutBasic from './basic';
|
|
14
|
+
import LayoutCenterBody from './centerBody';
|
|
10
15
|
|
|
16
|
+
// @ts-ignore
|
|
11
17
|
import styles from './index.less';
|
|
12
18
|
styles;
|
|
13
19
|
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React from 'react';
|
|
3
|
+
|
|
2
4
|
import { openLink,jumpUrl } from '@/utils';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
3
7
|
import styles from './index.less';
|
|
4
8
|
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 超链接组件
|
|
12
|
+
* @param {object} [props]
|
|
13
|
+
* @param {JSX.Element|string} [props.children] - 子组件
|
|
14
|
+
* @param {string} [props.className] - 扩展类样式名称
|
|
15
|
+
* @param {Function} [props.onClick] - 点击链接的回调
|
|
16
|
+
* @param {string} [props.href] - 跳转链接
|
|
17
|
+
* @param {string} [props.target] - 当target='_blank'时代表新窗口打开
|
|
18
|
+
*
|
|
19
|
+
* @returns {JSX.Element}
|
|
20
|
+
*/
|
|
5
21
|
const Link=(props)=>{
|
|
6
22
|
const {children,className='',onClick,href='',target=''} = props;
|
|
7
23
|
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-ignore
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
3
4
|
import {matchPath,useLocation,useNavigate,} from 'react-router-dom';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { Menu } from 'antd';
|
|
7
|
+
// @ts-ignore
|
|
4
8
|
import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons';
|
|
9
|
+
|
|
5
10
|
import {useLoading} from '@/hooks';
|
|
6
11
|
|
|
12
|
+
// @ts-ignore
|
|
7
13
|
import styles from './index.less';
|
|
8
14
|
|
|
9
15
|
const ICON_NAME={
|
|
@@ -92,7 +98,7 @@ const LeftMenu=(props)=>{
|
|
|
92
98
|
return item;
|
|
93
99
|
}
|
|
94
100
|
|
|
95
|
-
|
|
101
|
+
// @ts-ignore
|
|
96
102
|
window.matchPath=matchPath;
|
|
97
103
|
|
|
98
104
|
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
3
|
-
|
|
4
|
-
import Popup from '@/components/
|
|
5
|
+
|
|
6
|
+
import Popup from '@/components/popup';
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
5
9
|
import imgLoading from '@/assets/images/loading.svg';
|
|
6
10
|
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import CSS from './index.less';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 页面Loading状态
|
|
16
|
+
* @param {object} [props]
|
|
17
|
+
* @param {boolean} [props.visible=true] - 是否显示状态
|
|
18
|
+
*
|
|
19
|
+
* @returns {JSX.Element}
|
|
20
|
+
*/
|
|
7
21
|
const PageLoading = (props) => {
|
|
8
22
|
const {visible=true} = props;
|
|
9
23
|
if(!visible){
|
|
10
|
-
return
|
|
24
|
+
return <></>;
|
|
11
25
|
}
|
|
12
26
|
return (
|
|
13
27
|
<div className={CSS.wrap } >
|
|
@@ -18,6 +32,13 @@ const PageLoading = (props) => {
|
|
|
18
32
|
);
|
|
19
33
|
};
|
|
20
34
|
|
|
35
|
+
/**
|
|
36
|
+
* 全屏置顶显示一个页面loading组件
|
|
37
|
+
* @param {object} [props]
|
|
38
|
+
* @param {boolean} [props.canTouch=false] - 是否允许用户点击屏幕穿透到下面的组件
|
|
39
|
+
*
|
|
40
|
+
* @returns {(string)=>void}
|
|
41
|
+
*/
|
|
21
42
|
export const ShowPageLoading=(props={canTouch:false})=>{
|
|
22
43
|
let popup = Popup(()=>{},{cantouch:props.canTouch});
|
|
23
44
|
ReactDOM.render(
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
3
7
|
import styles from './index.less';
|
|
4
8
|
styles;
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 一个全屏置顶的遮罩层
|
|
12
|
+
* @param {(result)=>void} reslove - 遮罩层的关闭回调
|
|
13
|
+
* @param {Object} [options] - 参数
|
|
14
|
+
* @param {boolean} [options.cantouch=false] - 是否允许被点击穿透
|
|
15
|
+
* @param {boolean} [options.transparent=false] - 是否遮罩层完全透明
|
|
16
|
+
*
|
|
17
|
+
* @returns { {dom:HTMLElement,destory:()=>void} }
|
|
18
|
+
*/
|
|
6
19
|
const Popup = (reslove,options) => {
|
|
7
20
|
let rootDom = document.createElement('div');
|
|
8
21
|
rootDom.className='popup-box';
|
package/templates/template_oa/public/src/components/{Select/DepSelect → select/depSelect}/index.jsx
RENAMED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import { Select } from 'antd';
|
|
3
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @typedef DepItem
|
|
8
|
+
* @property {string} ORG_ID - 部门ID
|
|
9
|
+
* @property {string} ORG_NAME - 部门名称
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
14
|
* 所属部门选择器
|
|
15
|
+
* @param {Object} props
|
|
16
|
+
* @param {string|string[]} [props.value] - 当前选中的部门数据
|
|
17
|
+
* @param {DepItem[]} props.list - 所有部门数据
|
|
18
|
+
* @param {(options:string|string[],selected:any|any[])=>void} props.onChange - 选中数据发生变更的回调
|
|
19
|
+
*
|
|
20
|
+
* @returns { JSX.Element }
|
|
6
21
|
*/
|
|
7
22
|
function DepSelect(props) {
|
|
8
23
|
const [value, setValue] = useState(props?.value || '');
|
|
@@ -1,7 +1,34 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import { Select } from 'antd';
|
|
5
|
+
// @ts-ignore
|
|
3
6
|
import CSS from './index.less';
|
|
4
7
|
CSS;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef StaffItem
|
|
11
|
+
* @property {string} USR_UID - 用户ID
|
|
12
|
+
* @property {string} USR_JOB_ID - 工号
|
|
13
|
+
* @property {string} REAL_NAME - 真实姓名
|
|
14
|
+
* @property {string} USR_CN - 姓名(带重名数字)
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 员工选择器
|
|
21
|
+
* @param {Object} props
|
|
22
|
+
* @param {StaffItem[]} props.userList - 所有员工数据
|
|
23
|
+
* @param {string|string[]} props.value - 当前选中的员工UID
|
|
24
|
+
* @param {string} [props.mode=false] - 单选/多选模式,multiple=多选
|
|
25
|
+
* @param {string} [props.valIsLabel=false] - value值的格式,true=姓名(工号),false=用户UID
|
|
26
|
+
* @param {string|string[]} [props.defaultValue] - 初始选中的员工UID
|
|
27
|
+
* @param {string|string[]} [props.ifnofound] - 当初始选中的员工数据中无法匹配到员工时,对应显示的文案
|
|
28
|
+
* @param {(options:string|string[],selected:any|any[])=>void} [props.onChange] - 选中数据发生变更的回调
|
|
29
|
+
*
|
|
30
|
+
* @returns { JSX.Element }
|
|
31
|
+
*/
|
|
5
32
|
const StaffSelect = (props) => {
|
|
6
33
|
const [userList, setUserList] = useState(props.userList || null);
|
|
7
34
|
const [value, setValue] = useState(props?.defaultValue || []);
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React,{useEffect} from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import Popup from '@/components/popup';
|
|
8
|
+
|
|
9
|
+
// @ts-ignore
|
|
3
10
|
import styles from './index.less';
|
|
4
|
-
|
|
11
|
+
|
|
5
12
|
|
|
6
13
|
const toastList=[];
|
|
7
14
|
const runNext=()=>{
|
|
@@ -43,12 +50,25 @@ const Toast=props=>{
|
|
|
43
50
|
)
|
|
44
51
|
}
|
|
45
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {object} ToastOptions
|
|
55
|
+
* @property {string} message - 吐司文案内容
|
|
56
|
+
* @property {number} [delay=2000] - 持续时间,毫秒
|
|
57
|
+
* @property {string} [position] - 显示位置,center|top|bottom
|
|
58
|
+
* @property {Function} [resolve] - 显示完毕的回调
|
|
59
|
+
*/
|
|
46
60
|
|
|
61
|
+
/**
|
|
62
|
+
* 显示一个吐司信息
|
|
63
|
+
* @param {ToastOptions|string} [props] - 文案内容或一个配置参数
|
|
64
|
+
* @returns { Promise }
|
|
65
|
+
*/
|
|
47
66
|
const ShowToast=props=>{
|
|
48
67
|
if(typeof props === 'string'){
|
|
49
68
|
props = {message:props}
|
|
50
69
|
}
|
|
51
70
|
return new Promise((resolve) => {
|
|
71
|
+
// @ts-ignore
|
|
52
72
|
props.resolve = resolve;
|
|
53
73
|
toastList.push(props);
|
|
54
74
|
if(toastList.length===1){
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useState,useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import { Upload, message,Button } from 'antd';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { UploadOutlined } from '@ant-design/icons';
|
|
7
|
+
|
|
3
8
|
import { UPLOAD_FILE,GET_DOWNLOAD_FILE } from "@/services/common.js";
|
|
4
9
|
// import {getUploadToken,setMediaInfo} from '@/services/common.js';
|
|
5
10
|
// import COS from 'cos-js-sdk-v5';
|
|
6
11
|
|
|
7
|
-
import { UploadOutlined } from '@ant-design/icons';
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
function DELAY(time){
|
|
@@ -67,12 +71,16 @@ function DELAY(time){
|
|
|
67
71
|
// }
|
|
68
72
|
|
|
69
73
|
function CHECK_FILE_TYPE(types, filename) {
|
|
74
|
+
/**
|
|
75
|
+
* @type RegExp|string
|
|
76
|
+
*/
|
|
70
77
|
let reg = '';
|
|
71
78
|
|
|
72
79
|
if (types.constructor === Array) {
|
|
73
80
|
types = types.join('|');
|
|
74
81
|
}
|
|
75
82
|
reg = `[.](${types})$`;
|
|
83
|
+
|
|
76
84
|
reg = new RegExp(reg, 'i');
|
|
77
85
|
return reg.test(filename);
|
|
78
86
|
}
|
|
@@ -87,6 +95,7 @@ const getImageInfo= async (file)=>{
|
|
|
87
95
|
img.onload=()=>{
|
|
88
96
|
resolve({width:img.width,height:img.height});
|
|
89
97
|
}
|
|
98
|
+
// @ts-ignore
|
|
90
99
|
img.src=reader.result;
|
|
91
100
|
}
|
|
92
101
|
})
|
|
@@ -98,9 +107,11 @@ const getVideoInfo= async (file)=>{
|
|
|
98
107
|
reader.onload =()=>{
|
|
99
108
|
let video = document.createElement('video');
|
|
100
109
|
video.addEventListener('canplay',(e)=>{
|
|
110
|
+
// @ts-ignore
|
|
101
111
|
const {videoWidth,videoHeight} = e.target;
|
|
102
112
|
resolve({width:videoWidth,height:videoHeight});
|
|
103
113
|
})
|
|
114
|
+
// @ts-ignore
|
|
104
115
|
video.setAttribute('src',reader.result);
|
|
105
116
|
// document.body.appendChild(img);
|
|
106
117
|
}
|
|
@@ -184,8 +195,35 @@ export const uploadFile=async (props,detail)=>{
|
|
|
184
195
|
}
|
|
185
196
|
|
|
186
197
|
|
|
198
|
+
/**
|
|
199
|
+
* @typedef FileInfo
|
|
200
|
+
* @property {string} server_link - 文件唯一名
|
|
201
|
+
* @property {string} [client_name] - 文件显示名
|
|
202
|
+
* @property {string} [thumbUrl] - 预览图URL
|
|
203
|
+
* @property {any} [info] - 文件唯一ID
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
|
|
187
208
|
/**
|
|
188
209
|
*
|
|
210
|
+
* 上传文件组件
|
|
211
|
+
* @param {Object} props
|
|
212
|
+
* @param {FileInfo|FileInfo[]} props.value - 当前值
|
|
213
|
+
* @param {FileInfo|FileInfo[]} props.defaultFile - 初始值
|
|
214
|
+
* @param {string} [props.thumbUrl] - 通用预览图
|
|
215
|
+
* @param {number} [props.maxSize] - 单个文件最大值,单位KB
|
|
216
|
+
* @param {(files:FileInfo[])=>void} [props.onChange] - 文件发生变化的回调
|
|
217
|
+
* @param {string} [props.listType] - 上传内容的类型,text=常规文件,上传图片
|
|
218
|
+
* @param {boolean} [props.multiple] - 是否支持多选
|
|
219
|
+
* @param {boolean} [props.disabled] - 是否禁用状态
|
|
220
|
+
* @param {string[]} [props.acceptTypes] - 允许上传的文件类型,如:['png','jpg']
|
|
221
|
+
* @param {()=>void} [props.onPreview] - 点击图片查看的回调
|
|
222
|
+
* @param {boolean} [props.showUploadList] - 同antd upload组件内的showUploadList https://4x.ant.design/components/upload-cn/#API
|
|
223
|
+
* @param {string} [props.className] - 扩展类样式
|
|
224
|
+
*
|
|
225
|
+
*
|
|
226
|
+
* @returns {JSX.Element}
|
|
189
227
|
* {
|
|
190
228
|
* uid:'',//唯一id,负数为默认文件
|
|
191
229
|
* url:'',//下载链接
|
|
@@ -206,14 +244,14 @@ const UploadHelper = (props) => {
|
|
|
206
244
|
let defaultFile=[];
|
|
207
245
|
let ret=[];
|
|
208
246
|
if(props.value){
|
|
209
|
-
if(props.value
|
|
247
|
+
if( Array.isArray(props.value) ){
|
|
210
248
|
defaultFile=[...props.value];
|
|
211
249
|
}else{
|
|
212
250
|
defaultFile.push(props.value);
|
|
213
251
|
}
|
|
214
252
|
}
|
|
215
253
|
else if(props.defaultFile){
|
|
216
|
-
if(props.defaultFile
|
|
254
|
+
if( Array.isArray(props.defaultFile) ){
|
|
217
255
|
defaultFile=[...props.defaultFile];
|
|
218
256
|
}else{
|
|
219
257
|
defaultFile.push(props.defaultFile);
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { useRef,useState,useMemo, useEffect } from 'react';
|
|
2
3
|
|
|
3
4
|
const useDelay=()=>{
|
|
4
5
|
const [loading,setLoading] = useState(false);
|
|
5
6
|
const refSet = useRef();
|
|
7
|
+
// @ts-ignore
|
|
6
8
|
refSet.current = setLoading;
|
|
7
9
|
useEffect(()=>{
|
|
10
|
+
// @ts-ignore
|
|
8
11
|
refSet.current = setLoading;
|
|
9
12
|
},[setLoading]);
|
|
10
13
|
|
|
11
14
|
const actions=useMemo(()=>{
|
|
12
15
|
const wait=(ms)=>{
|
|
16
|
+
// @ts-ignore
|
|
13
17
|
refSet.current(true);
|
|
14
18
|
return new Promise(res=>{
|
|
15
19
|
setTimeout(()=>{
|
|
20
|
+
// @ts-ignore
|
|
16
21
|
refSet.current(false);
|
|
17
22
|
res();
|
|
18
23
|
}, ms);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { useRef,useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
+
|
|
4
|
+
import {ShowPageLoading} from '@/components/page/pageLoading';
|
|
3
5
|
|
|
4
6
|
const useLoading=(props={})=>{
|
|
5
7
|
const {canTouch=false} = props;
|
|
@@ -20,10 +22,12 @@ const useLoading=(props={})=>{
|
|
|
20
22
|
useEffect(()=>{
|
|
21
23
|
if(count > 0 ){
|
|
22
24
|
if(!refPageLoading.current){
|
|
25
|
+
// @ts-ignore
|
|
23
26
|
refPageLoading.current = ShowPageLoading({canTouch:canTouch});
|
|
24
27
|
}
|
|
25
28
|
}else{
|
|
26
29
|
if(refPageLoading.current){
|
|
30
|
+
// @ts-ignore
|
|
27
31
|
refPageLoading.current();//销毁
|
|
28
32
|
refPageLoading.current=null;
|
|
29
33
|
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import { useState, useMemo, useEffect } from 'react'
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import { createContainer } from 'unstated-next'
|
|
3
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {[HTMLElement,Function]} UseStateElement
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
4
11
|
const useActivity = () => {
|
|
5
12
|
const [scrollTop, setScrollTop] = useState(0);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type UseStateElement
|
|
16
|
+
*/
|
|
6
17
|
const [containerNode, setContainerNode] = useState();
|
|
7
18
|
const [clientHeight, setClientHeight] = useState(0);
|
|
8
19
|
const [titleRefs, setTitleRefs] = useState({});
|
|
@@ -12,6 +23,7 @@ const useActivity = () => {
|
|
|
12
23
|
setContainerNode(node);
|
|
13
24
|
setClientHeight(node.clientHeight)
|
|
14
25
|
node.addEventListener('scroll', (e) => {
|
|
26
|
+
// @ts-ignore
|
|
15
27
|
setScrollTop(e.target.scrollTop);
|
|
16
28
|
})
|
|
17
29
|
}, [])
|