Commit 8016f6c08e89d4d2a49ae65603045f1e96159159
1 parent
fafd72c7
处理报错
Showing
2 changed files
with
4 additions
and
4 deletions
src/components/Common/CommonComponent/index.js
| ... | ... | @@ -82,7 +82,7 @@ export default class CommonComponent extends Component { |
| 82 | 82 | buttonLoading: false, |
| 83 | 83 | }; |
| 84 | 84 | this.lastValue = props.dataValue; |
| 85 | - this.firstDataIndex = props.showConfig.sDateFormat === "decimalPoint" ? "d" : props.showConfig.sName.substring(0, 1); /* 控件首字母(数据格式:字符串) */ | |
| 85 | + this.firstDataIndex = props.showConfig.sDateFormat === "decimalPoint" ? "d" : props.showConfig.sName?.substring(0, 1); /* 控件首字母(数据格式:字符串) */ | |
| 86 | 86 | this.max = props.showConfig.sMaxValue; /* 最大值(数据格式:数字) */ |
| 87 | 87 | this.min = props.showConfig.sMinValue; /* 最小值(数据格式:数字) */ |
| 88 | 88 | // 重构修改 |
| ... | ... | @@ -196,7 +196,7 @@ export default class CommonComponent extends Component { |
| 196 | 196 | dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType, |
| 197 | 197 | } = this.state; |
| 198 | 198 | if (nextProps.showConfig === undefined || this.props.showConfig === undefined) return; |
| 199 | - this.firstDataIndex = nextProps.showConfig.sDateFormat === "decimalPoint" ? "d" : nextProps.showConfig.sName.substring(0, 1); /* 控件首字母(数据格式:字符串) */ | |
| 199 | + this.firstDataIndex = nextProps.showConfig.sDateFormat === "decimalPoint" ? "d" : nextProps.showConfig.sName?.substring(0, 1); /* 控件首字母(数据格式:字符串) */ | |
| 200 | 200 | |
| 201 | 201 | if (nextProps.showConfig.sDropDownType === 'const') { /* 常量下拉 */ |
| 202 | 202 | /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ | ... | ... |
src/components/Common/CommonHooks/useCommonBase.js
| ... | ... | @@ -683,10 +683,10 @@ const useCommonBase = props => { |
| 683 | 683 | |
| 684 | 684 | /* 获取数字格式化规范 */ |
| 685 | 685 | const getFloatNum = sName => { |
| 686 | - if (sName.toLowerCase().endsWith("price")) { | |
| 686 | + if (sName?.toLowerCase().endsWith("price")) { | |
| 687 | 687 | /* 价格 */ |
| 688 | 688 | return props.app.decimals.dNetPrice; |
| 689 | - } else if (sName.toLowerCase().endsWith("money")) { | |
| 689 | + } else if (sName?.toLowerCase().endsWith("money")) { | |
| 690 | 690 | /* 金额 */ |
| 691 | 691 | return props.app.decimals.dNetMoney; |
| 692 | 692 | } else { | ... | ... |