Commit 8016f6c08e89d4d2a49ae65603045f1e96159159

Authored by chenxt
1 parent fafd72c7

处理报错

src/components/Common/CommonComponent/index.js
@@ -82,7 +82,7 @@ export default class CommonComponent extends Component { @@ -82,7 +82,7 @@ export default class CommonComponent extends Component {
82 buttonLoading: false, 82 buttonLoading: false,
83 }; 83 };
84 this.lastValue = props.dataValue; 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 this.max = props.showConfig.sMaxValue; /* 最大值(数据格式:数字) */ 86 this.max = props.showConfig.sMaxValue; /* 最大值(数据格式:数字) */
87 this.min = props.showConfig.sMinValue; /* 最小值(数据格式:数字) */ 87 this.min = props.showConfig.sMinValue; /* 最小值(数据格式:数字) */
88 // 重构修改 88 // 重构修改
@@ -196,7 +196,7 @@ export default class CommonComponent extends Component { @@ -196,7 +196,7 @@ export default class CommonComponent extends Component {
196 dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType, 196 dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType,
197 } = this.state; 197 } = this.state;
198 if (nextProps.showConfig === undefined || this.props.showConfig === undefined) return; 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 if (nextProps.showConfig.sDropDownType === 'const') { /* 常量下拉 */ 201 if (nextProps.showConfig.sDropDownType === 'const') { /* 常量下拉 */
202 /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ 202 /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */
src/components/Common/CommonHooks/useCommonBase.js
@@ -683,10 +683,10 @@ const useCommonBase = props => { @@ -683,10 +683,10 @@ const useCommonBase = props => {
683 683
684 /* 获取数字格式化规范 */ 684 /* 获取数字格式化规范 */
685 const getFloatNum = sName => { 685 const getFloatNum = sName => {
686 - if (sName.toLowerCase().endsWith("price")) { 686 + if (sName?.toLowerCase().endsWith("price")) {
687 /* 价格 */ 687 /* 价格 */
688 return props.app.decimals.dNetPrice; 688 return props.app.decimals.dNetPrice;
689 - } else if (sName.toLowerCase().endsWith("money")) { 689 + } else if (sName?.toLowerCase().endsWith("money")) {
690 /* 金额 */ 690 /* 金额 */
691 return props.app.decimals.dNetMoney; 691 return props.app.decimals.dNetMoney;
692 } else { 692 } else {