kn-cli 1.0.59 → 1.0.61
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/build/build.sh +1 -1
- package/build/dev.sh +1 -1
- package/package.json +1 -1
- package/readme.md +3 -0
- package/src/build.js +28 -9
- package/templates/template_admin/build.sh +7 -1
- package/templates/template_admin/frontend_build.sh +4 -0
- package/templates/template_admin/readme.md +8 -0
- package/templates/template_app/build.sh +7 -1
- package/templates/template_app/frontend_build.sh +4 -0
- package/templates/template_app/readme.md +8 -0
- package/templates/template_oa/build.sh +7 -1
- package/templates/template_oa/frontend_build.sh +4 -0
- package/templates/template_oa/package.json +2 -1
- package/templates/template_oa/public/favicon.ico +0 -0
- package/templates/template_oa/public/index.html +1 -1
- package/templates/template_oa/public/src/_antd.less +0 -21
- package/templates/template_oa/public/src/_reset.less +3 -0
- package/templates/template_oa/public/src/_variable.less +1 -1
- package/templates/template_oa/public/src/assets/images/NY-pop-bg.png +0 -0
- package/templates/template_oa/public/src/components/Auth/index.jsx +1 -1
- package/templates/template_oa/public/src/components/Dialog/index.jsx +150 -0
- package/templates/template_oa/public/src/components/Dialog/index.less +123 -0
- package/templates/template_oa/public/src/components/Empty/index.jsx +23 -0
- package/templates/template_oa/public/src/components/Empty/index.less +6 -0
- package/templates/template_oa/public/src/components/FormRow/index.jsx +39 -0
- package/templates/template_oa/public/src/components/FormRow/index.less +67 -0
- package/templates/template_oa/public/src/components/FormTable/index.jsx +136 -0
- package/templates/template_oa/public/src/components/IFrame/index.less +1 -1
- package/templates/template_oa/public/src/components/Layout/Basic/index.jsx +18 -12
- package/templates/template_oa/public/src/components/Layout/Basic/index.less +21 -11
- package/templates/template_oa/public/src/components/Layout/index.jsx +2 -1
- package/templates/template_oa/public/src/components/Nav/index.jsx +163 -100
- package/templates/template_oa/public/src/components/Select/DepSelect/index.jsx +47 -0
- package/templates/template_oa/public/src/components/Select/StaffSelect/index.jsx +97 -0
- package/templates/template_oa/public/src/components/Select/StaffSelect/index.less +24 -0
- package/templates/template_oa/public/src/components/Toast/index.less +1 -1
- package/templates/template_oa/public/src/components/Upload/index.jsx +358 -0
- package/templates/template_oa/public/src/components/title/index.jsx +12 -0
- package/templates/template_oa/public/src/components/title/index.less +21 -0
- package/templates/template_oa/public/src/mock/cases.js +52 -0
- package/templates/template_oa/public/src/mock/index.js +2 -0
- package/templates/template_oa/public/src/pages/components/totalRecord/index.jsx +21 -0
- package/templates/template_oa/public/src/pages/components/totalRecord/index.less +16 -0
- package/templates/template_oa/public/src/pages/login/index.jsx +7 -9
- package/templates/template_oa/public/src/pages/my/index.jsx +14 -0
- package/templates/template_oa/public/src/pages/video/detail/index.jsx +14 -0
- package/templates/template_oa/public/src/pages/video/index.jsx +325 -23
- package/templates/template_oa/public/src/pages/video/index.less +3 -0
- package/templates/template_oa/public/src/provider/app.jsx +14 -81
- package/templates/template_oa/public/src/route.jsx +8 -2
- package/templates/template_oa/public/src/services/cases.js +7 -0
- package/templates/template_oa/public/src/services/common.js +132 -0
- package/templates/template_oa/public/src/services/index.js +42 -8
- package/templates/template_oa/public/src/services/video.js +1 -0
- package/templates/template_oa/public/src/utils/index.js +61 -1
- package/templates/template_oa/readme.md +8 -0
- package/templates/template_oa/webpack.api.js +10 -22
- package/templates/template_offcial/build.sh +7 -1
- package/templates/template_offcial/frontend_build.sh +5 -0
- package/templates/template_offcial/readme.md +8 -0
- package/templates/template_oa/public/favicon.png +0 -0
- package/templates/template_oa/public/src/components/mask/index.jsx +0 -47
- package/templates/template_oa/public/src/components/mask/index.less +0 -32
- package/templates/template_oa/public/src/dictionary/index.js +0 -39
- package/templates/template_oa/public/src/provider/menu.jsx +0 -20
- package/templates/template_oa/public/src/services/user.js +0 -26
package/build/build.sh
CHANGED
package/build/dev.sh
CHANGED
package/package.json
CHANGED
package/readme.md
CHANGED
package/src/build.js
CHANGED
|
@@ -9,7 +9,15 @@ const {copyDir,TaskNodeVersion,replaceFileData,cleanDir}= require( './utils');
|
|
|
9
9
|
const inquirer = require('inquirer');
|
|
10
10
|
const ROOT=path.resolve(__dirname,"../");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const IS_WINDOWS=()=>{
|
|
13
|
+
return process.platform === 'win32';
|
|
14
|
+
}
|
|
15
|
+
const TransformWindowsPath=(path)=>{
|
|
16
|
+
if (IS_WINDOWS()) {
|
|
17
|
+
path = path.replace(/\\/ig,'\\\\');
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
13
21
|
|
|
14
22
|
/**
|
|
15
23
|
* 项目编译流程
|
|
@@ -241,12 +249,12 @@ module.exports= async (options={})=> {
|
|
|
241
249
|
task.output = '项目目录:'+sourceFolder;
|
|
242
250
|
try{
|
|
243
251
|
await replaceFileData(tempWebpackConfigPath,function(data){
|
|
244
|
-
data = data.replace(/__dirname/ig,`"${sourceFolder}"`);
|
|
245
|
-
data = data.replace(/__webpackPath/ig,`"${tempWebpackDir}"`);
|
|
252
|
+
data = data.replace(/__dirname/ig,`"${TransformWindowsPath(sourceFolder)}"`);
|
|
253
|
+
data = data.replace(/__webpackPath/ig,`"${TransformWindowsPath(tempWebpackDir)}"`);
|
|
246
254
|
return data;
|
|
247
255
|
});
|
|
248
256
|
await replaceFileData(tempStartShell,function(data){
|
|
249
|
-
data = data.replace(/__dirname/ig,`${sourceFolder}`);
|
|
257
|
+
data = data.replace(/__dirname/ig,`${TransformWindowsPath(sourceFolder)}`);
|
|
250
258
|
return data;
|
|
251
259
|
})
|
|
252
260
|
resolve();
|
|
@@ -265,11 +273,15 @@ module.exports= async (options={})=> {
|
|
|
265
273
|
title:"执行build",
|
|
266
274
|
task:(ctx,task)=>{
|
|
267
275
|
return new Promise(resolve=>{
|
|
268
|
-
let cmd='sh build.sh';
|
|
269
276
|
shelljs.cd(tempWebpackDir);
|
|
270
277
|
let cmdParams = [];
|
|
278
|
+
const shellFile={
|
|
279
|
+
dev:'sh ./dev.sh',
|
|
280
|
+
report:'sh ./report.sh',
|
|
281
|
+
build:'sh ./build.sh'
|
|
282
|
+
}
|
|
283
|
+
let cmd=shellFile[type]||shellFile.build;
|
|
271
284
|
if(type=='dev'){
|
|
272
|
-
cmd='sh dev.sh';
|
|
273
285
|
let build_env='';
|
|
274
286
|
let mock='';
|
|
275
287
|
let noSkipNpmInstall='';
|
|
@@ -295,15 +307,22 @@ module.exports= async (options={})=> {
|
|
|
295
307
|
if(noSkipNpmInstall){
|
|
296
308
|
cmdParams.push(`noSkipNpmInstall=${noSkipNpmInstall}`)
|
|
297
309
|
}
|
|
298
|
-
}else if( type =='report'){
|
|
299
|
-
cmd='sh report.sh';
|
|
300
310
|
}
|
|
311
|
+
|
|
301
312
|
if(cliConfig?.registryType){
|
|
302
313
|
cmdParams.push(`registryType=${cliConfig.registryType}`)
|
|
303
314
|
}
|
|
315
|
+
|
|
316
|
+
shelljs.exec(`echo echo "run env.sh">env.sh`);
|
|
317
|
+
if (IS_WINDOWS()) {
|
|
318
|
+
shelljs.exec(`echo echo "set windows config">>env.sh`);
|
|
319
|
+
shelljs.exec(`echo alias sh='source'>>env.sh`);
|
|
320
|
+
}
|
|
304
321
|
if(cmdParams.length>0){
|
|
305
|
-
|
|
322
|
+
shelljs.exec(`echo export ${cmdParams.join(' ')}>>env.sh`);
|
|
306
323
|
}
|
|
324
|
+
shelljs.exec(`echo ${cmd}>>env.sh`);
|
|
325
|
+
cmd='sh ./env.sh'
|
|
307
326
|
task.title=`执行:${cmd}`;
|
|
308
327
|
let req = shelljs.exec(cmd)
|
|
309
328
|
if(req.code==0){
|
|
@@ -21,6 +21,14 @@ kn-cli --dev
|
|
|
21
21
|
构建方式:执行仓库下 sh frontend_build.sh
|
|
22
22
|
部署方式:将构建完成的文件夹下的 `release` 内的内容部署到目标服务器
|
|
23
23
|
参考应用:oa-app
|
|
24
|
+
其它要求:nginx添加对index.html的缓存策略,配置如下:
|
|
25
|
+
expires 0;
|
|
26
|
+
add_header Cache-Control "max-age=0";
|
|
27
|
+
add_header Cache-Control "private";
|
|
28
|
+
add_header Cache-Control "no-store";
|
|
29
|
+
add_header Cache-Control "no-cache";
|
|
30
|
+
add_header Cache-Control "must-revalidate";
|
|
31
|
+
add_header Cache-Control "proxy-revalidate";
|
|
24
32
|
|
|
25
33
|
```
|
|
26
34
|
2. 进入CICD,构建相应环境
|
|
@@ -30,6 +30,14 @@ sh report.sh
|
|
|
30
30
|
构建方式:执行仓库下 sh frontend_build.sh
|
|
31
31
|
部署方式:将构建完成的文件夹下的 `release` 内的内容部署到目标服务器
|
|
32
32
|
参考应用:oa-app
|
|
33
|
+
其它要求:nginx添加对index.html的缓存策略,配置如下:
|
|
34
|
+
expires 0;
|
|
35
|
+
add_header Cache-Control "max-age=0";
|
|
36
|
+
add_header Cache-Control "private";
|
|
37
|
+
add_header Cache-Control "no-store";
|
|
38
|
+
add_header Cache-Control "no-cache";
|
|
39
|
+
add_header Cache-Control "must-revalidate";
|
|
40
|
+
add_header Cache-Control "proxy-revalidate";
|
|
33
41
|
|
|
34
42
|
```
|
|
35
43
|
2. 进入CICD,构建相应环境
|
|
Binary file
|
|
@@ -111,27 +111,6 @@
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
//Radio
|
|
115
|
-
.ant-radio {
|
|
116
|
-
|
|
117
|
-
.ant-radio-inner{
|
|
118
|
-
width:20px;
|
|
119
|
-
height:20px;
|
|
120
|
-
border-color:#d9d9d9;
|
|
121
|
-
&:after{
|
|
122
|
-
width:.10px;
|
|
123
|
-
height:10px;
|
|
124
|
-
top:4px;
|
|
125
|
-
left:4px;
|
|
126
|
-
background-color:#108ee9;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
& .ant-radio-checked{
|
|
130
|
-
.ant-radio-checked{
|
|
131
|
-
border-color: #108ee9;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
114
|
|
|
136
115
|
|
|
137
116
|
//Checkbox
|
|
Binary file
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
|
|
4
|
+
import IconFont from '@/components/IconFont';
|
|
5
|
+
|
|
6
|
+
import Popup from '@/components/Popup';
|
|
7
|
+
|
|
8
|
+
import styles from './index.less';
|
|
9
|
+
import { Button } from 'antd';
|
|
10
|
+
|
|
11
|
+
const Dialog = (props) => {
|
|
12
|
+
async function onClose() {
|
|
13
|
+
if (props.onClose) {
|
|
14
|
+
let ret = await props.onClose();
|
|
15
|
+
if (ret) {
|
|
16
|
+
props.destory();
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
props.destory();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function onOk() {
|
|
23
|
+
if (props.onOk) {
|
|
24
|
+
let ret = await props.onOk();
|
|
25
|
+
if (ret) {
|
|
26
|
+
props.destory();
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
props.destory();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return (
|
|
33
|
+
<section className={styles.body}>
|
|
34
|
+
<div className={styles.mask} />
|
|
35
|
+
<section className={styles.wrap}>
|
|
36
|
+
<div className={styles.header}>
|
|
37
|
+
<span>{props.title}</span>
|
|
38
|
+
<IconFont icon='close' className={styles.close} onClick={onClose} />
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
{props.children}
|
|
42
|
+
|
|
43
|
+
<div className={styles.footer}>
|
|
44
|
+
<Button type='primary' onClick={onOk}>
|
|
45
|
+
{props.okText || '确认'}
|
|
46
|
+
</Button>
|
|
47
|
+
{props.noCancel ? (
|
|
48
|
+
''
|
|
49
|
+
) : (
|
|
50
|
+
<Button onClick={onClose} style={{ marginLeft: '10px' }}>
|
|
51
|
+
{props.cancelText || '取消'}
|
|
52
|
+
</Button>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
</section>
|
|
56
|
+
</section>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const ShowDialog = (props) => {
|
|
61
|
+
return new Promise((reslove) => {
|
|
62
|
+
let popup = Popup(reslove);
|
|
63
|
+
ReactDOM.render(
|
|
64
|
+
<Dialog
|
|
65
|
+
title={props.title}
|
|
66
|
+
destory={popup.destory}
|
|
67
|
+
onOk={props.onOk}
|
|
68
|
+
okText={props.okText}
|
|
69
|
+
cancelText={props.cancelText}
|
|
70
|
+
noCancel={props.noCancel}
|
|
71
|
+
onClose={props.onClose}
|
|
72
|
+
>
|
|
73
|
+
{props.component}
|
|
74
|
+
</Dialog>,
|
|
75
|
+
popup.dom
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const ShowConfirm = async (props) => {
|
|
81
|
+
if (typeof props === 'string') {
|
|
82
|
+
props = { content: props };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let result = false;
|
|
86
|
+
await ShowDialog({
|
|
87
|
+
title: props.title || '注意',
|
|
88
|
+
okText: props.okText || '确认',
|
|
89
|
+
cancelText: props.cancelText || '取消',
|
|
90
|
+
noCancel: typeof props.noCancel !== 'undefined' ? props.noCancel : false,
|
|
91
|
+
onClose: async () => {
|
|
92
|
+
result = false;
|
|
93
|
+
return Promise.resolve(true);
|
|
94
|
+
},
|
|
95
|
+
onOk: async () => {
|
|
96
|
+
result = true;
|
|
97
|
+
return Promise.resolve(true);
|
|
98
|
+
},
|
|
99
|
+
component: (
|
|
100
|
+
<div className={styles.confirmWrap}>
|
|
101
|
+
{props.content}
|
|
102
|
+
</div>
|
|
103
|
+
),
|
|
104
|
+
});
|
|
105
|
+
return result;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const Alert = (props) => {
|
|
109
|
+
function onOk() {
|
|
110
|
+
if (props.onOk) props.onOk();
|
|
111
|
+
props.destory();
|
|
112
|
+
}
|
|
113
|
+
return (
|
|
114
|
+
<section className={styles.body }>
|
|
115
|
+
<div className={styles.mask} />
|
|
116
|
+
<section className={styles.wrapAlert}>
|
|
117
|
+
<div className={styles.alertContent}>
|
|
118
|
+
<div className={props.type === 'success' ? styles.iconSuccess : styles.iconError} />
|
|
119
|
+
<span>{props.content}</span>
|
|
120
|
+
</div>
|
|
121
|
+
<div className={styles.alertFooter}>
|
|
122
|
+
<span onClick={onOk}>{props.okText || '确认'}</span>
|
|
123
|
+
</div>
|
|
124
|
+
</section>
|
|
125
|
+
</section>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const ShowAlert = (props) => {
|
|
130
|
+
if (props.constructor === String) {
|
|
131
|
+
props = { content: props };
|
|
132
|
+
}
|
|
133
|
+
return new Promise((reslove) => {
|
|
134
|
+
let popup = Popup(reslove);
|
|
135
|
+
|
|
136
|
+
ReactDOM.render(
|
|
137
|
+
<Alert destory={popup.destory} type={props.type || 'success'} onOk={props.onOk} content={props.content} />,
|
|
138
|
+
popup.dom
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const ShowErrorAlert = (props) => {
|
|
144
|
+
if (props.constructor === String) {
|
|
145
|
+
props = { content: props };
|
|
146
|
+
}
|
|
147
|
+
return ShowAlert({ ...props, type: 'fail' });
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default Dialog;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
.body {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
min-height: 400px;
|
|
5
|
+
position: fixed;
|
|
6
|
+
z-index: 999;
|
|
7
|
+
left: 0;
|
|
8
|
+
top: 0;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
.mask {
|
|
16
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
position: fixed;
|
|
20
|
+
left: 0;
|
|
21
|
+
top: 0;
|
|
22
|
+
}
|
|
23
|
+
.wrap {
|
|
24
|
+
position: relative;
|
|
25
|
+
min-width: 385px;
|
|
26
|
+
min-height: 2px;
|
|
27
|
+
background-color: white;
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
box-shadow: 0 1px 3px rgba(34, 25, 25, 0.4);
|
|
30
|
+
}
|
|
31
|
+
.close {
|
|
32
|
+
color: white;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
font-weight: bold;
|
|
35
|
+
&:hover {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.header {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
align-items: center;
|
|
43
|
+
padding: 0 20px;
|
|
44
|
+
span {
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
color: white;
|
|
47
|
+
font-weight: 700;
|
|
48
|
+
}
|
|
49
|
+
background-color: #3e9cfc;
|
|
50
|
+
height: 45px;
|
|
51
|
+
padding: 0 20px;
|
|
52
|
+
border-radius: 5px 5px 0 0;
|
|
53
|
+
border-bottom: 1px solid #e5e5e5;
|
|
54
|
+
}
|
|
55
|
+
.footer {
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
height: 62px;
|
|
59
|
+
width: 100%;
|
|
60
|
+
background-color: #f6f6f6;
|
|
61
|
+
border-radius: 0 0 5px 5px;
|
|
62
|
+
border-top: 1px solid #dcdcdc;
|
|
63
|
+
padding-top: 13px;
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.iconError {
|
|
68
|
+
background: url('~@/assets/images/NY-pop-bg.png') -63px -44px no-repeat;
|
|
69
|
+
width: 46px;
|
|
70
|
+
height: 46px;
|
|
71
|
+
margin-bottom: 18px;
|
|
72
|
+
}
|
|
73
|
+
.iconSuccess {
|
|
74
|
+
background: url('~@/assets/images/NY-pop-bg.png') -5px -97px no-repeat;
|
|
75
|
+
width: 46px;
|
|
76
|
+
height: 46px;
|
|
77
|
+
margin-bottom: 18px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.wrapAlert {
|
|
81
|
+
position: relative;
|
|
82
|
+
min-width: 308px;
|
|
83
|
+
background-color: #f8f8f8;
|
|
84
|
+
border-radius: 5px;
|
|
85
|
+
box-shadow: 0 1px 3px rgba(34, 25, 25, 0.4);
|
|
86
|
+
}
|
|
87
|
+
.alertContent {
|
|
88
|
+
padding: 20px;
|
|
89
|
+
width: 100%;
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
align-items: center;
|
|
93
|
+
span {
|
|
94
|
+
color: #666;
|
|
95
|
+
font-size: 18px;
|
|
96
|
+
font-weight: 400;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.alertFooter {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
height: 44px;
|
|
105
|
+
width: 100%;
|
|
106
|
+
background-color: #fff;
|
|
107
|
+
border-radius: 0 0 5px 5px;
|
|
108
|
+
// border-top:1px solid #dcdcdc;
|
|
109
|
+
// padding-top:.13rem;
|
|
110
|
+
span {
|
|
111
|
+
color: #5fc0f9;
|
|
112
|
+
font-weight: 400;
|
|
113
|
+
font-size: 18px;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.confirmWrap{
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
padding:30px;
|
|
123
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Empty, Button } from 'antd';
|
|
3
|
+
import styles from './index.less';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 当table数据为空时下方有“添加数据”按钮
|
|
7
|
+
*/
|
|
8
|
+
function TableEmpty(props) {
|
|
9
|
+
return (
|
|
10
|
+
<section className={styles.tableEmpty}>
|
|
11
|
+
<Empty />
|
|
12
|
+
{props.editmode ? (
|
|
13
|
+
<Button style={{ marginTop: '.1rem' }} onClick={props.onClick} type='primary'>
|
|
14
|
+
添加数据
|
|
15
|
+
</Button>
|
|
16
|
+
) : (
|
|
17
|
+
''
|
|
18
|
+
)}
|
|
19
|
+
</section>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default TableEmpty;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styles from './index.less';
|
|
3
|
+
|
|
4
|
+
const FormRow = (props) => {
|
|
5
|
+
function createCol(item, idx) {
|
|
6
|
+
if (!item) return '';
|
|
7
|
+
const editmode = item.props.editmode === undefined ? true : item.props.editmode;
|
|
8
|
+
return (
|
|
9
|
+
<div key={idx} className={styles.formRow}>
|
|
10
|
+
<hgroup className={styles.row}>
|
|
11
|
+
<div className={styles.title}>
|
|
12
|
+
<div required={editmode && item.props.required}>{item.props.label}</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div className={styles.data}>{item}</div>
|
|
15
|
+
</hgroup>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return (
|
|
20
|
+
<section className={styles.formRowBody}>
|
|
21
|
+
{props.children.length > 0 ? props.children.map(createCol) : createCol(props.children)}
|
|
22
|
+
</section>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function HocEditControl(props) {
|
|
27
|
+
const { editmode = true, txtdata ,textarea} = props;
|
|
28
|
+
if (editmode) {
|
|
29
|
+
return props.children;
|
|
30
|
+
}
|
|
31
|
+
if(textarea){
|
|
32
|
+
return <span style={{whiteSpace:'pre-wrap'}}>{txtdata||'-'}</span>
|
|
33
|
+
}
|
|
34
|
+
return <span>{txtdata || '-'}</span>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
FormRow.Col = HocEditControl;
|
|
38
|
+
|
|
39
|
+
export default FormRow;
|