aldehyde 0.0.1
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/163.js +2 -0
- package/dist/163.js.LICENSE.txt +43 -0
- package/dist/41.js +1 -0
- package/dist/aldehyde.js +2 -0
- package/dist/aldehyde.js.LICENSE.txt +122 -0
- package/dist/chemstruc-graph.js +1 -0
- package/dist/css/163-24392163d3c7b54ea806.css +11 -0
- package/dist/css/290-5e8e152675ab7d201c00.css +886 -0
- package/dist/css/chemstruc-graph-87868f791bf92fb80db9.css +29 -0
- package/dist/css/main-2e6725ec1b56da516cee.css +256 -0
- package/dist/html-editor-draft.js +2 -0
- package/dist/html-editor-draft.js.LICENSE.txt +5 -0
- package/dist/images/logo-06f6a5d8.png +0 -0
- package/dist/index.html +4 -0
- package/dist/signature.js +2 -0
- package/dist/signature.js.LICENSE.txt +17 -0
- package/package.json +180 -0
- package/src/components/chart/antd/Chart.js +32 -0
- package/src/components/chart/antd/Chart10000.js +90 -0
- package/src/components/chart/antd/Max2DimLineChart.js +128 -0
- package/src/components/chart/antd/PieChart1.js +54 -0
- package/src/components/chart/antd/PieChart2.js +56 -0
- package/src/components/chart/antd/chart-utils.tsx +50 -0
- package/src/components/chart/antd/column-chart-sub.tsx +67 -0
- package/src/components/chart/antd/line-chart-sub.tsx +65 -0
- package/src/components/chart/antd/pie-chart-sub.tsx +54 -0
- package/src/components/chart/antd/statview-d2-chart.tsx +125 -0
- package/src/components/chart/statview-l2-chart.tsx +69 -0
- package/src/components/controls/action/index.css +9 -0
- package/src/components/controls/action/index.tsx +228 -0
- package/src/components/controls/action/utils.tsx +122 -0
- package/src/components/controls/auto-complete/index.tsx +80 -0
- package/src/components/controls/cascader/index.js +97 -0
- package/src/components/controls/chemstruc/graph.tsx +150 -0
- package/src/components/controls/chemstruc/index.css +28 -0
- package/src/components/controls/collapse-card/index.css +9 -0
- package/src/components/controls/collapse-card/index.tsx +59 -0
- package/src/components/controls/color-picker/index.css +27 -0
- package/src/components/controls/color-picker/index.tsx +88 -0
- package/src/components/controls/cquery/cquick-button.tsx +117 -0
- package/src/components/controls/date-picker/index.tsx +141 -0
- package/src/components/controls/entity-select/entity-select.tsx +277 -0
- package/src/components/controls/entity-select/index.css +6 -0
- package/src/components/controls/entity-select/popover-entity-select.tsx +112 -0
- package/src/components/controls/entry-control.tsx +240 -0
- package/src/components/controls/enum-badge/index.tsx +28 -0
- package/src/components/controls/enum-tag/index.tsx +30 -0
- package/src/components/controls/file-view/drawer-file-view.tsx +69 -0
- package/src/components/controls/file-view/index.tsx +145 -0
- package/src/components/controls/html-editor/draft.tsx +161 -0
- package/src/components/controls/html-editor/tinymce.js +55 -0
- package/src/components/controls/input-number/index.tsx +101 -0
- package/src/components/controls/input-range/index.tsx +48 -0
- package/src/components/controls/password-setter/index.css +3 -0
- package/src/components/controls/password-setter/index.js +70 -0
- package/src/components/controls/progress/index.tsx +61 -0
- package/src/components/controls/relation-existion/index.css +4 -0
- package/src/components/controls/relation-existion/index.tsx +108 -0
- package/src/components/controls/rfield/index.css +4 -0
- package/src/components/controls/rfield/index.tsx +161 -0
- package/src/components/controls/signature/index.tsx +162 -0
- package/src/components/controls/steps/index.tsx +58 -0
- package/src/components/controls/text/ellipsis-text.tsx +70 -0
- package/src/components/controls/upload/index.tsx +122 -0
- package/src/components/controls/view-control.tsx +177 -0
- package/src/components/detail/button/cquery-button-bar.tsx +112 -0
- package/src/components/detail/button/index.css +43 -0
- package/src/components/detail/button/submit-button-bar.tsx +151 -0
- package/src/components/detail/dtmpl.css +53 -0
- package/src/components/detail/edit/dtmpl-edit.tsx +218 -0
- package/src/components/detail/edit/fields-edit-card.tsx +103 -0
- package/src/components/detail/edit/modal-dtmpl-edit.tsx +198 -0
- package/src/components/detail/edit/modal-row-edit.tsx +72 -0
- package/src/components/detail/edit/post-result/index.tsx +52 -0
- package/src/components/detail/edit/row-edit-card.tsx +125 -0
- package/src/components/detail/edit/row-editor.tsx +71 -0
- package/src/components/detail/rightbar/index.css +35 -0
- package/src/components/detail/rightbar/index.tsx +76 -0
- package/src/components/detail/view/act-dtmpl-view.tsx +155 -0
- package/src/components/detail/view/dtmpl-view.tsx +143 -0
- package/src/components/detail/view/field-view-group.tsx +73 -0
- package/src/components/detail/view/modal-dtmpl-view.tsx +56 -0
- package/src/components/detail/view/snapshot-timeline.tsx +130 -0
- package/src/components/exportor/export-frame.css +3 -0
- package/src/components/exportor/export-frame.tsx +194 -0
- package/src/components/exportor/index.tsx +60 -0
- package/src/components/form/criteria-form.tsx +241 -0
- package/src/components/form/dtmpl-form.css +4 -0
- package/src/components/form/dtmpl-form.tsx +272 -0
- package/src/components/form/field-group-form.tsx +75 -0
- package/src/components/form/fields-form.tsx +51 -0
- package/src/components/form/form-Item-group.tsx +99 -0
- package/src/components/form/index.css +13 -0
- package/src/components/import/excel-import.tsx +316 -0
- package/src/components/import/index.css +54 -0
- package/src/components/import/template-builder.js +474 -0
- package/src/components/import/template.css +51 -0
- package/src/components/layout/MainPage.tsx +230 -0
- package/src/components/layout/footer/index.css +6 -0
- package/src/components/layout/footer/index.js +17 -0
- package/src/components/layout/header/index.css +86 -0
- package/src/components/layout/header/index.tsx +58 -0
- package/src/components/layout/menu/block.tsx +88 -0
- package/src/components/layout/menu/l2menu-message-bar.tsx +118 -0
- package/src/components/layout/menu/l2menu-quick-bar.tsx +132 -0
- package/src/components/layout/menu/menu-2layers.tsx +92 -0
- package/src/components/layout/menu/menu-render.tsx +49 -0
- package/src/components/layout/menu/reset-password.tsx +185 -0
- package/src/components/layout/menu/user-bar.tsx +97 -0
- package/src/components/layout/menu/userinfo-bar.tsx +70 -0
- package/src/components/layout/sidebar/index.css +26 -0
- package/src/components/layout/sidebar/index.tsx +38 -0
- package/src/components/login.js +137 -0
- package/src/components/module/criteria-page.tsx +175 -0
- package/src/components/module/dtmpl-page.tsx +70 -0
- package/src/components/module/ltmpl-page.tsx +181 -0
- package/src/components/routable/dtmpl-route.tsx +96 -0
- package/src/components/routable/import-route.tsx +28 -0
- package/src/components/routable/ltmpl-route.tsx +158 -0
- package/src/components/table/act-table.tsx +635 -0
- package/src/components/table/column/column-selector.tsx +79 -0
- package/src/components/table/column/index.css +14 -0
- package/src/components/table/index.css +45 -0
- package/src/components/table/l2-act-table.tsx +85 -0
- package/src/components/table/modal-select-table.tsx +248 -0
- package/src/components/table/pagination.css +15 -0
- package/src/components/table/pagination.tsx +72 -0
- package/src/components/table/query-table.tsx +331 -0
- package/src/components/table/relation-table.tsx +600 -0
- package/src/components/table/select-table.tsx +247 -0
- package/src/components/table/selected-rows-card.tsx +62 -0
- package/src/components/table/stat/restat.tsx +79 -0
- package/src/components/table/table-util.tsx +33 -0
- package/src/components/tmpl/control-type-supportor.tsx +97 -0
- package/src/components/tmpl/hc-data-source.tsx +230 -0
- package/src/components/tmpl/hcservice-v3.tsx +624 -0
- package/src/components/tmpl/interface.tsx +308 -0
- package/src/components/tmpl/superagent.js +93 -0
- package/src/components/tmpl/tmpl-config-analysis.tsx +111 -0
- package/src/components/units/EncryptUtils.js +38 -0
- package/src/components/units/image.d.ts +8 -0
- package/src/components/units/index.tsx +536 -0
- package/src/components/units/logo.png +0 -0
- package/src/components/units/storage.js +3 -0
- package/src/components/welcome/HCWelcome.js +232 -0
- package/src/components/welcome/index.css +13 -0
- package/src/components/welcome/logo.png +0 -0
- package/src/components/welcome/quick-entrance.tsx +77 -0
- package/src/components/welcome/workbench.tsx +76 -0
- package/src/index.js +4 -0
- package/src/style/common.css +79 -0
- package/src/style/coverstyle.css +49 -0
- package/src/style/transstyle.css +24 -0
- package/tsconfig.json +106 -0
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Button, Card, Checkbox, Col, Collapse, Divider, Popconfirm, Popover, Row, Space, Table, Tooltip} from 'antd';
|
|
3
|
+
import {
|
|
4
|
+
AlignLeftOutlined,
|
|
5
|
+
CalculatorOutlined,
|
|
6
|
+
DownloadOutlined,
|
|
7
|
+
EditOutlined,
|
|
8
|
+
EyeInvisibleOutlined,
|
|
9
|
+
EyeOutlined,
|
|
10
|
+
FundOutlined,
|
|
11
|
+
LineChartOutlined,
|
|
12
|
+
MenuOutlined,
|
|
13
|
+
PlusOutlined,
|
|
14
|
+
ReloadOutlined,
|
|
15
|
+
RetweetOutlined,
|
|
16
|
+
TableOutlined,
|
|
17
|
+
UploadOutlined,
|
|
18
|
+
CopyOutlined
|
|
19
|
+
} from '@ant-design/icons';
|
|
20
|
+
import "./index.css"
|
|
21
|
+
import {
|
|
22
|
+
ActTableViewModel,
|
|
23
|
+
ColumnConfig,
|
|
24
|
+
DtmplConfig, DtmplData,
|
|
25
|
+
LtmplConfig,
|
|
26
|
+
QueryKey,
|
|
27
|
+
SelectedRow,
|
|
28
|
+
TmplBaseProps,
|
|
29
|
+
AddOrUpdate
|
|
30
|
+
} from "../tmpl/interface";
|
|
31
|
+
import TableUnits from "./table-util";
|
|
32
|
+
import SupportInputTypes from '../tmpl/control-type-supportor';
|
|
33
|
+
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
34
|
+
import QueryTable from './query-table';
|
|
35
|
+
import CriteriaForm from "../form/criteria-form";
|
|
36
|
+
import ViewControl from "../controls/view-control";
|
|
37
|
+
import Units from "../units";
|
|
38
|
+
import ColumnSelector from './column/column-selector';
|
|
39
|
+
import ExportFrame from '../exportor/export-frame';
|
|
40
|
+
import {SortableHandle} from 'react-sortable-hoc';
|
|
41
|
+
import L2ActTable from "./l2-act-table";
|
|
42
|
+
import StatViewL2Chart from '../chart/statview-l2-chart'
|
|
43
|
+
import Action from '../controls/action'
|
|
44
|
+
import Restat from "./stat/restat"
|
|
45
|
+
import ActionUtils from '../controls/action/utils'
|
|
46
|
+
import CquickButton from "../controls/cquery/cquick-button";
|
|
47
|
+
const DragHandle = SortableHandle(() => <MenuOutlined style={{cursor: 'grab', color: '#999'}}/>);
|
|
48
|
+
const {Panel} = Collapse;
|
|
49
|
+
|
|
50
|
+
type Level = 'l1' | 'l2'
|
|
51
|
+
|
|
52
|
+
const defualtDisabledColIds:string[]=['20000']
|
|
53
|
+
|
|
54
|
+
interface ActTableProps extends TmplBaseProps {
|
|
55
|
+
criteriaData: object,
|
|
56
|
+
ltmplConfig: LtmplConfig,
|
|
57
|
+
menuId?:string,
|
|
58
|
+
showView?: (code: string) => void,
|
|
59
|
+
doCreate?: () => void,
|
|
60
|
+
doEdit?: (code: string,mode:AddOrUpdate) => void,
|
|
61
|
+
doSearch?: (params: object) => void,
|
|
62
|
+
level?: Level,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
interface ActTableStat {
|
|
66
|
+
tableColumns: object[];
|
|
67
|
+
sortedColConfigs: ColumnConfig[];
|
|
68
|
+
queryKey: QueryKey;
|
|
69
|
+
loading: boolean;
|
|
70
|
+
criteriaData: object;
|
|
71
|
+
selectedRows: SelectedRow[];
|
|
72
|
+
selectedDatas:DtmplData[];
|
|
73
|
+
hiddenColIds?: string[];
|
|
74
|
+
drillingColIds?: string[];
|
|
75
|
+
disabledColIds: string[];
|
|
76
|
+
hiddenRowCodes?: string[];
|
|
77
|
+
viewModels?: ActTableViewModel[];
|
|
78
|
+
showL2ActTable: boolean;
|
|
79
|
+
showL2Chart: boolean;
|
|
80
|
+
// drillingPopoverVisible:boolean;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
87
|
+
state = {
|
|
88
|
+
tableColumns: undefined,
|
|
89
|
+
sortedColConfigs: undefined,
|
|
90
|
+
queryKey: undefined,
|
|
91
|
+
loading: true,
|
|
92
|
+
criteriaData: undefined,
|
|
93
|
+
disableCols: undefined,
|
|
94
|
+
hiddenColIds: defualtDisabledColIds,
|
|
95
|
+
selectedRows: [],
|
|
96
|
+
selectedDatas:[],
|
|
97
|
+
hiddenRowCodes: [],
|
|
98
|
+
viewModels: [],
|
|
99
|
+
drillingColIds: undefined,
|
|
100
|
+
disabledColIds: undefined,
|
|
101
|
+
showL2ActTable: false,
|
|
102
|
+
showL2Chart: false,
|
|
103
|
+
//drillingPopoverVisible:false,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static defaultProps={
|
|
107
|
+
criteriaData:{}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
loadData = async (hiddenColIds: string[], hiddenRowCodes: string[], sortedColConfigs: ColumnConfig[]) => {
|
|
111
|
+
const {sourceId, criteriaData, ltmplConfig, mainCode, level} = this.props;
|
|
112
|
+
if (!ltmplConfig) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// console.log('acttable location criteriaData:', criteriaData);
|
|
116
|
+
// console.log('acttable ltmplConfig:', ltmplConfig);
|
|
117
|
+
this.setState({
|
|
118
|
+
loading: true,
|
|
119
|
+
})
|
|
120
|
+
let disabledColIds: string[] = [];
|
|
121
|
+
let hiddenColIds_ = [...hiddenColIds];
|
|
122
|
+
if (criteriaData && criteriaData['drillingColIds']) {
|
|
123
|
+
let dColIds = [...criteriaData['drillingColIds']];
|
|
124
|
+
ltmplConfig.columns.forEach((item) => {
|
|
125
|
+
if (item.statColType == 'dimension' && !dColIds.includes(item.id) && !hiddenColIds_.includes(item.id)) {
|
|
126
|
+
hiddenColIds_.push(item.id);
|
|
127
|
+
disabledColIds.push(item.id);
|
|
128
|
+
}
|
|
129
|
+
if (item.statColType == 'dimension' && !dColIds.includes(item.id) && !disabledColIds.includes(item.id)) {
|
|
130
|
+
disabledColIds.push(item.id);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
hiddenColIds_ = hiddenColIds_.filter((id) => {
|
|
134
|
+
return !dColIds.includes(id)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/** 构建column **/
|
|
138
|
+
let tableColumns = this.buildTableColumns(ltmplConfig, hiddenColIds_, hiddenRowCodes, sortedColConfigs);
|
|
139
|
+
|
|
140
|
+
const {defaultPageSize, buttons} = ltmplConfig;
|
|
141
|
+
|
|
142
|
+
let pageInfo = {
|
|
143
|
+
pageNo: 1,
|
|
144
|
+
pageSize: defaultPageSize ? defaultPageSize : 10,
|
|
145
|
+
virtualEndPageNo: undefined,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** 构建 dataSource **/
|
|
149
|
+
//构建过滤条件
|
|
150
|
+
let queryKey: QueryKey
|
|
151
|
+
if (level && level == 'l2') {
|
|
152
|
+
queryKey = await HcserviceV3.requestL2LtmplQueryKey( sourceId, {
|
|
153
|
+
...criteriaData, ...pageInfo,
|
|
154
|
+
mainCode
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
queryKey = await HcserviceV3.requestLtmplQueryKey( sourceId, {
|
|
158
|
+
...criteriaData, ...pageInfo,
|
|
159
|
+
mainCode
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
this.setState({
|
|
165
|
+
disabledColIds,
|
|
166
|
+
hiddenColIds: hiddenColIds_,
|
|
167
|
+
hiddenRowCodes,
|
|
168
|
+
sortedColConfigs,
|
|
169
|
+
tableColumns,
|
|
170
|
+
queryKey,
|
|
171
|
+
criteriaData,
|
|
172
|
+
loading: false,
|
|
173
|
+
showL2Chart:false,
|
|
174
|
+
selectedRows: [],
|
|
175
|
+
selectedDatas:[],
|
|
176
|
+
viewModels: (this.state.viewModels.length > 0 ? this.state.viewModels : ['table']),
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
buildTableColumns = (ltmplConfig: LtmplConfig, hiddenColIds: string[], hiddenRowCodes: string[], sortedColConfigs: ColumnConfig[]) => {
|
|
181
|
+
const {mainCode, showView, doEdit,menuId} = this.props
|
|
182
|
+
const {buttons} = ltmplConfig;
|
|
183
|
+
let tableColumns = [];
|
|
184
|
+
let s = 0;
|
|
185
|
+
|
|
186
|
+
let colConfigs = sortedColConfigs ? sortedColConfigs : ltmplConfig.columns;
|
|
187
|
+
|
|
188
|
+
colConfigs.forEach((item) => {
|
|
189
|
+
let column = {};
|
|
190
|
+
if (!hiddenColIds || !hiddenColIds.includes(item.id)) {
|
|
191
|
+
tableColumns.push(column);
|
|
192
|
+
}
|
|
193
|
+
column['title'] = item.title;
|
|
194
|
+
column['dataIndex'] = item.id;
|
|
195
|
+
// column['ellipsis']= true;
|
|
196
|
+
s++;
|
|
197
|
+
let itemType = SupportInputTypes.getSupportControlType(item);
|
|
198
|
+
if (s < 10 && item.title != '操作' && item.title != '序号') {
|
|
199
|
+
if (hiddenColIds.includes('10000')) {
|
|
200
|
+
TableUnits.sort(column, itemType);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//TableUnits.render(column, item);
|
|
204
|
+
//特殊列处理
|
|
205
|
+
//序号
|
|
206
|
+
if (item.title === "序号") {
|
|
207
|
+
//item.fixed='left';
|
|
208
|
+
column['render'] = (text, record, index) => (
|
|
209
|
+
<label>{index + 1}</label>
|
|
210
|
+
)
|
|
211
|
+
item['sorter'] = undefined;
|
|
212
|
+
} else if (item.id == '10000') {
|
|
213
|
+
column['title'] = <Tooltip title={'拖拽排序'}>{item.title}</Tooltip>;
|
|
214
|
+
column['width'] = 30;
|
|
215
|
+
column['dataIndex'] = item.id;
|
|
216
|
+
column['className'] = 'drag-visible';
|
|
217
|
+
column['render'] = () => <DragHandle/>;
|
|
218
|
+
} else if (item.id == '20000') {//隐藏
|
|
219
|
+
column['align'] = 'center';
|
|
220
|
+
column['width'] = 14;
|
|
221
|
+
column['title'] = <>{hiddenRowCodes.length > 0 ?
|
|
222
|
+
<Tooltip title={'取消隐藏'}><Button style={{marginRight: '0px'}}
|
|
223
|
+
size="small" shape={'circle'}
|
|
224
|
+
icon={<EyeOutlined/>} type={'text'}
|
|
225
|
+
onClick={() => this.unHiden()}>
|
|
226
|
+
</Button></Tooltip> : ''}</>;
|
|
227
|
+
column['render'] = (text, record) => (<Tooltip title={'隐藏'}> <Button style={{marginRight: '0px'}}
|
|
228
|
+
icon={<EyeInvisibleOutlined/>}
|
|
229
|
+
type="dashed"
|
|
230
|
+
size="small"
|
|
231
|
+
onClick={() => this.onHide(record.code)}>
|
|
232
|
+
</Button></Tooltip>);
|
|
233
|
+
} else if (item.title === "操作") {
|
|
234
|
+
column['fixed'] = 'right';
|
|
235
|
+
column['align']='center';
|
|
236
|
+
column['className']='opsColumn';
|
|
237
|
+
column['title'] = <>操 作</>
|
|
238
|
+
column['render'] = (text, record) => (
|
|
239
|
+
<Space size={[0, 4]} wrap>
|
|
240
|
+
{buttons.includes('detail') && showView ?
|
|
241
|
+
<Button
|
|
242
|
+
size="small"
|
|
243
|
+
type="primary"
|
|
244
|
+
icon={<AlignLeftOutlined/>}
|
|
245
|
+
onClick={() => showView(record.code)}>
|
|
246
|
+
</Button>
|
|
247
|
+
: ""}
|
|
248
|
+
{buttons.includes('dtmplEdit') && doEdit
|
|
249
|
+
&& (!ltmplConfig.editAction || ActionUtils.isShow(ltmplConfig.editAction,[record],undefined))?
|
|
250
|
+
< Button
|
|
251
|
+
size="small"
|
|
252
|
+
type="dashed"
|
|
253
|
+
icon={<EditOutlined/>}
|
|
254
|
+
onClick={() => doEdit(record.code,'update')}>
|
|
255
|
+
</Button>: ""}
|
|
256
|
+
{buttons.includes('copy') && doEdit
|
|
257
|
+
//&& (!ltmplConfig.editAction || ActionUtils.isShow(ltmplConfig.editAction,[record],undefined))
|
|
258
|
+
?
|
|
259
|
+
<Tooltip title={'复制'}>< Button
|
|
260
|
+
size="small"
|
|
261
|
+
type="dashed"
|
|
262
|
+
icon={<CopyOutlined />}
|
|
263
|
+
onClick={() => doEdit(record.code,'copy')}>
|
|
264
|
+
</Button></Tooltip> : ""}
|
|
265
|
+
{ltmplConfig.ractions ? ltmplConfig.ractions.map((raction) => {
|
|
266
|
+
return <Button
|
|
267
|
+
key={raction.id}
|
|
268
|
+
size="small"
|
|
269
|
+
type="dashed"
|
|
270
|
+
href={`#/${raction.id}/act-table?mainCode=${record.code}&menuId=${menuId}`}>
|
|
271
|
+
{raction.title}
|
|
272
|
+
</Button>
|
|
273
|
+
}) : ""}
|
|
274
|
+
{ltmplConfig.rowActions && ltmplConfig.rowActions.length > 0 ?
|
|
275
|
+
ltmplConfig.rowActions.map((action) => {
|
|
276
|
+
return <Action key={action.id} data={[record]} actionConfig={action} doAction={this.doRowAction} buttonSize={'small'} serial={1}></Action>
|
|
277
|
+
}) : ""}
|
|
278
|
+
{ltmplConfig.jumps && ltmplConfig.jumps.length > 0 ?
|
|
279
|
+
ltmplConfig.jumps.map((jump) => {
|
|
280
|
+
return <Button key={jump.id} size="small" type="dashed"
|
|
281
|
+
onClick={() => this.doRowJump(jump.id, record.code)}
|
|
282
|
+
>{jump.title}</Button>;
|
|
283
|
+
}) : ""}
|
|
284
|
+
{ltmplConfig.rowCQuerys && ltmplConfig.rowCQuerys.length > 0 ?
|
|
285
|
+
ltmplConfig.rowCQuerys.map((cquery) => {
|
|
286
|
+
// return <Button key={cQuery.id} size="small" type="dashed"
|
|
287
|
+
// onClick={() => this.doRowCQuery(cQuery.id, record.code)}
|
|
288
|
+
// >{cQuery.title}</Button>;
|
|
289
|
+
console.log("record record",record);
|
|
290
|
+
return <CquickButton key={cquery.id} size={"small"}
|
|
291
|
+
// onClick={() => doCQuery(cquery.id)}
|
|
292
|
+
disabled={false} cQueryConfig={cquery} mainCode={cquery.mainCodeColId?record[cquery.mainCodeColId]:record.code}/>
|
|
293
|
+
}) : ""}
|
|
294
|
+
</Space>);
|
|
295
|
+
} else {
|
|
296
|
+
column['className']='opsColumn';
|
|
297
|
+
column['render'] = (text, record) => {
|
|
298
|
+
return <ViewControl fieldConfig={item} value={record[item.id]} holderType={'table'}/>
|
|
299
|
+
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
return tableColumns
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
async componentDidMount() {
|
|
308
|
+
const {ltmplConfig} = this.props;
|
|
309
|
+
let sortedColConfigs = undefined;
|
|
310
|
+
if (ltmplConfig) {
|
|
311
|
+
sortedColConfigs = [{id: '10000', title: '排序'}, ...ltmplConfig.columns, {id: '20000', title: '隐藏'}]
|
|
312
|
+
}
|
|
313
|
+
this.loadData(defualtDisabledColIds, [], sortedColConfigs);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async componentDidUpdate(prevProps) {
|
|
317
|
+
const { sourceId, criteriaData, ltmplConfig} = this.props;
|
|
318
|
+
let {ltmplConfig: preLtmplConfig, criteriaData: preCriteriaData} = prevProps;
|
|
319
|
+
|
|
320
|
+
let {hiddenColIds, sortedColConfigs} = this.state;
|
|
321
|
+
|
|
322
|
+
console.log("UnitscriteriaData)",Units.transQueryParamsToStr(criteriaData));
|
|
323
|
+
console.log("preCriteriaData)",Units.transQueryParamsToStr(preCriteriaData));
|
|
324
|
+
console.log("preCriteriaData) bool",Units.transQueryParamsToStr(preCriteriaData)==Units.transQueryParamsToStr(criteriaData));
|
|
325
|
+
if (ltmplConfig && (!preLtmplConfig || ltmplConfig.id != preLtmplConfig.id) || (Units.transQueryParamsToStr(criteriaData) != Units.transQueryParamsToStr(preCriteriaData))) {
|
|
326
|
+
|
|
327
|
+
if (ltmplConfig.id == preLtmplConfig.id) {
|
|
328
|
+
this.loadData(hiddenColIds, [], sortedColConfigs);
|
|
329
|
+
} else {
|
|
330
|
+
let sColConfigs = undefined;
|
|
331
|
+
if (ltmplConfig) {
|
|
332
|
+
sColConfigs = [{id: '10000', title: '排序'}, ...ltmplConfig.columns, {id: '20000', title: '隐藏'}]
|
|
333
|
+
}
|
|
334
|
+
this.setState({
|
|
335
|
+
viewModels: ['table'],
|
|
336
|
+
})
|
|
337
|
+
this.loadData(defualtDisabledColIds, [], sColConfigs);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
handleShowChart = () => {
|
|
344
|
+
this.setState({
|
|
345
|
+
showL2Chart: !this.state.showL2Chart
|
|
346
|
+
})
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
handleDataAnalysis = () => {
|
|
350
|
+
|
|
351
|
+
this.setState({
|
|
352
|
+
showL2ActTable: !this.state.showL2ActTable,
|
|
353
|
+
})
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
unHiden = () => {
|
|
357
|
+
const {ltmplConfig,} = this.props
|
|
358
|
+
const {hiddenColIds, sortedColConfigs} = this.state;
|
|
359
|
+
this.setState({
|
|
360
|
+
hiddenRowCodes: [],
|
|
361
|
+
tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, [], sortedColConfigs),
|
|
362
|
+
})
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
onHide = (code: string) => {
|
|
366
|
+
const {ltmplConfig,} = this.props
|
|
367
|
+
const {hiddenRowCodes, hiddenColIds, sortedColConfigs} = this.state;
|
|
368
|
+
let hiddenCodes = [...hiddenRowCodes, code];
|
|
369
|
+
this.setState({
|
|
370
|
+
hiddenRowCodes: hiddenCodes,
|
|
371
|
+
tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenCodes, sortedColConfigs),
|
|
372
|
+
})
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
changeViewModel = (viewModels) => {
|
|
376
|
+
this.setState({
|
|
377
|
+
viewModels
|
|
378
|
+
})
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
changeHiddenColumns = (hiddenColIds: string[]) => {
|
|
382
|
+
const {ltmplConfig} = this.props
|
|
383
|
+
const {hiddenRowCodes, sortedColConfigs} = this.state;
|
|
384
|
+
this.setState({
|
|
385
|
+
showL2Chart:false,
|
|
386
|
+
hiddenColIds,
|
|
387
|
+
tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenRowCodes, sortedColConfigs),
|
|
388
|
+
})
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
doSelectedAction = async (actionId: string,codes,params:object) => {
|
|
392
|
+
const {selectedRows} = this.state;
|
|
393
|
+
this.doAction(actionId, selectedRows,params);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
doAction = async (actionId: string, selectedRows: SelectedRow[],params) => {
|
|
397
|
+
const { sourceId} = this.props;
|
|
398
|
+
const {hiddenColIds, hiddenRowCodes, sortedColConfigs} = this.state;
|
|
399
|
+
this.setState({
|
|
400
|
+
loading: true,
|
|
401
|
+
})
|
|
402
|
+
let result: boolean = await HcserviceV3.postActions( actionId, selectedRows,params);
|
|
403
|
+
if (result) {//重新加载数据
|
|
404
|
+
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
|
|
405
|
+
} else {
|
|
406
|
+
this.setState({
|
|
407
|
+
loading: false,
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
doRowAction = async (actionId: string, codes: string[],params:object) => {
|
|
413
|
+
this.doAction(actionId, [{title: undefined, code:codes[0]}],params);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
doDelete = async () => {
|
|
417
|
+
const { sourceId} = this.props;
|
|
418
|
+
const {selectedRows, hiddenColIds, hiddenRowCodes, sortedColConfigs} = this.state;
|
|
419
|
+
this.setState({
|
|
420
|
+
loading: true,
|
|
421
|
+
})
|
|
422
|
+
let result: boolean = await HcserviceV3.deleteData(sourceId, selectedRows);
|
|
423
|
+
if (result) {//重新加载数据
|
|
424
|
+
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
|
|
425
|
+
} else {
|
|
426
|
+
this.setState({
|
|
427
|
+
loading: false,
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// doCQuery=(cqueryId: string, selectedRow: SelectedRow)=>{
|
|
433
|
+
//
|
|
434
|
+
//
|
|
435
|
+
// }
|
|
436
|
+
// doRowCQuery = async (cqueryId: string, code: string) => {
|
|
437
|
+
// this.doCQuery(cqueryId, {title: undefined, code})
|
|
438
|
+
// }
|
|
439
|
+
|
|
440
|
+
doSelectedCQuery = async (cqueryId: string) => {
|
|
441
|
+
// const {selectedRows} = this.state;
|
|
442
|
+
// this.doCQuery(cqueryId, selectedRows[0])
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
doJump = async (jumpId: string, selectedRows: SelectedRow[]) => {
|
|
446
|
+
const { sourceId} = this.props;
|
|
447
|
+
const {hiddenColIds, hiddenRowCodes, sortedColConfigs} = this.state;
|
|
448
|
+
let result: boolean = await HcserviceV3.postJumps( sourceId, jumpId, selectedRows);
|
|
449
|
+
if (result) {//重新加载数据
|
|
450
|
+
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
doRowJump = async (jumpId: string, code: string) => {
|
|
455
|
+
this.doJump(jumpId, [{title: undefined, code}])
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
doSelectedJump = async (jumpId: string) => {
|
|
459
|
+
const {selectedRows} = this.state;
|
|
460
|
+
this.doJump(jumpId, selectedRows)
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
changeRowSelection = (selectedRows: SelectedRow[],selectedDatas:DtmplData[]) => {
|
|
467
|
+
this.setState({
|
|
468
|
+
selectedRows,
|
|
469
|
+
selectedDatas,
|
|
470
|
+
})
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
onChangeColSort = (sortedColConfigs: ColumnConfig[]) => {
|
|
474
|
+
const {ltmplConfig} = this.props
|
|
475
|
+
const {hiddenRowCodes, hiddenColIds} = this.state;
|
|
476
|
+
this.setState({
|
|
477
|
+
sortedColConfigs,
|
|
478
|
+
tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenRowCodes, sortedColConfigs),
|
|
479
|
+
})
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
renderHeaderButtons = () => {
|
|
485
|
+
let {hiddenColIds, queryKey, viewModels, sortedColConfigs, disabledColIds, showL2Chart, showL2ActTable} = this.state;
|
|
486
|
+
const {ltmplConfig, sourceId, doCreate, doSearch,menuId} = this.props;
|
|
487
|
+
let {buttons} = ltmplConfig;
|
|
488
|
+
|
|
489
|
+
return <>
|
|
490
|
+
{buttons.includes("dtmplAdd") && doCreate ?
|
|
491
|
+
<Tooltip title={'创建'}>
|
|
492
|
+
<Button
|
|
493
|
+
onClick={doCreate}>
|
|
494
|
+
<PlusOutlined/>
|
|
495
|
+
</Button> </Tooltip> : ''}
|
|
496
|
+
{buttons.includes("importLtmplExcel") ? <Tooltip title={'导入'}> <Button
|
|
497
|
+
href={`#/${sourceId}/importer?menuId=${menuId}`} target={'_blank'}>
|
|
498
|
+
<UploadOutlined/>
|
|
499
|
+
</Button></Tooltip> : ''}
|
|
500
|
+
<Popover
|
|
501
|
+
content={<ExportFrame //导出组件
|
|
502
|
+
queryKey={queryKey}
|
|
503
|
+
title={ltmplConfig.title}
|
|
504
|
+
/>}
|
|
505
|
+
title={"导出"}
|
|
506
|
+
placement="bottomRight"
|
|
507
|
+
trigger="click">
|
|
508
|
+
<Tooltip title={'导出'}><Button
|
|
509
|
+
style={{
|
|
510
|
+
display: buttons.includes("exportLtmplExcel") ? "inline" : "none",
|
|
511
|
+
marginLeft: '5px'
|
|
512
|
+
}} //为了点击到没有导出模块,使组件不致销毁,丢失导出数据
|
|
513
|
+
>
|
|
514
|
+
<DownloadOutlined/>
|
|
515
|
+
</Button></Tooltip>
|
|
516
|
+
</Popover>
|
|
517
|
+
{buttons.includes("showChart") ? <Tooltip title={showL2Chart ? '隐藏图表' : '展示图表'}><Button
|
|
518
|
+
onClick={this.handleShowChart}>
|
|
519
|
+
<LineChartOutlined/>
|
|
520
|
+
</Button></Tooltip> : ""
|
|
521
|
+
|
|
522
|
+
}
|
|
523
|
+
{buttons.includes("analysis") ? <Tooltip title={showL2ActTable ? '隐藏数据分析' : '展示数据分析'}><Button
|
|
524
|
+
onClick={this.handleDataAnalysis}>
|
|
525
|
+
<FundOutlined/>
|
|
526
|
+
</Button></Tooltip> : ""}
|
|
527
|
+
{buttons.includes("reStat") ? <Restat fields={ltmplConfig.reStatParams} sourceId={sourceId} onfinish={()=>doSearch(null)}></Restat> : ""}
|
|
528
|
+
<Popover content={<Checkbox.Group value={viewModels} onChange={this.changeViewModel}>
|
|
529
|
+
<Row style={{width: '120px'}}>
|
|
530
|
+
<Col span={24}><Checkbox value={'table'}>表格</Checkbox></Col>
|
|
531
|
+
<Col span={24}><Checkbox value={'verticalList'}>纵向列表</Checkbox></Col>
|
|
532
|
+
{/*<Col span={24}><Checkbox value={'horizontalList'}>横向列表</Checkbox></Col>*/}
|
|
533
|
+
</Row>
|
|
534
|
+
</Checkbox.Group>} title="视图" placement="bottomRight"
|
|
535
|
+
trigger="click">
|
|
536
|
+
<Tooltip title={'选择视图'}>
|
|
537
|
+
<Button><RetweetOutlined/></Button>
|
|
538
|
+
</Tooltip>
|
|
539
|
+
</Popover>
|
|
540
|
+
<Popover content={<ColumnSelector columns={sortedColConfigs}
|
|
541
|
+
disabledColIds={disabledColIds}
|
|
542
|
+
hiddenColIds={hiddenColIds}
|
|
543
|
+
onChangeColSort={this.onChangeColSort}
|
|
544
|
+
onChangeHiddenCols={this.changeHiddenColumns}/>}
|
|
545
|
+
title={'排序和选择列'}
|
|
546
|
+
placement="bottomRight"
|
|
547
|
+
trigger="click">
|
|
548
|
+
<Tooltip title={'点击排序和选择列'}>
|
|
549
|
+
<Button><TableOutlined/></Button>
|
|
550
|
+
</Tooltip>
|
|
551
|
+
</Popover>
|
|
552
|
+
{doSearch ?
|
|
553
|
+
<Button
|
|
554
|
+
className="hoverbig"
|
|
555
|
+
title="刷新"
|
|
556
|
+
onClick={() => {
|
|
557
|
+
doSearch(null)
|
|
558
|
+
}}>
|
|
559
|
+
<ReloadOutlined/>
|
|
560
|
+
</Button> : ""
|
|
561
|
+
}
|
|
562
|
+
</>
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
render() {
|
|
566
|
+
let {queryKey, tableColumns, criteriaData, loading, selectedRows,selectedDatas, hiddenRowCodes, viewModels, sortedColConfigs, hiddenColIds, showL2ActTable, showL2Chart} = this.state;
|
|
567
|
+
let { sourceId, ltmplConfig, doSearch} = this.props;
|
|
568
|
+
|
|
569
|
+
if (!ltmplConfig || !sourceId) {
|
|
570
|
+
return <>
|
|
571
|
+
<Card loading={loading}>
|
|
572
|
+
</Card>
|
|
573
|
+
<Table loading={loading}>
|
|
574
|
+
</Table>
|
|
575
|
+
</>
|
|
576
|
+
}
|
|
577
|
+
let {buttons, criterias, jumps, actions} = ltmplConfig
|
|
578
|
+
let displayCriteriaCard: boolean = false;
|
|
579
|
+
if (buttons.includes('delete') || (buttons.includes('query') && criterias && criterias.length > 0) ||
|
|
580
|
+
(actions && actions.length > 0) || (jumps && jumps.length > 0) || buttons.includes('drilling')) {
|
|
581
|
+
displayCriteriaCard = true;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
let columnConfigs = [];
|
|
585
|
+
if (sortedColConfigs) {
|
|
586
|
+
for (let colConfig of sortedColConfigs) {
|
|
587
|
+
if (!hiddenColIds.includes(colConfig.id)) {
|
|
588
|
+
columnConfigs.push(colConfig);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return (
|
|
593
|
+
<>
|
|
594
|
+
{buttons.includes("showChart") && showL2Chart ? <div>
|
|
595
|
+
<StatViewL2Chart queryKey={queryKey.key} ltmplConfig={ltmplConfig} hiddenColIds={hiddenColIds}
|
|
596
|
+
hiddenRowCodes={hiddenRowCodes}/>
|
|
597
|
+
{/*<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>*/}
|
|
598
|
+
</div> : ""
|
|
599
|
+
}
|
|
600
|
+
{buttons.includes("analysis") && showL2ActTable ? <div>
|
|
601
|
+
<L2ActTable innerQueryKey={queryKey.key} sourceId={sourceId}/>
|
|
602
|
+
<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>
|
|
603
|
+
</div> : ""
|
|
604
|
+
}
|
|
605
|
+
<div className="actTable">
|
|
606
|
+
<h3>
|
|
607
|
+
{ltmplConfig.title}
|
|
608
|
+
<p className="fr">
|
|
609
|
+
{this.renderHeaderButtons()}
|
|
610
|
+
</p>
|
|
611
|
+
</h3>
|
|
612
|
+
<CriteriaForm loading={loading} visible={displayCriteriaCard} selectedDatas={selectedDatas} selectedRows={selectedRows}
|
|
613
|
+
ltmplConfig={ltmplConfig} data={criteriaData}
|
|
614
|
+
doCQuery={this.doSelectedCQuery}
|
|
615
|
+
doAction={this.doSelectedAction}
|
|
616
|
+
doDelete={this.doDelete}
|
|
617
|
+
doJump={this.doSelectedJump}
|
|
618
|
+
doSearch={doSearch} />
|
|
619
|
+
{
|
|
620
|
+
loading ? "" :
|
|
621
|
+
<QueryTable viewModels={viewModels} columnConfigs={columnConfigs}
|
|
622
|
+
selectedRows={selectedRows}
|
|
623
|
+
columns={tableColumns}
|
|
624
|
+
hiddenRowCodes={hiddenRowCodes}
|
|
625
|
+
defaultPageSize={ltmplConfig.defaultPageSize}
|
|
626
|
+
queryKey={queryKey}
|
|
627
|
+
onChangeRowSelection={this.changeRowSelection}/>
|
|
628
|
+
}
|
|
629
|
+
</div>
|
|
630
|
+
</>
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export default ActTable;
|