aldehyde 0.2.159 → 0.2.161
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/action/index.js +1 -1
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/action/utils.d.ts +2 -2
- package/lib/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +5 -5
- package/lib/controls/action/utils.js.map +1 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +5 -8
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/file-export/select-code-export.d.ts +13 -0
- package/lib/controls/file-export/select-code-export.d.ts.map +1 -0
- package/lib/controls/file-export/select-code-export.js +14 -0
- package/lib/controls/file-export/select-code-export.js.map +1 -0
- package/lib/detail/button/edit-button.d.ts +11 -0
- package/lib/detail/button/edit-button.d.ts.map +1 -0
- package/lib/detail/button/edit-button.js +23 -0
- package/lib/detail/button/edit-button.js.map +1 -0
- package/lib/detail/view/act-dtmpl-view.d.ts +3 -1
- package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/act-dtmpl-view.js +9 -3
- package/lib/detail/view/act-dtmpl-view.js.map +1 -1
- package/lib/{exportor → export}/export-frame.d.ts +4 -0
- package/lib/export/export-frame.d.ts.map +1 -0
- package/lib/{exportor → export}/export-frame.js +6 -4
- package/lib/export/export-frame.js.map +1 -0
- package/lib/export/select-code-export-frame.d.ts +49 -0
- package/lib/export/select-code-export-frame.d.ts.map +1 -0
- package/lib/export/select-code-export-frame.js +145 -0
- package/lib/export/select-code-export-frame.js.map +1 -0
- package/lib/form/criteria-form.d.ts.map +1 -1
- package/lib/form/criteria-form.js +26 -2
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/hooks/useVarCssColor.d.ts +2 -0
- package/lib/hooks/useVarCssColor.d.ts.map +1 -0
- package/lib/hooks/useVarCssColor.js +7 -0
- package/lib/hooks/useVarCssColor.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/layout/MainPage.d.ts.map +1 -1
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/layout/menu/block.css +1 -1
- package/lib/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/block.js +1 -1
- package/lib/layout/menu/block.js.map +1 -1
- package/lib/layout2/components/userButton.d.ts +5 -0
- package/lib/layout2/components/userButton.d.ts.map +1 -0
- package/lib/layout2/components/userButton.js +133 -0
- package/lib/layout2/components/userButton.js.map +1 -0
- package/lib/layout2/css/header.css +38 -0
- package/lib/layout2/header.d.ts +12 -0
- package/lib/layout2/header.d.ts.map +1 -0
- package/lib/layout2/header.js +218 -0
- package/lib/layout2/header.js.map +1 -0
- package/lib/layout2/imgs/1.png +0 -0
- package/lib/layout2/imgs/2.png +0 -0
- package/lib/layout2/imgs/3.png +0 -0
- package/lib/layout2/imgs/4.png +0 -0
- package/lib/layout2/imgs/5.png +0 -0
- package/lib/layout2/imgs/6.png +0 -0
- package/lib/layout2/imgs/home.png +0 -0
- package/lib/layout2/main.d.ts +9 -0
- package/lib/layout2/main.d.ts.map +1 -0
- package/lib/layout2/main.js +14 -0
- package/lib/layout2/main.js.map +1 -0
- package/lib/layout2/page.d.ts +7 -0
- package/lib/layout2/page.d.ts.map +1 -0
- package/lib/layout2/page.js +120 -0
- package/lib/layout2/page.js.map +1 -0
- package/lib/layout2/sider.d.ts +10 -0
- package/lib/layout2/sider.d.ts.map +1 -0
- package/lib/layout2/sider.js +259 -0
- package/lib/layout2/sider.js.map +1 -0
- package/lib/layout2/type/layout.type.d.ts +10 -0
- package/lib/layout2/type/layout.type.d.ts.map +1 -0
- package/lib/layout2/type/layout.type.js +2 -0
- package/lib/layout2/type/layout.type.js.map +1 -0
- package/lib/layout2/util/menu.util.d.ts +28 -0
- package/lib/layout2/util/menu.util.d.ts.map +1 -0
- package/lib/layout2/util/menu.util.js +76 -0
- package/lib/layout2/util/menu.util.js.map +1 -0
- package/lib/login2/Login.d.ts +10 -0
- package/lib/login2/Login.d.ts.map +1 -0
- package/lib/login2/Login.js +63 -0
- package/lib/login2/Login.js.map +1 -0
- package/lib/login2/LoginPage.d.ts +4 -0
- package/lib/login2/LoginPage.d.ts.map +1 -0
- package/lib/login2/LoginPage.js +42 -0
- package/lib/login2/LoginPage.js.map +1 -0
- package/lib/login2/img/login-bg.png +0 -0
- package/lib/login2/index.d.ts +4 -0
- package/lib/login2/index.d.ts.map +1 -0
- package/lib/login2/index.js +4 -0
- package/lib/login2/index.js.map +1 -0
- package/lib/module/ltmpl-table.d.ts +4 -2
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +10 -8
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/routable/dtmpl-route.d.ts +3 -2
- package/lib/routable/dtmpl-route.d.ts.map +1 -1
- package/lib/routable/dtmpl-route.js +20 -16
- package/lib/routable/dtmpl-route.js.map +1 -1
- package/lib/routable/import-route.d.ts +3 -2
- package/lib/routable/import-route.d.ts.map +1 -1
- package/lib/routable/import-route.js +10 -6
- package/lib/routable/import-route.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts +1 -0
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +21 -15
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/ttmpl-route.d.ts +3 -2
- package/lib/routable/ttmpl-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-route.js +13 -9
- package/lib/routable/ttmpl-route.js.map +1 -1
- package/lib/routable/withroute.d.ts +1 -1
- package/lib/routable/withroute.d.ts.map +1 -1
- package/lib/routable/withroute.js +3 -3
- package/lib/routable/withroute.js.map +1 -1
- package/lib/table/act-table.d.ts +6 -3
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +110 -88
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/index.css +4 -4
- package/lib/table/query-table.d.ts +1 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +24 -16
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +2 -2
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +5 -5
- package/lib/table/relation-table.js.map +1 -1
- package/lib/table/select-table.js +2 -2
- package/lib/table/select-table.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +2 -3
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +3 -2
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +11 -2
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +41 -6
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.js +33 -27
- package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +2 -1
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/lib/welcome/HCWelcome.d.ts +1 -1
- package/lib/welcome/HCWelcome.js +254 -169
- package/lib/welcome/HCWelcome.js.map +1 -1
- package/lib/welcome/img/welcome.png +0 -0
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +1 -1
- package/src/aldehyde/controls/action/utils.tsx +4 -5
- package/src/aldehyde/controls/entry-control.tsx +5 -8
- package/src/aldehyde/controls/file-export/select-code-export.tsx +40 -0
- package/src/aldehyde/detail/button/edit-button.tsx +51 -0
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +14 -2
- package/src/aldehyde/{exportor → export}/export-frame.tsx +10 -6
- package/src/aldehyde/export/select-code-export-frame.tsx +218 -0
- package/src/aldehyde/form/criteria-form.tsx +35 -0
- package/src/aldehyde/hooks/useVarCssColor.ts +6 -0
- package/src/aldehyde/index.tsx +2 -2
- package/src/aldehyde/layout/MainPage.tsx +8 -6
- package/src/aldehyde/layout/menu/block.css +1 -1
- package/src/aldehyde/layout/menu/block.tsx +1 -0
- package/src/aldehyde/layout2/components/userButton.tsx +171 -0
- package/src/aldehyde/layout2/css/header.css +38 -0
- package/src/aldehyde/layout2/header.tsx +334 -0
- package/src/aldehyde/layout2/imgs/1.png +0 -0
- package/src/aldehyde/layout2/imgs/2.png +0 -0
- package/src/aldehyde/layout2/imgs/3.png +0 -0
- package/src/aldehyde/layout2/imgs/4.png +0 -0
- package/src/aldehyde/layout2/imgs/5.png +0 -0
- package/src/aldehyde/layout2/imgs/6.png +0 -0
- package/src/aldehyde/layout2/imgs/home.png +0 -0
- package/src/aldehyde/layout2/imgs/s.svg +3 -0
- package/src/aldehyde/layout2/main.tsx +27 -0
- package/src/aldehyde/layout2/page.tsx +169 -0
- package/src/aldehyde/layout2/sider.tsx +357 -0
- package/src/aldehyde/layout2/type/layout.type.ts +10 -0
- package/src/aldehyde/layout2/util/menu.util.tsx +112 -0
- package/src/aldehyde/login2/Login.tsx +110 -0
- package/src/aldehyde/login2/LoginPage.tsx +58 -0
- package/src/aldehyde/login2/img/login-bg.png +0 -0
- package/src/aldehyde/login2/index.tsx +4 -0
- package/src/aldehyde/module/ltmpl-table.tsx +12 -9
- package/src/aldehyde/routable/dtmpl-route.tsx +141 -121
- package/src/aldehyde/routable/import-route.tsx +28 -23
- package/src/aldehyde/routable/ltmpl-route.tsx +82 -56
- package/src/aldehyde/routable/ttmpl-route.tsx +73 -55
- package/src/aldehyde/routable/withroute.tsx +21 -18
- package/src/aldehyde/table/act-table.tsx +88 -66
- package/src/aldehyde/table/index.css +4 -4
- package/src/aldehyde/table/query-table.tsx +27 -20
- package/src/aldehyde/table/relation-table.tsx +7 -7
- package/src/aldehyde/table/select-table.tsx +2 -2
- package/src/aldehyde/tmpl/hc-data-source.tsx +373 -352
- package/src/aldehyde/tmpl/hcservice-v3.tsx +33 -17
- package/src/aldehyde/tmpl/interface.tsx +43 -6
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +307 -247
- package/src/aldehyde/tree/tmpl-tree.tsx +2 -1
- package/src/aldehyde/welcome/HCWelcome.js +270 -235
- package/src/aldehyde/welcome/img/welcome.png +0 -0
- package/lib/exportor/export-frame.d.ts.map +0 -1
- package/lib/exportor/export-frame.js.map +0 -1
- /package/lib/{exportor → export}/export-frame.css +0 -0
- /package/src/aldehyde/{exportor → export}/export-frame.css +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Button, Form, Input } from "antd";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import HCserviceV3 from "../tmpl/hcservice-v3";
|
|
4
|
+
import { useLocale } from "../locale/useLocale";
|
|
5
|
+
|
|
6
|
+
type LoginPropType = {
|
|
7
|
+
onFinish?: (token: string) => void;
|
|
8
|
+
title?: any;
|
|
9
|
+
programCode?: string;
|
|
10
|
+
autoSaveUser?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type FormType = {
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Login = (props: LoginPropType) => {
|
|
19
|
+
// locale
|
|
20
|
+
const { translate } = useLocale();
|
|
21
|
+
|
|
22
|
+
// form
|
|
23
|
+
const [form] = Form.useForm<FormType>();
|
|
24
|
+
const submit = async () => {
|
|
25
|
+
try {
|
|
26
|
+
const { username, password } = await form.validateFields();
|
|
27
|
+
|
|
28
|
+
setLoading(true);
|
|
29
|
+
const { programCode, onFinish } = props;
|
|
30
|
+
const pubkey = await HCserviceV3.getRasPubkey(null, programCode);
|
|
31
|
+
const res = await HCserviceV3.login(
|
|
32
|
+
{ username, password },
|
|
33
|
+
"",
|
|
34
|
+
"",
|
|
35
|
+
pubkey,
|
|
36
|
+
programCode
|
|
37
|
+
);
|
|
38
|
+
if (res.status === "success") {
|
|
39
|
+
onFinish(res.token);
|
|
40
|
+
}
|
|
41
|
+
setLoading(false);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error(err);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// button
|
|
48
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Form
|
|
52
|
+
name="login"
|
|
53
|
+
form={form}
|
|
54
|
+
wrapperCol={{ span: 24 }}
|
|
55
|
+
initialValues={{ remember: true }}
|
|
56
|
+
autoComplete="off"
|
|
57
|
+
>
|
|
58
|
+
<Form.Item
|
|
59
|
+
name="username"
|
|
60
|
+
rules={[{ required: true, message: translate("请输入用户名") }]}
|
|
61
|
+
>
|
|
62
|
+
<Input
|
|
63
|
+
placeholder={translate("请输入用户名")}
|
|
64
|
+
style={{
|
|
65
|
+
borderRadius: "50px",
|
|
66
|
+
background: "#EEF3FB",
|
|
67
|
+
height: "50px",
|
|
68
|
+
fontSize: "15px",
|
|
69
|
+
lineHeight: "15px",
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</Form.Item>
|
|
73
|
+
|
|
74
|
+
<Form.Item
|
|
75
|
+
name="password"
|
|
76
|
+
rules={[{ required: true, message: translate("请输入密码") }]}
|
|
77
|
+
>
|
|
78
|
+
<Input.Password
|
|
79
|
+
placeholder={translate("请输入密码")}
|
|
80
|
+
style={{
|
|
81
|
+
borderRadius: "50px",
|
|
82
|
+
background: "#EEF3FB",
|
|
83
|
+
height: "50px",
|
|
84
|
+
fontSize: "15px",
|
|
85
|
+
lineHeight: "15px",
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</Form.Item>
|
|
89
|
+
|
|
90
|
+
<Form.Item wrapperCol={{ span: 24 }}>
|
|
91
|
+
<Button
|
|
92
|
+
type="primary"
|
|
93
|
+
onClick={submit}
|
|
94
|
+
shape="round"
|
|
95
|
+
loading={loading}
|
|
96
|
+
style={{
|
|
97
|
+
width: "100%",
|
|
98
|
+
height: "50px",
|
|
99
|
+
fontSize: "15px",
|
|
100
|
+
lineHeight: "15px",
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
登录
|
|
104
|
+
</Button>
|
|
105
|
+
</Form.Item>
|
|
106
|
+
</Form>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default Login;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Login from "./Login";
|
|
3
|
+
import LoginBgPng from "./img/login-bg.png";
|
|
4
|
+
import { useLocale } from "../locale/useLocale";
|
|
5
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
6
|
+
import Units from "../units";
|
|
7
|
+
|
|
8
|
+
const LoginPage = () => {
|
|
9
|
+
const { translate } = useLocale();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
style={{
|
|
14
|
+
width: "100%",
|
|
15
|
+
height: "100%",
|
|
16
|
+
minWidth: "1600px",
|
|
17
|
+
position: "absolute",
|
|
18
|
+
background: `url(${LoginBgPng})`,
|
|
19
|
+
backgroundSize: "cover",
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "row-reverse",
|
|
22
|
+
justifyContent: "flex-start",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
style={{
|
|
28
|
+
width: "500px",
|
|
29
|
+
height: "500px",
|
|
30
|
+
background: "linear-gradient(0deg, #FFFFFF 65%, #DFEDFF)",
|
|
31
|
+
boxShadow: "0px 10px 15px -3px rgba(0,0,0,0.1)",
|
|
32
|
+
marginRight: "10%",
|
|
33
|
+
padding: "60px",
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
fontWeight: 600,
|
|
39
|
+
fontSize: "30px",
|
|
40
|
+
color: "#222222",
|
|
41
|
+
marginBottom: 60,
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
{translate("欢迎, 登录")}
|
|
45
|
+
</div>
|
|
46
|
+
<Login
|
|
47
|
+
onFinish={(token) => {
|
|
48
|
+
HCDataSource.clear();
|
|
49
|
+
window.location.hash = "/v2";
|
|
50
|
+
Units.setHydrocarbonToken(token);
|
|
51
|
+
}}
|
|
52
|
+
></Login>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default LoginPage;
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {AddOrUpdate, LtmplConfigRes, ActTableMode, DoEditParam} from "../tmpl/interface";
|
|
3
3
|
import Units from "../units";
|
|
4
4
|
import ActTable from "../table/act-table";
|
|
5
5
|
// import StatActTable from '../table/stat-act-table'
|
|
@@ -46,6 +46,7 @@ export interface LtmplTableState {
|
|
|
46
46
|
ractionId?: string;
|
|
47
47
|
collapse?: boolean;
|
|
48
48
|
addTmplId?: string;
|
|
49
|
+
dtmplSourceId?:string;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
@@ -62,6 +63,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
62
63
|
ractionId: undefined,
|
|
63
64
|
collapse: false,
|
|
64
65
|
addTmplId: undefined,
|
|
66
|
+
dtmplSourceId:undefined,
|
|
65
67
|
};
|
|
66
68
|
static contextType = LocaleContext;
|
|
67
69
|
context: React.ContextType<typeof LocaleContext>;
|
|
@@ -130,22 +132,23 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
130
132
|
});
|
|
131
133
|
};
|
|
132
134
|
|
|
133
|
-
doEdit = (
|
|
134
|
-
const { doCustomEdit } = this.props;
|
|
135
|
-
if (toCustomPage) {
|
|
135
|
+
doEdit = (param:DoEditParam) => {
|
|
136
|
+
const { doCustomEdit,sourceId } = this.props;
|
|
137
|
+
if (param.toCustomPage) {
|
|
136
138
|
if (doCustomEdit) {
|
|
137
|
-
doCustomEdit(code, mode, () => {
|
|
139
|
+
doCustomEdit(param.code, param.mode, () => {
|
|
138
140
|
this.doSearch(this.state.criteriaData);
|
|
139
141
|
});
|
|
140
142
|
} else {
|
|
141
143
|
this.setState({
|
|
142
|
-
selectedCode: code,
|
|
144
|
+
selectedCode: param.code,
|
|
145
|
+
dtmplSourceId:param.dtmplSourceId?param.dtmplSourceId:sourceId,
|
|
143
146
|
showDtmplCustomEdit: true,
|
|
144
147
|
});
|
|
145
148
|
}
|
|
146
149
|
} else {
|
|
147
150
|
this.setState({
|
|
148
|
-
selectedCode: code,
|
|
151
|
+
selectedCode: param.code,
|
|
149
152
|
showDtmplEdit: true,
|
|
150
153
|
});
|
|
151
154
|
}
|
|
@@ -229,7 +232,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
229
232
|
ractionId,
|
|
230
233
|
showDraw,
|
|
231
234
|
collapse,
|
|
232
|
-
addTmplId,
|
|
235
|
+
addTmplId,dtmplSourceId,
|
|
233
236
|
} = this.state;
|
|
234
237
|
const {
|
|
235
238
|
sourceId,
|
|
@@ -307,7 +310,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
307
310
|
showDtmplEdit: false,
|
|
308
311
|
});
|
|
309
312
|
}}
|
|
310
|
-
sourceId={sourceId}
|
|
313
|
+
sourceId={dtmplSourceId?dtmplSourceId:sourceId}
|
|
311
314
|
mainCode={mainCode}
|
|
312
315
|
code={selectedCode}
|
|
313
316
|
onOk={this.handleDtmplEdit}
|
|
@@ -1,145 +1,165 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Empty} from
|
|
3
|
-
import {CodeSource, RouterCompProps} from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Empty } from "antd";
|
|
3
|
+
import { CodeSource, RouterCompProps } from "../tmpl/interface";
|
|
4
4
|
import DtmplEdit from "../detail/edit/dtmpl-edit";
|
|
5
|
-
import ActDtmplView from
|
|
5
|
+
import ActDtmplView from "../detail/view/act-dtmpl-view";
|
|
6
6
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
7
7
|
import withRouter from "./withroute";
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
export interface DtmplRouteProps extends RouterCompProps {
|
|
11
|
-
|
|
12
|
-
}
|
|
10
|
+
layoutRootPath?: string;
|
|
11
|
+
}
|
|
13
12
|
|
|
14
13
|
export interface DtmplRoutePropsStat {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
14
|
+
codeSource?: CodeSource;
|
|
15
|
+
queriedCode?: string;
|
|
16
|
+
}
|
|
18
17
|
|
|
19
18
|
class DtmplRoute extends React.Component<DtmplRouteProps, DtmplRoutePropsStat> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
state = {
|
|
20
|
+
codeSource: undefined,
|
|
21
|
+
queriedCode: undefined,
|
|
22
|
+
};
|
|
23
|
+
static defaultProps = {
|
|
24
|
+
basePath: "",
|
|
25
|
+
codeSource: undefined,
|
|
26
|
+
queriedCode: undefined,
|
|
27
|
+
};
|
|
28
|
+
async componentDidMount() {
|
|
29
|
+
await this.queryCode();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get computedLayoutPath() {
|
|
33
|
+
const { layoutRootPath } = this.props;
|
|
34
|
+
if (layoutRootPath !== undefined) return `/${layoutRootPath}`;
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
shouldComponentUpdate(prevProps, prevState) {
|
|
39
|
+
if (!prevProps || prevProps != this.props) {
|
|
40
|
+
this.setState({ codeSource: undefined, queriedCode: undefined });
|
|
31
41
|
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
45
|
+
async componentDidUpdate(prevProps, prevState, snapshot) {
|
|
46
|
+
if (!prevProps || prevProps != this.props) {
|
|
47
|
+
await this.queryCode();
|
|
38
48
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
queryCode = async () => {
|
|
52
|
+
const { params } = this.props;
|
|
53
|
+
const { sourceId } = params;
|
|
54
|
+
let codeSource: CodeSource = this.getCodeSource();
|
|
55
|
+
let queriedCode = await HcserviceV3.queryCode(sourceId, codeSource);
|
|
56
|
+
this.setState({
|
|
57
|
+
codeSource,
|
|
58
|
+
queriedCode,
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
getMenuId = () => {
|
|
63
|
+
const { searchParams } = this.props;
|
|
64
|
+
//console.log("this.props.match.params",this.props);
|
|
65
|
+
// var searchParams = new URLSearchParams( location.search);
|
|
66
|
+
let menuId = searchParams.get("menuId");
|
|
67
|
+
return menuId;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
getCodeSource = () => {
|
|
71
|
+
const { searchParams } = this.props;
|
|
72
|
+
// let params=Units.transQueryStrToParams(location.search);
|
|
73
|
+
// if('codeSource' in params){
|
|
74
|
+
return searchParams.get("codeSource");
|
|
75
|
+
// }else{
|
|
76
|
+
// return undefined;
|
|
77
|
+
// }
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
goBackToLtmpl = () => {
|
|
81
|
+
this.props.navigate(-1);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
goDtmpl = (code: string) => {
|
|
85
|
+
const { sourceId } = this.props.params;
|
|
86
|
+
const { basePath } = this.props;
|
|
87
|
+
let url = `${basePath}${
|
|
88
|
+
this.computedLayoutPath
|
|
89
|
+
}/${sourceId}/detail-edit?menuId=${this.getMenuId()}`;
|
|
90
|
+
if (code) {
|
|
91
|
+
url = url + `&code=${code}`;
|
|
44
92
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const {sourceId} = params;
|
|
49
|
-
let codeSource:CodeSource=this.getCodeSource();
|
|
50
|
-
let queriedCode=await HcserviceV3.queryCode(sourceId,codeSource);
|
|
51
|
-
this.setState({
|
|
52
|
-
codeSource,
|
|
53
|
-
queriedCode
|
|
54
|
-
})
|
|
93
|
+
let mainCode = this.getMainCode();
|
|
94
|
+
if (mainCode) {
|
|
95
|
+
url = url + `&mainCode=${mainCode}`;
|
|
55
96
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
97
|
+
this.props.navigate(url);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
getMainCode = () => {
|
|
101
|
+
const { searchParams } = this.props;
|
|
102
|
+
return searchParams.get("mainCode");
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
getCode = () => {
|
|
106
|
+
const { codeSource, queriedCode } = this.state;
|
|
107
|
+
const { searchParams } = this.props;
|
|
108
|
+
//let code;
|
|
109
|
+
if (codeSource) {
|
|
110
|
+
return queriedCode;
|
|
111
|
+
} else {
|
|
112
|
+
// let params=Units.transQueryStrToParams(location.search);
|
|
113
|
+
return searchParams.get("code");
|
|
63
114
|
}
|
|
115
|
+
};
|
|
64
116
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// }else{
|
|
71
|
-
// return undefined;
|
|
72
|
-
// }
|
|
73
|
-
}
|
|
117
|
+
getMode = () => {
|
|
118
|
+
const { searchParams } = this.props;
|
|
119
|
+
// let params=Units.transQueryStrToParams(location.search);
|
|
120
|
+
return this.getCode() ? searchParams.get("mode") : "add";
|
|
121
|
+
};
|
|
74
122
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
123
|
+
render() {
|
|
124
|
+
const { location, params, searchParams } = this.props;
|
|
125
|
+
const { sourceId } = params;
|
|
78
126
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
let url=`${basePath}/${sourceId}/detail-edit?menuId=${this.getMenuId()}`;
|
|
83
|
-
if(code){
|
|
84
|
-
url=url+`&code=${code}`;
|
|
85
|
-
}
|
|
86
|
-
let mainCode=this.getMainCode();
|
|
87
|
-
if(mainCode){
|
|
88
|
-
url=url+`&mainCode=${mainCode}`;
|
|
89
|
-
}
|
|
90
|
-
this.props.navigate(url);
|
|
127
|
+
const { codeSource } = this.state;
|
|
128
|
+
if (!location) {
|
|
129
|
+
return <></>;
|
|
91
130
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return searchParams.get('mainCode');
|
|
131
|
+
const code = this.getCode();
|
|
132
|
+
if (code && code == "bad-code") {
|
|
133
|
+
return <Empty />;
|
|
96
134
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return <></>;
|
|
124
|
-
}
|
|
125
|
-
const code=this.getCode();
|
|
126
|
-
if(code && code=='bad-code'){
|
|
127
|
-
return <Empty />
|
|
128
|
-
}
|
|
129
|
-
// let params=Units.transQueryStrToParams(location.search);
|
|
130
|
-
let versionId=params['versionId'];
|
|
131
|
-
if(location.pathname.endsWith("detail-view")){
|
|
132
|
-
return (
|
|
133
|
-
<ActDtmplView serverKey={null} goDtmpl={this.goDtmpl} sourceId={sourceId} versionId={versionId} code={code} mainCode={this.getMainCode()} />
|
|
134
|
-
);
|
|
135
|
-
}else{
|
|
136
|
-
return (
|
|
137
|
-
<DtmplEdit addTmplId={searchParams.get('addTmplId')} serverKey={null} addOrUpdate={this.getMode()} sourceId={sourceId} code={code} mainCode={this.getMainCode()} goBackToLtmpl={codeSource?undefined:this.goBackToLtmpl} goDtmpl={this.goDtmpl}></DtmplEdit>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
135
|
+
// let params=Units.transQueryStrToParams(location.search);
|
|
136
|
+
let versionId = params["versionId"];
|
|
137
|
+
if (location.pathname.endsWith("detail-view")) {
|
|
138
|
+
return (
|
|
139
|
+
<ActDtmplView
|
|
140
|
+
serverKey={null}
|
|
141
|
+
goDtmpl={this.goDtmpl}
|
|
142
|
+
sourceId={sourceId}
|
|
143
|
+
versionId={versionId}
|
|
144
|
+
code={code}
|
|
145
|
+
mainCode={this.getMainCode()}
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
} else {
|
|
149
|
+
return (
|
|
150
|
+
<DtmplEdit
|
|
151
|
+
addTmplId={searchParams.get("addTmplId")}
|
|
152
|
+
serverKey={null}
|
|
153
|
+
addOrUpdate={this.getMode()}
|
|
154
|
+
sourceId={sourceId}
|
|
155
|
+
code={code}
|
|
156
|
+
mainCode={this.getMainCode()}
|
|
157
|
+
goBackToLtmpl={codeSource ? undefined : this.goBackToLtmpl}
|
|
158
|
+
goDtmpl={this.goDtmpl}
|
|
159
|
+
></DtmplEdit>
|
|
160
|
+
);
|
|
141
161
|
}
|
|
162
|
+
}
|
|
142
163
|
}
|
|
143
164
|
|
|
144
165
|
export default withRouter(DtmplRoute);
|
|
145
|
-
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {RouterCompProps} from
|
|
3
|
-
import ExcelImport from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RouterCompProps } from "../tmpl/interface";
|
|
3
|
+
import ExcelImport from "../import/excel-import";
|
|
4
4
|
import withRouter from "./withroute";
|
|
5
5
|
|
|
6
6
|
export interface ImportRouteProps extends RouterCompProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
interface ImportRouteStat{
|
|
10
|
-
|
|
7
|
+
serverKey?: string;
|
|
8
|
+
layoutRootPath?: string;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
interface ImportRouteStat {}
|
|
11
|
+
|
|
12
|
+
class ExcelImportRoute extends React.PureComponent<
|
|
13
|
+
ImportRouteProps,
|
|
14
|
+
ImportRouteStat
|
|
15
|
+
> {
|
|
16
|
+
state = {};
|
|
17
|
+
|
|
18
|
+
async componentDidMount() {}
|
|
19
|
+
|
|
20
|
+
get computedLayoutPath() {
|
|
21
|
+
const { layoutRootPath } = this.props;
|
|
22
|
+
if (layoutRootPath !== undefined) return `/${layoutRootPath}`;
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
render() {
|
|
27
|
+
const { params, serverKey } = this.props;
|
|
28
|
+
const { sourceId } = params;
|
|
29
|
+
return (
|
|
30
|
+
<ExcelImport serverKey={serverKey} sourceId={sourceId}></ExcelImport>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
export default withRouter(ExcelImportRoute);
|
|
29
|
-
|