oeeWagesSearch.js
8.19 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
import React from 'react';
import { Layout } from 'antd';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import CommonBase from '../../components/Common/CommonBase';
import CommonListEvent from '../../components/Common/CommonListEvent';
import * as commonFunc from '../../components/Common/commonFunc';
import * as commonUtils from '../../utils/utils';
import * as commonBusiness from '../../components/Common/commonBusiness';
import StaticEditTable from '../../components/Common/CommonTable';
import oeeStyle from './oee.less';
import OeeSearchComponent from './oeeSearchComponent';
import AntdDraggableModal from '../../components/Common/AntdDraggableModal';
import ShowType from '../../components/Common/CommonComponent';
const { Content } = Layout;
class OeeWagesSearchComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
renderOnce: true,
dateFormat: 'YYYY/MM/DD',
};
}
shouldComponentUpdate(nextProps) {
const { slaveColumn } = nextProps;
return commonUtils.isNotEmptyArr(slaveColumn);
}
componentDidUpdate() {
// 设置table中的ant-table-body的高度,使滚动条至底
// const antTable = document.getElementsByClassName('currentStateTable')[0].getElementsByClassName('xly-normal-list')[0].offsetHeight;
// const antTableHeader = document.getElementsByClassName('currentStateTable')[0].getElementsByClassName('ant-table-header')[0].offsetHeight;
// document.getElementsByClassName('currentStateTable')[0].getElementsByClassName('ant-table-body')[0].style.height = `${antTable - antTableHeader}px`;
}
handleWagesSearchCancel = () => {
this.props.handleWagesSearchVisble(false); // 关闭日期弹窗
}
handleWagesSearchOk = () => {
const { app, masterData, slaveConfig } = this.props;
const filterCondition = [];
filterCondition.push({
bFilterName: 'sMachineGuid_pro',
bFilterCondition: '=',
bFilterValue: app.sMachineNameSId,
});
if (commonUtils.isNotEmptyObject(masterData)) {
if (commonUtils.isNotEmptyObject(masterData.tDateStart) && commonUtils.isNotEmptyObject(masterData.tDateEnd)) {
filterCondition.push({
bFilterName: 'tStartDate_pro',
bFilterCondition: '=',
bFilterValue: masterData.tDateStart,
});
filterCondition.push({
bFilterName: 'tEndDate_pro',
bFilterCondition: '=',
bFilterValue: masterData.tDateEnd,
});
}
}
this.props.onGetData(slaveConfig, filterCondition, 1, 20, '', false);
this.props.handleWagesSearchVisble(false); // 关闭日期弹窗
}
render() {
return (
<WagesSearchComponent
{...this.props}
{...this.state}
onWagesSearchCancel={this.handleWagesSearchCancel}
onWagesSearchOk={this.handleWagesSearchOk}
/>
);
}
}
const WagesSearchComponent = Form.create({
mapPropsToFields(props) {
const { masterData } = props;
const obj = commonFunc.mapPropsToFields(masterData, Form);
return obj;
},
})((props) => {
const {
app,
form,
onReturnForm,
slavePagination,
isSmall,
dateVisibleState, // 日期显示
// renderContent, // 切换页面
masterData,
onBtnClick,
slaveConfig,
onWagesSearchCancel,
} = props;
// isSmall将分页变小,以及去掉跳转页面和总条数记录
/* 回带表单 */
if (commonUtils.isNotEmptyObject(slavePagination)) {
if (isSmall) {
slavePagination.showTotal = null;
}
}
onReturnForm(form);
const pagination = false;
const tableProps = {
...commonBusiness.getTableTypes('slave', props),
tableProps: {
rowKey: 'sSlaveId',
pagination,
onChange: props.onTitleChange,
// AutoTableHeight: '400px',
},
onSaveState: props.onSaveState,
clearArray: props.clearArray,
readOnly: true,
isSmall,
sGroupByList: props.sGroupByList,
};
const onCancleProps = {
style: { display: 'none' },
};
const onOkProps = {
style: { width: '100%' },
className: 'modalDateOk',
};
const wagesSearchStartConfig = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave.filter(item => item.sName === 'tDateStart')[0] : {};
const wagesSearchEndConfig = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave.filter(item => item.sName === 'tDateEnd')[0] : {};
const wagesSearchStartProps = {
form: props.form,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: wagesSearchStartConfig,
formItemLayout: {},
textArea: false,
enabled: true,
dataValue: commonUtils.isNotEmptyObject(masterData) ? masterData[wagesSearchStartConfig.sName] : '',
bTable: false,
formRoute: props.formRoute,
};
const wagesSearchEndProps = {
form: props.form,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: wagesSearchEndConfig,
formItemLayout: {},
textArea: false,
enabled: true,
dataValue: commonUtils.isNotEmptyObject(masterData) ? masterData[wagesSearchEndConfig.sName] : '',
bTable: false,
formRoute: props.formRoute,
};
const wagesSearch = commonFunc.showMessage(app.commonConst, 'wagesSearch');/* 工资查询 */
// 取得配置中的按钮
const buttonConfigs = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave.filter(item => item.sName === '' && item.showName !== '' && item.sControlName !== '' && item.bVisible && item.sControlName.indexOf('Btn') > -1 && item.sControlName.indexOf('BtnCopyTo') === -1) : [];
return (
<div>
<Form style={{ height: '100% ' }}>
<Layout style={{ height: '100%' }} className="xly-list">
<Layout className="table currentStateTable">
<Content className="xly-normal-list" >
<StaticEditTable {...tableProps} footer="hidden" tableBelone="list" formRoute={props.formRoute} sModelsType={props.sModelsType} />
</Content>
</Layout>
<div className={oeeStyle.bottomBtns} style={{ height: '9.7vh' }}>
<div className={oeeStyle.oeeCurrentState}>
{
commonUtils.isNotEmptyArr(buttonConfigs) ?
buttonConfigs.map((item, index) => {
return (
// eslint-disable-next-line jsx-a11y/anchor-is-valid,react/no-array-index-key
<a key={index} style={{ background: `${item.sColorTerms}` }} onClick={() => onBtnClick(item)}>
{item.showName}
</a>
);
}) : ''
}
</div>
<div className={oeeStyle.searchComponent}>
<OeeSearchComponent worldVis="false" {...props} />
</div>
</div>
</Layout>
{
dateVisibleState ?
<AntdDraggableModal
title={wagesSearch}
width={467}
visible={dateVisibleState}
onCancel={onWagesSearchCancel}
// footer={null}
okText="确 定"
okButtonProps={onOkProps}
cancelButtonProps={onCancleProps}
onOk={props.onWagesSearchOk}
className="dateModal"
>
<div className={oeeStyle.dateDiv}>
{
commonUtils.isNotEmptyObject(wagesSearchStartConfig) ? <ShowType {...wagesSearchStartProps} /> : ''
}
</div>
<div className={oeeStyle.dateDiv}>
{
commonUtils.isNotEmptyObject(wagesSearchStartConfig) ? <ShowType {...wagesSearchEndProps} /> : ''
}
</div>
</AntdDraggableModal>
: ''
}
</Form>
</div>
);
});
export default CommonBase(CommonListEvent(OeeWagesSearchComponent));