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,79 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Checkbox, Col, Row} from "antd";
|
|
3
|
+
import {ColumnConfig,} from "../../tmpl/interface";
|
|
4
|
+
import '../pagination.css';
|
|
5
|
+
import {MenuOutlined} from '@ant-design/icons';
|
|
6
|
+
import {SortableContainer, SortableElement, SortableHandle} from 'react-sortable-hoc';
|
|
7
|
+
import {arrayMoveImmutable} from 'array-move';
|
|
8
|
+
|
|
9
|
+
interface ColumnSelectorProps {
|
|
10
|
+
columns: ColumnConfig[],
|
|
11
|
+
hiddenColIds: string[],
|
|
12
|
+
ignoredColIds?: string[],
|
|
13
|
+
disabledColIds?:string[],
|
|
14
|
+
onChangeHiddenCols?: (hiddenColIds: string[]) => void;
|
|
15
|
+
onChangeColSort?: (columns: ColumnConfig[]) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
interface ColumnSelectorStat {
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const SortableCheckbox = SortableElement(({value, index,disabledColIds}) => <Col key={index} span={24}>
|
|
23
|
+
<Checkbox disabled={disabledColIds.includes(value.id)} value={value.id}><DragHandle/> {value.title}</Checkbox>
|
|
24
|
+
</Col>);
|
|
25
|
+
const DragHandle = SortableHandle(() => <MenuOutlined style={{cursor: 'grab', color: '#999'}}/>);
|
|
26
|
+
const SortableGroupContainer = SortableContainer(({items, selected, onChange,disabledColIds}) => {
|
|
27
|
+
return <Checkbox.Group value={selected} onChange={onChange}>
|
|
28
|
+
<Row style={{width: '148px'}}>
|
|
29
|
+
{items.map((value, index) => (
|
|
30
|
+
<SortableCheckbox key={`item-${value.id}`} index={index} value={value} disabledColIds={disabledColIds}/>
|
|
31
|
+
))}
|
|
32
|
+
</Row>
|
|
33
|
+
</Checkbox.Group>
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
class ColumnSelector extends React.PureComponent<ColumnSelectorProps, ColumnSelectorStat> {
|
|
37
|
+
|
|
38
|
+
static defaultProps = {
|
|
39
|
+
ignoredColIds: [],
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onChange = (checkedValues) => {
|
|
43
|
+
const {onChangeHiddenCols, columns, ignoredColIds} = this.props;
|
|
44
|
+
console.log('checked = ', checkedValues);
|
|
45
|
+
const hiddenColIds = [];
|
|
46
|
+
for (let c of columns) {
|
|
47
|
+
if (checkedValues.length != 0 && !checkedValues.includes(c.id) && !ignoredColIds.includes(c.id)) {
|
|
48
|
+
hiddenColIds.push(c.id);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
onChangeHiddenCols(hiddenColIds);
|
|
52
|
+
}
|
|
53
|
+
onSortEnd = ({oldIndex, newIndex}) => {
|
|
54
|
+
const {columns,onChangeColSort} = this.props;
|
|
55
|
+
if (oldIndex !== newIndex) {
|
|
56
|
+
const newData = arrayMoveImmutable([].concat(columns), oldIndex, newIndex).filter(
|
|
57
|
+
el => !!el,
|
|
58
|
+
);
|
|
59
|
+
console.log('Sorted items: ', newData);
|
|
60
|
+
onChangeColSort(newData);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
const {hiddenColIds, columns,disabledColIds} = this.props;
|
|
66
|
+
const showColIds_str = [];
|
|
67
|
+
if (columns) {
|
|
68
|
+
for (let c of columns) {
|
|
69
|
+
if (!hiddenColIds || !hiddenColIds.includes(c.id)) {
|
|
70
|
+
showColIds_str.push(c.id);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return <SortableGroupContainer disabledColIds={disabledColIds} helperClass={'row-dragging'} items={columns} selected={showColIds_str} onChange={this.onChange}
|
|
75
|
+
onSortEnd={this.onSortEnd}/>
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default ColumnSelector;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.editTableList .ant-upload-list-picture .ant-upload-list-item{
|
|
2
|
+
width:110px;
|
|
3
|
+
}
|
|
4
|
+
.SearchForm{
|
|
5
|
+
padding: 8px;
|
|
6
|
+
background:#fff;
|
|
7
|
+
box-shadow:0 0 5px rgb(187, 182, 182);
|
|
8
|
+
border-radius: 3px
|
|
9
|
+
}
|
|
10
|
+
.actTable button {
|
|
11
|
+
margin-right: 5px
|
|
12
|
+
}
|
|
13
|
+
.actTable a{
|
|
14
|
+
margin-right: 5px
|
|
15
|
+
}
|
|
16
|
+
.actTable h3{
|
|
17
|
+
font-size: 18px
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.row-dragging {
|
|
21
|
+
background: #fafafa;
|
|
22
|
+
border: 1px solid #ccc;
|
|
23
|
+
z-index: 9999;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.row-dragging td {
|
|
27
|
+
padding: 14px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.row-dragging .drag-visible {
|
|
31
|
+
visibility: visible;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.opsColumn {
|
|
35
|
+
min-width: 80px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/*.collapse .ant-card-body {*/
|
|
39
|
+
/* padding:0px*/
|
|
40
|
+
/*}*/
|
|
41
|
+
|
|
42
|
+
/*.ant-card-head-title button{*/
|
|
43
|
+
/* font-size: 16px;*/
|
|
44
|
+
/* padding:0px;*/
|
|
45
|
+
/*}*/
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Card, Collapse, Table} from 'antd';
|
|
3
|
+
import {MenuOutlined} from '@ant-design/icons';
|
|
4
|
+
import "./index.css"
|
|
5
|
+
import {LtmplConfigRes, TmplBaseProps} from "../tmpl/interface";
|
|
6
|
+
import Units from "../units";
|
|
7
|
+
import {SortableHandle} from 'react-sortable-hoc';
|
|
8
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
9
|
+
import ActTable from './act-table'
|
|
10
|
+
|
|
11
|
+
interface L2ActTableProps extends TmplBaseProps {
|
|
12
|
+
innerQueryKey: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
interface L2ActTableStat {
|
|
16
|
+
ltmplConfigRes: LtmplConfigRes,
|
|
17
|
+
criteriaData:object,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class L2ActTable extends React.PureComponent<L2ActTableProps, L2ActTableStat> {
|
|
22
|
+
state = {
|
|
23
|
+
ltmplConfigRes: undefined,
|
|
24
|
+
criteriaData:{},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
loadData = async (criteriaData:object) => {
|
|
28
|
+
const { sourceId} = this.props;
|
|
29
|
+
let ltmplConfigRes = await HCDataSource.requestL2LtmplConfig( sourceId);
|
|
30
|
+
this.setState({
|
|
31
|
+
ltmplConfigRes,
|
|
32
|
+
criteriaData
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async componentDidMount() {
|
|
37
|
+
const {criteriaData} = this.state;
|
|
38
|
+
const { sourceId,innerQueryKey} = this.props;
|
|
39
|
+
criteriaData['innerQueryKey'] = innerQueryKey;
|
|
40
|
+
criteriaData['sourceId'] = sourceId;
|
|
41
|
+
this.loadData(criteriaData);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async componentDidUpdate(prevProps) {
|
|
45
|
+
const {sourceId, innerQueryKey} = this.props;
|
|
46
|
+
let {sourceId:preSourceId, innerQueryKey: preInnerQueryKey} = prevProps;
|
|
47
|
+
let {criteriaData} = this.state;
|
|
48
|
+
if (sourceId && sourceId != preSourceId){
|
|
49
|
+
let params={};
|
|
50
|
+
params['innerQueryKey'] = innerQueryKey;
|
|
51
|
+
params['sourceId'] = sourceId;
|
|
52
|
+
this.loadData(params);
|
|
53
|
+
}else if (innerQueryKey != preInnerQueryKey) {
|
|
54
|
+
let params={...criteriaData};
|
|
55
|
+
params['innerQueryKey'] = innerQueryKey;
|
|
56
|
+
this.setState({
|
|
57
|
+
criteriaData:params
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
doSearch = (params_) => {
|
|
63
|
+
const {sourceId, innerQueryKey} = this.props;
|
|
64
|
+
let criteriaData = {...params_}
|
|
65
|
+
//追加过滤条件,hiddenColIds,innerQueryKey
|
|
66
|
+
const {} = this.state;
|
|
67
|
+
criteriaData['innerQueryKey'] = innerQueryKey;
|
|
68
|
+
criteriaData['sourceId'] = sourceId;
|
|
69
|
+
this.setState({
|
|
70
|
+
criteriaData
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
render() {
|
|
75
|
+
let {ltmplConfigRes,criteriaData} = this.state;
|
|
76
|
+
let {sourceId} = this.props;
|
|
77
|
+
return (
|
|
78
|
+
ltmplConfigRes?
|
|
79
|
+
<ActTable doSearch={this.doSearch} level={'l2'} criteriaData={criteriaData} sourceId={sourceId}
|
|
80
|
+
ltmplConfig={ltmplConfigRes.ltmplConfig} /> : ""
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default L2ActTable;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Modal} from 'antd';
|
|
3
|
+
import "./index.css"
|
|
4
|
+
import {DtmplData, QueryKey, SelectConfig, SelectedRow, SourceName} from "../tmpl/interface";
|
|
5
|
+
import TableUnits from "./table-util";
|
|
6
|
+
import SupportInputTypes from '../tmpl/control-type-supportor';
|
|
7
|
+
import HCDataSource from '../tmpl/hc-data-source';
|
|
8
|
+
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
9
|
+
import QueryTable from './query-table';
|
|
10
|
+
import CriteriaForm from "../form/criteria-form";
|
|
11
|
+
import ViewControl from "../controls/view-control";
|
|
12
|
+
import SelectedRowsCard from './selected-rows-card'
|
|
13
|
+
|
|
14
|
+
interface ModelSelectTableProps {
|
|
15
|
+
maxSelectedRows: number,
|
|
16
|
+
visible: boolean,
|
|
17
|
+
sourceId: string,
|
|
18
|
+
exceptCodes?: string[],
|
|
19
|
+
onCancel: () => void,
|
|
20
|
+
onOK: (selectedRows: SelectedRow[]) => void,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
interface ModelSelectTableStat {
|
|
24
|
+
selectConfig: SelectConfig;
|
|
25
|
+
columns: object[];
|
|
26
|
+
queryKey: QueryKey;
|
|
27
|
+
loading: boolean;
|
|
28
|
+
criteriaData: object;
|
|
29
|
+
selectedRows: SelectedRow[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class ModelSelectTable extends React.PureComponent<ModelSelectTableProps, ModelSelectTableStat> {
|
|
33
|
+
state = {
|
|
34
|
+
selectConfig: undefined,
|
|
35
|
+
columns: undefined,
|
|
36
|
+
queryKey: undefined,
|
|
37
|
+
loading: true,
|
|
38
|
+
criteriaData: undefined,
|
|
39
|
+
disableCols: undefined,
|
|
40
|
+
selectedRows: [],
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
loadData = async (selectConfig: SelectConfig, criteriaData: object) => {
|
|
44
|
+
|
|
45
|
+
this.setState({
|
|
46
|
+
loading: true,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const {defaultPageSize} = selectConfig;
|
|
50
|
+
|
|
51
|
+
let pageInfo = {
|
|
52
|
+
pageNo: 1,
|
|
53
|
+
pageSize: defaultPageSize ? defaultPageSize : 10,
|
|
54
|
+
virtualEndPageNo: undefined,
|
|
55
|
+
}
|
|
56
|
+
const {sourceId, exceptCodes} = this.props;
|
|
57
|
+
/** 构建 dataSource **/
|
|
58
|
+
//构建过滤条件
|
|
59
|
+
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey(sourceId, {exceptCodes, ...criteriaData, ...pageInfo});
|
|
60
|
+
this.setState({
|
|
61
|
+
queryKey,
|
|
62
|
+
criteriaData,
|
|
63
|
+
loading: false,
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async componentDidMount() {
|
|
68
|
+
const { sourceId, visible} = this.props;
|
|
69
|
+
if (sourceId && visible) {
|
|
70
|
+
await this.loadData(await this.loadConfig(), {});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
loadConfig = async () => {
|
|
75
|
+
const { sourceId, exceptCodes} = this.props;
|
|
76
|
+
this.setState({
|
|
77
|
+
loading: true,
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
let selectConfig = await HCDataSource.requestSelectConfig( sourceId);
|
|
81
|
+
/** 构建column **/
|
|
82
|
+
let columns = [];
|
|
83
|
+
|
|
84
|
+
let s = 0;
|
|
85
|
+
selectConfig.columns.forEach((item) => {
|
|
86
|
+
let column = {};
|
|
87
|
+
if (item.title != "操作") {
|
|
88
|
+
columns.push(column);
|
|
89
|
+
}
|
|
90
|
+
column['title'] = item.title;
|
|
91
|
+
column['dataIndex'] = item.id;
|
|
92
|
+
// column['ellipsis']= true;
|
|
93
|
+
s++;
|
|
94
|
+
let itemType = SupportInputTypes.getSupportControlType(item);
|
|
95
|
+
if (s < 10) {
|
|
96
|
+
TableUnits.sort(column, itemType);
|
|
97
|
+
}
|
|
98
|
+
//特殊列处理
|
|
99
|
+
//序号
|
|
100
|
+
if (item.title === "序号") {
|
|
101
|
+
//item.fixed='left';
|
|
102
|
+
column['render'] = (text, record, index) => (
|
|
103
|
+
<label>{index + 1}</label>
|
|
104
|
+
)
|
|
105
|
+
item['sorter'] = undefined;
|
|
106
|
+
} else {
|
|
107
|
+
column['render'] = (text, record) => {
|
|
108
|
+
return <ViewControl fieldConfig={item} value={record[item.id]} holderType={'table'} />
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
this.setState({
|
|
113
|
+
columns,
|
|
114
|
+
selectConfig,
|
|
115
|
+
loading: false,
|
|
116
|
+
})
|
|
117
|
+
return selectConfig;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async componentDidUpdate(prevProps) {
|
|
121
|
+
const {exceptCodes, visible} = this.props;
|
|
122
|
+
const {selectConfig, criteriaData, queryKey, loading} = this.state;
|
|
123
|
+
const {exceptCodes: preExceptCodes, visible: preVisible} = prevProps;
|
|
124
|
+
let config = selectConfig;
|
|
125
|
+
if (visible) {
|
|
126
|
+
if (!config) {
|
|
127
|
+
config = await this.loadConfig();
|
|
128
|
+
}
|
|
129
|
+
if (!queryKey && !loading) {
|
|
130
|
+
await this.loadData(config, criteriaData);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
doSearch = async (params_) => {
|
|
136
|
+
const {selectConfig} = this.state;
|
|
137
|
+
let params = {...params_}
|
|
138
|
+
await this.loadData(selectConfig, params);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
handleOk = () => {
|
|
142
|
+
this.props.onOK(this.state.selectedRows);
|
|
143
|
+
this.setState({
|
|
144
|
+
selectedRows: [],
|
|
145
|
+
queryKey: undefined,
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
handleCancel = () => {
|
|
150
|
+
this.setState({
|
|
151
|
+
// selectedRows: [],//暂不置空
|
|
152
|
+
queryKey: undefined,
|
|
153
|
+
})
|
|
154
|
+
this.props.onCancel();
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
changeRowSelection = (selectedRows_: SelectedRow[],selectedDatas?:DtmplData[], allRowKeys?: string[]) => {
|
|
159
|
+
console.log('changeRowSelection:', allRowKeys);
|
|
160
|
+
let {maxSelectedRows} = this.props;
|
|
161
|
+
if (allRowKeys) {
|
|
162
|
+
const {selectedRows} = this.state;
|
|
163
|
+
let selectedKeys = [];
|
|
164
|
+
let selectedRows_1: SelectedRow[] = [];
|
|
165
|
+
if (maxSelectedRows != 1) {
|
|
166
|
+
selectedRows_1.push(...selectedRows);
|
|
167
|
+
}
|
|
168
|
+
//先追加
|
|
169
|
+
let contains: boolean = false;
|
|
170
|
+
for (let s1 of selectedRows_) {
|
|
171
|
+
contains = false;
|
|
172
|
+
for (let s2 of selectedRows_1) {
|
|
173
|
+
if (s1.code == s2.code) {
|
|
174
|
+
contains = true;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!contains) {
|
|
178
|
+
selectedRows_1.push(s1);
|
|
179
|
+
}
|
|
180
|
+
selectedKeys.push(s1.code);
|
|
181
|
+
}
|
|
182
|
+
//再删除
|
|
183
|
+
let selectedRows_2: SelectedRow[] = [];
|
|
184
|
+
selectedRows_2.push(...selectedRows_1);
|
|
185
|
+
for (let row of selectedRows_1) {
|
|
186
|
+
if (allRowKeys.includes(row.code) && !selectedKeys.includes(row.code)) {
|
|
187
|
+
for (let i in selectedRows_2) {
|
|
188
|
+
let s = selectedRows_2[i];
|
|
189
|
+
if (s.code == row.code) {
|
|
190
|
+
selectedRows_2.splice(Number(i), 1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
this.setState({
|
|
196
|
+
selectedRows: selectedRows_2,
|
|
197
|
+
})
|
|
198
|
+
} else {
|
|
199
|
+
this.setState({
|
|
200
|
+
selectedRows: selectedRows_,
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
render() {
|
|
207
|
+
let {visible, maxSelectedRows} = this.props;
|
|
208
|
+
let {queryKey, columns, selectConfig, criteriaData, loading, selectedRows} = this.state;
|
|
209
|
+
|
|
210
|
+
if (!selectConfig) {
|
|
211
|
+
return <>
|
|
212
|
+
</>
|
|
213
|
+
}
|
|
214
|
+
let {buttons, criterias, jumps, actions} = selectConfig
|
|
215
|
+
let displayCriteriaCard: boolean = false;
|
|
216
|
+
if (buttons.includes('delete') || (buttons.includes('query') && criterias && criterias.length > 0) ||
|
|
217
|
+
(actions && actions.length > 0) || (jumps && jumps.length > 0)) {
|
|
218
|
+
displayCriteriaCard = true;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// const selectedTag=
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<Modal
|
|
225
|
+
visible={visible}
|
|
226
|
+
title={<SelectedRowsCard value={selectedRows} onChange={this.changeRowSelection}></SelectedRowsCard>}
|
|
227
|
+
style={{maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'}}
|
|
228
|
+
width={'1250px'}
|
|
229
|
+
destroyOnClose={true}
|
|
230
|
+
centered
|
|
231
|
+
bodyStyle={{height: 500, overflow: 'auto'}}
|
|
232
|
+
onCancel={this.handleCancel}
|
|
233
|
+
onOk={this.handleOk}
|
|
234
|
+
>
|
|
235
|
+
<div className="actTable">
|
|
236
|
+
<CriteriaForm selectedRows={selectedRows} ltmplConfig={selectConfig} data={criteriaData}
|
|
237
|
+
doSearch={this.doSearch} loading={loading} />
|
|
238
|
+
<QueryTable maxSelectedRows={maxSelectedRows} selectedRows={selectedRows} columns={columns}
|
|
239
|
+
defaultPageSize={selectConfig.defaultPageSize}
|
|
240
|
+
queryKey={queryKey}
|
|
241
|
+
onChangeRowSelection={this.changeRowSelection}/>
|
|
242
|
+
</div>
|
|
243
|
+
</Modal>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export default ModelSelectTable;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {PageInfo} from "../tmpl/interface";
|
|
3
|
+
import {Pagination as AntdPagination} from 'antd';
|
|
4
|
+
import './pagination.css';
|
|
5
|
+
|
|
6
|
+
interface PaginationProps {
|
|
7
|
+
pageTo: (pageNo: number, pageSize: number) => void;
|
|
8
|
+
queryTotal: () => void;
|
|
9
|
+
pageInfo: PageInfo;
|
|
10
|
+
total: number;
|
|
11
|
+
touchEnd: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface PaginationStat {
|
|
15
|
+
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Pagination extends React.PureComponent<PaginationProps, PaginationStat> {
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
const {queryTotal, pageInfo, total, pageTo, touchEnd} = this.props;
|
|
23
|
+
|
|
24
|
+
if(!pageInfo){
|
|
25
|
+
return <></>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let virtualTotal;
|
|
29
|
+
let myTotal;
|
|
30
|
+
let sewTotal: boolean = true;
|
|
31
|
+
let seeTotalTitle: string = "";
|
|
32
|
+
|
|
33
|
+
if (total && total >= 0) {
|
|
34
|
+
virtualTotal = total;
|
|
35
|
+
sewTotal = true;
|
|
36
|
+
if (total > 0) {
|
|
37
|
+
seeTotalTitle = `共${total}条`;
|
|
38
|
+
}
|
|
39
|
+
} else if (touchEnd ) {
|
|
40
|
+
sewTotal = false;
|
|
41
|
+
virtualTotal = pageInfo.virtualEndPageNo * pageInfo.pageSize+1;
|
|
42
|
+
seeTotalTitle = `点击查看总数`;
|
|
43
|
+
} else {//这里还有问题
|
|
44
|
+
sewTotal = false;
|
|
45
|
+
virtualTotal = pageInfo.virtualEndPageNo * pageInfo.pageSize + 1;
|
|
46
|
+
seeTotalTitle = `点击查看总数`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (virtualTotal<pageInfo.pageSize?"":
|
|
50
|
+
<div className='Pagination'>
|
|
51
|
+
<span className={sewTotal ? 'sewTotal' : 'seeTotal'} onClick={queryTotal}>
|
|
52
|
+
{seeTotalTitle}
|
|
53
|
+
</span>
|
|
54
|
+
<AntdPagination
|
|
55
|
+
style={{display: 'inline-block'}}
|
|
56
|
+
showQuickJumper
|
|
57
|
+
showSizeChanger
|
|
58
|
+
pageSizeOptions={['5', '10', '20', '50', '100', '500']}
|
|
59
|
+
defaultCurrent={1}
|
|
60
|
+
current={pageInfo.pageNo}
|
|
61
|
+
pageSize={pageInfo.pageSize}
|
|
62
|
+
onChange={(page, pageSize) => pageTo(page, pageSize)}
|
|
63
|
+
onShowSizeChange={(current, size) => pageTo(current, size)}
|
|
64
|
+
hideOnSinglePage={total === 0 ? true : false}
|
|
65
|
+
total={virtualTotal}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default Pagination;
|