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.
Files changed (143) hide show
  1. package/package.json +1 -1
  2. package/readme.md +3 -0
  3. package/src/.DS_Store +0 -0
  4. package/templates/template_admin/.gitignore +6 -0
  5. package/templates/template_admin/public/index.html +5 -2
  6. package/templates/template_admin/public/src/_antd.less +7 -1
  7. package/templates/template_admin/public/src/components/menu/index.jsx +47 -100
  8. package/templates/template_admin/public/src/components/menu/topMenu/index.jsx +119 -0
  9. package/templates/template_admin/public/src/dictionary/index.js +4 -1
  10. package/templates/template_admin/public/src/hooks/index.jsx +4 -1
  11. package/templates/template_admin/public/src/hooks/useRouteMenu.jsx +232 -0
  12. package/templates/template_admin/public/src/provider/menu.jsx +261 -10
  13. package/templates/template_admin/public/src/route.jsx +18 -9
  14. package/templates/template_app/.gitignore +6 -0
  15. package/templates/template_oa/.gitignore +6 -0
  16. package/templates/template_oa/jsconfig.json +5 -1
  17. package/templates/template_oa/public/src/components/dialog/index.jsx +237 -0
  18. package/templates/template_oa/public/src/components/{Empty → empty}/index.jsx +9 -0
  19. package/templates/{template_oa_jwt/public/src/components/FormRow → template_oa/public/src/components/formRow}/index.jsx +25 -3
  20. package/templates/{template_oa_jwt/public/src/components/FormTable → template_oa/public/src/components/formTable}/index.jsx +39 -1
  21. package/templates/template_oa/public/src/components/iconFont/index.jsx +22 -0
  22. package/templates/template_oa/public/src/components/{IFrame → iframe}/index.jsx +18 -4
  23. package/templates/template_oa/public/src/components/{Layout/Basic → layout/basic}/index.jsx +7 -1
  24. package/templates/{template_oa_jwt/public/src/components/Layout/CenterBody → template_oa/public/src/components/layout/centerBody}/index.jsx +2 -0
  25. package/templates/{template_oa_jwt/public/src/components/Layout/FormBlock → template_oa/public/src/components/layout/formBlock}/index.jsx +3 -1
  26. package/templates/template_oa/public/src/components/{Layout → layout}/index.jsx +12 -6
  27. package/templates/{template_oa_jwt/public/src/components/Layout/Provider → template_oa/public/src/components/layout/provider}/index.jsx +4 -0
  28. package/templates/template_oa/public/src/components/{Link → link}/index.jsx +16 -0
  29. package/templates/template_oa/public/src/components/{Nav → nav}/index.jsx +8 -2
  30. package/templates/{template_oa_jwt/public/src/components/Page/PageLoading → template_oa/public/src/components/page/pageLoading}/index.jsx +25 -4
  31. package/templates/template_oa/public/src/components/{Popup → popup}/index.jsx +13 -0
  32. package/templates/template_oa/public/src/components/{Select/DepSelect → select/depSelect}/index.jsx +15 -0
  33. package/templates/template_oa/public/src/components/{Select/StaffSelect → select/staffSelect}/index.jsx +27 -0
  34. package/templates/template_oa/public/src/components/title/index.jsx +3 -0
  35. package/templates/template_oa/public/src/components/{Toast → toast}/index.jsx +21 -1
  36. package/templates/template_oa/public/src/components/{Upload → upload}/index.jsx +41 -3
  37. package/templates/template_oa/public/src/hooks/index.jsx +1 -0
  38. package/templates/template_oa/public/src/hooks/useDelay.jsx +5 -0
  39. package/templates/template_oa/public/src/hooks/useImageLoader.jsx +1 -2
  40. package/templates/template_oa/public/src/hooks/useLoading.jsx +5 -1
  41. package/templates/template_oa/public/src/hooks/usePreload.jsx +2 -1
  42. package/templates/template_oa/public/src/hooks/useScrollTop.jsx +12 -0
  43. package/templates/template_oa/public/src/hooks/useSearch.jsx +28 -2
  44. package/templates/template_oa/public/src/hooks/useUpdate.jsx +5 -0
  45. package/templates/template_oa/public/src/index.jsx +15 -1
  46. package/templates/template_oa/public/src/pages/video/index.jsx +17 -13
  47. package/templates/template_oa/public/src/provider/app.jsx +33 -2
  48. package/templates/template_oa/public/src/route.jsx +4 -2
  49. package/templates/template_oa/public/src/services/common.js +11 -0
  50. package/templates/template_oa/public/src/services/index.js +44 -2
  51. package/templates/template_oa/public/src/type.js +48 -0
  52. package/templates/template_oa/public/src/utils/index.js +34 -17
  53. package/templates/template_oa_jwt/.gitignore +6 -0
  54. package/templates/template_oa_jwt/jsconfig.json +5 -1
  55. package/templates/template_oa_jwt/public/src/components/dialog/index.jsx +237 -0
  56. package/templates/template_oa_jwt/public/src/components/{Empty → empty}/index.jsx +9 -0
  57. package/templates/{template_oa/public/src/components/FormRow → template_oa_jwt/public/src/components/formRow}/index.jsx +25 -3
  58. package/templates/{template_oa/public/src/components/FormTable → template_oa_jwt/public/src/components/formTable}/index.jsx +41 -2
  59. package/templates/template_oa_jwt/public/src/components/formTable/index.less +18 -0
  60. package/templates/template_oa_jwt/public/src/components/iconFont/index.jsx +22 -0
  61. package/templates/template_oa_jwt/public/src/components/{IFrame → iframe}/index.jsx +15 -0
  62. package/templates/template_oa_jwt/public/src/components/{Layout/Basic → layout/basic}/index.jsx +11 -6
  63. package/templates/{template_oa/public/src/components/Layout/CenterBody → template_oa_jwt/public/src/components/layout/centerBody}/index.jsx +2 -0
  64. package/templates/{template_oa/public/src/components/Layout/FormBlock → template_oa_jwt/public/src/components/layout/formBlock}/index.jsx +3 -1
  65. package/templates/template_oa_jwt/public/src/components/{Layout → layout}/index.jsx +10 -4
  66. package/templates/{template_oa/public/src/components/Layout/Provider → template_oa_jwt/public/src/components/layout/provider}/index.jsx +4 -0
  67. package/templates/template_oa_jwt/public/src/components/{Link → link}/index.jsx +16 -0
  68. package/templates/template_oa_jwt/public/src/components/{Nav → nav}/index.jsx +11 -5
  69. package/templates/{template_oa/public/src/components/Page/PageLoading → template_oa_jwt/public/src/components/page/pageLoading}/index.jsx +25 -4
  70. package/templates/template_oa_jwt/public/src/components/{Popup → popup}/index.jsx +13 -0
  71. package/templates/template_oa_jwt/public/src/components/{Select/DepSelect → select/depSelect}/index.jsx +15 -0
  72. package/templates/template_oa_jwt/public/src/components/{Select/StaffSelect → select/staffSelect}/index.jsx +27 -0
  73. package/templates/template_oa_jwt/public/src/components/title/index.jsx +3 -0
  74. package/templates/template_oa_jwt/public/src/components/{Toast → toast}/index.jsx +21 -1
  75. package/templates/template_oa_jwt/public/src/components/{Upload → upload}/index.jsx +41 -3
  76. package/templates/template_oa_jwt/public/src/dictionary/index.js +2 -0
  77. package/templates/template_oa_jwt/public/src/hooks/index.jsx +2 -2
  78. package/templates/template_oa_jwt/public/src/hooks/useDelay.jsx +5 -0
  79. package/templates/template_oa_jwt/public/src/hooks/useImageLoader.jsx +1 -2
  80. package/templates/template_oa_jwt/public/src/hooks/useLoading.jsx +5 -1
  81. package/templates/template_oa_jwt/public/src/hooks/usePreload.jsx +2 -1
  82. package/templates/template_oa_jwt/public/src/hooks/useScrollTop.jsx +12 -0
  83. package/templates/template_oa_jwt/public/src/hooks/useSearch.jsx +28 -2
  84. package/templates/template_oa_jwt/public/src/hooks/useUpdate.jsx +5 -0
  85. package/templates/template_oa_jwt/public/src/pages/demo/index.jsx +17 -11
  86. package/templates/template_oa_jwt/public/src/provider/app.jsx +30 -1
  87. package/templates/template_oa_jwt/public/src/route.jsx +4 -2
  88. package/templates/template_oa_jwt/public/src/services/common.js +13 -1
  89. package/templates/template_oa_jwt/public/src/services/index.js +52 -8
  90. package/templates/template_oa_jwt/public/src/services/token.js +7 -0
  91. package/templates/template_oa_jwt/public/src/utils/index.js +62 -22
  92. package/templates/template_offcial/.gitignore +6 -0
  93. package/templates/template_admin/public/src/components/topMenu/index.jsx +0 -267
  94. package/templates/template_oa/public/src/components/Alert/index.jsx +0 -0
  95. package/templates/template_oa/public/src/components/Alert/index.less +0 -0
  96. package/templates/template_oa/public/src/components/Auth/index.jsx +0 -44
  97. package/templates/template_oa/public/src/components/Dialog/index.jsx +0 -150
  98. package/templates/template_oa/public/src/components/Footer/index.jsx +0 -17
  99. package/templates/template_oa/public/src/components/Footer/index.less +0 -28
  100. package/templates/template_oa/public/src/components/IconFont/index.jsx +0 -10
  101. package/templates/template_oa/public/src/components/Loading/index.jsx +0 -14
  102. package/templates/template_oa/public/src/components/Loading/index.less +0 -85
  103. package/templates/template_oa_jwt/public/src/components/Alert/index.jsx +0 -0
  104. package/templates/template_oa_jwt/public/src/components/Alert/index.less +0 -0
  105. package/templates/template_oa_jwt/public/src/components/Auth/index.jsx +0 -44
  106. package/templates/template_oa_jwt/public/src/components/Dialog/index.jsx +0 -150
  107. package/templates/template_oa_jwt/public/src/components/Footer/index.jsx +0 -17
  108. package/templates/template_oa_jwt/public/src/components/Footer/index.less +0 -28
  109. package/templates/template_oa_jwt/public/src/components/IconFont/index.jsx +0 -10
  110. package/templates/template_oa_jwt/public/src/components/Loading/index.jsx +0 -16
  111. package/templates/template_oa_jwt/public/src/components/Loading/index.less +0 -96
  112. /package/templates/template_admin/public/src/components/{topMenu → menu/topMenu}/index.less +0 -0
  113. /package/templates/template_oa/public/src/components/{Dialog → dialog}/index.less +0 -0
  114. /package/templates/template_oa/public/src/components/{Empty → empty}/index.less +0 -0
  115. /package/templates/template_oa/public/src/components/{FormRow → formRow}/index.less +0 -0
  116. /package/templates/{template_oa_jwt/public/src/components/FormTable → template_oa/public/src/components/formTable}/index.less +0 -0
  117. /package/templates/template_oa/public/src/components/{IconFont → iconFont}/index.less +0 -0
  118. /package/templates/template_oa/public/src/components/{IFrame → iframe}/index.less +0 -0
  119. /package/templates/template_oa/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
  120. /package/templates/template_oa/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
  121. /package/templates/template_oa/public/src/components/{Layout/FormBlock → layout/formBlock}/index.less +0 -0
  122. /package/templates/template_oa/public/src/components/{Layout → layout}/index.less +0 -0
  123. /package/templates/template_oa/public/src/components/{Link → link}/index.less +0 -0
  124. /package/templates/template_oa/public/src/components/{Nav → nav}/index.less +0 -0
  125. /package/templates/template_oa/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  126. /package/templates/template_oa/public/src/components/{Popup → popup}/index.less +0 -0
  127. /package/templates/template_oa/public/src/components/{Select/StaffSelect → select/staffSelect}/index.less +0 -0
  128. /package/templates/template_oa/public/src/components/{Toast → toast}/index.less +0 -0
  129. /package/templates/template_oa_jwt/public/src/components/{Dialog → dialog}/index.less +0 -0
  130. /package/templates/template_oa_jwt/public/src/components/{Empty → empty}/index.less +0 -0
  131. /package/templates/template_oa_jwt/public/src/components/{FormRow → formRow}/index.less +0 -0
  132. /package/templates/template_oa_jwt/public/src/components/{IconFont → iconFont}/index.less +0 -0
  133. /package/templates/template_oa_jwt/public/src/components/{IFrame → iframe}/index.less +0 -0
  134. /package/templates/template_oa_jwt/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
  135. /package/templates/template_oa_jwt/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
  136. /package/templates/template_oa_jwt/public/src/components/{Layout/FormBlock → layout/formBlock}/index.less +0 -0
  137. /package/templates/template_oa_jwt/public/src/components/{Layout → layout}/index.less +0 -0
  138. /package/templates/template_oa_jwt/public/src/components/{Link → link}/index.less +0 -0
  139. /package/templates/template_oa_jwt/public/src/components/{Nav → nav}/index.less +0 -0
  140. /package/templates/template_oa_jwt/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  141. /package/templates/template_oa_jwt/public/src/components/{Popup → popup}/index.less +0 -0
  142. /package/templates/template_oa_jwt/public/src/components/{Select/StaffSelect → select/staffSelect}/index.less +0 -0
  143. /package/templates/template_oa_jwt/public/src/components/{Toast → toast}/index.less +0 -0
