aldehyde 0.1.80 → 0.1.82
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/lib/controls/chemstruc/graph.d.ts.map +1 -1
- package/lib/controls/chemstruc/graph.js +8 -6
- package/lib/controls/chemstruc/graph.js.map +1 -1
- package/lib/controls/code-editor/sql-code-editor.d.ts.map +1 -1
- package/lib/controls/code-editor/sql-code-editor.js +6 -4
- package/lib/controls/code-editor/sql-code-editor.js.map +1 -1
- package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
- package/lib/controls/cquery/cquick-button.js.map +1 -1
- package/lib/controls/entity-select/entity-select.d.ts +1 -0
- package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/entity-select.js +17 -0
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +1 -0
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/upload/index.js +1 -1
- package/lib/controls/upload/index.js.map +1 -1
- package/lib/controls/view-control.d.ts.map +1 -1
- package/lib/controls/view-control.js +7 -0
- package/lib/controls/view-control.js.map +1 -1
- package/lib/exportor/export-frame.js +1 -1
- package/lib/exportor/export-frame.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/layout/menu/user-bar.d.ts +3 -0
- package/lib/layout/menu/user-bar.d.ts.map +1 -1
- package/lib/layout/menu/user-bar.js +29 -4
- package/lib/layout/menu/user-bar.js.map +1 -1
- package/lib/login/context-setter.d.ts +24 -0
- package/lib/login/context-setter.d.ts.map +1 -0
- package/lib/login/context-setter.js +99 -0
- package/lib/login/context-setter.js.map +1 -0
- package/lib/login/login-context.d.ts +22 -0
- package/lib/login/login-context.d.ts.map +1 -0
- package/lib/login/login-context.js +127 -0
- package/lib/login/login-context.js.map +1 -0
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +9 -7
- package/lib/login/login.js.map +1 -1
- package/lib/module/ltmpl-page.d.ts.map +1 -1
- package/lib/module/ltmpl-page.js.map +1 -1
- package/lib/tmpl/control-type-supportor.js +1 -0
- package/lib/tmpl/control-type-supportor.js.map +1 -1
- package/lib/tmpl/hc-data-source.js +11 -12
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +4 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +45 -19
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/superagent.d.ts.map +1 -1
- package/lib/tmpl/superagent.js +16 -6
- package/lib/tmpl/superagent.js.map +1 -1
- package/lib/units/index.d.ts +1 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +8 -0
- package/lib/units/index.js.map +1 -1
- package/package.json +3 -3
- package/src/aldehyde/controls/chemstruc/graph.tsx +9 -6
- package/src/aldehyde/controls/code-editor/sql-code-editor.tsx +6 -5
- package/src/aldehyde/controls/cquery/cquick-button.tsx +0 -1
- package/src/aldehyde/controls/entity-select/entity-select.tsx +17 -1
- package/src/aldehyde/controls/entry-control.tsx +1 -0
- package/src/aldehyde/controls/upload/index.tsx +1 -1
- package/src/aldehyde/controls/view-control.tsx +7 -0
- package/src/aldehyde/exportor/export-frame.tsx +1 -1
- package/src/aldehyde/index.tsx +3 -1
- package/src/aldehyde/layout/menu/user-bar.tsx +41 -16
- package/src/aldehyde/login/context-setter.tsx +124 -0
- package/src/aldehyde/login/login-context.js +175 -0
- package/src/aldehyde/login/login.js +48 -44
- package/src/aldehyde/module/ltmpl-page.tsx +0 -1
- package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -1
- package/src/aldehyde/tmpl/hc-data-source.tsx +6 -6
- package/src/aldehyde/tmpl/hcservice-v3.tsx +44 -20
- package/src/aldehyde/tmpl/interface.tsx +1 -0
- package/src/aldehyde/tmpl/superagent.js +19 -10
- package/src/aldehyde/units/index.tsx +9 -0
|
@@ -86,7 +86,7 @@ export default class Upload extends React.PureComponent<UploadProps, UploadState
|
|
|
86
86
|
uid: '-1',
|
|
87
87
|
name: value_1.base.fileName,
|
|
88
88
|
status: 'done',
|
|
89
|
-
url: Units.api()+'/v3/files'+value_1.base.path+`?@token=${Units.getLocalStorge("hydrocarbonToken")}&disposition=attachment`,
|
|
89
|
+
url: Units.api()+'/v3/files'+value_1.base.path+`?@token=${Units.getLocalStorge("hydrocarbonToken")}&@programToken=${Units.programCode()}&disposition=attachment`,
|
|
90
90
|
})
|
|
91
91
|
}else if(value_1.valid=='new'){
|
|
92
92
|
fileList.push({
|
|
@@ -14,6 +14,7 @@ import Progress from './progress'
|
|
|
14
14
|
import ColorPicker from "./color-picker";
|
|
15
15
|
import EllipsisText from './text/ellipsis-text'
|
|
16
16
|
import {ProgramConfig} from "../index";
|
|
17
|
+
import SqlCodeEditor from "./code-editor/sql-code-editor";
|
|
17
18
|
//import ChemStruc from "./chemstruc/graph";
|
|
18
19
|
// import HtmlEditor from "../HtmlEditor/tinymce";
|
|
19
20
|
const Loading = <Spin tip="Loading...">
|
|
@@ -145,6 +146,9 @@ function renderControl(fieldConfig: FieldConfig, fieldValue: any,pHolderType:Con
|
|
|
145
146
|
viewControl = <ChemStruc {...controlProps}></ChemStruc>
|
|
146
147
|
//viewControl = unSupportControl
|
|
147
148
|
break;
|
|
149
|
+
case 'sql-code-editor':
|
|
150
|
+
viewControl = <SqlCodeEditor viewOrEdit={'view'} {...controlProps}></SqlCodeEditor>
|
|
151
|
+
break;
|
|
148
152
|
case 'relselect':
|
|
149
153
|
case 'refselect':
|
|
150
154
|
case 'entity-select':
|
|
@@ -160,6 +164,9 @@ function renderControl(fieldConfig: FieldConfig, fieldValue: any,pHolderType:Con
|
|
|
160
164
|
case 'color':
|
|
161
165
|
viewControl = <ColorPicker {...controlProps}></ColorPicker>
|
|
162
166
|
break;
|
|
167
|
+
case 'url':
|
|
168
|
+
viewControl = <a target={"_blank"} href={value}>网址</a>
|
|
169
|
+
break;
|
|
163
170
|
case 'hidden'://
|
|
164
171
|
viewControl = <Input
|
|
165
172
|
type="hidden"
|
|
@@ -135,7 +135,7 @@ export default class ExportFrame extends React.PureComponent<ExportFrameProps, E
|
|
|
135
135
|
const {title}=this.props;
|
|
136
136
|
const {exportId}=this.state;
|
|
137
137
|
const hydrocarbonToken=Units.getLocalStorge("hydrocarbonToken")
|
|
138
|
-
Units.downloadFile(Units.joinPath(Units.api(),`/v3/exporter/excel?exportId=${exportId}&@token=${hydrocarbonToken}`),title)
|
|
138
|
+
Units.downloadFile(Units.joinPath(Units.api(),`/v3/exporter/excel?exportId=${exportId}&@token=${hydrocarbonToken}&@programToken=${Units.programCode()}`),title)
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
handleCancel=()=>{
|
package/src/aldehyde/index.tsx
CHANGED
|
@@ -40,6 +40,8 @@ const SelectTable = loadable(() =>
|
|
|
40
40
|
//import Loginit from './login/login';
|
|
41
41
|
const Loginit = loadable(() =>
|
|
42
42
|
import("./login/login"), {fallback: Loading});
|
|
43
|
+
const ContextSetter = loadable(() =>
|
|
44
|
+
import("./login/context-setter"), {fallback: Loading});
|
|
43
45
|
//import DtmplRoute from './routable/dtmpl-route';
|
|
44
46
|
const DtmplRoute = loadable(() =>
|
|
45
47
|
import("./routable/dtmpl-route"), {fallback: Loading});
|
|
@@ -91,5 +93,5 @@ const DtmplEditPage = loadable(() =>
|
|
|
91
93
|
|
|
92
94
|
export {ActTable,SelectTable,Loginit,DtmplRoute,ImportRoute,LtmplRoute,DtmplViewPage,LtmplPage,Menu2layers,Block,UserBar,
|
|
93
95
|
ResetPassword,Footer,EntryControl,ViewControl,ProgramConfig,HydrocarbonService,QuickEntrance,Workbench,PopoverEntitySelect,DtmplEditCard
|
|
94
|
-
,DatePicker,DtmplEditPage,TmplInterface,TmplDataSource,Superagent,DtmplEdit,HCWelcome,MainPage,ExcelImportRoute,CustomPageRouter,HCCustomPageRouter,L2MenuMessageBar,L2MenuQuickBar,}
|
|
96
|
+
,DatePicker,DtmplEditPage,TmplInterface,TmplDataSource,Superagent,DtmplEdit,HCWelcome,MainPage,ExcelImportRoute,CustomPageRouter,HCCustomPageRouter,L2MenuMessageBar,L2MenuQuickBar,ContextSetter,}
|
|
95
97
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {Dropdown, Menu,Tooltip,
|
|
3
|
-
import {
|
|
2
|
+
import {Avatar, Button, Descriptions, Dropdown, Menu, Popover, Tooltip,Row,Col} from 'antd';
|
|
3
|
+
import {ClearOutlined, LogoutOutlined, UserOutlined,ProfileOutlined} from '@ant-design/icons';
|
|
4
4
|
import {UserInfo} from "../../tmpl/interface";
|
|
5
5
|
import HcserviceV3 from '../../tmpl/hcservice-v3';
|
|
6
6
|
import HCDataSource from "../../tmpl/hc-data-source";
|
|
7
7
|
import UserInfoBar from "./userinfo-bar"
|
|
8
8
|
import ResetPassword from "./reset-password";
|
|
9
|
+
|
|
9
10
|
//const confirm = Modal.confirm;
|
|
10
11
|
|
|
11
12
|
interface UserBarProps {
|
|
@@ -13,51 +14,75 @@ interface UserBarProps {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
interface UserBarState extends UserInfo{
|
|
17
|
+
interface UserBarState extends UserInfo {
|
|
17
18
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class UserBar extends React.PureComponent<UserBarProps, UserBarState> {
|
|
22
|
-
state={
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
roles:[],
|
|
23
|
+
state = {
|
|
24
|
+
id: undefined,
|
|
25
|
+
name: undefined,
|
|
26
|
+
roles: [],
|
|
27
|
+
context: undefined,
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
async componentDidMount() {
|
|
29
31
|
let userInfo = await HcserviceV3.getUser();
|
|
32
|
+
//查询 上下文配置信息
|
|
33
|
+
let context = await HcserviceV3.getContextSourceValue();
|
|
34
|
+
// console.log('context', context);
|
|
30
35
|
this.setState({
|
|
36
|
+
context,
|
|
31
37
|
...userInfo
|
|
32
38
|
});
|
|
33
39
|
}
|
|
34
40
|
|
|
35
|
-
cleanCache=()=>{
|
|
36
|
-
let {roles}=this.state;
|
|
41
|
+
cleanCache = () => {
|
|
42
|
+
let {roles} = this.state;
|
|
37
43
|
let loading = document.getElementById('ajaxLoading');
|
|
38
44
|
loading.style.display = "block";
|
|
39
45
|
HCDataSource.clear(roles);
|
|
40
46
|
loading.style.display = "none";
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
getContext = () => {
|
|
50
|
+
let {context} = this.state;
|
|
51
|
+
if (context) {
|
|
52
|
+
console.log('context', context);
|
|
53
|
+
return <>
|
|
54
|
+
{context.map((c)=>{
|
|
55
|
+
return <Row><Col>{c.label} : {c.content}</Col></Row>
|
|
56
|
+
})}
|
|
57
|
+
</>
|
|
58
|
+
}
|
|
59
|
+
return "无"
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
toSetContext=()=>{
|
|
63
|
+
window.location.hash = "#/context-setter";
|
|
64
|
+
}
|
|
43
65
|
|
|
44
66
|
render() {
|
|
45
|
-
const {name} = this.state;
|
|
67
|
+
const {name, context} = this.state;
|
|
46
68
|
|
|
47
69
|
const menu = (
|
|
48
|
-
<Menu style={{minWidth:'100px'}}>
|
|
70
|
+
<Menu style={{minWidth: '100px'}}>
|
|
49
71
|
<Menu.Item>
|
|
50
|
-
|
|
72
|
+
<UserInfoBar/>
|
|
51
73
|
</Menu.Item>
|
|
74
|
+
{context && context.length>0 ? <Menu.Item>
|
|
75
|
+
<span onClick={this.toSetContext} ><ProfileOutlined />全局配置</span>
|
|
76
|
+
</Menu.Item> : null}
|
|
52
77
|
<Menu.Item>
|
|
53
78
|
<ResetPassword></ResetPassword>
|
|
54
79
|
</Menu.Item>
|
|
55
80
|
<Menu.Item>
|
|
56
|
-
<span onClick={this.cleanCache}><ClearOutlined
|
|
81
|
+
<span onClick={this.cleanCache}><ClearOutlined/>清空缓存</span>
|
|
57
82
|
</Menu.Item>
|
|
58
83
|
<Menu.Item>
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
<span onClick={HcserviceV3.logout}><LogoutOutlined/>退出登录</span>
|
|
85
|
+
</Menu.Item>
|
|
61
86
|
</Menu>
|
|
62
87
|
);
|
|
63
88
|
return (
|
|
@@ -70,7 +95,7 @@ class UserBar extends React.PureComponent<UserBarProps, UserBarState> {
|
|
|
70
95
|
{/*</Tooltip>*/}
|
|
71
96
|
{/*<UserOutlined/>*/}
|
|
72
97
|
<Tooltip placement="left" title={name}>
|
|
73
|
-
<Avatar className={'loginAvatar'}
|
|
98
|
+
<Avatar className={'loginAvatar'} icon={<UserOutlined/>} size="large">
|
|
74
99
|
{/*{name ?name.substring(0,1).toUpperCase():null}*/}
|
|
75
100
|
</Avatar>
|
|
76
101
|
{/*<span>{name && name.length>=8?name.substring(0,5)+'...':name}</span>*/}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
// import StatActTable from '../table/stat-act-table'
|
|
3
|
+
import {Button, Col, Form, FormInstance, Modal, Row} from "antd";
|
|
4
|
+
import EntryControl from "../controls/entry-control";
|
|
5
|
+
import HCserviceV3 from "../tmpl/hcservice-v3";
|
|
6
|
+
|
|
7
|
+
//以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。
|
|
8
|
+
|
|
9
|
+
export interface ContextSetterProps {
|
|
10
|
+
// match:any,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface ContextSetterState {
|
|
14
|
+
loading:boolean,
|
|
15
|
+
config: object,
|
|
16
|
+
context:object,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class LtmplPage extends React.PureComponent<ContextSetterProps, ContextSetterState> {
|
|
20
|
+
|
|
21
|
+
state = {
|
|
22
|
+
loading:false,
|
|
23
|
+
config: null,
|
|
24
|
+
context:null,
|
|
25
|
+
}
|
|
26
|
+
formRef = React.createRef<FormInstance>();
|
|
27
|
+
static defaultProps = {}
|
|
28
|
+
|
|
29
|
+
async componentDidMount() {
|
|
30
|
+
let config = await HCserviceV3.getContextSourceConfig();
|
|
31
|
+
let context = await HCserviceV3.getContextSourceValue();
|
|
32
|
+
debugger
|
|
33
|
+
if (!config || config.length==0) {
|
|
34
|
+
config = []
|
|
35
|
+
window.location.hash = "#/home";
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.setState({
|
|
39
|
+
config,
|
|
40
|
+
context,
|
|
41
|
+
loading: false
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async componentDidUpdate(prevProps) {
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
handleSubmit =async () => {
|
|
50
|
+
this.setState({
|
|
51
|
+
loading: true
|
|
52
|
+
})
|
|
53
|
+
let { config} = this.state
|
|
54
|
+
|
|
55
|
+
await this.formRef.current.validateFields().then(async (values) => {
|
|
56
|
+
let json = {}
|
|
57
|
+
config.forEach((c) => {
|
|
58
|
+
json[c.id] = values[c.id];
|
|
59
|
+
})
|
|
60
|
+
let res = await HCserviceV3.setContext(json);
|
|
61
|
+
// if (res.status === 'error') {
|
|
62
|
+
// await this.getKaptchaToken();
|
|
63
|
+
// }
|
|
64
|
+
}
|
|
65
|
+
).catch(errorInfo => {
|
|
66
|
+
})
|
|
67
|
+
this.setState({
|
|
68
|
+
loading: false
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
render() {
|
|
74
|
+
|
|
75
|
+
const {config,loading,context}=this.state;
|
|
76
|
+
return <Modal title="全局配置" closable={false} open={true} footer={[]}>
|
|
77
|
+
<Row justify="center" align="middle" >
|
|
78
|
+
<Col>
|
|
79
|
+
<Form style={{width: 350}} ref={this.formRef}
|
|
80
|
+
name="normal_login"
|
|
81
|
+
className="login-form"
|
|
82
|
+
initialValues={{remember: true}}
|
|
83
|
+
>
|
|
84
|
+
{config ? config.map((c) => {
|
|
85
|
+
let initialValue=null;
|
|
86
|
+
if(context ){
|
|
87
|
+
context.forEach((con)=>{
|
|
88
|
+
if(con.moduleName== c.moduleName){
|
|
89
|
+
initialValue=con.selectedValues;
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
return <Form.Item
|
|
94
|
+
name={c.id} initialValue={initialValue} rules={[{required: true, message: '请选择' + c.title}]}
|
|
95
|
+
>
|
|
96
|
+
<EntryControl id={'14'}
|
|
97
|
+
fieldConfig={{
|
|
98
|
+
id: c.groupId,
|
|
99
|
+
title: c.title,
|
|
100
|
+
controlType: 'entity-select',
|
|
101
|
+
max: "1",
|
|
102
|
+
required: true,
|
|
103
|
+
suppleOptions: c.canNotSet ? [{code: 'all', title: '不设置'}] : undefined
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
</Form.Item>
|
|
107
|
+
}) : null}
|
|
108
|
+
<Form.Item>
|
|
109
|
+
<Button type="primary" style={{width: '100%'}} loading={loading} onClick={this.handleSubmit}
|
|
110
|
+
className="login-form-button">
|
|
111
|
+
确 定
|
|
112
|
+
</Button>
|
|
113
|
+
</Form.Item>
|
|
114
|
+
</Form>
|
|
115
|
+
</Col>
|
|
116
|
+
</Row>
|
|
117
|
+
</Modal>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export default LtmplPage;
|
|
124
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './index.css'
|
|
3
|
+
import {Button, Col, Form, Input, Row} from 'antd'
|
|
4
|
+
import {LockOutlined, SafetyCertificateOutlined, UserOutlined} from '@ant-design/icons';
|
|
5
|
+
import HCserviceV3 from "../tmpl/hcservice-v3"
|
|
6
|
+
import EntryControl from "../controls/entry-control";
|
|
7
|
+
|
|
8
|
+
export default class Loginit extends React.Component {
|
|
9
|
+
state = {
|
|
10
|
+
username: "",
|
|
11
|
+
password: "",
|
|
12
|
+
loading: true,
|
|
13
|
+
needKaptcha: false,
|
|
14
|
+
kaptchaImg: null,
|
|
15
|
+
kaptchaToken: null,
|
|
16
|
+
config: null,
|
|
17
|
+
}
|
|
18
|
+
formRef = React.createRef();
|
|
19
|
+
|
|
20
|
+
componentDidMount = async () => {
|
|
21
|
+
if (this.props && this.props.match && this.props.match.params) {
|
|
22
|
+
const {programCode} = this.props.match.params;
|
|
23
|
+
if (programCode) {
|
|
24
|
+
window.localStorage['programCode'] = programCode;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let pubkey = await HCserviceV3.getRasPubkey();
|
|
28
|
+
let config = await HCserviceV3.getContextSourceConfig();
|
|
29
|
+
if (!config) {
|
|
30
|
+
config = []
|
|
31
|
+
}
|
|
32
|
+
this.setState({
|
|
33
|
+
config,
|
|
34
|
+
pubkey,
|
|
35
|
+
loading: false
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getKaptchaToken = async () => {
|
|
41
|
+
let res = await HCserviceV3.getKaptchaToken();
|
|
42
|
+
if (res) {
|
|
43
|
+
let kaptchaImg = `data:image/png;base64,${res.img}`;
|
|
44
|
+
this.setState({
|
|
45
|
+
kaptchaImg,
|
|
46
|
+
kaptchaToken: res.kaptchaToken,
|
|
47
|
+
needKaptcha: true
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
handleSubmit = async () => {
|
|
53
|
+
|
|
54
|
+
this.setState({
|
|
55
|
+
loading: true
|
|
56
|
+
})
|
|
57
|
+
let {kaptchaToken, pubkey, config} = this.state
|
|
58
|
+
|
|
59
|
+
await this.formRef.current.validateFields().then(async (values) => {
|
|
60
|
+
|
|
61
|
+
let json = {username: values.username, password: values.password}
|
|
62
|
+
config.forEach((c) => {
|
|
63
|
+
json[c.id] = values[c.id];
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
let res = await HCserviceV3.login(json, kaptchaToken, values.kaptchaText, pubkey);
|
|
67
|
+
if (res.status === 'error') {
|
|
68
|
+
//message.info(res.message);
|
|
69
|
+
await this.getKaptchaToken();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
).catch(errorInfo => {
|
|
73
|
+
})
|
|
74
|
+
this.setState({
|
|
75
|
+
loading: false
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
handleKeyDown = (event) => { //按下enter键,触发login事件
|
|
80
|
+
switch (event.keyCode) {
|
|
81
|
+
case 13:
|
|
82
|
+
this.handleSubmit();
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
changeKaptcha = async (event) => { //切换验证码
|
|
90
|
+
await this.getKaptchaToken();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
componentDidMount() {
|
|
94
|
+
window.removeEventListener('keydown', this.handleKeyDown)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
render() {
|
|
98
|
+
const {username, password, loading, needKaptcha, kaptchaImg, config} = this.state
|
|
99
|
+
|
|
100
|
+
return (<Row type="flex" justify="center" align="middle" className="login">
|
|
101
|
+
<Col>
|
|
102
|
+
<Form style={{width: 350}} ref={this.formRef}
|
|
103
|
+
name="normal_login"
|
|
104
|
+
className="login-form"
|
|
105
|
+
initialValues={{remember: true}}
|
|
106
|
+
><h3>欢迎登录</h3>
|
|
107
|
+
{
|
|
108
|
+
config ? config.map((c) => {
|
|
109
|
+
return <Form.Item
|
|
110
|
+
name={c.id} rules={[{required: true, message: '请选择' + c.title}]}
|
|
111
|
+
>
|
|
112
|
+
<EntryControl id={'14'}
|
|
113
|
+
fieldConfig={{
|
|
114
|
+
id: c.groupId,
|
|
115
|
+
title: c.title,
|
|
116
|
+
controlType: 'entity-select',
|
|
117
|
+
max: "1",
|
|
118
|
+
required: true,
|
|
119
|
+
suppleOptions: c.canNotSet ? [{code: 'all', title: '不设置'}] : undefined
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
</Form.Item>
|
|
123
|
+
}) : null
|
|
124
|
+
}
|
|
125
|
+
{config ? <>
|
|
126
|
+
<Form.Item
|
|
127
|
+
name="username"
|
|
128
|
+
rules={[{required: true, message: '请输入用户名!'}, {max: 20, min: 0, message: '输入0-20个字符'},]}
|
|
129
|
+
>
|
|
130
|
+
<Input prefix={<UserOutlined className="site-form-item-icon"/>} placeholder="用户名"
|
|
131
|
+
/>
|
|
132
|
+
</Form.Item>
|
|
133
|
+
<Form.Item
|
|
134
|
+
name="password"
|
|
135
|
+
rules={[{required: true, message: '请输入密码!'}]}
|
|
136
|
+
>
|
|
137
|
+
<Input.Password
|
|
138
|
+
placeholder="密码"
|
|
139
|
+
onKeyDown={this.handleKeyDown}
|
|
140
|
+
prefix={<LockOutlined className="site-form-item-icon"/>}
|
|
141
|
+
/>
|
|
142
|
+
</Form.Item></> : null}
|
|
143
|
+
{
|
|
144
|
+
needKaptcha ? <Row gutter={8}>
|
|
145
|
+
<Col span={12}>
|
|
146
|
+
<Form.Item
|
|
147
|
+
name="kaptchaText"
|
|
148
|
+
rules={[{required: true, message: '请输入验证码!'}]}
|
|
149
|
+
>
|
|
150
|
+
<Input prefix={<SafetyCertificateOutlined className="site-form-item-icon"/>}
|
|
151
|
+
placeholder="验证码"
|
|
152
|
+
onKeyDown={this.handleKeyDown}
|
|
153
|
+
/>
|
|
154
|
+
</Form.Item>
|
|
155
|
+
</Col>
|
|
156
|
+
<Col span={12}>
|
|
157
|
+
<img style={{"cursor": "pointer"}} height={30} width={90} title={'点击刷新'}
|
|
158
|
+
onClick={this.changeKaptcha}
|
|
159
|
+
src={kaptchaImg}></img>
|
|
160
|
+
</Col>
|
|
161
|
+
</Row> : ""
|
|
162
|
+
}
|
|
163
|
+
<Form.Item>
|
|
164
|
+
<Button type="primary" style={{width: '100%'}} loading={loading} onClick={this.handleSubmit}
|
|
165
|
+
className="login-form-button">
|
|
166
|
+
登录
|
|
167
|
+
</Button>
|
|
168
|
+
</Form.Item>
|
|
169
|
+
</Form>
|
|
170
|
+
</Col>
|
|
171
|
+
</Row>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import './index.css'
|
|
3
|
-
import {Button, Col, Form,
|
|
3
|
+
import {Button, Col, Form, Input, Row} from 'antd'
|
|
4
4
|
import {LockOutlined, SafetyCertificateOutlined, UserOutlined} from '@ant-design/icons';
|
|
5
5
|
import HCserviceV3 from "../tmpl/hcservice-v3"
|
|
6
6
|
|
|
@@ -9,17 +9,17 @@ export default class Loginit extends React.Component {
|
|
|
9
9
|
username: "",
|
|
10
10
|
password: "",
|
|
11
11
|
loading: true,
|
|
12
|
-
needKaptcha:false,
|
|
13
|
-
kaptchaImg:null,
|
|
14
|
-
kaptchaToken:null
|
|
12
|
+
needKaptcha: false,
|
|
13
|
+
kaptchaImg: null,
|
|
14
|
+
kaptchaToken: null,
|
|
15
15
|
}
|
|
16
16
|
formRef = React.createRef();
|
|
17
17
|
|
|
18
|
-
componentDidMount=async ()=> {
|
|
19
|
-
if(this.props && this.props.match &&
|
|
18
|
+
componentDidMount = async () => {
|
|
19
|
+
if (this.props && this.props.match && this.props.match.params) {
|
|
20
20
|
const {programCode} = this.props.match.params;
|
|
21
|
-
if(programCode){
|
|
22
|
-
window.localStorage['programCode']=programCode;
|
|
21
|
+
if (programCode) {
|
|
22
|
+
window.localStorage['programCode'] = programCode;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
let pubkey = await HCserviceV3.getRasPubkey();
|
|
@@ -30,16 +30,16 @@ export default class Loginit extends React.Component {
|
|
|
30
30
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
getKaptchaToken=async ()=>{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
getKaptchaToken = async () => {
|
|
34
|
+
let res = await HCserviceV3.getKaptchaToken();
|
|
35
|
+
if (res) {
|
|
36
|
+
let kaptchaImg = `data:image/png;base64,${res.img}`;
|
|
37
|
+
this.setState({
|
|
38
|
+
kaptchaImg,
|
|
39
|
+
kaptchaToken: res.kaptchaToken,
|
|
40
|
+
needKaptcha: true
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
handleSubmit = async () => {
|
|
@@ -47,10 +47,12 @@ export default class Loginit extends React.Component {
|
|
|
47
47
|
this.setState({
|
|
48
48
|
loading: true
|
|
49
49
|
})
|
|
50
|
-
let {kaptchaToken,pubkey}=this.state
|
|
50
|
+
let {kaptchaToken, pubkey} = this.state
|
|
51
51
|
|
|
52
52
|
await this.formRef.current.validateFields().then(async (values) => {
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
let json = {username: values.username, password: values.password}
|
|
55
|
+
let res = await HCserviceV3.login(json, kaptchaToken, values.kaptchaText, pubkey);
|
|
54
56
|
if (res.status === 'error') {
|
|
55
57
|
//message.info(res.message);
|
|
56
58
|
await this.getKaptchaToken();
|
|
@@ -73,8 +75,8 @@ export default class Loginit extends React.Component {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
changeKaptcha =async
|
|
77
|
-
await
|
|
78
|
+
changeKaptcha = async (event) => { //切换验证码
|
|
79
|
+
await this.getKaptchaToken();
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
componentDidMount() {
|
|
@@ -82,7 +84,7 @@ export default class Loginit extends React.Component {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
render() {
|
|
85
|
-
const {username, password, loading,needKaptcha,kaptchaImg} = this.state
|
|
87
|
+
const {username, password, loading, needKaptcha, kaptchaImg, config} = this.state
|
|
86
88
|
|
|
87
89
|
return (<Row type="flex" justify="center" align="middle" className="login">
|
|
88
90
|
<Col>
|
|
@@ -91,25 +93,26 @@ export default class Loginit extends React.Component {
|
|
|
91
93
|
className="login-form"
|
|
92
94
|
initialValues={{remember: true}}
|
|
93
95
|
><h3>欢迎登录</h3>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
<>
|
|
97
|
+
<Form.Item
|
|
98
|
+
name="username"
|
|
99
|
+
rules={[{required: true, message: '请输入用户名!'}, {max: 20, min: 0, message: '输入0-20个字符'},]}
|
|
100
|
+
>
|
|
101
|
+
<Input prefix={<UserOutlined className="site-form-item-icon"/>} placeholder="用户名"
|
|
102
|
+
/>
|
|
103
|
+
</Form.Item>
|
|
104
|
+
<Form.Item
|
|
105
|
+
name="password"
|
|
106
|
+
rules={[{required: true, message: '请输入密码!'}]}
|
|
107
|
+
>
|
|
108
|
+
<Input.Password
|
|
109
|
+
placeholder="密码"
|
|
110
|
+
onKeyDown={this.handleKeyDown}
|
|
111
|
+
prefix={<LockOutlined className="site-form-item-icon"/>}
|
|
112
|
+
/>
|
|
113
|
+
</Form.Item></>
|
|
111
114
|
{
|
|
112
|
-
needKaptcha
|
|
115
|
+
needKaptcha ? <Row gutter={8}>
|
|
113
116
|
<Col span={12}>
|
|
114
117
|
<Form.Item
|
|
115
118
|
name="kaptchaText"
|
|
@@ -122,10 +125,11 @@ export default class Loginit extends React.Component {
|
|
|
122
125
|
</Form.Item>
|
|
123
126
|
</Col>
|
|
124
127
|
<Col span={12}>
|
|
125
|
-
<img style={{"cursor":"pointer"}}
|
|
126
|
-
|
|
128
|
+
<img style={{"cursor": "pointer"}} height={30} width={90} title={'点击刷新'}
|
|
129
|
+
onClick={this.changeKaptcha}
|
|
130
|
+
src={kaptchaImg}></img>
|
|
127
131
|
</Col>
|
|
128
|
-
</Row
|
|
132
|
+
</Row> : ""
|
|
129
133
|
}
|
|
130
134
|
<Form.Item>
|
|
131
135
|
<Button type="primary" style={{width: '100%'}} loading={loading} onClick={this.handleSubmit}
|
|
@@ -6,7 +6,6 @@ import ActTable,{Mode} from '../table/act-table'
|
|
|
6
6
|
import HCDataSource from "../tmpl/hc-data-source";
|
|
7
7
|
import ModalDtmplView from "../detail/view/modal-dtmpl-view";
|
|
8
8
|
import DtmplEditPage from "../detail/edit/dtmpl-edit-page";
|
|
9
|
-
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
10
9
|
import {Button, Drawer, Space} from "antd";
|
|
11
10
|
|
|
12
11
|
//以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。
|
|
@@ -62,7 +62,7 @@ SupportInputTypes.add('entity-select');
|
|
|
62
62
|
SupportInputTypes.add('table-entity-select');
|
|
63
63
|
SupportInputTypes.add('modal-entity-select');
|
|
64
64
|
SupportInputTypes.add('color');
|
|
65
|
-
|
|
65
|
+
SupportInputTypes.add('url');
|
|
66
66
|
SupportInputTypes.add('hidden');
|
|
67
67
|
SupportInputTypes.add('lab-tree-select');
|
|
68
68
|
function ControlTypeSupportor(){
|