ProcessInfo.js
16.4 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/* eslint-disable array-callback-return,no-undef */
import React, { Component } from 'react';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Layout, Tabs, Spin, Avatar } from 'antd';
import styles from '../../index.less';
import Toolbar from '../Common/ToolBar/ToolBarNew';
import * as commonFunc from '../Common/commonFunc';
import CommonBase from '../Common/CommonBase';
import CommonElementEvent from '../Common/CommonElementEvent';
import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
import CommonView from '../Common/CommonView';
import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
import * as commonUtils from '../../utils/utils';/* 通用方法 */
const { Header, Content } = Layout;
const { TabPane } = Tabs;
class ProcessInfoComponent extends Component {
constructor(props) {
super(props);
this.state = {
};
this.form = {}; /* 表单对象 */
}
onTabChange = (key) => {
this.props.onSaveState({ activeKey: key });
};
handleAddRow = (name, sType) => {
const tableData = JSON.parse(JSON.stringify(this.props[`${name}Data`] || []));
const tableDataRow = { ...this.props.onDataRowAdd(name, true), sType };
tableData.push(tableDataRow);
this.props.onSaveState({
[`${name}Data`]: tableData,
});
}
render() {
const { pageLoading } = this.props;
return (
<div>
<Spin spinning={pageLoading}>
<div>
<ProcessComponent
{...this.props}
{...this.state}
handleAddRow={this.handleAddRow}
onTabChange={this.onTabChange}
/>
</div>
</Spin>
</div>
);
}
}
const ProcessComponent = Form.create({
mapPropsToFields(props) {
const { masterData, masterConfig } = props;
const obj = commonFunc.mapPropsToFields(masterData, Form, masterConfig);
return obj;
},
})((props) => {
const {
form, onReturnForm, masterData, AutoTableHeight, app, assortConfig, outsideConfig, processstyleConfig,
} = props;
/* 回带表单 */
onReturnForm(form);
if (commonUtils.isNotEmptyObject(masterData)) {
masterData.bCheck = true;
}
// let tabMachine = commonFunc.showMessage(app.commonConst, 'tabMachine');/* 对应机台 */
let tabAssort = commonFunc.showMessage(app.commonConst, 'tabAssort');/* 配套工序 */
let tabOutside = commonFunc.showMessage(app.commonConst, 'tabOutside');/* 發外公式 */
let tabProcessstyle = commonFunc.showMessage(app.commonConst, 'tabProcesstyle');/* 工序规格 */
// let tabProcessApsRule = commonFunc.showMessage(app.commonConst, 'tabProcessApsRule');/* APS规则定义 */
// const tabDynamicParam = commonFunc.showMessage(app.commonConst, 'tabDynamicParam'); /* 动态参数 */
let tabOrderParam = commonFunc.showMessage(app.commonConst, 'tabOrderParam'); /* 工单参数 */
let tabOfferParam = commonFunc.showMessage(app.commonConst, 'tabOfferParam'); /* 报价参数 */
let tabReportParam = commonFunc.showMessage(app.commonConst, 'tabReportParam'); /* 上报参数 */
const bMachine = false; /* 对应机台 */
// if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
// const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabMachine'); /* 对应机台 */
// if (iIndexProcess > -1) {
// bMachine = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
// tabMachine = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
// }
// }
let bAssort = commonUtils.isNotEmptyObject(assortConfig); /* 配套工序 */
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabAssort'); /* 配套工序 */
if (iIndexProcess > -1) {
bAssort = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
tabAssort = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
}
}
let bOutside = commonUtils.isNotEmptyObject(outsideConfig); /* 發外公式 */
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabOutSide'); /* 發外公式 */
if (iIndexProcess > -1) {
bOutside = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
tabOutside = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
}
}
let bProcessstyle = commonUtils.isNotEmptyObject(processstyleConfig); /* 工序规格 */
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabProcessStyle'); /* 工序规格 */
if (iIndexProcess > -1) {
bProcessstyle = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
tabProcessstyle = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
}
}
const bProcesssApsRule = false; /* APS规则定义 */
// if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
// const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabAPS'); /* APS规则定义 */
// if (iIndexProcess > -1) {
// bProcesssApsRule = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
// tabProcessApsRule = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
// }
// }
let bOrderParam = true; /* 工单参数 */
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabProcessParam'); /* 工单参数 */
if (iIndexProcess > -1) {
bOrderParam = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
tabOrderParam = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
}
}
let bOfferParam = true; /* 报价参数 */
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabQuoParam'); /* 报价参数 */
if (iIndexProcess > -1) {
bOfferParam = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
tabOfferParam = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
}
}
let bReportParam = true; /* 上报参数 */
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndexProcess = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabReportParam');
if (iIndexProcess > -1) {
bReportParam = props.masterConfig.gdsconfigformslave[iIndexProcess].bVisible;
tabReportParam = props.masterConfig.gdsconfigformslave[iIndexProcess].sChinese;
}
}
let bNormParam = true; /* 标准书参数 */
let tabNormParam = '标准书参数';
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndex = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabNormParam');
if (iIndex > -1) {
bNormParam = props.masterConfig.gdsconfigformslave[iIndex].bVisible;
tabNormParam = props.masterConfig.gdsconfigformslave[iIndex].sChinese;
}
}
let bTestParam = false; /* 测试参数 */
let tabTestParam = '测试参数';
if (commonUtils.isNotEmptyObject(props.masterConfig) && commonUtils.isNotEmptyArr(props.masterConfig.gdsconfigformslave)) {
const iIndex = props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'tabTestParam');
if (iIndex > -1) {
bTestParam = props.masterConfig.gdsconfigformslave[iIndex].bVisible;
tabTestParam = props.masterConfig.gdsconfigformslave[iIndex].sChinese;
}
}
let defalutKey = '3';
if (bMachine) {
defalutKey = '2';
} else if (bAssort) {
defalutKey = '3';
} else if (bAssort) {
defalutKey = '3';
} else if (bOutside) {
defalutKey = '4';
} else if (bProcessstyle) {
defalutKey = '5';
} else if (bProcesssApsRule) {
defalutKey = '6';
} else if (bReportParam) {
defalutKey = '7';
} else if (bOfferParam) {
defalutKey = '8';
}
return (
<Form>
<Layout id="eleprocess">
<Header className={styles.header}>
<Toolbar {...props} />
</Header>
<Layout className={`${styles.clayout} ${styles.setHeight}`}>
<Content className={styles.content}>
<div className="bill-search-group">
<CommonView {...props} />
</div>
<div id="slaveTabs" className={`${styles.bShow} ${styles.slaveTabHight}`} >
<div>
<Avatar src={props.imgSrc} />
</div>
<Tabs
onChange={props.onTabChange}
activeKey={props.activeKey === undefined ? defalutKey : props.activeKey}
tabBarStyle={{ margin: '0 10px' }}
className={`${styles.slaveTabs} basicInfo`}
>
{
bMachine ?
<TabPane tab={tabMachine} key={2} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable {...commonBusiness.getTableTypes('machine', props)} setOpterationColumn="Y" footer="hidden" />
</div>
</TabPane> : ''
}
{
bAssort ?
<TabPane tab={tabAssort} key={3} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable {...commonBusiness.getTableTypes('assort', props)} setOpterationColumn="Y" footer="hidden" />
</div>
</TabPane> : ''
}
{
bOutside ?
<TabPane tab={tabOutside} key={4} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable {...commonBusiness.getTableTypes('outside', props)} setOpterationColumn="Y" footer="hidden" />
</div>
</TabPane> : ''
}
{
bProcessstyle ?
<TabPane tab={tabProcessstyle} key={5} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable {...commonBusiness.getTableTypes('processstyle', props)} setOpterationColumn="Y" footer="hidden" />
</div>
</TabPane> : ''
}
{
bProcesssApsRule ?
<TabPane tab={tabProcessApsRule} key={6} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable {...commonBusiness.getTableTypes('processApsRule', props)} setOpterationColumn="Y" footer="hidden" />
</div>
</TabPane> : ''
}
{
bReportParam ?
<TabPane tab={tabReportParam} key={7} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable
{...commonBusiness.getTableTypes('dynamicParam', props)}
data={
commonBusiness.getTableTypes('dynamicParam', props).data ?
commonBusiness.getTableTypes('dynamicParam', props).data.filter(o => o.sType === '1') : []
}
onAddRow={e => props.handleAddRow(e, '1')}
setOpterationColumn="Y"
footer="hidden"
/>
</div>
</TabPane> : ''
}
{
bOfferParam ?
<TabPane tab={tabOfferParam} key={8} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable
{...commonBusiness.getTableTypes('dynamicParam', props)}
data={
commonBusiness.getTableTypes('dynamicParam', props).data ?
commonBusiness.getTableTypes('dynamicParam', props).data.filter(o => o.sType === '2') : []
}
onAddRow={e => props.handleAddRow(e, '2')}
setOpterationColumn="Y"
footer="hidden"
/>
</div>
</TabPane> : ''
}
{
bOrderParam ?
<TabPane tab={tabOrderParam} key={9} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable
{...commonBusiness.getTableTypes('dynamicParam', props)}
data={
commonBusiness.getTableTypes('dynamicParam', props).data ?
commonBusiness.getTableTypes('dynamicParam', props).data.filter(o => o.sType === '3') : []
}
onAddRow={e => props.handleAddRow(e, '3')}
setOpterationColumn="Y"
footer="hidden"
/>
</div>
</TabPane> : ''
}
{
bNormParam ?
<TabPane tab={tabNormParam} key={10} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable
{...commonBusiness.getTableTypes('dynamicParam', props)}
data={
commonBusiness.getTableTypes('dynamicParam', props).data ?
commonBusiness.getTableTypes('dynamicParam', props).data.filter(o => o.sType === '4') : []
}
onAddRow={e => props.handleAddRow(e, '4')}
setOpterationColumn="Y"
footer="hidden"
/>
</div>
</TabPane> : ''
}
{
bTestParam ?
<TabPane tab={tabTestParam} key={11} className="xly-bill-list" style={{ height: `calc( ${AutoTableHeight} - 105px)` }}>
<div className="TabPaneStyle">
<StaticEditTable
{...commonBusiness.getTableTypes('dynamicParam', props)}
data={
commonBusiness.getTableTypes('dynamicParam', props).data ?
commonBusiness.getTableTypes('dynamicParam', props).data.filter(o => o.sType === '5') : []
}
onAddRow={e => props.handleAddRow(e, '5')}
setOpterationColumn="Y"
footer="hidden"
/>
</div>
</TabPane> : ''
}
</Tabs>
</div>
</Content>
</Layout>
</Layout>
</Form>
);
});
export default CommonBase(CommonElementEvent(ProcessInfoComponent));