CommonListA.js
8.83 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* 此组件作用是 列表绕开注册 */
import React, { Component } from 'react';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Layout, Spin, Slider } from 'antd';
import CommonListEvent from '@/components/Common/CommonListEvent';/* 继承销售模块业务功能 */
import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
import Toolbar from '@/components/Common/ToolBar/ToolBarNew';
import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
import styles from '@/index.less';
import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */
import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
import SearchComponent from '@/components/Common/SearchComponent';/* 搜索组件 */
import * as commonConfig from '@/utils/config';
import * as commonUtils from '@/utils/utils';
import StaticEditTree from '@/components/Common/Tree/StaticTree';
import Eject from '@/assets/eject.svg';/* 弹出图标 */
import Close from '@/assets/close.svg';/* 关闭图标 */
import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
import CommonListSelect from '@/components/Common/CommonListSelect';/* 选择界面 */
const { Header, Content } = Layout;
let NoTotalData = '';
class CommonListA extends Component {
handleEject = () => {
const { currentPane, panes } = this.props.app;
if (commonUtils.isNotEmptyArr(panes) && commonUtils.isNotEmptyObject(currentPane)) {
// const index = panes.indexOf(currentPane);
const index = panes.findIndex(item => item.formId === currentPane.formId && item.key === currentPane.key && item.notCurrentPane === currentPane.notCurrentPane && item.route === currentPane.route && item.title === currentPane.title && item.sModelsType === currentPane.sModelsType && item.sProcName === currentPane.sProcName);
/* 当前页签 */
const currentTab = document.getElementById('navTabWrap').children[index];
if (!commonUtils.isEmpty(currentTab)) {
const filterTreeArr = currentTab.getElementsByClassName('xly-filter-tree');/* 获取当前页签下的树组件 */
if (commonUtils.isNotEmptyArr(filterTreeArr)) {
const filterTree = filterTreeArr[0];
if (filterTree.style.display === 'block') {
filterTree.style.display = 'none';
} else {
filterTree.style.display = 'block';
}
}
}
}
};
/** 树节点选中 */
handleTreeSelect = (name, checkedKeys, e) => {
this.props.onSelect(name, checkedKeys, e); /* 调用CommonListEvent通用处理 */
};
handleCancelModal = (modelVisible) => {
this.props.onSaveState({
[modelVisible]: false,
});
}
handleSelectModal = (modelVisible) => {
this.props.onSaveState({
[modelVisible]: false,
});
}
render() {
const { pageLoading } = this.props;
return (
<div style={{ height: '100%' }}>
<Spin spinning={pageLoading}>
<div style={{ height: '100%' }}>
<CommonListComponent
{...this.props}
{...this.state}
onEject={this.handleEject}
onSelectTree={this.handleTreeSelect}
onSelectModal={this.handleSelectModal}
onCancelModal={this.handleCancelModal}
/>
</div>
</Spin>
</div>
);
}
}
const CommonListComponent = Form.create({
mapPropsToFields(props) {
const { masterData } = props;
const obj = commonFunc.mapPropsToFields(masterData, Form);
return obj;
},
})((props) => {
const {
form, onReturnForm, slavePagination, slaveConfig, slaveColumn, isSmall, iHeight, logVisible,
} = props;
// isSmall将分页变小,以及去掉跳转页面和总条数记录
/* 回带表单 */
if (commonUtils.isNotEmptyObject(slavePagination)) {
if (isSmall) {
slavePagination.showTotal = null;
}
}
onReturnForm(form);
const pagination = {
pageSize: commonUtils.isNotEmptyNumber(props.iPageSize) && props.iPageSize !== 0 ? props.iPageSize : commonConfig.pageSize,
...slavePagination,
size: isSmall ? 'small' : 'large',
pageSizeOptions: commonConfig.pageSizeOptions,
showSizeChanger: !isSmall,
showQuickJumper: !isSmall,
};
const tableProps = {
...commonBusiness.getTableTypes('slave', props),
tableProps: { rowKey: 'sSlaveId', pagination, onChange: props.onTitleChange },
onSaveState: props.onSaveState,
clearArray: props.clearArray,
readOnly: true,
isSmall,
sGroupByList: props.sGroupByList,
};
const masterSum = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave.filter(item => item.bSum && item.sName !== '') : [];
const masterTitleGroup = commonUtils.isNotEmptyObject(slaveColumn) ? slaveColumn.filter(item => commonUtils.isNotEmptyObject(item.title) && item.title.indexOf('-') > -1) : [];
const hasColumnGroup = masterTitleGroup.length;
if (masterSum.length > 0) {
NoTotalData = hasColumnGroup > 0 ? 'TitleGroup' : 'NoTitleGroup';
} else {
NoTotalData = hasColumnGroup > 0 ? 'NoTotalData TitleGroup' : 'NoTotalData NoTitleGroup';
}
// const mProps = { ...commonBusiness.createMemoProps('master', props)};
const name = 'filterTree';
const treeProps = {
...commonBusiness.getTreeTypes('tree', props),
isSearch: false,
checkable: false,
disabled: false,
checkedAll: false,
unChecked: false,
[`${name}Column`]: props[`${name}Column`],
[`${name}Config`]: props[`${name}Config`],
[`${name}Data`]: props[`${name}Data`],
getFloatNum: props.getFloatNum,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getDateFormat: props.getDateFormat,
onDoubleClick: props.onDoubleClick,
onSelect: props.onSelectTree,
expandedKeys: props.expandedKeys,
};
const logProps = {
app: {
...props.app,
currentPane: {
...props.app.currentPane,
formRoute: '/indexPage/commonList',
route: '/indexPage/commonList',
name: 'logView',
config: props.logConfig,
select: props.onSelectModal.bind(this, 'logVisible'),
selectCancel: props.onCancelModal.bind(this, 'logVisible'),
sModelsType: 'modal/logView',
},
},
token: props.app.token,
slaveColumn: props.logColumn, /* 表头 */
slaveConfig: props.logConfig,
slaveData: props.logData,
dispatch: props.dispatch,
content: props.content,
id: new Date().getTime().toString(),
pageLoading: false,
};
return (
<Form style={{ height: '100%' }}>
<Layout style={{ height: '100%' }} className="xly-list">
{!commonUtils.isEmpty(props.routing) ? '' :
<Header className={styles.header}>
<Toolbar {...props} />
</Header>}
<Layout className={styles.clayout}>
<div style={{ maxHeight: '100%', zIndex: 20 }}>
<SearchComponent {...props} />
</div>
<Content style={{ height: iHeight || 'auto' }} className={`xly-normal-list ${NoTotalData}`} >
<StaticEditTable {...tableProps} tableBelone="list" />
</Content>
</Layout>
</Layout>
{/* {!commonUtils.isEmpty(props.routing) ? '' : <SlaveMemo {...props} />} */}
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
{commonUtils.isEmptyArr(treeProps.treeData) || !commonUtils.isEmpty(props.routing) ? '' : <div className="xly-eject"> <a onClick={props.onEject}> <img src={Eject} alt="eject" /></a> </div>}
{commonUtils.isEmptyArr(treeProps.treeData) || !commonUtils.isEmpty(props.routing) ? '' :
<div className="xly-filter-tree">
<StaticEditTree {...treeProps} />
<div className="xly-tree-close" >
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a onClick={props.onEject}> <img src={Close} alt="close" /></a>
</div>
</div>
}
{
logVisible ?
<AntdDraggableModal
width="1200"
title="查看操作日志"
visible={logVisible}
onCancel={props.onCancelModal.bind(this, 'logVisible')}
onOk={props.onSelectModal.bind(this, 'logVisible')}
footer={null}
>
<CommonListSelect {...logProps} />
</AntdDraggableModal> : ''
}
{
props.bDataAuditProgress ?
<div className="dataAuditProgress">
<Slider
min={1}
max={props.dataAuditProcessMaxValue}
tooltipVisible
step={1}
draggableTrack
defaultValue={3}
value={props.dataAuditProcessValue}
/>
</div> : ''
}
</Form>
);
});
export default CommonBase(CommonListEvent(CommonListA));