kn-cli 1.0.63 → 1.0.65
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 +2 -1
- package/readme.md +6 -0
- package/src/create.js +2 -0
- package/templates/template_oa/public/src/components/IFrame/index.jsx +3 -0
- package/templates/template_oa/readme.md +6 -1
- package/templates/template_oa/webpack.api.js +7 -3
- package/templates/template_oa_jwt/.gitignore +6 -0
- package/templates/template_oa_jwt/build.sh +7 -0
- package/templates/template_oa_jwt/cli.config.js +30 -0
- package/templates/template_oa_jwt/dev.sh +89 -0
- package/templates/template_oa_jwt/frontend_build.sh +88 -0
- package/templates/template_oa_jwt/init/prepare-commit-msg +5 -0
- package/templates/template_oa_jwt/init.sh +33 -0
- package/templates/template_oa_jwt/jsconfig.json +10 -0
- package/templates/template_oa_jwt/package.json +25 -0
- package/templates/template_oa_jwt/public/404.html +26 -0
- package/templates/template_oa_jwt/public/favicon.ico +0 -0
- package/templates/template_oa_jwt/public/index.html +44 -0
- package/templates/template_oa_jwt/public/src/_antd.less +216 -0
- package/templates/template_oa_jwt/public/src/_reset.less +134 -0
- package/templates/template_oa_jwt/public/src/_variable.less +84 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.eot +0 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.less +57 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.svg +36 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.ttf +0 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.woff +0 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.woff2 +0 -0
- package/templates/template_oa_jwt/public/src/assets/images/NY-pop-bg.png +0 -0
- package/templates/template_oa_jwt/public/src/assets/images/avatar.png +0 -0
- package/templates/template_oa_jwt/public/src/assets/images/loading.svg +40 -0
- 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 +44 -0
- package/templates/template_oa_jwt/public/src/components/Dialog/index.jsx +150 -0
- package/templates/template_oa_jwt/public/src/components/Dialog/index.less +123 -0
- package/templates/template_oa_jwt/public/src/components/Empty/index.jsx +23 -0
- package/templates/template_oa_jwt/public/src/components/Empty/index.less +6 -0
- package/templates/template_oa_jwt/public/src/components/Footer/index.jsx +17 -0
- package/templates/template_oa_jwt/public/src/components/Footer/index.less +28 -0
- package/templates/template_oa_jwt/public/src/components/FormRow/index.jsx +39 -0
- package/templates/template_oa_jwt/public/src/components/FormRow/index.less +67 -0
- package/templates/template_oa_jwt/public/src/components/FormTable/index.jsx +137 -0
- package/templates/template_oa_jwt/public/src/components/FormTable/index.less +18 -0
- package/templates/template_oa_jwt/public/src/components/IFrame/index.jsx +44 -0
- package/templates/template_oa_jwt/public/src/components/IFrame/index.less +4 -0
- package/templates/template_oa_jwt/public/src/components/IconFont/index.jsx +10 -0
- package/templates/template_oa_jwt/public/src/components/IconFont/index.less +5 -0
- package/templates/template_oa_jwt/public/src/components/Layout/Basic/index.jsx +52 -0
- package/templates/template_oa_jwt/public/src/components/Layout/Basic/index.less +82 -0
- package/templates/template_oa_jwt/public/src/components/Layout/CenterBody/index.jsx +15 -0
- package/templates/template_oa_jwt/public/src/components/Layout/CenterBody/index.less +36 -0
- package/templates/template_oa_jwt/public/src/components/Layout/FormBlock/index.jsx +23 -0
- package/templates/template_oa_jwt/public/src/components/Layout/FormBlock/index.less +37 -0
- package/templates/template_oa_jwt/public/src/components/Layout/Provider/index.jsx +12 -0
- package/templates/template_oa_jwt/public/src/components/Layout/index.jsx +27 -0
- package/templates/template_oa_jwt/public/src/components/Layout/index.less +8 -0
- package/templates/template_oa_jwt/public/src/components/Link/index.jsx +24 -0
- package/templates/template_oa_jwt/public/src/components/Link/index.less +11 -0
- package/templates/template_oa_jwt/public/src/components/Loading/index.jsx +16 -0
- package/templates/template_oa_jwt/public/src/components/Loading/index.less +96 -0
- package/templates/template_oa_jwt/public/src/components/Nav/index.jsx +184 -0
- package/templates/template_oa_jwt/public/src/components/Nav/index.less +38 -0
- package/templates/template_oa_jwt/public/src/components/Page/PageLoading/index.jsx +30 -0
- package/templates/template_oa_jwt/public/src/components/Page/PageLoading/index.less +29 -0
- package/templates/template_oa_jwt/public/src/components/Popup/index.jsx +22 -0
- package/templates/template_oa_jwt/public/src/components/Popup/index.less +18 -0
- package/templates/template_oa_jwt/public/src/components/Select/DepSelect/index.jsx +47 -0
- package/templates/template_oa_jwt/public/src/components/Select/StaffSelect/index.jsx +97 -0
- package/templates/template_oa_jwt/public/src/components/Select/StaffSelect/index.less +24 -0
- package/templates/template_oa_jwt/public/src/components/Toast/index.jsx +60 -0
- package/templates/template_oa_jwt/public/src/components/Toast/index.less +43 -0
- package/templates/template_oa_jwt/public/src/components/Upload/index.jsx +358 -0
- package/templates/template_oa_jwt/public/src/components/title/index.jsx +12 -0
- package/templates/template_oa_jwt/public/src/components/title/index.less +21 -0
- package/templates/template_oa_jwt/public/src/dictionary/index.js +20 -0
- package/templates/template_oa_jwt/public/src/hooks/index.jsx +21 -0
- package/templates/template_oa_jwt/public/src/hooks/useDelay.jsx +29 -0
- package/templates/template_oa_jwt/public/src/hooks/useImageLoader.jsx +27 -0
- package/templates/template_oa_jwt/public/src/hooks/useLoading.jsx +42 -0
- package/templates/template_oa_jwt/public/src/hooks/useLogin.jsx +33 -0
- package/templates/template_oa_jwt/public/src/hooks/usePreload.jsx +66 -0
- package/templates/template_oa_jwt/public/src/hooks/useScrollTop.jsx +32 -0
- package/templates/template_oa_jwt/public/src/hooks/useSearch.jsx +137 -0
- package/templates/template_oa_jwt/public/src/hooks/useUpdate.jsx +11 -0
- package/templates/template_oa_jwt/public/src/index.jsx +50 -0
- package/templates/template_oa_jwt/public/src/mock/common.js +484 -0
- package/templates/template_oa_jwt/public/src/mock/index.js +63 -0
- package/templates/template_oa_jwt/public/src/mock/user.js +70 -0
- package/templates/template_oa_jwt/public/src/mock/utils.js +33 -0
- package/templates/template_oa_jwt/public/src/pages/components/pageTitle/index.jsx +13 -0
- package/templates/template_oa_jwt/public/src/pages/components/pageTitle/index.less +20 -0
- package/templates/template_oa_jwt/public/src/pages/components/totalRecord/index.jsx +21 -0
- package/templates/template_oa_jwt/public/src/pages/components/totalRecord/index.less +16 -0
- package/templates/template_oa_jwt/public/src/pages/demo/detail/index.jsx +14 -0
- package/templates/template_oa_jwt/public/src/pages/demo/index.jsx +399 -0
- package/templates/template_oa_jwt/public/src/pages/demo/index.less +15 -0
- package/templates/template_oa_jwt/public/src/pages/login/index.jsx +29 -0
- package/templates/template_oa_jwt/public/src/pages/login/index.less +44 -0
- package/templates/template_oa_jwt/public/src/pages/redirect/index.jsx +31 -0
- package/templates/template_oa_jwt/public/src/provider/app.jsx +66 -0
- package/templates/template_oa_jwt/public/src/route.jsx +45 -0
- package/templates/template_oa_jwt/public/src/services/common.js +133 -0
- package/templates/template_oa_jwt/public/src/services/demo.js +41 -0
- package/templates/template_oa_jwt/public/src/services/index.js +266 -0
- package/templates/template_oa_jwt/public/src/services/token.js +132 -0
- package/templates/template_oa_jwt/public/src/utils/index.js +115 -0
- package/templates/template_oa_jwt/public/static/about.html +1 -0
- package/templates/template_oa_jwt/public/static/kssoLogin.html +22 -0
- package/templates/template_oa_jwt/public/static/noAuth.html +217 -0
- package/templates/template_oa_jwt/public/static/noAuth.png +0 -0
- package/templates/template_oa_jwt/readme.md +71 -0
- package/templates/template_oa_jwt/report.sh +68 -0
- package/templates/template_oa_jwt/tools/iconfont/gulpfile.js +70 -0
- package/templates/template_oa_jwt/tools/iconfont/package.json +20 -0
- package/templates/template_oa_jwt/tools/iconfont/run.sh +39 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/arrowBack.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/check.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/close.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/down.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/image.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/play.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/refresh.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/warn.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/templates/_icons.css +26 -0
- package/templates/template_oa_jwt/tools/iconfont/templates/_icons.less +29 -0
- package/templates/template_oa_jwt/tools/iconfont/templates/index.html +56 -0
- package/templates/template_oa_jwt/tools/tinypng/package.json +11 -0
- package/templates/template_oa_jwt/tools/tinypng/run.sh +15 -0
- package/templates/template_oa_jwt/versionPublish.sh +27 -0
- package/templates/template_oa_jwt/webpack.api.js +61 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import {usePaginationWithForm} from '@/hooks';
|
|
5
|
+
import {GET_LIST,TEST_AUTH} from '@/services/demo';
|
|
6
|
+
import {GET_STAFF_LIST,GET_DEP_LIST} from '@/services/common';
|
|
7
|
+
|
|
8
|
+
import { Table, Input, Button, Form,Checkbox,Radio } from 'antd';
|
|
9
|
+
import {FormBlockByTitle} from '@/components/Layout/FormBlock';
|
|
10
|
+
import styles from './index.less';
|
|
11
|
+
import PageTitle from '@/pages/components/pageTitle';
|
|
12
|
+
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';
|
|
21
|
+
import ProviderApp from '@/provider/app';
|
|
22
|
+
|
|
23
|
+
const Page = () => {
|
|
24
|
+
const providerApp = ProviderApp.useContainer();
|
|
25
|
+
const navigate= useNavigate();
|
|
26
|
+
const [form] = Form.useForm();
|
|
27
|
+
const [formEdit]= Form.useForm();
|
|
28
|
+
const [formTable]= Form.useForm();
|
|
29
|
+
const [staff,setStaffList] = useState(null);
|
|
30
|
+
const [depList,setDepList] = useState(null);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const [edit,setEdit]= useState(false);
|
|
34
|
+
const [noData,setNoData]= useState(true);
|
|
35
|
+
const [formData,setFormData]=useState({
|
|
36
|
+
name:'cc',
|
|
37
|
+
age:156,
|
|
38
|
+
files:[{client_name:'abc.jpg',server_link:'abc.jpg'}],
|
|
39
|
+
manager:'69379379356ab1b1a1920d9052021900',
|
|
40
|
+
managerName:'王悦',
|
|
41
|
+
dep:'816',
|
|
42
|
+
depName:'平台技术中心',
|
|
43
|
+
fruit:'西瓜',
|
|
44
|
+
color:'蓝色'
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const [tableFormList,setTableFormList]=useState({
|
|
48
|
+
list:[
|
|
49
|
+
{id:'1',name:'name1',age:'age1'},
|
|
50
|
+
{id:'2',name:'name2',age:'age2'},
|
|
51
|
+
{id:'3',name:'name3',age:'age3'},
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const request = usePaginationWithForm({
|
|
56
|
+
service:GET_LIST,
|
|
57
|
+
pagination:{pageSize:10},
|
|
58
|
+
form:form
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const init=async ()=>{
|
|
62
|
+
let staff = GET_STAFF_LIST();
|
|
63
|
+
let ret = GET_DEP_LIST();
|
|
64
|
+
staff = await staff;
|
|
65
|
+
ret = await ret;
|
|
66
|
+
if(staff&&staff.code==1){
|
|
67
|
+
setStaffList(staff.info)
|
|
68
|
+
}
|
|
69
|
+
if(ret&&ret.code==1){
|
|
70
|
+
setDepList(ret.info);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
useEffect(()=>{
|
|
74
|
+
init();
|
|
75
|
+
},[])
|
|
76
|
+
useEffect(()=>{
|
|
77
|
+
if(request?.pagination?.total>0){
|
|
78
|
+
setNoData(false);
|
|
79
|
+
console.log('有数据了')
|
|
80
|
+
}
|
|
81
|
+
},[request.pagination])
|
|
82
|
+
|
|
83
|
+
useEffect(()=>{
|
|
84
|
+
console.log('初次查询')
|
|
85
|
+
request.update();
|
|
86
|
+
},[])
|
|
87
|
+
|
|
88
|
+
const columns=[{
|
|
89
|
+
dataIndex:'id',
|
|
90
|
+
title:'id',
|
|
91
|
+
render:(_,record,idx)=>{
|
|
92
|
+
return record.id;
|
|
93
|
+
}
|
|
94
|
+
},{
|
|
95
|
+
dataIndex:'value',
|
|
96
|
+
title:'数据值',
|
|
97
|
+
render:(_,record,idx)=>{
|
|
98
|
+
return record.value||'-'
|
|
99
|
+
}
|
|
100
|
+
}];
|
|
101
|
+
|
|
102
|
+
const getDataSource=()=>{
|
|
103
|
+
if(request?.data?.length>0){
|
|
104
|
+
let req=request?.data[request.pagination.current-1]||[];
|
|
105
|
+
return req;
|
|
106
|
+
}
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const onPageChange=(current,pageSize)=>{
|
|
112
|
+
request.update({pagination:{current,pageSize}})
|
|
113
|
+
}
|
|
114
|
+
const onSearch=()=>{
|
|
115
|
+
request.update();
|
|
116
|
+
}
|
|
117
|
+
const onReset=()=>{
|
|
118
|
+
request.reset();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const onDetail=()=>{
|
|
122
|
+
navigate('/detail')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const onAlert= async (type)=>{
|
|
126
|
+
switch(type){
|
|
127
|
+
case 'ShowErrorAlert':{ShowErrorAlert('错误啦');}break;
|
|
128
|
+
case 'ShowAlert':{ShowAlert('提示框');}break;
|
|
129
|
+
case 'ShowConfirm':{
|
|
130
|
+
const req= await ShowConfirm({content:'你确定吗?'})
|
|
131
|
+
if(req){
|
|
132
|
+
ShowToast('确认')
|
|
133
|
+
}else{
|
|
134
|
+
ShowToast('取消')
|
|
135
|
+
}
|
|
136
|
+
}break;
|
|
137
|
+
case 'ShowToast':{
|
|
138
|
+
ShowToast('toast')
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
const onNoData=()=>{
|
|
144
|
+
setNoData(true)
|
|
145
|
+
}
|
|
146
|
+
const onEdit=()=>{
|
|
147
|
+
setEdit(true);
|
|
148
|
+
}
|
|
149
|
+
const onSave= async ()=>{
|
|
150
|
+
try{
|
|
151
|
+
const req= await formEdit.validateFields();
|
|
152
|
+
if(req){
|
|
153
|
+
setFormData(req)
|
|
154
|
+
}
|
|
155
|
+
}catch(ex){
|
|
156
|
+
ShowToast(ex);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
setEdit(false);
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
const onCancel=()=>{
|
|
163
|
+
formEdit.resetFields();
|
|
164
|
+
setEdit(false)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const createColumn=({formItemName,onAdd,onDel,onCopy})=> {
|
|
168
|
+
let ret = [
|
|
169
|
+
{
|
|
170
|
+
align: 'center',
|
|
171
|
+
dataIndex: 'name',
|
|
172
|
+
title:'name',
|
|
173
|
+
width: 60,
|
|
174
|
+
render: (text, record, index) => {
|
|
175
|
+
return (
|
|
176
|
+
<Form.Item name={[formItemName,index,'name']} >
|
|
177
|
+
<Input />
|
|
178
|
+
</Form.Item>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
{
|
|
184
|
+
align: 'center',
|
|
185
|
+
dataIndex: 'age',
|
|
186
|
+
title:'age',
|
|
187
|
+
width: 60,
|
|
188
|
+
render: (text, record, index) => {
|
|
189
|
+
return (
|
|
190
|
+
<Form.Item name={[formItemName,index,'age']} >
|
|
191
|
+
<Input />
|
|
192
|
+
</Form.Item>
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
ret.push({
|
|
198
|
+
align: 'center',
|
|
199
|
+
dataIndex: 'oper',
|
|
200
|
+
title: '操作',
|
|
201
|
+
width: 120,
|
|
202
|
+
render: (text, record, index) => {
|
|
203
|
+
return (
|
|
204
|
+
<div>
|
|
205
|
+
<Button type='link' style={{marginRight:"12px"}} onClick={onDel.bind(this, record, index)} >
|
|
206
|
+
删除
|
|
207
|
+
</Button>
|
|
208
|
+
|
|
209
|
+
<Button type='link' style={{marginRight:"12px"}} onClick={onCopy.bind(this, record, index)}>
|
|
210
|
+
复制
|
|
211
|
+
</Button>
|
|
212
|
+
|
|
213
|
+
<Button type='link' onClick={onAdd.bind(this, record, index)}>
|
|
214
|
+
添加
|
|
215
|
+
</Button>
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
return ret;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const onPrintFormTable= async ()=>{
|
|
226
|
+
|
|
227
|
+
try{
|
|
228
|
+
const req= await formTable.validateFields();
|
|
229
|
+
console.log(req);
|
|
230
|
+
}catch(ex){
|
|
231
|
+
ShowToast(ex);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const onLogout=()=>{
|
|
236
|
+
providerApp.logout();
|
|
237
|
+
}
|
|
238
|
+
const onKsso=()=>{
|
|
239
|
+
TEST_AUTH();
|
|
240
|
+
}
|
|
241
|
+
return (
|
|
242
|
+
<section className={styles.wrap}>
|
|
243
|
+
|
|
244
|
+
<PageTitle>管理系统</PageTitle>
|
|
245
|
+
<FormBlockByTitle title='查询结果'>
|
|
246
|
+
<Form
|
|
247
|
+
form={form}
|
|
248
|
+
layout='inline'
|
|
249
|
+
colon={false}
|
|
250
|
+
>
|
|
251
|
+
<Form.Item name='keywords' labelAlign='left' label='关键字'>
|
|
252
|
+
<Input placeholder='产品编码/产品名称/产品型号/部门/单号' />
|
|
253
|
+
</Form.Item>
|
|
254
|
+
|
|
255
|
+
<Button style={{marginRight:'12px'}} type='primary' onClick={onSearch}>
|
|
256
|
+
查询
|
|
257
|
+
</Button>
|
|
258
|
+
<Button onClick={onReset}>
|
|
259
|
+
重置
|
|
260
|
+
</Button>
|
|
261
|
+
</Form>
|
|
262
|
+
<TotalRecord count={request?.pagination?.total||'-'} right={
|
|
263
|
+
<>
|
|
264
|
+
<Button type='primary'className={styles.margin}>导出</Button>
|
|
265
|
+
<Button onClick={onDetail} className={styles.margin}>查看详情页面</Button>
|
|
266
|
+
<Button onClick={onNoData} className={styles.margin}>模拟空数据</Button>
|
|
267
|
+
|
|
268
|
+
</>
|
|
269
|
+
} />
|
|
270
|
+
{
|
|
271
|
+
noData?<Empty />:
|
|
272
|
+
<Table
|
|
273
|
+
className={styles.table}
|
|
274
|
+
rowKey='id'
|
|
275
|
+
columns={columns}
|
|
276
|
+
loading={!request?.data?.length>0}
|
|
277
|
+
dataSource={getDataSource()}
|
|
278
|
+
// pagination={false}
|
|
279
|
+
pagination={{
|
|
280
|
+
current:request?.pagination?.current,
|
|
281
|
+
pageSize:request?.pagination?.pageSize,
|
|
282
|
+
onChange:onPageChange,
|
|
283
|
+
total:request?.pagination?.total
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
286
|
+
}
|
|
287
|
+
</FormBlockByTitle>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<FormBlockByTitle title='表单' rightBtns={
|
|
291
|
+
edit?
|
|
292
|
+
(<>
|
|
293
|
+
<Button type='primary' onClick={onSave} className={styles.margin}>保存</Button>
|
|
294
|
+
<Button onClick={onCancel} className={styles.margin}>取消</Button>
|
|
295
|
+
</>):(<Button type='primary' onClick={onEdit} className={styles.margin}>编辑</Button>)
|
|
296
|
+
}>
|
|
297
|
+
<Form initialValues={formData} form={formEdit}>
|
|
298
|
+
<FormRow>
|
|
299
|
+
<FormRow.Col label='姓名' required editmode={edit} txtdata={formData?.name}>
|
|
300
|
+
<Form.Item name='name'>
|
|
301
|
+
<Input />
|
|
302
|
+
</Form.Item>
|
|
303
|
+
</FormRow.Col>
|
|
304
|
+
<FormRow.Col label='年龄' editmode={edit} txtdata={formData?.age}>
|
|
305
|
+
<Form.Item name='age'>
|
|
306
|
+
<Input />
|
|
307
|
+
</Form.Item>
|
|
308
|
+
</FormRow.Col>
|
|
309
|
+
</FormRow>
|
|
310
|
+
<FormRow>
|
|
311
|
+
<FormRow.Col label='负责人' editmode={edit} txtdata={formData?.managerName}>
|
|
312
|
+
<Form.Item name='manager'>
|
|
313
|
+
<StaffSelect
|
|
314
|
+
// mode='multiple'
|
|
315
|
+
userList={staff}
|
|
316
|
+
/>
|
|
317
|
+
</Form.Item>
|
|
318
|
+
</FormRow.Col>
|
|
319
|
+
<FormRow.Col label='部门' editmode={edit} txtdata={formData?.depName}>
|
|
320
|
+
<Form.Item name='dep'>
|
|
321
|
+
<DepSelect
|
|
322
|
+
// mode='multiple'
|
|
323
|
+
list={depList}
|
|
324
|
+
/>
|
|
325
|
+
</Form.Item>
|
|
326
|
+
</FormRow.Col>
|
|
327
|
+
</FormRow>
|
|
328
|
+
<FormRow>
|
|
329
|
+
<FormRow.Col label='水果' editmode={edit} txtdata={formData?.fruit}>
|
|
330
|
+
<Form.Item name='fruit'>
|
|
331
|
+
<Checkbox.Group options={[
|
|
332
|
+
{label:'苹果',value:'苹果'},
|
|
333
|
+
{label:'西瓜',value:'西瓜'},
|
|
334
|
+
{label:'桔子',value:'桔子'},
|
|
335
|
+
|
|
336
|
+
]}/>
|
|
337
|
+
</Form.Item>
|
|
338
|
+
</FormRow.Col>
|
|
339
|
+
<FormRow.Col label='颜色' editmode={edit} txtdata={formData?.color}>
|
|
340
|
+
<Form.Item name='color'>
|
|
341
|
+
<Radio.Group>
|
|
342
|
+
<Radio value="红色">红色</Radio>
|
|
343
|
+
<Radio value="黄色">黄色</Radio>
|
|
344
|
+
<Radio value="蓝色">蓝色</Radio>
|
|
345
|
+
</Radio.Group>
|
|
346
|
+
</Form.Item>
|
|
347
|
+
</FormRow.Col>
|
|
348
|
+
</FormRow>
|
|
349
|
+
|
|
350
|
+
<FormRow>
|
|
351
|
+
<FormRow.Col label='附件' editmode={true} >
|
|
352
|
+
<Form.Item name='files'>
|
|
353
|
+
<UploadHelper
|
|
354
|
+
disabled={!edit}
|
|
355
|
+
></UploadHelper>
|
|
356
|
+
</Form.Item>
|
|
357
|
+
</FormRow.Col>
|
|
358
|
+
</FormRow>
|
|
359
|
+
</Form>
|
|
360
|
+
</FormBlockByTitle>
|
|
361
|
+
|
|
362
|
+
<FormBlockByTitle title='表格中的表单'
|
|
363
|
+
rightBtns={
|
|
364
|
+
<Button type='primary' onClick={onPrintFormTable} className={styles.margin}>打印当前表单值</Button>
|
|
365
|
+
}>
|
|
366
|
+
<Form form={formTable} initialValues={{...tableFormList}}>
|
|
367
|
+
<FormTable
|
|
368
|
+
Table={Table}
|
|
369
|
+
initialValue={tableFormList.list}
|
|
370
|
+
form={formTable}
|
|
371
|
+
formItemName='list'
|
|
372
|
+
antTableOptions={{ bordered: true, pagination: false }}
|
|
373
|
+
newdata={{
|
|
374
|
+
name: '',
|
|
375
|
+
age:''
|
|
376
|
+
}}
|
|
377
|
+
columns={createColumn}
|
|
378
|
+
saveLast
|
|
379
|
+
/>
|
|
380
|
+
</Form>
|
|
381
|
+
</FormBlockByTitle>
|
|
382
|
+
<FormBlockByTitle title='其它功能'>
|
|
383
|
+
<Button className={styles.margin} onClick={onAlert.bind(this,'ShowErrorAlert')}>ShowErrorAlert</Button>
|
|
384
|
+
<Button className={styles.margin} onClick={onAlert.bind(this,'ShowAlert')}>ShowAlert</Button>
|
|
385
|
+
<Button className={styles.margin} onClick={onAlert.bind(this,'ShowConfirm')}>ShowConfirm</Button>
|
|
386
|
+
<Button className={styles.margin} onClick={onAlert.bind(this,'ShowToast')}>ShowToast</Button>
|
|
387
|
+
|
|
388
|
+
<Button className={styles.margin} onClick={onKsso}>调用接口自动登录测试</Button>
|
|
389
|
+
|
|
390
|
+
<Button className={styles.margin} onClick={onLogout}>登出OA</Button>
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
</FormBlockByTitle>
|
|
394
|
+
|
|
395
|
+
</section>
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export default Page;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
|
|
3
|
+
import ProviderApp from '@/provider/app';
|
|
4
|
+
import Iframe from '@/components/IFrame';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import styles from './index.less';
|
|
8
|
+
|
|
9
|
+
const Page = () => {
|
|
10
|
+
const navigate= useNavigate();
|
|
11
|
+
const [search] = useSearchParams();
|
|
12
|
+
const providerApp = ProviderApp.useContainer();
|
|
13
|
+
|
|
14
|
+
const onLogin=()=>{
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
const goHome = () => {
|
|
18
|
+
navigate('/');
|
|
19
|
+
}
|
|
20
|
+
return (
|
|
21
|
+
<section className={styles.body} onClick={onLogin}>
|
|
22
|
+
右键 - OA插件 - cookie操作 - 将系统的cookie写入本站
|
|
23
|
+
|
|
24
|
+
<div style={{color: '#2a96fc', marginTop: '30px'}} onClick={goHome}>跳到首页</div>
|
|
25
|
+
</section>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default Page;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
.link{
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.body{
|
|
7
|
+
width: 100%;
|
|
8
|
+
height:100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
.wrap{
|
|
16
|
+
padding:26px 32px;
|
|
17
|
+
background-color: #ccc;
|
|
18
|
+
.title{
|
|
19
|
+
font-size: 24px;
|
|
20
|
+
font-weight: var(--weight-Medium);
|
|
21
|
+
margin-bottom: 24px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
hgroup{
|
|
25
|
+
margin-bottom: 16px;
|
|
26
|
+
display: block;
|
|
27
|
+
.inputLabel{
|
|
28
|
+
display: block;
|
|
29
|
+
font-size: 13px;
|
|
30
|
+
font-weight: var(--weight-Medium);
|
|
31
|
+
color: #86909C;
|
|
32
|
+
line-height: 22px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
.input{
|
|
36
|
+
width: 336px;
|
|
37
|
+
border-radius: 4px;
|
|
38
|
+
border: 1px solid #E5E6EB;
|
|
39
|
+
}
|
|
40
|
+
.btn{
|
|
41
|
+
width: 336px;
|
|
42
|
+
margin-top: 18px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useSearchParams } from 'react-router-dom';
|
|
3
|
+
import PageLoading from '@/components/Page/PageLoading';
|
|
4
|
+
import { CHANGE_TOKEN, setRefreshToken } from '@/services/token'
|
|
5
|
+
import { setJwt } from '@/services';
|
|
6
|
+
import { toHref } from '@/utils';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 过度页 - 用cookie换取token,在跳转到指定页面
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
const Redirect = () => {
|
|
13
|
+
|
|
14
|
+
const [searchParams] = useSearchParams();
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const code = searchParams.get('code');
|
|
18
|
+
const state = searchParams.get('state');
|
|
19
|
+
const {id} = JSON.parse(state);
|
|
20
|
+
CHANGE_TOKEN({ code }).then(res => {
|
|
21
|
+
if (res) {
|
|
22
|
+
setJwt(res.data.access_token);
|
|
23
|
+
setRefreshToken(res.data.refresh_token);
|
|
24
|
+
toHref(`/#/${id ? '/' + id : ''}`, true);
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
}, [])
|
|
28
|
+
return <PageLoading />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default Redirect;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useState,useMemo, useEffect } from 'react';
|
|
2
|
+
import { useSearchParams,useNavigate } from 'react-router-dom';
|
|
3
|
+
import {setLogout,setToLogin,setRefreshToken} from '@/services/token';
|
|
4
|
+
import { setJwt } from '@/services';
|
|
5
|
+
|
|
6
|
+
import { createContainer } from "unstated-next"
|
|
7
|
+
const useApp=() =>{
|
|
8
|
+
const [search] = useSearchParams();
|
|
9
|
+
const navigate= useNavigate();
|
|
10
|
+
const [loading,setLoading] = useState(true);
|
|
11
|
+
const [nav,setNavConfig] = useState({visible:true,syncDocumentTitle:false});
|
|
12
|
+
const [user,setUser] = useState(null);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const setNav=(config)=>{
|
|
16
|
+
setNavConfig({...nav,...config});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const logout=()=>{
|
|
20
|
+
setJwt('');
|
|
21
|
+
setRefreshToken('');
|
|
22
|
+
location.href='/'
|
|
23
|
+
console.log('退出登录')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const toLogin=async (loginUrl)=>{
|
|
27
|
+
// if(BUILD_ENV==='localdebug'){
|
|
28
|
+
// navigate('/login');
|
|
29
|
+
// }else{
|
|
30
|
+
const redirectUrl = `${location.origin}/#/redirect?code={code}&state={state}`;
|
|
31
|
+
const id = location.href.split('/#/')[1] || '';
|
|
32
|
+
|
|
33
|
+
const callback = JSON.stringify({
|
|
34
|
+
callback: encodeURIComponent(redirectUrl),
|
|
35
|
+
id,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
let redirect=`${loginUrl}?state=${callback}`;
|
|
39
|
+
|
|
40
|
+
location.href=redirect;
|
|
41
|
+
|
|
42
|
+
// }
|
|
43
|
+
}
|
|
44
|
+
setToLogin(toLogin);
|
|
45
|
+
setLogout(logout);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const action=useMemo(()=>{
|
|
49
|
+
return {
|
|
50
|
+
loading,
|
|
51
|
+
setLoading,
|
|
52
|
+
nav,
|
|
53
|
+
setNav,
|
|
54
|
+
setUser,
|
|
55
|
+
user,
|
|
56
|
+
logout,
|
|
57
|
+
toLogin
|
|
58
|
+
}
|
|
59
|
+
},[loading,nav,setNav,user,setUser,logout,toLogin]);
|
|
60
|
+
|
|
61
|
+
return action
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const App = createContainer(useApp);
|
|
65
|
+
|
|
66
|
+
export default App;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React,{Suspense} from 'react';
|
|
2
|
+
import { Routes, Route, Navigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import { LayoutBasic, Layout } from '@/components/Layout';
|
|
5
|
+
import PageLoading from '@/components/Page/PageLoading';
|
|
6
|
+
|
|
7
|
+
import Login from '@/pages/login';
|
|
8
|
+
// import {AuthLogin} from '@/components/Auth';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const delayLoader=(loader)=>{
|
|
12
|
+
return new Promise(resolve=>{
|
|
13
|
+
loader.then(req=>{
|
|
14
|
+
setTimeout(()=>{
|
|
15
|
+
resolve(req);
|
|
16
|
+
},5000)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const Demo = React.lazy(()=>import('@/pages/demo'));
|
|
23
|
+
const DemoDetail = React.lazy(()=>import('@/pages/demo/detail'));
|
|
24
|
+
const Redirect = React.lazy(()=>import('@/pages/redirect'));
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export const RouteList = (
|
|
28
|
+
<Routes>
|
|
29
|
+
<Route path='/' element={<Suspense fallback={<PageLoading />}><Layout /></Suspense>}>
|
|
30
|
+
<Route path='/redirect' element={<Redirect />} />
|
|
31
|
+
<Route path='login' element={<Login />} />
|
|
32
|
+
|
|
33
|
+
<Route
|
|
34
|
+
path='/'
|
|
35
|
+
element={
|
|
36
|
+
<LayoutBasic />
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<Route path='/' element={<Demo />} />
|
|
40
|
+
<Route path='/detail' element={<DemoDetail />} />
|
|
41
|
+
</Route>
|
|
42
|
+
</Route>
|
|
43
|
+
</Routes>
|
|
44
|
+
);
|
|
45
|
+
|