/* 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, Spin, Tabs, Row, Col } from 'antd'; import styles from '@/index.less'; import * as commonUtils from '@/utils/utils'; import Toolbar from '@/components/Common/ToolBar/ToolBarNew'; import * as commonFunc from '@/components/Common/commonFunc'; import CommonBase from '@/components/Common/CommonBase'; import CommonElementEvent from '@/components/Common/CommonElementEvent'; import CommonView from '@/components/Common/CommonView'; import TabCounter from '@/components/Common/CommonCalculator'; import TabParam from '@/components/Common/commonParam'; import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ import ShowTypeNew from '@/components/Common/CommonComponent'; import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */ const { Header, Content } = Layout; const { TabPane } = Tabs; class SisformulaInfoComponent extends Component { constructor(props) { super(props); this.state = { }; this.form = {}; /* 表单对象 */ } // onDoubleClick = (record) => { /* 双击行 将参数名 @参数名放到公式框里 */ // if (this.props.enabled && commonUtils.isNotEmptyObject(record)) { // const { sParam } = record; // if (commonUtils.isNotEmptyObject(sParam)) { // const { masterData: masterDataOld } = this.props; // const value = `@${sParam}`; // const masterData = { ...masterDataOld }; // const sFormulaMemo = (Object.keys(masterData).length > 0 && masterData.sFormulaMemo !== undefined) ? masterData.sFormulaMemo : ''; // const changeFormula = `${sFormulaMemo}${value}`; // masterData.sFormula = changeFormula; // masterData.sFormulaMemo = changeFormula; // masterData.handleType = masterData.handleType === 'add' ? 'add' : 'update'; // this.props.onSaveState({ masterData }); // } // } // }; handleFieldDoubleClick = (record, sValue, showConfig, tbName) => { if (!this.props.bUserModel) { return; } const lastChar = tbName.charAt(tbName.length - 1); const firstChar = this.props.onGetFirstChar(lastChar); const { [`${tbName}Data`]: tableData, enabled } = this.props; if (enabled && commonUtils.isNotEmptyObject(showConfig) && commonUtils.isNotEmptyArr(tableData)) { if (commonUtils.isNotEmptyObject(record)) { const { masterData: masterDataOld } = this.props; let sParam = ''; /* 找到该字段所在行 */ const iIndex = tableData.findIndex(item => item.sId === record.sId); if (showConfig.sName === 'sName') { if (iIndex > -1) { sParam = record[showConfig.sName]; } else { sParam = showConfig.sName; } } else if (iIndex > -1) { sParam = `${firstChar}${iIndex}_${showConfig.sName}`; } else { sParam = showConfig.sName; } const value = `@${sParam}`; const masterData = { ...masterDataOld }; const sFormulaMemo = (Object.keys(masterData).length > 0 && masterData.sFormulaMemo !== undefined) ? masterData.sFormulaMemo : ''; const changeFormula = `${sFormulaMemo}${value}`; masterData.sFormula = changeFormula; masterData.sFormulaMemo = changeFormula; masterData.handleType = masterData.handleType === 'add' ? 'add' : 'update'; this.props.onSaveState({ masterData }); } } }; render() { const { pageLoading } = this.props; return (
); } } const SisformulaComponent = Form.create({ mapPropsToFields(props) { const { masterData } = props; const obj = commonFunc.mapPropsToFields(masterData, Form); return obj; }, })((props) => { const { form, onReturnForm, sModelsId, app, customizeParamConfig, selfParamConfig, } = props; onReturnForm(form); const { masterConfig } = props; let { masterData } = props; masterData = masterData === undefined ? {} : masterData; const masterShowConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'sFormulaMemo') : {}; const masterShowConfigMemo = commonUtils.isNotEmptyObject(masterShowConfig) ? masterShowConfig[0] : {}; const tabFormulaDetails = commonFunc.showMessage(app.commonConst, 'tabFormulaDetails');/* 公式详情 */ // const tabCalculatorArea = commonFunc.showMessage(app.commonConst, 'tabCalculatorArea');/* 计算器区域 */ const tabCalculationParameter = commonFunc.showMessage(app.commonConst, 'tabCalculationParameter');/* 计算参数 */ const tabSystemFunction = commonFunc.showMessage(app.commonConst, 'tabSystemFunction');/* 系统函数 */ const tabBusinessFunction = commonFunc.showMessage(app.commonConst, 'tabBusinessFunction');/* 业务函数 */ const tabBusinessParameters = commonFunc.showMessage(app.commonConst, 'tabBusinessParameters');/* 自定义参数 */ const showTypeProps = { record: masterData, name: 'master', form: props.form, formId: sModelsId, isDropDownLoadFinish: true, getSqlDropDownData: props.getSqlDropDownData, getSqlCondition: props.getSqlCondition, handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord, getFloatNum: props.getFloatNum, getDateFormat: props.getDateFormat, onChange: props.onChange, showConfig: masterShowConfigMemo, formItemLayout: true, textArea: true, enabled: props.enabled, dataValue: masterData.sFormulaMemo, bTable: true, onFilterDropDownData: props.onFilterDropDownData, onSaveState: props.onSaveState, }; /* 开发者模式 */ const customizeParamPropsType = { ...commonBusiness.getTableTypes('customizeParam', props), tableProps: { AutoTableHeight: 255, }, // bNaturalWidth: true, /* 原始宽度 不进行最后一列计算 */ rowSelection: null, }; /* 自定义参数 */ const selfParamPropsType = { ...commonBusiness.getTableTypes('selfParam', props), tableProps: { AutoTableHeight: 150, }, // bNaturalWidth: true, /* 原始宽度 不进行最后一列计算 */ rowSelection: null, }; const customizeParamPropsTypeArr = []; if (commonUtils.isNotEmptyArr(props.customizeParamName)) { props.customizeParamName.forEach((paramName) => { customizeParamPropsTypeArr.push({ ...commonBusiness.getTableTypes(paramName, props), tableProps: { AutoTableHeight: 255, }, // bNaturalWidth: true, /* 原始宽度 不进行最后一列计算 */ rowSelection: null, bHideCopyAll: true, }); }); } /* 用户模式 */ const customizeParamUserPropsType = { ...commonBusiness.getTableTypes('customizeParam', props), data: props.customizeParamData, config: props.userParamConfig, headerColumn: props.userParamColumn, tableProps: { AutoTableHeight: 469, }, // bNaturalWidth: true, /* 原始宽度 不进行最后一列计算 */ rowSelection: null, }; const customizeParamUserPropsTypeArr = []; if (commonUtils.isNotEmptyArr(props.userParamName)) { props.userParamName.forEach((paramName) => { const customizeParamName = paramName.replace('userParam', 'customizeParam'); customizeParamUserPropsTypeArr.push({ ...commonBusiness.getTableTypes(customizeParamName, props), data: props[`${customizeParamName}Data`], config: props[`${paramName}Config`], headerColumn: props[`${paramName}Column`], tableProps: { AutoTableHeight: 469, }, // bNaturalWidth: true, /* 原始宽度 不进行最后一列计算 */ rowSelection: null, bHideCopyAll: true, }); }); } const editableClass = commonUtils.isNotEmptyObject(props) && props.enabled ? 'xly-bill-list editUser' : 'xly-bill-list viewUser'; return (
{/*
*/} {/* */} {/*
*/} { commonUtils.isNotEmptyObject(masterData) && masterData.bUserModel ?
{ commonUtils.isNotEmptyObject(masterShowConfig) ?
: ''}
{/* */} {/* */} {/*
*/} {/* */} {/* */} {/* */} { commonUtils.isNotEmptyArr(customizeParamPropsTypeArr) ? customizeParamPropsTypeArr.map((paramProps, index) => { const key = `${props.tableKey || 2}_${index}`; return (
{ commonUtils.isNotEmptyObject(paramProps) ? : ''}
); }) :
{ commonUtils.isNotEmptyObject(customizeParamConfig) ? : ''}
}
{ selfParamConfig ? { commonUtils.isNotEmptyObject(selfParamPropsType) ? : ''} : '' } {/*
*/}
:
{ commonUtils.isNotEmptyArr(customizeParamUserPropsTypeArr) ? customizeParamUserPropsTypeArr.map((paramProps, index) => { const key = `${props.tableKey || 2}_${index}`; return (
{ commonUtils.isNotEmptyObject(paramProps) ? : ''}
); }) :
{ commonUtils.isNotEmptyObject(customizeParamConfig) ? : ''}
}
} ); }); export default CommonBase(CommonElementEvent(SisformulaInfoComponent));