@@ -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,4 +1,7 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+
4
+ // @ts-ignore
2
5
  import CSS from './index.less';
3
6
 
4
7
  const PageTitle = (props) => {
@@ -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
- import Popup from '@/components/Popup/index.jsx';
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.map){
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.map){
254
+ if( Array.isArray(props.defaultFile) ){
217
255
  defaultFile=[...props.defaultFile];
218
256
  }else{
219
257
  defaultFile.push(props.defaultFile);
@@ -1,5 +1,7 @@
1
+ // @ts-ignore
1
2
  import { useDictionary } from '@/hooks';
2
3
  // import { GET_PROJECT } from '@/services/dataset';
4
+ // @ts-ignore
3
5
  import { Select, Radio } from 'antd';
4
6
  useDictionary.SetConfig({ SelectOption: Select.Option, RadioOption: Radio });
5
7
 
@@ -6,10 +6,10 @@ import usePreload from './usePreload';
6
6
  import useSearch from './useSearch';
7
7
  import useUpdate from './useUpdate';
8
8
  import useLoading from './useLoading';
9
- import {useDictionary, usePagination,usePaginationWithForm} from 'kn-hooks';
9
+ // @ts-ignore
10
+ import {usePagination,usePaginationWithForm} from 'kn-hooks';
10
11
 
11
12
  export {
12
- useDictionary,
13
13
  usePaginationWithForm,
14
14
  usePagination,
15
15
  useImageLoader,
@@ -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,7 +1,6 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect,useState,useMemo } from 'react';
2
3
 
3
-
4
-
5
4
  const useImageLoader=(img_src)=>{
6
5
  const [src,setSrc] = useState('');
7
6
  useEffect(() => {
@@ -1,5 +1,7 @@
1
+ // @ts-ignore
1
2
  import { useRef,useState, useEffect } from 'react';
2
- import {ShowPageLoading} from '@/components/Page/PageLoading';
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,4 +1,5 @@
1
- import React, { useEffect,useState,useMemo,useRef,useCallback } from 'react';
1
+ // @ts-ignore
2
+ import React, { useState,useMemo,useCallback } from 'react';
2
3
 
3
4
  const usePreload=(files)=>{
4
5
  const [list] = useState(files);
@@ -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
  }, [])
@@ -1,7 +1,32 @@
1
- import { useRef,useState,useMemo, useEffect } from 'react';
1
+ // @ts-ignore
2
+ import React,{ useState } from 'react';
3
+
4
+
5
+ /**
6
+ * @typedef {object} UseSearch
7
+ * @property {(pageInfo:Pagination,sorterInfo:any)=>Promise} onPaginationChange - 监听分页信息发生变更
8
+ * @property {Pagination} pagination - 当前分页信息
9
+ * @property {object} search - 当前分页查询参数
10
+ * @property {()=>Promise} btnSearch - 出发查询
11
+ * @property {(object)=>void} setSearch - 设置查询参数
12
+ * @property {(object)=>Promise<ServicesResponse>} refresh - 设置查询参数
13
+ * @property {()=>void} btnReset - 重置查询参数
14
+ * @property {(sorter:object)=>void} onSorter - 监听排序变更
15
+ *
16
+ */
17
+
2
18
 
3
19
  /**
4
20
  * 管理表格数据的查询搜索及分页
21
+ * @param {object} props
22
+ * @param {object} [props.initSearch={}] - 初始的分页搜索参数
23
+ * @param {(params)=>Promise} [props.service] - 分页接口提交方法
24
+ * @param {(params:any)=>object} [props.beforeSearch] - 参数拦截器
25
+ * @param {(params:any)=>object} [props.beforeService] - 提交接口前的参数拦截器
26
+ * @param {(response:any)=>void} [props.updateData] - 接口返回后的回调
27
+ * @param {Pagination} [props.pagination] - 接口返回后的回调
28
+ *
29
+ * @returns {UseSearch}
5
30
  */
6
31
  const useSearch=(props)=>{
7
32
  const [search,setSearch] = useState(props.initSearch||{});
@@ -80,10 +105,11 @@ const useSearch=(props)=>{
80
105
  }
81
106
  }
82
107
  const btnReset=()=>{
108
+ // @ts-ignore
83
109
  formRef.resetFields();
84
110
  }
85
111
 
86
- const refresh= async ({searchValue,pageValue,orderValue}={})=>{
112
+ const refresh= async ({searchValue=null,pageValue=null,orderValue=null}={})=>{
87
113
  searchValue = searchValue || search;
88
114
  pageValue = pageValue || pagination;
89
115
 
@@ -1,5 +1,10 @@
1
+ // @ts-ignore
1
2
  import { useState, useMemo } from 'react';
2
3
 
4
+
5
+ /**
6
+ * 更新计数器
7
+ */
3
8
  const useUpdate=()=>{
4
9
  const [count,setCount] = useState(1);
5
10
  const action = useMemo(()=>{
@@ -1,25 +1,31 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect, useState, useRef } from 'react';
3
+ // @ts-ignore
2
4
  import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
5
+ // @ts-ignore
6
+ import { Table, Input, Button, Form,Checkbox,Radio } from 'antd';
3
7
 
4
8
  import {usePaginationWithForm} from '@/hooks';
5
9
  import {GET_LIST,TEST_AUTH} from '@/services/demo';
6
10
  import {GET_STAFF_LIST,GET_DEP_LIST} from '@/services/common';
7
11
 
8
- import { Table, Input, Button, Form,Checkbox,Radio } from 'antd';
9
- import {FormBlockByTitle} from '@/components/Layout/FormBlock';
10
- import styles from './index.less';
12
+ import {FormBlockByTitle} from '@/components/layout/formBlock';
13
+
11
14
  import PageTitle from '@/pages/components/pageTitle';
12
15
  import TotalRecord from '@/pages/components/totalRecord';
13
- import {ShowErrorAlert,ShowAlert,ShowConfirm} from '@/components/Dialog';
14
- import ShowToast from '@/components/Toast';
15
- import Empty from '@/components/Empty';
16
- import FormRow from '@/components/FormRow';
17
- import FormTable from '@/components/FormTable';
18
- import UploadHelper from '@/components/Upload';
19
- import StaffSelect from '@/components/Select/StaffSelect';
20
- import DepSelect from '@/components/Select/DepSelect';
16
+ import {ShowErrorAlert,ShowAlert,ShowConfirm} from '@/components/dialog';
17
+ import ShowToast from '@/components/toast';
18
+ import Empty from '@/components/empty';
19
+ import FormRow from '@/components/formRow';
20
+ import FormTable from '@/components/formTable';
21
+ import UploadHelper from '@/components/upload';
22
+ import StaffSelect from '@/components/select/staffSelect';
23
+ import DepSelect from '@/components/select/depSelect';
21
24
  import ProviderApp from '@/provider/app';
22
25
 
26
+ // @ts-ignore
27
+ import styles from './index.less';
28
+
23
29
  const Page = () => {
24
30
  const providerApp = ProviderApp.useContainer();
25
31
  const navigate= useNavigate();
@@ -1,9 +1,29 @@
1
+ // @ts-ignore
1
2
  import { useState,useMemo, useEffect } from 'react';
3
+ // @ts-ignore
2
4
  import { useSearchParams,useNavigate } from 'react-router-dom';
5
+ // @ts-ignore
6
+ import { createContainer } from "unstated-next"
7
+
3
8
  import {setLogout,setToLogin,setRefreshToken} from '@/services/token';
4
9
  import { setJwt } from '@/services';
5
10
 
6
- import { createContainer } from "unstated-next"
11
+
12
+
13
+ /**
14
+ * @typedef AppContaniner
15
+ * @property {boolean} loading - 当前是否是加载状态
16
+ * @property {(open:boolean)=>void} setLoading - 设置加载状态
17
+ * @property {object} nav - 导航栏配置
18
+ * @property {(option:object)=>void} setNav - 设置导航栏配置
19
+ * @property {()=>Promise} logout - 注销病退回登录界面
20
+ * @property {(redirectUrl:string)=>Promise} toLogin - 登录并跳转
21
+ * @property {(user:object)=>void} setUser - 注销病退回登录界面
22
+ * @property {object} user - 注销病退回登录界面
23
+ *
24
+ */
25
+
26
+
7
27
  const useApp=() =>{
8
28
  const [search] = useSearchParams();
9
29
  const navigate= useNavigate();
@@ -61,6 +81,15 @@ const useApp=() =>{
61
81
  return action
62
82
  }
63
83
 
84
+ /**
85
+ * @typedef {object} AppProvider
86
+ * @property {function():AppContaniner} useContainer
87
+ * @property {React.ComponentType<any>} Provider
88
+ */
89
+
90
+ /**
91
+ * @type {AppProvider}
92
+ */
64
93
  const App = createContainer(useApp);
65
94
 
66
95
  export default App;
@@ -1,8 +1,10 @@
1
+ // @ts-ignore
1
2
  import React,{Suspense} from 'react';
3
+ // @ts-ignore
2
4
  import { Routes, Route, Navigate } from 'react-router-dom';
3
5
 
4
- import { LayoutBasic, Layout } from '@/components/Layout';
5
- import PageLoading from '@/components/Page/PageLoading';
6
+ import { LayoutBasic, Layout } from '@/components/layout';
7
+ import PageLoading from '@/components/page/pageLoading';
6
8
 
7
9
  import Login from '@/pages/login';
8
10
  // import {AuthLogin} from '@/components/Auth';
@@ -1,11 +1,14 @@
1
+ // @ts-ignore
2
+ import axios from 'axios';
1
3
 
2
4
  import {GET_TOKEN,GET_DEFAULT_CROSS} from '@/services';
3
- import axios from 'axios';
5
+
4
6
 
5
7
  /**
6
8
  * 获取员工列表
7
9
  */
8
10
  export async function GET_STAFF_LIST() {
11
+ // @ts-ignore
9
12
  let ret = await GET_DEFAULT_CROSS(`${OA_HOST}/common/getNewUserList`);
10
13
  return ret;
11
14
  // let response = await axios({
@@ -23,6 +26,7 @@ export async function GET_STAFF_LIST() {
23
26
  * 所有部门信息
24
27
  */
25
28
  export async function GET_DEP_LIST() {
29
+ // @ts-ignore
26
30
  return GET_DEFAULT_CROSS(`${OA_HOST}/common/getBenefitDept`);
27
31
  }
28
32
 
@@ -31,6 +35,7 @@ export async function GET_DEP_LIST() {
31
35
  * @returns
32
36
  */
33
37
  export function GET_COMPANY_LIST(){
38
+ // @ts-ignore
34
39
  return GET_DEFAULT_CROSS(`${OA_HOST}/filestore/list?status=1`);
35
40
  }
36
41
 
@@ -51,6 +56,7 @@ export async function POST_IMPORT_EXCEL(url, file, onProgress) {
51
56
  url: url,
52
57
  data: formdata,
53
58
  onUploadProgress: (e) => {
59
+ // @ts-ignore
54
60
  onProgress({ percent: `${e.loaded}/${e.total}` * 100 });
55
61
  },
56
62
  });
@@ -61,6 +67,7 @@ export async function POST_IMPORT_EXCEL(url, file, onProgress) {
61
67
  * 获取下载文件的url路径
62
68
  */
63
69
  export function GET_DOWNLOAD_FILE(s_name) {
70
+ // @ts-ignore
64
71
  return `${OA_HOST}/file/download?name=${s_name}`;
65
72
  }
66
73
 
@@ -81,6 +88,7 @@ export async function UPLOAD_FILE(file, param, onProgress) {
81
88
 
82
89
  let response = await axios({
83
90
  method: 'post',
91
+ // @ts-ignore
84
92
  url: `${OA_HOST}/file/upload`,
85
93
  data: formdata,
86
94
  xsrfCookieName: '',
@@ -88,6 +96,7 @@ export async function UPLOAD_FILE(file, param, onProgress) {
88
96
  withCredentials: true,
89
97
 
90
98
  onUploadProgress: (e) => {
99
+ // @ts-ignore
91
100
  let per = parseFloat((e.loaded / e.total) * 100).toFixed(0);
92
101
  onProgress({ percent: per });
93
102
  },
@@ -111,6 +120,9 @@ export async function UPLOAD_FILE(file, param, onProgress) {
111
120
  * types:array|string,['png','gif']|'png' 类型
112
121
  */
113
122
  export function CHECK_FILE_TYPE(types, filename) {
123
+ /**
124
+ * @type RegExp|string
125
+ */
114
126
  let reg = '';
115
127
 
116
128
  if (types.constructor === Array) {