aldehyde 0.2.74 → 0.2.76
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.d.ts.map +1 -1
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +13 -20
- package/lib/controls/action/utils.js.map +1 -1
- package/lib/custom-page/custom-page-router.d.ts.map +1 -1
- package/lib/custom-page/custom-page-router.js +0 -1
- package/lib/custom-page/custom-page-router.js.map +1 -1
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/import/excel-import.d.ts.map +1 -1
- package/lib/import/excel-import.js +45 -37
- package/lib/import/excel-import.js.map +1 -1
- package/lib/module/dtmpl-view-card.js +1 -1
- package/lib/module/dtmpl-view-card.js.map +1 -1
- package/lib/routable/ttmpl-route.d.ts +2 -4
- package/lib/routable/ttmpl-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-route.js +20 -128
- package/lib/routable/ttmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/query-table.js +1 -1
- package/lib/table/query-table.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts +2 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +11 -0
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +2 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +30 -7
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +13 -5
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tree/act-tree.d.ts +40 -0
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/act-tree.js +119 -112
- package/lib/tree/act-tree.js.map +1 -1
- package/lib/tree/index.css +21 -0
- package/lib/tree/tmpl-tree.d.ts +61 -0
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +341 -481
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/lib/tree/tree-node.d.ts +22 -0
- package/lib/tree/tree-node.d.ts.map +1 -0
- package/lib/tree/tree-node.js +62 -0
- package/lib/tree/tree-node.js.map +1 -0
- package/lib/tree/tree-utils.d.ts +55 -0
- package/lib/tree/tree-utils.d.ts.map +1 -0
- package/lib/tree/tree-utils.js +142 -0
- package/lib/tree/tree-utils.js.map +1 -0
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +1 -0
- package/src/aldehyde/controls/action/utils.tsx +14 -20
- package/src/aldehyde/custom-page/custom-page-router.tsx +0 -1
- package/src/aldehyde/form/dtmpl-form.tsx +0 -1
- package/src/aldehyde/import/excel-import.tsx +42 -35
- package/src/aldehyde/module/dtmpl-view-card.tsx +1 -1
- package/src/aldehyde/routable/ttmpl-route.tsx +24 -154
- package/src/aldehyde/table/act-table.tsx +1 -0
- package/src/aldehyde/table/query-table.tsx +1 -1
- package/src/aldehyde/tmpl/hc-data-source.tsx +11 -1
- package/src/aldehyde/tmpl/hcservice-v3.tsx +29 -7
- package/src/aldehyde/tmpl/interface.tsx +14 -5
- package/src/aldehyde/tree/act-tree.tsx +149 -111
- package/src/aldehyde/tree/index.css +21 -0
- package/src/aldehyde/tree/tmpl-tree.tsx +397 -480
- package/src/aldehyde/tree/tree-node.tsx +78 -0
- package/src/aldehyde/tree/tree-utils.tsx +166 -0
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {AddOrUpdate, LtmplConfigRes, RouterCompProps} from '../tmpl/interface';
|
|
3
|
-
|
|
4
|
-
import ActTable from '../table/act-table'
|
|
5
|
-
// import StatActTable from '../table/stat-act-table'
|
|
2
|
+
import {AddOrUpdate, LtmplConfigRes, RouterCompProps, TtmplConfig} from '../tmpl/interface';
|
|
3
|
+
|
|
6
4
|
import HCDataSource from "../tmpl/hc-data-source";
|
|
7
5
|
import withRouter from "../routable/withroute";
|
|
6
|
+
import ActTree from "../tree/act-tree";
|
|
7
|
+
import {Card} from "antd";
|
|
8
8
|
export interface TtmplRouteProps extends RouterCompProps {
|
|
9
9
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export interface TtmplRouteState {
|
|
13
|
-
|
|
14
|
-
pageNo?: number,
|
|
15
|
-
pageSize?: number,
|
|
13
|
+
ttmplConfig?: TtmplConfig,
|
|
16
14
|
};
|
|
17
15
|
|
|
18
16
|
class TtmplRoute extends React.PureComponent<TtmplRouteProps, TtmplRouteState> {
|
|
@@ -20,9 +18,7 @@ class TtmplRoute extends React.PureComponent<TtmplRouteProps, TtmplRouteState> {
|
|
|
20
18
|
basePath: "",
|
|
21
19
|
}
|
|
22
20
|
state = {
|
|
23
|
-
|
|
24
|
-
pageNo: undefined,
|
|
25
|
-
pageSize: undefined,
|
|
21
|
+
ttmplConfig: undefined,
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
async componentDidMount() {
|
|
@@ -42,10 +38,15 @@ class TtmplRoute extends React.PureComponent<TtmplRouteProps, TtmplRouteState> {
|
|
|
42
38
|
loadData = async () => {
|
|
43
39
|
const {params} = this.props;
|
|
44
40
|
const {sourceId} = params;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
let ttmplConfig:TtmplConfig = await HCDataSource.requestTtmplConfig(null,sourceId);
|
|
42
|
+
//debugger
|
|
43
|
+
if(ttmplConfig.type=='1M'){
|
|
44
|
+
this.props.navigate(`/${ttmplConfig.id}/act-table`);
|
|
45
|
+
}else{
|
|
46
|
+
this.setState({
|
|
47
|
+
ttmplConfig:{...ttmplConfig},
|
|
48
|
+
})
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
async componentDidUpdate(prevProps) {
|
|
@@ -53,151 +54,20 @@ class TtmplRoute extends React.PureComponent<TtmplRouteProps, TtmplRouteState> {
|
|
|
53
54
|
const {sourceId} = params;
|
|
54
55
|
let {sourceId: preSourceId} = prevProps.params;
|
|
55
56
|
let {location: preLocation} = prevProps;
|
|
56
|
-
if (!sourceId ||
|
|
57
|
-
(!preSourceId && this.state.ltmplConfigRes)
|
|
58
|
-
|| (location.pathname == preLocation.pathname && location.search == preLocation.search)
|
|
59
|
-
) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.loadData();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
showView = (code: string, toCustomPage: boolean = false) => {
|
|
66
|
-
const {basePath} = this.props;
|
|
67
|
-
const {sourceId} = this.props.params;
|
|
68
|
-
const {ltmplConfigRes} = this.state;
|
|
69
|
-
let path = `${basePath}/${sourceId}/detail-view?code=${code}&menuId=${this.getMenuId()}`;
|
|
70
|
-
if (toCustomPage && ltmplConfigRes.ltmplConfig.customViewPagePath) {
|
|
71
|
-
path = `${basePath}${ltmplConfigRes.ltmplConfig.customViewPagePath}?menuId=${this.getMenuId()}&sourceId=${sourceId}`;
|
|
72
|
-
}
|
|
73
|
-
this.onRoute(path);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
doEdit = (code: string, mode: AddOrUpdate, toCustomPage: boolean = false) => {
|
|
77
|
-
const {basePath} = this.props;
|
|
78
|
-
const {sourceId} = this.props.params;
|
|
79
|
-
const {ltmplConfigRes} = this.state;
|
|
80
|
-
let mainCode = this.getMainCode();
|
|
81
|
-
|
|
82
|
-
let path = `${basePath}/${sourceId}/detail-edit?code=${code}&menuId=${this.getMenuId()}&mode=${mode}`;
|
|
83
|
-
if (toCustomPage && ltmplConfigRes.ltmplConfig.customEditPagePath) {
|
|
84
|
-
path = `${basePath}/page/${sourceId}${ltmplConfigRes.ltmplConfig.customEditPagePath}?code=${code}&menuId=${this.getMenuId()}`;
|
|
85
|
-
}
|
|
86
|
-
if (mainCode) {
|
|
87
|
-
path = path + `&mainCode=${mainCode}`;
|
|
88
|
-
}
|
|
89
|
-
this.onRoute(path);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
getMainCode = () => {
|
|
93
|
-
const {searchParams} = this.props;
|
|
94
|
-
let mainCode = undefined;
|
|
95
|
-
// let criteriaData = Units.transQueryStrToParams(search);
|
|
96
|
-
let mcode=searchParams.get('mainCode');
|
|
97
|
-
if (mcode) {
|
|
98
|
-
// criteriaData = Units.transQueryStrToParams(search);
|
|
99
|
-
mainCode = mcode;
|
|
100
|
-
}
|
|
101
|
-
return mainCode;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
doCreate = (toCustomPage: boolean = false) => {
|
|
105
|
-
const {basePath} = this.props;
|
|
106
|
-
const {sourceId} = this.props.params;
|
|
107
|
-
const {ltmplConfigRes} = this.state;
|
|
108
|
-
let path = `${basePath}/${sourceId}/detail-edit?menuId=${this.getMenuId()}`;
|
|
109
|
-
if (toCustomPage && ltmplConfigRes.ltmplConfig.customEditPagePath) {
|
|
110
|
-
path = `${basePath}/page/${sourceId}${ltmplConfigRes.ltmplConfig.customEditPagePath}?menuId=${this.getMenuId()}`;
|
|
111
|
-
}
|
|
112
|
-
let mainCode = this.getMainCode();
|
|
113
|
-
if (mainCode) {
|
|
114
|
-
path = path + `&mainCode=${mainCode}`;
|
|
115
|
-
}
|
|
116
|
-
this.onRoute(path);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
doRAction = (ractionId: string, mainCode: String) => {
|
|
120
|
-
const {basePath} = this.props;
|
|
121
|
-
let path = `${basePath}/${ractionId}/act-table?mainCode=${mainCode}&menuId=${this.getMenuId()}`;
|
|
122
|
-
this.onRoute(path);
|
|
123
|
-
}
|
|
124
57
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const {sourceId} = this.props.params;
|
|
128
|
-
let params = {...params_}
|
|
129
|
-
//params['sourceId'] = sourceId;
|
|
130
|
-
const newfliter = Units.transQueryParamsToStr(params);
|
|
131
|
-
this.props.navigate(`${basePath}/${sourceId}/act-table?${newfliter}`,{replace:true})
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
onChangeSearch = (params_) => {
|
|
135
|
-
let params = {...params_}
|
|
136
|
-
//追加过滤条件,hiddenColIds,innerQueryKey
|
|
137
|
-
const {searchParams} = this.props;
|
|
138
|
-
let mcode=searchParams.get("mainCode");
|
|
139
|
-
if (mcode) {
|
|
140
|
-
params['mainCode'] = mcode;
|
|
141
|
-
}
|
|
142
|
-
const {pageSize,pageNo} = this.state;
|
|
143
|
-
if(pageSize){
|
|
144
|
-
params['pageNo'] = pageNo;
|
|
58
|
+
if (sourceId && preSourceId && sourceId==preSourceId) {
|
|
59
|
+
return;
|
|
145
60
|
}
|
|
146
|
-
|
|
147
|
-
params['pageSize'] = pageSize;
|
|
148
|
-
}
|
|
149
|
-
params['menuId']=this.getMenuId();
|
|
150
|
-
params['sourceId']=this.getMenuId();
|
|
151
|
-
this.doSearch(params);
|
|
61
|
+
await this.loadData();
|
|
152
62
|
}
|
|
153
63
|
|
|
154
|
-
onChangePage = (pageNo: number, pageSize: number) => {
|
|
155
|
-
const {location} = this.props;
|
|
156
|
-
let search = location.search;
|
|
157
|
-
let params = Units.transQueryStrToParams(search);
|
|
158
|
-
params['pageNo'] = pageNo;
|
|
159
|
-
params['pageSize'] = pageSize;
|
|
160
|
-
this.doSearch(params);
|
|
161
|
-
|
|
162
|
-
// this.setState({
|
|
163
|
-
// pageNo,
|
|
164
|
-
// pageSize
|
|
165
|
-
// })
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
64
|
render() {
|
|
170
|
-
const {
|
|
171
|
-
const {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
let search = location.search;
|
|
177
|
-
let criteriaData = Units.transQueryStrToParams(search);
|
|
178
|
-
// if (search.indexOf('menuId') > 0) {
|
|
179
|
-
// menuId = criteriaData['menuId'];
|
|
180
|
-
// criteriaData['menuId'] = undefined;
|
|
181
|
-
// } else {
|
|
182
|
-
// menuId = sourceId;
|
|
183
|
-
// }
|
|
184
|
-
let pageSize = criteriaData['pageSize'];
|
|
185
|
-
let pageNo = criteriaData['pageNo'];
|
|
186
|
-
|
|
187
|
-
if (search.indexOf('mainCode') > 0) {
|
|
188
|
-
//criteriaData = Units.transQueryStrToParams(search);
|
|
189
|
-
mainCode = criteriaData['mainCode'];
|
|
190
|
-
}
|
|
191
|
-
if (!ltmplConfigRes) {
|
|
192
|
-
return <></>;
|
|
193
|
-
} else {
|
|
194
|
-
return <ActTable serverKey={null} pageSize={pageSize} pageNo={pageNo} onChangePage={this.onChangePage}
|
|
195
|
-
menuId={this.getMenuId()} mainCode={mainCode} showView={this.showView}
|
|
196
|
-
doSearch={this.onChangeSearch} doEdit={this.doEdit} doCreate={this.doCreate}
|
|
197
|
-
sourceId={sourceId} criteriaData={criteriaData}
|
|
198
|
-
ltmplConfig={ltmplConfigRes?ltmplConfigRes.ltmplConfig:null}
|
|
199
|
-
doRAction={this.doRAction}
|
|
200
|
-
/>
|
|
65
|
+
const { } = this.props;
|
|
66
|
+
const {ttmplConfig}=this.state;
|
|
67
|
+
if(!ttmplConfig){
|
|
68
|
+
return <Card loading={true}></Card>
|
|
69
|
+
}else{
|
|
70
|
+
return <><ActTree ttmplConfig={ttmplConfig}></ActTree></>;
|
|
201
71
|
}
|
|
202
72
|
|
|
203
73
|
}
|
|
@@ -301,6 +301,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
301
301
|
}) : ""}
|
|
302
302
|
{ltmplConfig.rowActions && ltmplConfig.rowActions.length > 0 ?
|
|
303
303
|
ltmplConfig.rowActions.map((action) => {
|
|
304
|
+
|
|
304
305
|
return <Action serverKey={serverKey} iconType={'icon'} key={action.id} data={[record]} actionConfig={action}
|
|
305
306
|
doAction={this.doRowAction} buttonSize={'small'} serial={1}></Action>
|
|
306
307
|
}) : ""}
|
|
@@ -242,7 +242,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
242
242
|
}
|
|
243
243
|
})
|
|
244
244
|
selectedRows.forEach((item) => {
|
|
245
|
-
selectedRows_.push({code: item
|
|
245
|
+
selectedRows_.push({code: item['code'], title: item[titleColId]});
|
|
246
246
|
selectedDatas.push(item);
|
|
247
247
|
})
|
|
248
248
|
if (onChangeRowSelection) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Level2Menu,
|
|
9
9
|
LtmplConfig,
|
|
10
10
|
LtmplConfigRes,
|
|
11
|
-
SelectConfig
|
|
11
|
+
SelectConfig, TtmplConfig
|
|
12
12
|
} from "./interface";
|
|
13
13
|
import HcserviceV3 from './hcservice-v3';
|
|
14
14
|
import ControlTypeSupportor from './control-type-supportor'
|
|
@@ -25,6 +25,7 @@ const selectConfigMap: Map<string, SelectConfig> = new Map<string, SelectConfig>
|
|
|
25
25
|
const ltmplConfigMap: Map<string, LtmplConfigRes> = new Map<string, LtmplConfigRes>();
|
|
26
26
|
const l2LtmplConfigMap: Map<string, LtmplConfigRes> = new Map<string, LtmplConfigRes>();
|
|
27
27
|
const dtmplConfigMap: Map<string, DtmplConfig> = new Map<string, DtmplConfig>();
|
|
28
|
+
const ttmplConfigMap: Map<string, TtmplConfig> = new Map<string, TtmplConfig>();
|
|
28
29
|
const viewDtmplConfigMap: Map<string, DtmplConfig> = new Map<string, DtmplConfig>();
|
|
29
30
|
const addDtmplConfigMap: Map<string, DtmplConfig> = new Map<string, DtmplConfig>();
|
|
30
31
|
const objctCacheMap: Map<string, DtmplData> = new Map<string, DtmplData>();
|
|
@@ -195,6 +196,15 @@ HCDataSource.requestDtmplConfig = async function (serverKey:string,sourceId: str
|
|
|
195
196
|
return dtmplConfigMap.get(sourceId);
|
|
196
197
|
};
|
|
197
198
|
|
|
199
|
+
HCDataSource.requestTtmplConfig = async function (serverKey:string,sourceId: string) {
|
|
200
|
+
if (!ttmplConfigMap.has(sourceId)) {
|
|
201
|
+
let res= await HcserviceV3.requestTtmplConfig(serverKey,sourceId);
|
|
202
|
+
ttmplConfigMap.set(sourceId, res);
|
|
203
|
+
ttmplConfigMap.set(res.id, res);
|
|
204
|
+
}
|
|
205
|
+
return ttmplConfigMap.get(sourceId);
|
|
206
|
+
};
|
|
207
|
+
|
|
198
208
|
HCDataSource.requestViewDtmplConfig = async function (serverKey:string,sourceId: string) {
|
|
199
209
|
if (!viewDtmplConfigMap.has(sourceId)) {
|
|
200
210
|
viewDtmplConfigMap.set(sourceId, await HcserviceV3.requestViewDtmplConfig(serverKey,sourceId));
|
|
@@ -48,6 +48,18 @@ export default class HcserviceV3 {
|
|
|
48
48
|
return res.dtmplConfig;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
static async requestTtmplConfig(serverKey:string,sourceId: string) {
|
|
52
|
+
|
|
53
|
+
let url = `/v3/ttmpl/config`
|
|
54
|
+
let res = await Super.super({
|
|
55
|
+
url,
|
|
56
|
+
serverKey,
|
|
57
|
+
method: "GET",
|
|
58
|
+
query: {sourceId}
|
|
59
|
+
});
|
|
60
|
+
return res.ttmplConfig;
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
static async requestViewDtmplConfig(serverKey:string,sourceId: string) {
|
|
52
64
|
|
|
53
65
|
let url = `/v3/view-dtmpl/config`
|
|
@@ -122,6 +134,11 @@ export default class HcserviceV3 {
|
|
|
122
134
|
return await this.requestCommonLtmplQueryTop(serverKey,sourceId, condition, url);
|
|
123
135
|
}
|
|
124
136
|
|
|
137
|
+
static async requestTtmplRootData(serverKey:string,sourceId:string, condition) {
|
|
138
|
+
let url = `/v3/ttmpl/root-data`
|
|
139
|
+
return await this.requestCommonLtmplQueryTop(serverKey,sourceId, condition, url);
|
|
140
|
+
}
|
|
141
|
+
|
|
125
142
|
static async requestMstrucLtmplQueryTop(serverKey:string,sourceId:string, condition) {
|
|
126
143
|
//console.log('condition:',condition);
|
|
127
144
|
let url = `/v3/mstruc/ltmpl/top-data`
|
|
@@ -139,13 +156,18 @@ export default class HcserviceV3 {
|
|
|
139
156
|
|
|
140
157
|
static async requestCommonLtmplQueryTop(serverKey:string,sourceId:string, condition, url) {
|
|
141
158
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
if(!sourceId){
|
|
160
|
+
message.error("SourceId is undefined!");
|
|
161
|
+
}else{
|
|
162
|
+
let res = await Super.super({
|
|
163
|
+
url: url,
|
|
164
|
+
serverKey,
|
|
165
|
+
method: 'GET',
|
|
166
|
+
query: {...condition, sourceId}
|
|
167
|
+
});
|
|
168
|
+
return res;
|
|
169
|
+
}
|
|
170
|
+
|
|
149
171
|
}
|
|
150
172
|
|
|
151
173
|
static async requestSelectedData(serverKey:string,sourceId:string, codes) {
|
|
@@ -154,7 +154,7 @@ export interface DtmplConfig extends TmplBase {
|
|
|
154
154
|
onValuesChange:(changedValues,allValues:DtmplData,formInstance:FormInstance)=>void
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
export type Comparator = 'equal' | 'unequal' | 'includeOne' | 'exclude' | 'noLess' | 'noGreater';
|
|
157
|
+
export type Comparator ='contain'| 'equal' | 'equals' |'unequal' |'unequals' | 'includeOne'|'include_anyone'|'noless'|'nogreater' | 'exclude' | 'noLess' | 'noGreater';
|
|
158
158
|
|
|
159
159
|
export type FieldAction = 'add' | 'delete' | 'edit' | 'detail'|'table';
|
|
160
160
|
|
|
@@ -188,6 +188,12 @@ export interface SelectConfig extends TmplBase {
|
|
|
188
188
|
orderColumn:ColumnConfig;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
export interface TtmplConfigRes {
|
|
192
|
+
sourceId: string;
|
|
193
|
+
ltmplConfig?: LtmplConfig;
|
|
194
|
+
parentLtmplConfig?: LtmplConfig;
|
|
195
|
+
}
|
|
196
|
+
|
|
191
197
|
export interface RActionConfig extends OrderableTmplBase {
|
|
192
198
|
|
|
193
199
|
}
|
|
@@ -200,10 +206,13 @@ export interface LtmplConfigRes {
|
|
|
200
206
|
ltmplConfig?: LtmplConfig;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
|
-
export interface
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
export interface TtmplConfig extends TmplBase {
|
|
210
|
+
type:"2M"|'1M'|'2MR',
|
|
211
|
+
leafTitle:string,
|
|
212
|
+
branchTitle:string,
|
|
213
|
+
rootGtmplId:string,
|
|
214
|
+
branchRatmplId:string,
|
|
215
|
+
leafRatmplId:string,
|
|
207
216
|
}
|
|
208
217
|
|
|
209
218
|
// export interface StatViewConfig extends SelectConfig {
|
|
@@ -1,111 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Card, Layout, Typography} from 'antd';
|
|
3
|
+
import TmplTree from "./tmpl-tree";
|
|
4
|
+
import TreeUtils, {TtmplNodeConfig} from "./tree-utils";
|
|
5
|
+
import {TtmplConfig} from "../tmpl/interface";
|
|
6
|
+
import {DtmplEditCard, DtmplViewCard} from "../index";
|
|
7
|
+
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
8
|
+
|
|
9
|
+
const {Content, Sider} = Layout;
|
|
10
|
+
const {Text, Title} = Typography
|
|
11
|
+
|
|
12
|
+
interface ActTreeProps {
|
|
13
|
+
ttmplConfig: TtmplConfig,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ActTreeState {
|
|
17
|
+
ttmplNodeConfig?: TtmplNodeConfig,
|
|
18
|
+
showEdit?: boolean,
|
|
19
|
+
showView?:boolean,
|
|
20
|
+
recordCode?: string,
|
|
21
|
+
mainCode?: string,
|
|
22
|
+
sourceId?: string,
|
|
23
|
+
cardtitle?:string,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default class ActTree extends React.PureComponent<ActTreeProps, ActTreeState> {
|
|
27
|
+
|
|
28
|
+
static defaultProps = {}
|
|
29
|
+
state = {
|
|
30
|
+
ttmplNodeConfig: undefined,
|
|
31
|
+
recordCode: undefined,
|
|
32
|
+
showEdit: false,
|
|
33
|
+
showView:false,
|
|
34
|
+
mainCode: undefined,
|
|
35
|
+
sourceId: undefined,
|
|
36
|
+
cardtitle:undefined,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
refTmplTree: any = React.createRef();
|
|
40
|
+
|
|
41
|
+
async componentDidMount() {
|
|
42
|
+
|
|
43
|
+
await this.loadData();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
loadData=async ()=>{
|
|
47
|
+
const {ttmplConfig} = this.props;
|
|
48
|
+
let ttmplNodeConfig = await TreeUtils.initTtmplNodeConfig(ttmplConfig);
|
|
49
|
+
this.setState({
|
|
50
|
+
ttmplNodeConfig,
|
|
51
|
+
showEdit:false,
|
|
52
|
+
showView:false,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async componentDidUpdate(prevProps) {
|
|
57
|
+
let {ttmplConfig: prettmplConfig} = prevProps;
|
|
58
|
+
let {ttmplConfig} = this.props;
|
|
59
|
+
|
|
60
|
+
if (ttmplConfig && prettmplConfig && ttmplConfig.id==prettmplConfig.id) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
await this.loadData();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
onEditRoot = (title:string,code?: string) => {
|
|
67
|
+
const {ttmplConfig} = this.props;
|
|
68
|
+
this.showCard(title,ttmplConfig.rootGtmplId,null,code,true,false);
|
|
69
|
+
};
|
|
70
|
+
showCard=(cardtitle,sourceId,mainCode,recordCode,showEdit,showView)=>{
|
|
71
|
+
this.setState({
|
|
72
|
+
mainCode,
|
|
73
|
+
cardtitle,
|
|
74
|
+
recordCode,
|
|
75
|
+
showEdit,
|
|
76
|
+
showView,
|
|
77
|
+
sourceId,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
onViewRoot = (title:string,code?: string) => {
|
|
81
|
+
const {ttmplConfig} = this.props;
|
|
82
|
+
this.showCard(title,ttmplConfig.rootGtmplId,null,code,false,true);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
onEditSub = (title:string,sourceId:string,mainCode:string,recordCode?: string) => {
|
|
86
|
+
this.showCard(title,sourceId,mainCode,recordCode,true,false);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
onViewSub = (title:string,sourceId:string,mainCode:string,recordCode?: string) => {
|
|
90
|
+
|
|
91
|
+
this.showCard(title,sourceId,mainCode,recordCode,false,true);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
onDelete=(sourceId:string,recordCode?: string) => {
|
|
95
|
+
HcserviceV3.deleteByCode(null,sourceId, [recordCode]);
|
|
96
|
+
};
|
|
97
|
+
onAddSub=(title:string,sourceId:string,mainCode: string) => {
|
|
98
|
+
|
|
99
|
+
this.showCard(title,sourceId,mainCode,null,true,false);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
render() {
|
|
103
|
+
const {} = this.props;
|
|
104
|
+
|
|
105
|
+
const {ttmplNodeConfig,showView, showEdit, recordCode, mainCode, sourceId,cardtitle} = this.state;
|
|
106
|
+
if (!ttmplNodeConfig) {
|
|
107
|
+
return <Card loading={true}></Card>
|
|
108
|
+
}
|
|
109
|
+
return (<Layout hasSider style={{backgroundColor: '#fff'}}>
|
|
110
|
+
<Sider width={360} theme={'light'}
|
|
111
|
+
style={{
|
|
112
|
+
height: '90vh',
|
|
113
|
+
position: 'fixed',
|
|
114
|
+
left: 0,
|
|
115
|
+
top: 66,
|
|
116
|
+
bottom: 0,
|
|
117
|
+
marginLeft: 210
|
|
118
|
+
}}
|
|
119
|
+
><TmplTree doEditRoot={this.onEditRoot}
|
|
120
|
+
doEditSub={this.onEditSub}
|
|
121
|
+
doDelete={this.onDelete}
|
|
122
|
+
doViewRoot={this.onViewRoot}
|
|
123
|
+
doViewSub={this.onViewSub}
|
|
124
|
+
doAddSub={this.onAddSub}
|
|
125
|
+
ttmplNodeConfig={ttmplNodeConfig}
|
|
126
|
+
ref={this.refTmplTree}
|
|
127
|
+
></TmplTree>
|
|
128
|
+
</Sider>
|
|
129
|
+
<Layout style={{marginLeft: 382, backgroundColor: '#fff'}}>
|
|
130
|
+
<Content style={{overflow: 'initial'}}>
|
|
131
|
+
{showEdit ? <DtmplEditCard title={<>{recordCode ? <>编辑 {cardtitle?cardtitle:""}</> : <>添加 {cardtitle?cardtitle:""}</>} </>}
|
|
132
|
+
mainCode={mainCode}
|
|
133
|
+
sourceId={sourceId}
|
|
134
|
+
code={recordCode}
|
|
135
|
+
onOk={(recordCode) => {
|
|
136
|
+
let a=this.refTmplTree?.current?.reloadData(mainCode);
|
|
137
|
+
this.setState({recordCode})
|
|
138
|
+
}}
|
|
139
|
+
/> : null}
|
|
140
|
+
{showView ? <DtmplViewCard
|
|
141
|
+
mainCode={mainCode}
|
|
142
|
+
sourceId={sourceId}
|
|
143
|
+
code={recordCode}
|
|
144
|
+
/> : null}
|
|
145
|
+
</Content>
|
|
146
|
+
</Layout>
|
|
147
|
+
</Layout>)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.tree-container {
|
|
2
|
+
box-shadow:1px 0 0px 1px rgba(0,0,0,0.3) ;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tree-node{
|
|
6
|
+
box-shadow:0.4px 0px 0px 0.4px rgba(0,0,0,0.2) ;
|
|
7
|
+
margin-bottom: 2px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.tree-card-title-body {
|
|
13
|
+
padding:2px;
|
|
14
|
+
min-width: 280px;
|
|
15
|
+
}
|
|
16
|
+
.ant-tree-node-selected{
|
|
17
|
+
background-color: white !important;
|
|
18
|
+
}
|
|
19
|
+
.ant-avatar-string{
|
|
20
|
+
transform: scale(0.8) translateX(-50%) !important;
|
|
21
|
+
}
|