import React, { Component } from 'react'; import { Form } from '@ant-design/compatible'; import '@ant-design/compatible/assets/index.css'; import { Row, Col } from 'antd'; import ShowType from '@/components/Common/CommonComponent'; import styles from '@/index.less'; import * as commonUtils from '@/utils/utils'; import TabSysParamIcon from './TabSysParamsIcon'; const FormItem = Form.Item; class TabSysParamComponent 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; }; 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 {}; }; /* 判断字段是否存在并且勾了显示 */ 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; }; render() { const { masterConfig, masterData } = this.props; return ( {commonUtils.isEmptyObject(masterConfig) || commonUtils.isEmptyObject(masterData) ? '' :
{this.getExistVisibleShowConfig('sCbxMaterialsUnit') ? : '' } {this.getExistVisibleShowConfig('sCbxCardboardUnit') ? : '' } {this.getExistVisibleShowConfig('sCbxMachineUnit') ? : '' } {this.getExistVisibleShowConfig('dNetConversionRate') ? : '' }
{this.getExistVisibleShowConfig('dNetMoney') ? : '' } {this.getExistVisibleShowConfig('dNetPrice') ? : '' } {this.getExistVisibleShowConfig('iNetSquareM') ? : '' } {this.getExistVisibleShowConfig('bCkxPercentile') ? : '' }
{this.getExistVisibleShowConfig('sCbxLanguage') ? : '' } {this.getExistShowConfig('iCbxExitSystem') ? : ''}
{this.getExistVisibleShowConfig('sCbxNetID') ? : '' } {this.getExistVisibleShowConfig('sCbxNetVerifyCode') ? : '' } {this.getExistVisibleShowConfig('sCbxHttp') ? : '' } {this.getExistVisibleShowConfig('sCbxMac') ? : '' } {this.getExistVisibleShowConfig('sCbxWechatAppscret') ? : '' } {this.getExistVisibleShowConfig('sCbxWechatAgentid') ? : '' } {this.getExistVisibleShowConfig('sCbxWechatAppid') ? : '' } {this.getExistVisibleShowConfig('sCbxWechatIpAddress') ? : '' } {this.getExistVisibleShowConfig('sCbxWechatToken') ? : '' } {this.getExistVisibleShowConfig('sCbxWechatEncodingAESKey') ? : '' } {this.getExistVisibleShowConfig('sCbxEmailHost') ? : '' } {this.getExistVisibleShowConfig('sCbxEmailFrom') ? : '' } {this.getExistVisibleShowConfig('sCbxEmailUser') ? : '' } {this.getExistVisibleShowConfig('sCbxEmailPass') ? : '' } {this.getExistVisibleShowConfig('sCbxEmailPort') ? : '' } {this.getExistVisibleShowConfig('sCbxDingTalkToken') ? : '' } {this.getExistVisibleShowConfig('sCbxDingTalkEncodingAESKey') ? : '' } {this.getExistVisibleShowConfig('sCbxDingTalkAppid') ? : '' } {this.getExistVisibleShowConfig('sCbxDingTalkAgentid') ? : '' } {this.getExistVisibleShowConfig('sCbxDingTalkAppscret') ? : '' } {this.getExistVisibleShowConfig('sCbxApiUrl') ? : '' } {this.getExistVisibleShowConfig('sCbxDateTime') ? : '' }
{this.getExistVisibleShowConfig('iNetMonth') ? : ''} {this.getExistVisibleShowConfig('sCbxServerFilePath') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyName') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyTitle') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyAddress') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyInoviceAddress') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyPhone1') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyPhone2') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyFax') ? : ''} {this.getExistVisibleShowConfig('sCbxCompanyEmail') ? : ''} {this.getExistVisibleShowConfig('sCbxWorkPath') ? : ''} {this.getExistVisibleShowConfig('sCbxWorkCheckPath') ? : ''} {this.getExistVisibleShowConfig('sCbxTime') ? : ''} {this.getExistVisibleShowConfig('sCbxImpositionTime') ? : ''} {this.getExistVisibleShowConfig('bCkxNumAlign') ? : ''} {this.getExistVisibleShowConfig('bCkxViewAllMachine') ? : ''}
}
); } } export default TabSysParamComponent;