TabFinanceOffer.js
8.92 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
import React, { Component } from 'react';
import { Form } from '@ant-design/compatible';
// import '@ant-design/compatible/assets/index.css';
import { Row, Col } from 'antd-v4';
import ShowType from '@/components/Common/CommonComponent';
import styles from '@/index.less';
import * as commonUtils from '@/utils/utils';
const FormItem = Form.Item;
class TabFinanceOfferComponent extends Component {
constructor(props) {
super(props);
this.state = {
};
}
/* 判断字段是否存在 存在显示,不存在返回空 */
getExistShowConfig = (sName) => {
let bShow = false;
const { masterConfig, masterData } = this.props;
if (commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData)) {
/* 配置信息 */
const showConfig = this.getShowConfig(sName);
/* 返回值 */
if (commonUtils.isNotEmptyObject(showConfig)) {
bShow = true;
}
}
return bShow;
};
/* 判断字段是否存在并且勾了显示 */
getExistVisibleShowConfig = (sName) => {
let bShow = false;
const { masterConfig, masterData } = this.props;
if (commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData)) {
/* 配置信息 */
const showConfig = this.getShowConfig(sName);
/* 返回值 */
if (commonUtils.isNotEmptyObject(showConfig) && showConfig.bVisible) {
bShow = true;
}
}
return bShow;
};
getShowTypeProps = (sName) => {
const { masterConfig, masterData } = this.props;
if (commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData)) {
/* 配置信息 */
const showConfig = this.getShowConfig(sName);
if (commonUtils.isNotEmptyObject(showConfig)) {
/* 返回值 */
return {
form: this.props.form,
getSqlDropDownData: this.props.getSqlDropDownData,
getSqlCondition: this.props.getSqlCondition,
handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
getFloatNum: this.props.getFloatNum,
onChange: this.props.onChange, /* 表单数据改变事件方法(数据格式:函数) */
showConfig, /* 关于本showType相关配置(数据格式:对象) */
enabled: this.props.enabled && !showConfig.bReadonly, /* 是否是查看状态(数据格式:布尔) */
dataValue: masterData[sName], /* 本showType数据(数据格式:对象) */
bTable: false, /* 是否为表格数据 */
formItemLayout: { labelCol: { span: 12 }, wrapperCol: { span: 12 } },
};
}
}
};
/** 获取showConfig */
getShowConfig = (sName) => {
/* 通过sName过滤出对应的showConfig */
const showConfigArr = this.props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === sName && item.bVisible);
const showConfigHideArr = this.props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === sName && !item.bVisible); /* 隐藏字段 */
if (commonUtils.isNotEmptyArr(showConfigHideArr)) {
console.log(`请勾选${sName}字段显示!`);
}
if (commonUtils.isNotEmptyArr(showConfigArr)) {
showConfigArr[0].sName = showConfigArr[0].sControlName;
return showConfigArr[0];
}
/* 返回值 */
return {};
};
render() {
const { masterConfig, masterData } = this.props;
return (
<FormItem className={styles.searchSlaveForm}>
{commonUtils.isEmptyObject(masterConfig) || commonUtils.isEmptyObject(masterData) ? '' :
<Row type="flex" justify="space-between">
<Col span={11}>
<div className={styles.tabChild}>
<div className={styles.tabChildTitle}>
<span>{this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName.toLowerCase() === 'tabfinancecontrol'))[0].showName}</span>
</div>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('sCbxPayablesType') ? <ShowType {...this.getShowTypeProps('sCbxPayablesType')} /> : ''}
{this.getExistVisibleShowConfig('sCbxOutSidePayType') ? <ShowType {...this.getShowTypeProps('sCbxOutSidePayType')} /> : ''}
{this.getExistVisibleShowConfig('sCbxReceivablesType') ? <ShowType {...this.getShowTypeProps('sCbxReceivablesType')} /> : ''}
{this.getExistVisibleShowConfig('sCbxAdvanceType') ? <ShowType {...this.getShowTypeProps('sCbxAdvanceType')} /> : ''}
</Col>
</Row>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('bCkxMaterialsTax') ? <ShowType {...this.getShowTypeProps('bCkxMaterialsTax')} /> : ''}
</Col>
</Row>
</div>
</Col>
<Col span={11}>
<div className={styles.tabChild}>
<div className={styles.tabChildTitle}>
<span>{this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName.toLowerCase() === 'taboffer'))[0].showName}</span>
</div>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('iNetIntervalDays') ? <ShowType {...this.getShowTypeProps('iNetIntervalDays')} /> : ''}
{this.getExistVisibleShowConfig('sCbxOfferMaterials') ? <ShowType {...this.getShowTypeProps('sCbxOfferMaterials')} /> : ''}
</Col>
<Col span={11}>
{this.getExistVisibleShowConfig('sCbxProcessPrice') ? <ShowType {...this.getShowTypeProps('sCbxProcessPrice')} /> : ''}
{this.getExistVisibleShowConfig('iNetVeryHighPercentage') ? <ShowType {...this.getShowTypeProps('iNetVeryHighPercentage')} /> : ''}
</Col>
<Col span={11}>
{this.getExistVisibleShowConfig('sCbxTaxRate') ? <ShowType {...this.getShowTypeProps('sCbxTaxRate')} /> : ''}
</Col>
<Col span={11}>
{this.getExistVisibleShowConfig('bCkxNoTaxProcessPrice') ? <ShowType {...this.getShowTypeProps('bCkxNoTaxProcessPrice')} /> : ''}
</Col>
</Row>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('bCkxOfferFunctionality') ? <ShowType {...this.getShowTypeProps('bCkxOfferFunctionality')} /> : ''}
</Col>
</Row>
</div>
</Col>
<Col span={24}>
<div className={styles.tabChild}>
<div className={styles.tabChildTitle}>
<span>{this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName.toLowerCase() === 'tabinventorycontrol'))[0].showName}</span>
</div>
<Row type="flex" justify="space-between">
<Col span={11}>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('sCbxMaterialsDefine') ? <ShowType {...this.getShowTypeProps('sCbxMaterialsDefine')} /> : ''}
{this.getExistVisibleShowConfig('sCbxSemigoodsDefine') ? <ShowType {...this.getShowTypeProps('sCbxSemigoodsDefine')} /> : ''}
</Col>
<Col span={11}>
{this.getExistVisibleShowConfig('sCbxProductDefine') ? <ShowType {...this.getShowTypeProps('sCbxProductDefine')} /> : ''}
</Col>
</Row>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('sCbxCorrugateWidth') ? <ShowType {...this.getShowTypeProps('sCbxCorrugateWidth')} /> : ''}
{this.getExistVisibleShowConfig('sCbxCorrugateLength') ? <ShowType {...this.getShowTypeProps('sCbxCorrugateLength')} /> : ''}
</Col>
<Col span={11}>
{this.getExistVisibleShowConfig('iNetCorrugateWidthSubtract') ? <ShowType {...this.getShowTypeProps('iNetCorrugateWidthSubtract')} /> : ''}
{this.getExistVisibleShowConfig('iNetCorrugateLengthSubtract') ? <ShowType {...this.getShowTypeProps('iNetCorrugateLengthSubtract')} /> : ''}
</Col>
</Row>
</Col>
<Col span={11}>
<Row type="flex" justify="space-between">
<Col span={11}>
{this.getExistVisibleShowConfig('bCkxBuSampleNoDeliver') ? <ShowType {...this.getShowTypeProps('bCkxBuSampleNoDeliver')} /> : ''}
</Col>
</Row>
</Col>
</Row>
</div>
</Col>
</Row>
}
</FormItem>
);
}
}
export default TabFinanceOfferComponent;