+
);
}
- if (this.props.showConfig.sName && this.props.showConfig.sName.toLowerCase().includes('fullmemo')) {
+ if (this.props.showConfig.sName && this.props.showConfig.sName.toLowerCase().includes("fullmemo")) {
const row = commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1;
- const minHeight = (row * 20) + 6 + 4 + 2;
- return
;
+ const minHeight = row * 20 + 6 + 4 + 2;
+ return (
+
+ );
}
- if ((this.props.showConfig.sDropDownType === 'sql' || this.props.showConfig.sDropDownType === 'const')
- && (this.firstDataIndex === 'i' || this.firstDataIndex === 'd' || this.firstDataIndex === 's')) { /* 下拉选择框(数字和文本选择框才会下拉) */
- if (this.props.showConfig.bCanInput) { /* 文本输入下拉框 */
+ if (
+ (this.props.showConfig.sDropDownType === "sql" || this.props.showConfig.sDropDownType === "const") &&
+ (this.firstDataIndex === "i" || this.firstDataIndex === "d" || this.firstDataIndex === "s")
+ ) {
+ /* 下拉选择框(数字和文本选择框才会下拉) */
+ if (this.props.showConfig.bCanInput) {
+ /* 文本输入下拉框 */
const propsObj = { ...this.getCompleteProps() };
- return
{this.getSelectOption('autoComplete')};
- } else { /* 普通下拉框 */
- return
;
- }
- } else if (this.state.enabled && commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sDropDownType === 'popup') { /* 通用弹窗 */
- return (
);
- } else if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */
- return innerInputProps.readOnly ?
:
- location.pathname.includes('quotationPackTableTree') && this.props.name === 'control' && this.props.showConfig.sName === 'dSinglePQty' ?
:
;
- } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */
+ return
{this.getSelectOption("autoComplete")};
+ } else {
+ /* 普通下拉框 */
+ return
;
+ }
+ } else if (this.state.enabled && commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sDropDownType === "popup") {
+ /* 通用弹窗 */
+ return (
+
+ );
+ } else if (this.firstDataIndex === "i" || this.firstDataIndex === "d") {
+ /* 数字输入框(整形i和浮点型d) */
+ return innerInputProps.readOnly ? (
+
+
+
+ ) : location.pathname.includes("quotationPackTableTree") && this.props.name === "control" && this.props.showConfig.sName === "dSinglePQty" ? (
+
+
+
+
+
+
+ ) : (
+
+ );
+ } else if (this.firstDataIndex === "b") {
+ /* 选择框(布尔类型b) */
return
{this.showName};
// return
{this.showName};
- } else if (this.firstDataIndex === 'm' || sDateFormat === 'YYYY-MM' || sDateFormat === 'YYYYMM') { /* 月份选择框(月份类型m) */
- return this.props.bTable ?
:
;
- } else if (this.firstDataIndex === 't') { /* 时间选择框(时间类型t) */
- if (['tYear'].includes(this.props.showConfig.sName)) {
- innerInputProps.picker = 'year';
- innerInputProps.format = 'YYYY';
+ } else if (this.firstDataIndex === "m" || sDateFormat === "YYYY-MM" || sDateFormat === "YYYYMM") {
+ /* 月份选择框(月份类型m) */
+ return this.props.bTable ? (
+
+
+
+ ) : (
+
+ );
+ } else if (this.firstDataIndex === "t") {
+ /* 时间选择框(时间类型t) */
+ if (["tYear"].includes(this.props.showConfig.sName)) {
+ innerInputProps.picker = "year";
+ innerInputProps.format = "YYYY";
innerInputProps.allowClear = false;
}
- return this.props.bTable ?
:
;
- } else if (this.firstDataIndex === 'y') { /* 年份选择框(年份类型y) */
- return this.props.bTable ?
:
;
- } else if (this.firstDataIndex === 'p') { /* 时间选择框(时间类型t) */
+ return this.props.bTable ? (
+
+
+
+ ) : (
+
+ );
+ } else if (this.firstDataIndex === "y") {
+ /* 年份选择框(年份类型y) */
+ return this.props.bTable ? (
+
+
+
+ ) : (
+
+ );
+ } else if (this.firstDataIndex === "p") {
+ /* 时间选择框(时间类型t) */
return
;
- } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */
- if (this.props.textArea) { /* 大文本输入框 */
+ } else if (this.firstDataIndex === "s") {
+ /* 文本输入框(文本s) */
+ if (this.props.textArea) {
+ /* 大文本输入框 */
return
;
- } else { /* 普通文本输入框 */
+ } else {
+ /* 普通文本输入框 */
return
;
}
- } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */
+ } else if (this.firstDataIndex === "c") {
+ /* 地址联动框(联动下拉类型c) */
return
;
- } else { /* 文本输入框(默认类型) */
+ } else {
+ /* 文本输入框(默认类型) */
return
;
}
};
@@ -1300,15 +1477,19 @@ export default class CommonComponent extends Component {
const { sName } = this.props.showConfig;
const config = gdsconfigformslave.find(item => item.sControlName === `BtnPopup.${sName}`);
if (config && this.props.onFieldPopupModal) {
- this.props.onFieldPopupModal(config, this.props.name, 'CommonListSelect');
+ this.props.onFieldPopupModal(config, this.props.name, "CommonListSelect");
}
},
};
- return
;
- }
+ return (
+
+ );
+ };
// 获取innerinput控件后面的按钮(自定义)
- getInnerButtonCostom = (showConfig) => {
+ getInnerButtonCostom = showConfig => {
const { name, sysEnabled } = this.props;
const { showName } = showConfig;
let disabled = this.props.showConfig?.buttonbReadonly;
@@ -1316,7 +1497,7 @@ export default class CommonComponent extends Component {
disabled = !sysEnabled;
}
const props = {
- type: 'primary',
+ type: "primary",
disabled,
loading: this.state.buttonLoading,
onClick: () => {
@@ -1326,10 +1507,10 @@ export default class CommonComponent extends Component {
},
};
return
;
- }
+ };
/** 获取selectOption对象 */
- getSelectOption = (type) => {
+ getSelectOption = type => {
/* 返回值声明 */
const options = [];
/* 执行条件 */
@@ -1341,40 +1522,52 @@ export default class CommonComponent extends Component {
if (commonUtils.isNotEmptyObject(each)) {
/* 拼接optoin对象 */
let keyValue = !commonUtils.isEmpty(each.sSlaveId) ? each.sSlaveId : each.sId;
- if (this.firstDataIndex === 'i') {
+ if (this.firstDataIndex === "i") {
keyValue = parseInt(keyValue, 0);
- } else if (this.firstDataIndex === 'd') {
+ } else if (this.firstDataIndex === "d") {
keyValue = parseFloat(keyValue);
}
- let res = '';
+ let res = "";
if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) {
res = each[this.props.showConfig.sVisColumnName];
} else {
- res = Object.keys(each).length > 0 ? each[Object.keys(each)[0]] : '';
+ res = Object.keys(each).length > 0 ? each[Object.keys(each)[0]] : "";
}
- keyValue = commonUtils.isEmpty(keyValue) ? '' : keyValue;
- if (type === 'autoComplete') {
+ keyValue = commonUtils.isEmpty(keyValue) ? "" : keyValue;
+ if (type === "autoComplete") {
// 为autoComplete作特殊处理
- const option = this.props.showConfig.bCanInput ?
- (
) :
- (
);
+ const option = this.props.showConfig.bCanInput ? (
+
+ ) : (
+
+ );
/* 返回值赋值s */
options.push(option);
} else {
- const option = this.props.showConfig.bCanInput ?
- (
) :
- (
);
+ const option = this.props.showConfig.bCanInput ? (
+
+ ) : (
+
+ );
/* 返回值赋值 */
options.push(option);
}
}
}
}
- if (this.state.searchValue === '') {
+ if (this.state.searchValue === "") {
/* 下拉空处理 */
if (this.props.showConfig.bFirstEmpty) {
// 重构修改 options.unshift(
);
- if (type === 'autoComplete') {
+ if (type === "autoComplete") {
// options.unshift(
);/* 解决销售订单-产品名称,五笔输入法输入不支持直接输入中文 */
} else {
options.unshift(
);
@@ -1383,10 +1576,14 @@ export default class CommonComponent extends Component {
/* 下拉新增处理 */
if (this.props.showConfig.bNewRecord) {
// 重构修改 options.unshift(
);
- if (type === 'autoComplete') {
+ if (type === "autoComplete") {
options.unshift(
);
} else {
- options.unshift(
);
+ options.unshift(
+
+ );
}
}
}
@@ -1395,13 +1592,13 @@ export default class CommonComponent extends Component {
};
/* 获取sqlCondition对象 */
- getFloatPrice = (floatNum) => {
+ getFloatPrice = floatNum => {
/* 返回值声明 */
- let floatPrice = '';
+ let floatPrice = "";
/* 返回值赋值 */
if (!commonUtils.isUndefined(floatNum)) {
for (let i = 0; i < floatNum; i += 1) {
- floatPrice += '\\d';
+ floatPrice += "\\d";
}
}
/* 返回值 */
@@ -1417,15 +1614,23 @@ export default class CommonComponent extends Component {
1、判断是否直接传下拉,如果传了就直接用,并存储到store中去
2、没有传看 getStoreDropDownData有没有存储,存储后直接取用
3、 没有存储时直接调用后台SQL语句去下拉 */
- if (this.props.showConfig.sDropDownType === 'sql') { /* 数据下拉 */
+ if (this.props.showConfig.sDropDownType === "sql") {
+ /* 数据下拉 */
const { dropDownData: dropDownDataOld, searchDropDownData: searchDropDownDataOld } = this.state;
if (pageNum <= totalPageCount) {
- const sqlDropDownData = await this.props.getSqlDropDownData(this.props.formId, this.props.name, this.props.showConfig, this.props.record, searchValue, pageNum);
+ const sqlDropDownData = await this.props.getSqlDropDownData(
+ this.props.formId,
+ this.props.name,
+ this.props.showConfig,
+ this.props.record,
+ searchValue,
+ pageNum
+ );
if (dropDownCount !== undefined && dropDownCount < this.dropDownCount) {
return;
}
if (this.mounted) {
- if (searchValue !== '') {
+ if (searchValue !== "") {
const dropDownData = [];
if (commonUtils.isNotEmptyArr(sqlDropDownData.dropDownData)) {
if (pageNum !== 1) {
@@ -1457,7 +1662,7 @@ export default class CommonComponent extends Component {
totalPageCount: sqlDropDownData.totalPageCount,
pageNum: sqlDropDownData.currentPageNo,
spinState: false,
- searchValue: '',
+ searchValue: "",
totalCount: sqlDropDownData.totalCount,
selectTableData: sqlDropDownData.dropDownData,
});
@@ -1470,9 +1675,11 @@ export default class CommonComponent extends Component {
/** 获取innerinput控件参数 */
getInnerInputProps = () => {
/* 主表和从表的innerinputprops对象有区别 */
- if (!this.props.bTable) { /* 主表 */
+ if (!this.props.bTable) {
+ /* 主表 */
return this.getInnerInputPropsMaster();
- } else { /* 主从表 */
+ } else {
+ /* 主从表 */
return this.getInnerInputPropsSlave();
}
};
@@ -1481,16 +1688,21 @@ export default class CommonComponent extends Component {
getInnerInputPropsSlave = () => {
/* 返回值声明 */
let obj = {};
- if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */
+ if (this.firstDataIndex === "i" || this.firstDataIndex === "d") {
+ /* 数字输入框(整形i和浮点型d) */
obj = this.getNumberInnerInputPropsSlave();
- } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */
+ } else if (this.firstDataIndex === "b") {
+ /* 选择框(布尔类型b) */
obj = this.getBooleanInnerInputPropsSlave();
- } else if (this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 'm' || this.firstDataIndex === 'y') { /* 时间选择框(时间类型t) */
+ } else if (this.firstDataIndex === "t" || this.firstDataIndex === "p" || this.firstDataIndex === "m" || this.firstDataIndex === "y") {
+ /* 时间选择框(时间类型t) */
obj = this.getDateInnerInputPropsSlave();
- } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */
+ } else if (this.firstDataIndex === "s") {
+ /* 文本输入框(文本s) */
obj = this.getTextInnerInputPropsSlave();
obj.onDoubleClick = this.onDoubleClick;
- } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */
+ } else if (this.firstDataIndex === "c") {
+ /* 地址联动框(联动下拉类型c) */
obj = this.getAddressInnerInputPropsSlave();
}
obj.onKeyDown = this.onKeyDown;
@@ -1498,7 +1710,7 @@ export default class CommonComponent extends Component {
obj.onBlur = this.onBlur;
obj.onMouseEnter = this.onFocus;
obj.id = `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`; /* 所有从表组件添加id */
- obj.placeholder = this.props.showConfig.placeholder || '';
+ obj.placeholder = this.props.showConfig.placeholder || "";
/* 返回值 */
return obj;
};
@@ -1508,15 +1720,18 @@ export default class CommonComponent extends Component {
/* 返回值 */
const obj = {
// disabled: !this.state.enabled, /* 是否可编辑 */
- placeholder: '请选择省市区', /* 预期值的提示信息 */
- options: this.getProvinceCityAreaData(), /* 数据 */
- changeOnSelect: true, /* 对每个选择值进行更改 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
- value: commonUtils.isUndefined(this.state.dataValue) ? [] : typeof this.state.dataValue === 'string' ?
- this.state.dataValue.split(',') : commonUtils.convertUndefinedToEmptyArr(this.state.dataValue), /* 数据值 */
+ placeholder: "请选择省市区" /* 预期值的提示信息 */,
+ options: this.getProvinceCityAreaData() /* 数据 */,
+ changeOnSelect: true /* 对每个选择值进行更改 */,
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
+ value: commonUtils.isUndefined(this.state.dataValue)
+ ? []
+ : typeof this.state.dataValue === "string"
+ ? this.state.dataValue.split(",")
+ : commonUtils.convertUndefinedToEmptyArr(this.state.dataValue) /* 数据值 */,
};
if (this.props.readOnly) {
- obj.readOnly = 'readOnly';
+ obj.readOnly = "readOnly";
} else {
obj.disabled = !this.state.enabled;
}
@@ -1527,32 +1742,51 @@ export default class CommonComponent extends Component {
/* 获取文本innerinputprops对象(从) */
getTextInnerInputPropsSlave = () => {
/* 返回值声明 */
- const bShowSuffix = this.props.showConfig.sName === 'sSaveProName' || this.props.showConfig.sName === 'sDeleteProName' || this.props.showConfig.sName === 'sSaveProNameBefore' || this.props.showConfig.sName === 'sProcName' || this.props.showConfig.sName === 'sButtonParam'; /* 是否展示后缀图标 */
- const bShowArrow = this.props.showConfig.sName === 'dNeedAuxiliaryQty';
+ const bShowSuffix =
+ this.props.showConfig.sName === "sSaveProName" ||
+ this.props.showConfig.sName === "sDeleteProName" ||
+ this.props.showConfig.sName === "sSaveProNameBefore" ||
+ this.props.showConfig.sName === "sProcName" ||
+ this.props.showConfig.sName === "sButtonParam"; /* 是否展示后缀图标 */
+ const bShowArrow = this.props.showConfig.sName === "dNeedAuxiliaryQty";
const obj = {
// disabled: !this.state.enabled, /* 是否可编辑 */
- id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */
- onChange: e => this.handleSelectOptionEvent(e), /* 数据改变回带到父组件 */
- value: commonUtils.isUndefined(this.state.dataValue) ? '' : commonUtils.strUndefinedToEmpty(this.state.dataValue), /* 数据值 */
+ id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */,
+ onChange: e => this.handleSelectOptionEvent(e) /* 数据改变回带到父组件 */,
+ value: commonUtils.isUndefined(this.state.dataValue) ? "" : commonUtils.strUndefinedToEmpty(this.state.dataValue) /* 数据值 */,
// eslint-disable-next-line no-return-assign
- ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */
- onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */
- suffix: bShowSuffix ?
:
- (bShowArrow ?
: ''),
+ ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */,
+ onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */,
+ suffix: bShowSuffix ? (
+
+
+
+ ) : bShowArrow ? (
+
+
+
+ ) : (
+ ""
+ ),
rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1,
};
if (this.props.readOnly) {
- obj.readOnly = 'readOnly';
+ obj.readOnly = "readOnly";
} else {
obj.disabled = !this.state.enabled;
}
/* 最大值最小值 */
- if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) {
+ if (
+ typeof commonUtils.convertStrToNumber(this.max) === "number" &&
+ commonUtils.convertStrToNumber(this.max) !== 0 &&
+ this.max.indexOf(".d") === -1 &&
+ this.max.indexOf(".i") === -1
+ ) {
obj.maxLength = this.max; /* 最大长度 */
obj.title = obj.value;
}
obj.placeholder = this.props.showConfig.placeholder;
- obj.autocomplete = 'new-password';
+ obj.autocomplete = "new-password";
/* 返回值 */
return obj;
};
@@ -1561,10 +1795,10 @@ export default class CommonComponent extends Component {
getDateInnerInputPropsSlave = () => {
let { sDateFormat } = this.props.showConfig;
if (commonUtils.isEmptyStr(sDateFormat)) {
- if (this.firstDataIndex === 'm') {
- sDateFormat = 'YYYY-MM';
- } else if (this.firstDataIndex === 'y') {
- sDateFormat = 'YYYY';
+ if (this.firstDataIndex === "m") {
+ sDateFormat = "YYYY-MM";
+ } else if (this.firstDataIndex === "y") {
+ sDateFormat = "YYYY";
} else {
sDateFormat = this.props.getDateFormat();
}
@@ -1578,15 +1812,15 @@ export default class CommonComponent extends Component {
}
/* 返回值声明 */
const obj = {
- placeholder: '', /* 时间的提示信息 */
- disabled: !this.state.enabled, /* 是否可编辑 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
+ placeholder: "" /* 时间的提示信息 */,
+ disabled: !this.state.enabled /* 是否可编辑 */,
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
format: sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */
- disabledDate: this.getDataMaxAndMin, /* 不可选日期 */
+ disabledDate: this.getDataMaxAndMin /* 不可选日期 */,
showTime: showtimeFormat,
- style: { width: '100%' }, /* 样式 */
+ style: { width: "100%" } /* 样式 */,
onBlur: () => {
- this.onExecInstructSet('blur');
+ this.onExecInstructSet("blur");
},
};
// if (this.props.readOnly) {
@@ -1607,9 +1841,9 @@ export default class CommonComponent extends Component {
getBooleanInnerInputPropsSlave = () => {
/* 返回值声明 */
const obj = {
- disabled: !this.state.enabled, /* 是否可编辑 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
- checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue), /* 是否选中 */
+ disabled: !this.state.enabled /* 是否可编辑 */,
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
+ checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue) /* 是否选中 */,
};
// if (this.props.readOnly) {
// obj.readOnly = true;
@@ -1622,23 +1856,27 @@ export default class CommonComponent extends Component {
/* 获取数字innerinputprops对象(从) */
getNumberInnerInputPropsSlave = () => {
- const bShowArrow = this.props.showConfig.sName === 'dNeedAuxiliaryQty' && this.props.showConfig.sControlName !== 'slaveInfo';
+ const bShowArrow = this.props.showConfig.sName === "dNeedAuxiliaryQty" && this.props.showConfig.sControlName !== "slaveInfo";
/* 返回值声明 */
const obj = {
- id: `${this.props.showConfig.sName}${this.props.showConfig.sId}`, /* 虚拟数字键盘使用id获取光标 */
- className: styles.inputNum, /* 样式名称 */
+ id: `${this.props.showConfig.sName}${this.props.showConfig.sId}` /* 虚拟数字键盘使用id获取光标 */,
+ className: styles.inputNum /* 样式名称 */,
// disabled: !this.state.enabled, /* 是否可编辑 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
- parser: (oldValue) => {
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
+ parser: oldValue => {
const value = this.handleCheckNumberInnerInput(oldValue);
return value;
},
// eslint-disable-next-line no-return-assign
- ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */
- onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */
+ ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */,
+ onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */,
};
if (bShowArrow) {
- obj.addonAfter =
;
+ obj.addonAfter = (
+
+
+
+ );
}
if (this.props.readOnly) {
obj.readOnly = true;
@@ -1646,20 +1884,26 @@ export default class CommonComponent extends Component {
obj.disabled = !this.state.enabled;
}
/* 最大值最小值 */
- if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) {
+ if (
+ typeof commonUtils.convertStrToNumber(this.max) === "number" &&
+ commonUtils.convertStrToNumber(this.max) !== 0 &&
+ this.max.indexOf(".d") === -1 &&
+ this.max.indexOf(".i") === -1
+ ) {
obj.max = this.max; /* 最大值 */
- } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf('.') > -1 && commonUtils.isNotEmptyObject(this.props.record)) {
- obj.max = this.props.record[this.max.substring(this.max.indexOf('.') + 1)];
+ } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf(".") > -1 && commonUtils.isNotEmptyObject(this.props.record)) {
+ obj.max = this.props.record[this.max.substring(this.max.indexOf(".") + 1)];
}
- if (typeof commonUtils.convertStrToNumber(this.min) === 'number' && commonUtils.convertStrToNumber(this.min) !== 0) {
+ if (typeof commonUtils.convertStrToNumber(this.min) === "number" && commonUtils.convertStrToNumber(this.min) !== 0) {
obj.min = this.min; /* 最小值 */
}
- if (obj.max < 0) { /* 为解决收付款单据未收款为负数时收款金额不能大于未收款问题,当最大值小于0时,变更为设为最小值 */
+ if (obj.max < 0) {
+ /* 为解决收付款单据未收款为负数时收款金额不能大于未收款问题,当最大值小于0时,变更为设为最小值 */
obj.min = obj.max;
obj.max = 0;
}
/* 浮点型需要格式化 */
- if (this.firstDataIndex === 'd') {
+ if (this.firstDataIndex === "d") {
// obj.formatter = value => this.toFamatter(value);
// obj.parser = value => this.toFamatter(value);
// obj.precision = this.floatNum;
@@ -1671,7 +1915,7 @@ export default class CommonComponent extends Component {
const { dNetPrice } = this.props.app.decimals;
const { showConfig } = this.props;
const { sName, showName } = showConfig;
- const digit = sName.includes('Price') ? dNetPrice : 6;
+ const digit = sName.includes("Price") ? dNetPrice : 6;
const numCheck = new RegExp(`^(-?\\d+)(\\.?)(\\d{1,${digit}})?$`);
const numValue = this.state.dataValue;
if (!isNaN(+numValue)) {
@@ -1689,23 +1933,30 @@ export default class CommonComponent extends Component {
getInnerInputPropsMaster = () => {
/* 返回值声明 */
let obj = {};
- if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */
+ if (this.firstDataIndex === "i" || this.firstDataIndex === "d") {
+ /* 数字输入框(整形i和浮点型d) */
obj = this.getNumberInnerInputPropsMaster();
- } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */
+ } else if (this.firstDataIndex === "b") {
+ /* 选择框(布尔类型b) */
obj = this.getBooleanInnerInputPropsMaster();
- } else if (this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 'm' || this.firstDataIndex === 'y') { /* 时间选择框(时间类型t) */
+ } else if (this.firstDataIndex === "t" || this.firstDataIndex === "p" || this.firstDataIndex === "m" || this.firstDataIndex === "y") {
+ /* 时间选择框(时间类型t) */
obj = this.getDateInnerInputPropsMaster();
- } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */
- if (this.props.textArea) { /* 大文本输入框 */
+ } else if (this.firstDataIndex === "s") {
+ /* 文本输入框(文本s) */
+ if (this.props.textArea) {
+ /* 大文本输入框 */
obj = this.getTextAreaInnerInputPropsMaster();
obj.onDoubleClick = this.onDoubleClick;
- } else { /* 普通文本输入框 */
+ } else {
+ /* 普通文本输入框 */
obj = this.getTextInnerInputPropsMaster();
- if (this.props?.showConfig?.sName === 'sInstruct') {
+ if (this.props?.showConfig?.sName === "sInstruct") {
obj.onDoubleClick = this.onDoubleClick;
}
}
- } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */
+ } else if (this.firstDataIndex === "c") {
+ /* 地址联动框(联动下拉类型c) */
obj = this.getAddressInnerInputPropsMaster();
}
obj.onKeyDown = this.onKeyDown;
@@ -1714,7 +1965,7 @@ export default class CommonComponent extends Component {
if (this.props.allowClear) {
obj.allowClear = this.props.allowClear; /* 带移除图标 */
}
- obj.placeholder = this.props.showConfig.placeholder || '';
+ obj.placeholder = this.props.showConfig.placeholder || "";
// obj.onContextMenu = this.onContextMenu;
/* 返回值 */
return obj;
@@ -1724,13 +1975,13 @@ export default class CommonComponent extends Component {
getAddressInnerInputPropsMaster = () => {
const obj = {
// disabled: !this.state.enabled, /* 是否可编辑 */
- placeholder: '请选择省市区', /* 预期值的提示信息 */
- options: this.getProvinceCityAreaData(), /* 数据 */
- changeOnSelect: true, /* 对每个选择值进行更改 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
+ placeholder: "请选择省市区" /* 预期值的提示信息 */,
+ options: this.getProvinceCityAreaData() /* 数据 */,
+ changeOnSelect: true /* 对每个选择值进行更改 */,
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
};
if (this.props.readOnly) {
- obj.readOnly = 'readOnly';
+ obj.readOnly = "readOnly";
} else {
obj.disabled = !this.state.enabled;
}
@@ -1740,33 +1991,48 @@ export default class CommonComponent extends Component {
/* 获取文本innerinputprops对象(主) */
getTextInnerInputPropsMaster = () => {
/* 返回值声明 */
- const bShowSuffix = this.props.showConfig.sName === 'sButtonParam' || this.props.showConfig.sName === 'sSqlStr' || this.props.showConfig.sName === 'sConfigSqlStr' || this.props.showConfig.sName === 'sProcName'; /* 是否展示后缀图标 */
+ const bShowSuffix =
+ this.props.showConfig.sName === "sButtonParam" ||
+ this.props.showConfig.sName === "sSqlStr" ||
+ this.props.showConfig.sName === "sConfigSqlStr" ||
+ this.props.showConfig.sName === "sProcName"; /* 是否展示后缀图标 */
const obj = {
- id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */
+ id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */,
// disabled: !this.state.enabled, /* 是否可编辑 */
- onChange: e => this.handleSelectOptionEvent(e), /* 数据改变回带到父组件 */
+ onChange: e => this.handleSelectOptionEvent(e) /* 数据改变回带到父组件 */,
// eslint-disable-next-line no-return-assign
- ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */
- onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */
- suffix: bShowSuffix ?
: '',
+ ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */,
+ onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */,
+ suffix: bShowSuffix ? (
+
+
+
+ ) : (
+ ""
+ ),
};
if (this.props.readOnly) {
- obj.readOnly = 'readOnly';
+ obj.readOnly = "readOnly";
} else {
obj.disabled = !this.state.enabled;
}
if (this.props.bPassWord) {
- obj.type = 'password'; /* 文本密码类型 */
+ obj.type = "password"; /* 文本密码类型 */
}
/* 最大值最小值 */
// if (this.props.showConfig.sName === 'sZmmGgxh') {
// console.log('sZmmGgxhsZmmGgxh', this.max, (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1));
// }
- if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) {
+ if (
+ typeof commonUtils.convertStrToNumber(this.max) === "number" &&
+ commonUtils.convertStrToNumber(this.max) !== 0 &&
+ this.max.indexOf(".d") === -1 &&
+ this.max.indexOf(".i") === -1
+ ) {
obj.maxLength = this.max; /* 最大长度 */
}
obj.onBlur = this.onBlurText;
- obj.autocomplete = 'new-password';
+ obj.autocomplete = "new-password";
/* 返回值 */
return obj;
};
@@ -1775,21 +2041,23 @@ export default class CommonComponent extends Component {
getTextAreaInnerInputPropsMaster = () => {
/* 返回值声明 */
const obj = {
- id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */
+ id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */,
// disabled: !this.state.enabled, /* 是否可编辑 */
// rows: 3, /* 纵跨度 */
- rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1, /* 产品部要求 备注设置成一行到底 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
+ rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1 /* 产品部要求 备注设置成一行到底 */,
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
// eslint-disable-next-line no-return-assign
- ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */
- onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */
+ ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */,
+ onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */,
};
if (this.props.readOnly) {
- obj.readOnly = 'readOnly';
- } if (commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sName.toLowerCase().endsWith('memo')) {
- if (!this.state.enabled) { /* 非编辑模式下 */
+ obj.readOnly = "readOnly";
+ }
+ if (commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sName.toLowerCase().endsWith("memo")) {
+ if (!this.state.enabled) {
+ /* 非编辑模式下 */
obj.readOnly = true;
- obj.style = { backgroundColor: '#f1f2f8' };
+ obj.style = { backgroundColor: "#f1f2f8" };
} else {
obj.disabled = !this.state.enabled;
}
@@ -1797,57 +2065,66 @@ export default class CommonComponent extends Component {
obj.disabled = !this.state.enabled;
}
/* 最大值最小值 */
- if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) {
+ if (
+ typeof commonUtils.convertStrToNumber(this.max) === "number" &&
+ commonUtils.convertStrToNumber(this.max) !== 0 &&
+ this.max.indexOf(".d") === -1 &&
+ this.max.indexOf(".i") === -1
+ ) {
obj.maxLength = this.max; /* 最大长度 */
}
return obj;
};
/* 获取日期最大值和最小值 */
- getDataMaxAndMin = (current) => {
+ getDataMaxAndMin = current => {
return this.getDataMax(current) || this.getDataMin(current);
- }
+ };
/* 获取日期最大值 */
- getDataMax = (current) => {
+ getDataMax = current => {
const showtimeFormat = this.props.showConfig.sDateFormat?.length > 11;
- if (commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && this.props.showConfig.sMaxValue.split('.').length > 1) {
- const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMaxValue }, '', {});
+ if (commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && this.props.showConfig.sMaxValue.split(".").length > 1) {
+ const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMaxValue }, "", {});
const sMaxValue = Object.keys(conditionValues).length > 0 ? conditionValues[Object.keys(conditionValues)[0]] : this.props.showConfig.sMaxValue;
- const tDate = this.props.showConfig.sMaxValue === 'now' ? moment() : moment(sMaxValue);
- return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate :
- commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf('day') > tDate.endOf('day');
+ const tDate = this.props.showConfig.sMaxValue === "now" ? moment() : moment(sMaxValue);
+ return showtimeFormat
+ ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate
+ : commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf("day") > tDate.endOf("day");
} else {
- const tDate = this.props.showConfig.sMaxValue === 'now' ? moment() : moment(this.props.showConfig.sMaxValue);
- return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate :
- commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf('day') > tDate.endOf('day');
+ const tDate = this.props.showConfig.sMaxValue === "now" ? moment() : moment(this.props.showConfig.sMaxValue);
+ return showtimeFormat
+ ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate
+ : commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf("day") > tDate.endOf("day");
}
- }
+ };
/* 获取日期最小值 */
- getDataMin = (current) => {
+ getDataMin = current => {
const showtimeFormat = this.props.showConfig.sDateFormat?.length > 11;
- if (commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && this.props.showConfig.sMinValue.split('.').length > 1) {
- const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMinValue }, '', {});
+ if (commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && this.props.showConfig.sMinValue.split(".").length > 1) {
+ const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMinValue }, "", {});
const sMinValue = Object.keys(conditionValues).length > 0 ? conditionValues[Object.keys(conditionValues)[0]] : this.props.showConfig.sMinValue;
- const tDate = this.props.showConfig.sMinValue === 'now' ? moment() : moment(sMinValue);
- return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate :
- commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf('day') < tDate.endOf('day');
+ const tDate = this.props.showConfig.sMinValue === "now" ? moment() : moment(sMinValue);
+ return showtimeFormat
+ ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate
+ : commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf("day") < tDate.endOf("day");
} else {
- const tDate = this.props.showConfig.sMinValue === 'now' ? moment() : moment(this.props.showConfig.sMinValue);
- return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate :
- commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf('day') < tDate.endOf('day');
+ const tDate = this.props.showConfig.sMinValue === "now" ? moment() : moment(this.props.showConfig.sMinValue);
+ return showtimeFormat
+ ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate
+ : commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf("day") < tDate.endOf("day");
}
- }
+ };
/* 获取时间innerinputprops对象(主) */
getDateInnerInputPropsMaster = () => {
let { sDateFormat } = this.props.showConfig;
if (commonUtils.isEmptyStr(sDateFormat)) {
- if (this.firstDataIndex === 'm') {
- sDateFormat = 'YYYY-MM';
- } else if (this.firstDataIndex === 'y') {
- sDateFormat = 'YYYY';
+ if (this.firstDataIndex === "m") {
+ sDateFormat = "YYYY-MM";
+ } else if (this.firstDataIndex === "y") {
+ sDateFormat = "YYYY";
} else {
sDateFormat = this.props.getDateFormat();
}
@@ -1861,17 +2138,17 @@ export default class CommonComponent extends Component {
}
// 2021-6-5日修改,生产排程日期选择精确到小时
const obj = {
- placeholder: '', /* 时间的提示信息 */
- disabled: !this.state.enabled, /* 是否可编辑 */
- style: { width: '100%' }, /* 样式 */
+ placeholder: "" /* 时间的提示信息 */,
+ disabled: !this.state.enabled /* 是否可编辑 */,
+ style: { width: "100%" } /* 样式 */,
// showTime: this.props.showTime ? { format: 'HH:mm', defaultValue: [moment('00:00', 'HH:mm'), moment('00:00', 'HH:mm')] } : '',
// showTime: this.props.showTime,
showTime: showtimeFormat,
- format: this.props.showTime ? 'YYYY-MM-DD HH:mm:ss' : sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
- disabledDate: this.getDataMaxAndMin, /* 不可选日期 */
+ format: this.props.showTime ? "YYYY-MM-DD HH:mm:ss" : sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
+ disabledDate: this.getDataMaxAndMin /* 不可选日期 */,
onBlur: () => {
- this.onExecInstructSet('blur');
+ this.onExecInstructSet("blur");
},
};
// if (this.props.readOnly) {
@@ -1885,9 +2162,9 @@ export default class CommonComponent extends Component {
/* 获取布尔innerinputprops对象(主) */
getBooleanInnerInputPropsMaster = () => {
const obj = {
- disabled: !this.state.enabled, /* 是否显示 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
- checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue), /* 是否选中 */
+ disabled: !this.state.enabled /* 是否显示 */,
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
+ checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue) /* 是否选中 */,
};
// if (this.props.readOnly) {
// obj.readOnly = true;
@@ -1897,17 +2174,18 @@ export default class CommonComponent extends Component {
return obj;
};
// eslint-disable-next-line react/sort-comp
- handleInputOnClick = (id) => {
+ handleInputOnClick = id => {
// 判断是否是oee系统,否则不显示虚拟键盘
- if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.indexOf('/indexOee') > -1) {
- if (VirtualKeyboard.isKeyBoard()) { // 关闭上次键盘
+ if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.indexOf("/indexOee") > -1) {
+ if (VirtualKeyboard.isKeyBoard()) {
+ // 关闭上次键盘
VirtualKeyboard.closeKeyboard();
}
const keyboardValue = {};
if (commonUtils.isNotEmptyObject(this.props.dataValue)) {
keyboardValue.value = this.props.dataValue;
} else {
- keyboardValue.value = '';
+ keyboardValue.value = "";
}
VirtualKeyboard.showKeyboardSetState(keyboardValue, this, id);
}
@@ -1917,29 +2195,29 @@ export default class CommonComponent extends Component {
const rowId = this.props.record.sId;
this.props.onInputClick(rowId, sName);
}
- }
+ };
/* 获取数字innerinputprops对象(主) */
getNumberInnerInputPropsMaster = () => {
/* 如果是浮点型并且有格式规定,display类型需要变为block */
- let display = 'inline-block';
- if (this.firstDataIndex === 'd' && this.floatNum !== 0) {
- display = 'block';
+ let display = "inline-block";
+ if (this.firstDataIndex === "d" && this.floatNum !== 0) {
+ display = "block";
}
// const sInputId = `id${commonUtils.createSid()}`;
/* 返回值赋值 */
const obj = {
- id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */
- style: { width: 'auto', display, marginRight: 0 }, /* 样式 */
+ id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */,
+ style: { width: "auto", display, marginRight: 0 } /* 样式 */,
// disabled: !this.state.enabled, /* 是否显示 */
- onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */
- parser: (oldValue) => {
+ onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */,
+ parser: oldValue => {
const value = this.handleCheckNumberInnerInput(oldValue);
return value;
},
// eslint-disable-next-line no-return-assign
- ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 这里得ref中得变量必须是input得id */
- onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */
+ ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 这里得ref中得变量必须是input得id */,
+ onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */,
};
if (this.props.readOnly) {
obj.readOnly = true;
@@ -1947,12 +2225,17 @@ export default class CommonComponent extends Component {
obj.disabled = !this.state.enabled;
}
/* 最大值最小值 */
- if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) {
+ if (
+ typeof commonUtils.convertStrToNumber(this.max) === "number" &&
+ commonUtils.convertStrToNumber(this.max) !== 0 &&
+ this.max.indexOf(".d") === -1 &&
+ this.max.indexOf(".i") === -1
+ ) {
obj.max = this.max; /* 最大值 */
- } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf('.') > -1 && commonUtils.isNotEmptyObject(this.props.record)) {
- obj.max = this.props.record[this.max.substring(this.max.indexOf('.') + 1)];
+ } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf(".") > -1 && commonUtils.isNotEmptyObject(this.props.record)) {
+ obj.max = this.props.record[this.max.substring(this.max.indexOf(".") + 1)];
}
- if (typeof commonUtils.convertStrToNumber(this.min) === 'number' && commonUtils.convertStrToNumber(this.min) !== 0) {
+ if (typeof commonUtils.convertStrToNumber(this.min) === "number" && commonUtils.convertStrToNumber(this.min) !== 0) {
obj.min = this.min; /* 最小值 */
}
obj.placeholder = this.props.showConfig.placeholder;
@@ -1979,28 +2262,28 @@ export default class CommonComponent extends Component {
};
/* 获取省数据 */
- getProvinceData = (options) => {
- Provinces.forEach((childProvince) => {
+ getProvinceData = options => {
+ Provinces.forEach(childProvince => {
options.push({
- value: childProvince.name, /* 文字 */
- label: childProvince.name, /* 标签 */
- code: childProvince.code, /* 编码 */
- children: [], /* 子节点(city) */
+ value: childProvince.name /* 文字 */,
+ label: childProvince.name /* 标签 */,
+ code: childProvince.code /* 编码 */,
+ children: [] /* 子节点(city) */,
});
});
};
/* 获取市数据 */
- getCityData = (options) => {
- options.forEach((childProvince) => {
+ getCityData = options => {
+ options.forEach(childProvince => {
const cities = Cities.filter(item => item.provinceCode === childProvince.code);
if (cities.length > 0) {
- cities.forEach((childCity) => {
+ cities.forEach(childCity => {
childProvince.children.push({
- value: childCity.name, /* 文字 */
- label: childCity.name, /* 标签 */
- code: childCity.code, /* 编码 */
- children: [], /* 子节点(area) */
+ value: childCity.name /* 文字 */,
+ label: childCity.name /* 标签 */,
+ code: childCity.code /* 编码 */,
+ children: [] /* 子节点(area) */,
});
});
}
@@ -2008,17 +2291,17 @@ export default class CommonComponent extends Component {
};
/* 获取区数据 */
- getAreaData = (options) => {
- options.forEach((childProvince) => {
+ getAreaData = options => {
+ options.forEach(childProvince => {
const cities = childProvince.children;
- cities.forEach((childCity) => {
- const areas = Areas.filter((item => item.cityCode === childCity.code));
+ cities.forEach(childCity => {
+ const areas = Areas.filter(item => item.cityCode === childCity.code);
if (areas.length > 0) {
- areas.forEach((area) => {
+ areas.forEach(area => {
childCity.children.push({
- value: area.name, /* 文字 */
- label: area.name, /* 标签 */
- code: area.code, /* 编码 */
+ value: area.name /* 文字 */,
+ label: area.name /* 标签 */,
+ code: area.code /* 编码 */,
});
});
}
@@ -2029,11 +2312,14 @@ export default class CommonComponent extends Component {
/* 获取formitemprops对象 */
getOutFormItemProps = () => {
/* 主表和从表的formitemprops对象有区别 */
- if (!this.props.bTable) { /* 主表 */
+ if (!this.props.bTable) {
+ /* 主表 */
return this.getOutFormItemPropsMaster();
- } else if (this.props.bViewTable) { /* 表格单行显示 */
+ } else if (this.props.bViewTable) {
+ /* 表格单行显示 */
return this.getOutFormItemPropsViewSlave();
- } else { /* 从表 */
+ } else {
+ /* 从表 */
return this.getOutFormItemPropsSlave();
}
};
@@ -2042,36 +2328,40 @@ export default class CommonComponent extends Component {
getOutFormItemPropsMaster = () => {
/* 返回值声明 */
let obj = {};
- if (this.firstDataIndex === 'i'
- || this.firstDataIndex === 'd'
- || this.firstDataIndex === 'p'
- || this.firstDataIndex === 't'
- || this.firstDataIndex === 'm'
- || this.firstDataIndex === 's'
- || this.firstDataIndex === 'c') { /* 数字输入框(整形i和浮点型d),
+ if (
+ this.firstDataIndex === "i" ||
+ this.firstDataIndex === "d" ||
+ this.firstDataIndex === "p" ||
+ this.firstDataIndex === "t" ||
+ this.firstDataIndex === "m" ||
+ this.firstDataIndex === "s" ||
+ this.firstDataIndex === "c"
+ ) {
+ /* 数字输入框(整形i和浮点型d),
时间选择框(时间类型t),
文本输入框(文本s),
地址联动框(联动下拉类型c) */
obj = {
- label: this.props.showConfig.showName, /* 标签 */
- className: styles.formItemMargin, /* 样式名称 */
- ...this.formItemLayout, /* 主要是rowspan和colspan */
+ label: this.props.showConfig.showName /* 标签 */,
+ className: styles.formItemMargin /* 样式名称 */,
+ ...this.formItemLayout /* 主要是rowspan和colspan */,
};
- } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */
+ } else if (this.firstDataIndex === "b") {
+ /* 选择框(布尔类型b) */
obj = {
- label: this.props.showConfig.showName, /* 标签 */
- className: styles.formItemMag10, /* 样式名称 */
- ...this.formItemLayout, /* 主要是rowspan和colspan */
+ label: this.props.showConfig.showName /* 标签 */,
+ className: styles.formItemMag10 /* 样式名称 */,
+ ...this.formItemLayout /* 主要是rowspan和colspan */,
};
}
- if (this.props.itemLabel === 'hide') {
+ if (this.props.itemLabel === "hide") {
delete obj.label;
}
/* 设置标题颜色 */
if (this.props.showConfig.sFontColor) {
// eslint-disable-next-line prefer-destructuring
const sFontColor = this.props.showConfig.sFontColor;
- obj.labelCol.style = { color: sFontColor, fontWeight: 'bold', backgroundColor: '#BFEFFF' };
+ obj.labelCol.style = { color: sFontColor, fontWeight: "bold", backgroundColor: "#BFEFFF" };
}
/* 返回值 */
return obj;
@@ -2081,69 +2371,78 @@ export default class CommonComponent extends Component {
getOutFormItemPropsViewSlave = () => {
/* 返回值声明 */
let obj = {};
- if (this.firstDataIndex === 'i'
- || this.firstDataIndex === 'd'
- || this.firstDataIndex === 'p'
- || this.firstDataIndex === 't'
- || this.firstDataIndex === 'm'
- || this.firstDataIndex === 's'
- || this.firstDataIndex === 'c') { /* 数字输入框(整形i和浮点型d),
+ if (
+ this.firstDataIndex === "i" ||
+ this.firstDataIndex === "d" ||
+ this.firstDataIndex === "p" ||
+ this.firstDataIndex === "t" ||
+ this.firstDataIndex === "m" ||
+ this.firstDataIndex === "s" ||
+ this.firstDataIndex === "c"
+ ) {
+ /* 数字输入框(整形i和浮点型d),
时间选择框(时间类型t),
文本输入框(文本s),
地址联动框(联动下拉类型c) */
obj = {
- label: this.props.showConfig.showName, /* 标签 */
- className: styles.formItemMargin, /* 样式名称 */
- ...this.formItemLayout, /* 主要是rowspan和colspan */
+ label: this.props.showConfig.showName /* 标签 */,
+ className: styles.formItemMargin /* 样式名称 */,
+ ...this.formItemLayout /* 主要是rowspan和colspan */,
};
- } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */
+ } else if (this.firstDataIndex === "b") {
+ /* 选择框(布尔类型b) */
obj = {
- label: this.props.showConfig.showName, /* 标签 */
- className: styles.formItemMag10, /* 样式名称 */
- ...this.formItemLayout, /* 主要是rowspan和colspan */
+ label: this.props.showConfig.showName /* 标签 */,
+ className: styles.formItemMag10 /* 样式名称 */,
+ ...this.formItemLayout /* 主要是rowspan和colspan */,
};
}
- if (this.props.itemLabel === 'hide') {
+ if (this.props.itemLabel === "hide") {
delete obj.label;
}
/* 设置标题颜色 */
if (this.props.showConfig.sFontColor) {
// eslint-disable-next-line prefer-destructuring
const sFontColor = this.props.showConfig.sFontColor;
- obj.labelCol.style = { color: sFontColor, fontWeight: 'bold', backgroundColor: '#BFEFFF' };
+ obj.labelCol.style = { color: sFontColor, fontWeight: "bold", backgroundColor: "#BFEFFF" };
}
/* 返回值 */
return obj;
};
-
/* 获取formitemprops对象(从) */
getOutFormItemPropsSlave = () => {
/* 返回值声明 */
let obj = {};
- if (this.firstDataIndex === 'i'
- || this.firstDataIndex === 'd'
- || this.firstDataIndex === 'c'
- || this.props.showConfig.sDropDownType === 'sql'
- || this.props.showConfig.sDropDownType === 'const') { /* 数字输入框(整形i和浮点型d),
+ if (
+ this.firstDataIndex === "i" ||
+ this.firstDataIndex === "d" ||
+ this.firstDataIndex === "c" ||
+ this.props.showConfig.sDropDownType === "sql" ||
+ this.props.showConfig.sDropDownType === "const"
+ ) {
+ /* 数字输入框(整形i和浮点型d),
时间选择框(时间类型t),
文本输入框(文本s),
地址联动框(联动下拉类型c),
所有的下拉(从表只有文字下拉,分常量和sql两种) */
obj = {
- className: styles.formItemMargin0, /* 样式名称 */
+ className: styles.formItemMargin0 /* 样式名称 */,
};
- } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */
+ } else if (this.firstDataIndex === "b") {
+ /* 选择框(布尔类型b) */
obj = {
- className: styles.tableCheckBox, /* 样式名称 */
+ className: styles.tableCheckBox /* 样式名称 */,
};
- } else if (this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 'm' || this.firstDataIndex === 'y') { /* 时间选择框(时间类型t) */
+ } else if (this.firstDataIndex === "t" || this.firstDataIndex === "p" || this.firstDataIndex === "m" || this.firstDataIndex === "y") {
+ /* 时间选择框(时间类型t) */
obj = {
- className: styles.tableDataPicker, /* 样式名称 */
+ className: styles.tableDataPicker /* 样式名称 */,
};
- } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */
+ } else if (this.firstDataIndex === "s") {
+ /* 文本输入框(文本s) */
obj = {
- className: styles.editInput, /* 样式名称 */
+ className: styles.editInput /* 样式名称 */,
};
}
/* 返回值 */
@@ -2154,53 +2453,62 @@ export default class CommonComponent extends Component {
getFieldDecoratorProps = () => {
/* 返回值声明 */
let obj = {};
- if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd' || this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 's' || this.firstDataIndex === 'b') { /* 数字输入框(整形i和浮点型d),时间选择框(时间类型t),文本输入框(文本s),选择框(布尔类型b) */
+ if (
+ this.firstDataIndex === "i" ||
+ this.firstDataIndex === "d" ||
+ this.firstDataIndex === "t" ||
+ this.firstDataIndex === "p" ||
+ this.firstDataIndex === "s" ||
+ this.firstDataIndex === "b"
+ ) {
+ /* 数字输入框(整形i和浮点型d),时间选择框(时间类型t),文本输入框(文本s),选择框(布尔类型b) */
obj = { rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }] };
- } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */
+ } else if (this.firstDataIndex === "c") {
+ /* 地址联动框(联动下拉类型c) */
obj = {
- initialValue: ['北京市', '市辖区', '东城区'], /* 默认值 */
- rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }], /* 规则 */
+ initialValue: ["北京市", "市辖区", "东城区"] /* 默认值 */,
+ rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }] /* 规则 */,
};
}
/* 返回值 */
return obj;
};
- getPopupContainer = (triggerNode) => {
+ getPopupContainer = triggerNode => {
const trigger = triggerNode;
if (commonUtils.isNotEmptyObject(trigger)) {
return triggerNode;
}
- }
+ };
handleCancel = () => {
this.state.previewOpen = false;
- }
+ };
handleSelectClick = () => {
if (this.bInputIn) {
this.setState({ bDropDownOpen: true });
}
- }
+ };
// 限制数字位数
- handleCheckNumberInnerInput = (value) => {
+ handleCheckNumberInnerInput = value => {
const { sDateFormat: sDateFormatOld, sFieldValidation: sFieldValidationOld, sName } = this.props.showConfig;
const { record = {}, app = {} } = this.props;
const { auxiliaryQty = {} } = app;
let sDateFormat = sDateFormatOld;
let sFieldValidation = sFieldValidationOld;
- if (sName === 'dAuxiliaryQty' && commonUtils.isNotEmptyObject(record.sAuxiliaryUnit)) {
+ if (sName === "dAuxiliaryQty" && commonUtils.isNotEmptyObject(record.sAuxiliaryUnit)) {
const decimal = auxiliaryQty[record.sAuxiliaryUnit];
if (decimal !== undefined) {
- sDateFormat = 'decimalPoint';
+ sDateFormat = "decimalPoint";
sFieldValidation = `,${decimal}`;
}
}
- if (sDateFormat !== 'decimalPoint' || sFieldValidation === undefined || value === null || (typeof value === 'string' && !value)) {
+ if (sDateFormat !== "decimalPoint" || sFieldValidation === undefined || value === null || (typeof value === "string" && !value)) {
return value;
}
- const [length1, length2] = sFieldValidation.split(',');
+ const [length1, length2] = sFieldValidation.split(",");
let newValue = value;
if (length2 !== undefined) {
@@ -2209,9 +2517,9 @@ export default class CommonComponent extends Component {
if (isNaN(newValue) || Object.is(newValue, -0)) {
return value;
}
- if (length1 !== undefined && length1 !== '') {
+ if (length1 !== undefined && length1 !== "") {
const str = newValue.toString();
- const [integerPart, decimalPart] = str.split('.');
+ const [integerPart, decimalPart] = str.split(".");
if (integerPart.length > length1) {
const truncatedInteger = integerPart.slice(0, length1);
if (decimalPart !== undefined) {
@@ -2223,9 +2531,9 @@ export default class CommonComponent extends Component {
}
return newValue;
- }
+ };
- selectTableChange = (pageNum) => {
+ selectTableChange = pageNum => {
if (this.selectTableRef) {
this.selectTableRef.focus();
}
@@ -2234,11 +2542,11 @@ export default class CommonComponent extends Component {
} else {
this.setState({ currentPage: pageNum, selectTableIndex: 0 });
}
- this.selectTableRef1.querySelector('.ant-table-body').scrollTop = 0;
+ this.selectTableRef1.querySelector(".ant-table-body").scrollTop = 0;
this.getDropDownData(pageNum, this.state.totalPageCount, this.state.searchValue);
};
- selectTableSearch = (searchValue) => {
+ selectTableSearch = searchValue => {
if (this.dropDownTimer) {
clearTimeout(this.dropDownTimer);
}
@@ -2253,7 +2561,7 @@ export default class CommonComponent extends Component {
}, 500);
};
- toFamatter = (values) => {
+ toFamatter = values => {
if (values !== 0 && commonUtils.isNotEmptyNumber(values) && values !== null) {
const { sDateFormat } = this.props.showConfig;
const { dNetMoney, dNetPrice } = this.props.app.decimals;
@@ -2261,7 +2569,7 @@ export default class CommonComponent extends Component {
if (commonUtils.isNotEmptyObject(sDateFormat)) {
/* 取小数点位数 */
let point = 0;
- const strIndex = sDateFormat.indexOf('.');
+ const strIndex = sDateFormat.indexOf(".");
if (strIndex > -1 && sDateFormat.length > 1) {
point = sDateFormat.substring(strIndex + 1, sDateFormat.length).length;
if (commonUtils.isNotEmptyNumber(values) && values !== null) {
@@ -2271,14 +2579,16 @@ export default class CommonComponent extends Component {
}
}
}
- } else if (this.props.showConfig.sName.toLowerCase().endsWith('price')) { /* 单价格式化显示1 */
+ } else if (this.props.showConfig.sName.toLowerCase().endsWith("price")) {
+ /* 单价格式化显示1 */
if (commonUtils.isNotEmptyNumber(values) && values !== null) {
const dResult = commonUtils.convertFixNum(Number(values), dNetPrice).toFixed(dNetPrice);
if (!isNaN(dResult)) {
values = dResult;
}
}
- } else if (this.props.showConfig.sName.toLowerCase().endsWith('money')) { /* 金额格式化显示 */
+ } else if (this.props.showConfig.sName.toLowerCase().endsWith("money")) {
+ /* 金额格式化显示 */
if (commonUtils.isNotEmptyNumber(values) && values !== null) {
const dResult = commonUtils.convertFixNum(Number(values), dNetMoney).toFixed(dNetMoney);
if (!isNaN(dResult)) {
@@ -2290,7 +2600,7 @@ export default class CommonComponent extends Component {
} else {
return values;
}
- }
+ };
/** 处理下拉选择事件 */
handleSelectOptionEvent = (newValue, dateString) => {
if (this.chineseInputting) {
@@ -2306,13 +2616,22 @@ export default class CommonComponent extends Component {
// return;
// }
if (newValue === undefined) return;
- if (newValue !== null && newValue.target && newValue.target.type !== 'checkbox') {
+ if (newValue !== null && newValue.target && newValue.target.type !== "checkbox") {
newValue = newValue.target.value;
}
/* 下拉新增单独处理 */
- const dEmptyValue = this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth' ? newValue : null; /* 设置数值型为空值时 数据置为0 或空值 */
- let value = this.firstDataIndex === 's' && !this.props.textArea && commonUtils.isEmpty(newValue) ? newValue.replace('--', '') :
- ['t', 'm'].includes(this.firstDataIndex) ? dateString : (this.firstDataIndex === 'd' || this.firstDataIndex === 'i') && commonUtils.isEmpty(newValue) ? dEmptyValue : newValue;
+ const dEmptyValue =
+ this.props.showConfig.sName === "dMachineLength" || this.props.showConfig.sName === "dMachineWidth"
+ ? newValue
+ : null; /* 设置数值型为空值时 数据置为0 或空值 */
+ let value =
+ this.firstDataIndex === "s" && !this.props.textArea && commonUtils.isEmpty(newValue)
+ ? newValue.replace("--", "")
+ : ["t", "m"].includes(this.firstDataIndex)
+ ? dateString
+ : (this.firstDataIndex === "d" || this.firstDataIndex === "i") && commonUtils.isEmpty(newValue)
+ ? dEmptyValue
+ : newValue;
value = this.props.showConfig.bMultipleChoice ? value.toString() : value;
// if (value === 0) {
// setTimeout(() => {
@@ -2322,24 +2641,24 @@ export default class CommonComponent extends Component {
// }, 51);
// }
this.isDropdownFilter = true;
- if (this.props.showConfig.sDropDownType === 'sql' && value === '@#*000@') {
+ if (this.props.showConfig.sDropDownType === "sql" && value === "@#*000@") {
this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name);
if (this.mounted) {
- this.setState({ dataValue: '' });
+ this.setState({ dataValue: "" });
}
return;
}
- if (this.props.showConfig.sDropDownType === 'sql' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */
- value = '';
+ if (this.props.showConfig.sDropDownType === "sql" && value === "=+@") {
+ /* 如果是选择空值,则将特殊字符过滤为空值 */
+ value = "";
}
- if (this.props.showConfig.sDropDownType === 'const' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */
- value = '';
+ if (this.props.showConfig.sDropDownType === "const" && value === "=+@") {
+ /* 如果是选择空值,则将特殊字符过滤为空值 */
+ value = "";
}
/* 回带值声明 */
const returnValue = {};
- const {
- searchValue, searchDropDownData, dropDownData, selectTableData,
- } = this.state;
+ const { searchValue, searchDropDownData, dropDownData, selectTableData } = this.state;
let dropDownDataNew = [];
/* 如果是表格下拉的话 */
if (commonUtils.isNotEmptyStr(this.props.showConfig?.sTableTitleSql) && this.props.showConfig?.iVisCount > 1) {
@@ -2347,8 +2666,8 @@ export default class CommonComponent extends Component {
} else {
dropDownDataNew = commonUtils.isEmptyArr(searchValue) ? dropDownData : searchDropDownData;
}
- const getTValue = (value) => {
- const { sDateFormat = 'YYYY-MM-DD' } = this.props.showConfig;
+ const getTValue = value => {
+ const { sDateFormat = "YYYY-MM-DD" } = this.props.showConfig;
if (moment(value, sDateFormat, true).isValid()) return value; // 如果数据满足日期格式,则直接返回
@@ -2364,21 +2683,34 @@ export default class CommonComponent extends Component {
/* 回带值赋值(sName:value) */
returnValue[this.props.showConfig.sName] =
// this.firstDataIndex === 's' && this.props.textArea ? value.target.value :
- this.firstDataIndex === 'i' ? commonUtils.isEmpty(value) ? undefined : this.props.showConfig.sName === 'iOrder' ? value : parseInt(value, 0) :
- this.firstDataIndex === 'd' ? commonUtils.isEmpty(value) ? undefined : this.floatNumberCheck(value) :
- this.firstDataIndex === 't' ? getTValue(value) :
- this.firstDataIndex === 'b' ? value.target.checked : value === null ? undefined : value;
+ this.firstDataIndex === "i"
+ ? commonUtils.isEmpty(value)
+ ? undefined
+ : this.props.showConfig.sName === "iOrder"
+ ? value
+ : parseInt(value, 0)
+ : this.firstDataIndex === "d"
+ ? commonUtils.isEmpty(value)
+ ? undefined
+ : this.floatNumberCheck(value)
+ : this.firstDataIndex === "t"
+ ? getTValue(value)
+ : this.firstDataIndex === "b"
+ ? value.target.checked
+ : value === null
+ ? undefined
+ : value;
if (!this.props.showConfig.bMultipleChoice) {
const { sAssignField } = this.props.showConfig;
const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(item.sSlaveId) ? item.sSlaveId : item.sId) === value.toString());
if (!commonUtils.isEmpty(sAssignField)) {
/* 赋值数组 */
- const sAssignFieldObj = sAssignField.split(',');
+ const sAssignFieldObj = sAssignField.split(",");
if (commonUtils.isNotEmptyObject(changeData)) {
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- const sValueName = child.split(':')[1].trim();
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ const sValueName = child.split(":")[1].trim();
// returnValue[sFieldName] = changeData[sValueName] || changeData.value;
returnValue[sFieldName] = changeData[sValueName] === 0 ? 0 : changeData[sValueName] || changeData.value;
}
@@ -2386,26 +2718,28 @@ export default class CommonComponent extends Component {
} else if (!this.props.showConfig.bCanInput) {
// 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- returnValue[sFieldName] = '';
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ returnValue[sFieldName] = "";
}
}
}
}
} else {
const { sAssignField } = this.props.showConfig;
- const changeData = dropDownDataNew.filter(item => (`,${value.toString()},`).includes((!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`)));
+ const changeData = dropDownDataNew.filter(item =>
+ `,${value.toString()},`.includes(!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`)
+ );
if (!commonUtils.isEmpty(sAssignField)) {
/* 赋值数组 */
- const sAssignFieldObj = sAssignField.split(',');
+ const sAssignFieldObj = sAssignField.split(",");
if (commonUtils.isNotEmptyArr(changeData)) {
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- const sValueName = child.split(':')[1].trim();
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ const sValueName = child.split(":")[1].trim();
const valueArr = [];
- changeData.forEach((itemData) => {
+ changeData.forEach(itemData => {
valueArr.push(itemData[sValueName]);
});
returnValue[sFieldName] = valueArr.toString();
@@ -2414,9 +2748,9 @@ export default class CommonComponent extends Component {
} else if (!this.props.showConfig.bCanInput) {
// 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- returnValue[sFieldName] = '';
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ returnValue[sFieldName] = "";
}
}
}
@@ -2426,15 +2760,25 @@ export default class CommonComponent extends Component {
// 处理原因:如果已选数据不在下拉数据中时(比如懒加载模式),会过滤掉已选数据
if (commonUtils.isNotEmptyArr(Object.keys(returnValue))) {
const [returnValueKey0, returnValueValue0] = [Object.keys(returnValue)[0], Object.values(returnValue)[0]];
- if (returnValueValue0.split(',').length !== value.split(',').length || (returnValueValue0 === '' && value !== '')) {
+ if (returnValueValue0.split(",").length !== value.split(",").length || (returnValueValue0 === "" && value !== "")) {
returnValue[returnValueKey0] = value;
}
}
}
- if (this.state.searchPageNum !== 0 || this.state.searchTotalPageCount !== 1 || this.state.searchDropDownData !== [] || this.state.searchValue !== '' || this.state.spinState !== false) {
+ if (
+ this.state.searchPageNum !== 0 ||
+ this.state.searchTotalPageCount !== 1 ||
+ this.state.searchDropDownData !== [] ||
+ this.state.searchValue !== "" ||
+ this.state.spinState !== false
+ ) {
this.setState({
- searchPageNum: 0, searchTotalPageCount: 1, searchDropDownData: [], searchValue: '', spinState: false,
+ searchPageNum: 0,
+ searchTotalPageCount: 1,
+ searchDropDownData: [],
+ searchValue: "",
+ spinState: false,
});
}
// /* 调用父组件的回带函数 */
@@ -2442,7 +2786,7 @@ export default class CommonComponent extends Component {
clearTimeout(this.onChangeTimer);
this.onChangeTimer = setTimeout(() => {
- this.onExecInstructSet('change');
+ this.onExecInstructSet("change");
}, 500);
};
@@ -2489,22 +2833,31 @@ export default class CommonComponent extends Component {
if (newValue === undefined) {
return;
}
- if (newValue.target && newValue.target.type !== 'checkbox') {
+ if (newValue.target && newValue.target.type !== "checkbox") {
newValue = newValue.target.value;
}
/* 下拉新增单独处理 */
- const dMachine = ['dMachineLength', 'dMachineWidth'].includes(this.props.showConfig.sName);
+ const dMachine = ["dMachineLength", "dMachineWidth"].includes(this.props.showConfig.sName);
if (dMachine) {
if (!/^\d+(\.\d+)?(\*\d+(\.\d+)?)?$/.test(newValue)) {
- newValue = '';
+ newValue = "";
setTimeout(() => {
- this.setState({ searchValue: '' });
+ this.setState({ searchValue: "" });
}, 1200);
}
}
- const dEmptyValue = this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth' ? newValue : 0; /* 设置数值型为空值时 数据置为0 或空值 */
- let value = this.firstDataIndex === 's' && !this.props.textArea && commonUtils.isEmpty(newValue) ? newValue.replace('--', '') :
- this.firstDataIndex === 't' ? dateString : (this.firstDataIndex === 'd' || this.firstDataIndex === 'i') && commonUtils.isEmpty(newValue) ? dEmptyValue : newValue;
+ const dEmptyValue =
+ this.props.showConfig.sName === "dMachineLength" || this.props.showConfig.sName === "dMachineWidth"
+ ? newValue
+ : 0; /* 设置数值型为空值时 数据置为0 或空值 */
+ let value =
+ this.firstDataIndex === "s" && !this.props.textArea && commonUtils.isEmpty(newValue)
+ ? newValue.replace("--", "")
+ : this.firstDataIndex === "t"
+ ? dateString
+ : (this.firstDataIndex === "d" || this.firstDataIndex === "i") && commonUtils.isEmpty(newValue)
+ ? dEmptyValue
+ : newValue;
value = this.props.showConfig.bMultipleChoice ? value.toString() : value;
// if (this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth') { /* 处理上机长宽 下拉数据 数据分割错误问题 */
@@ -2512,18 +2865,20 @@ export default class CommonComponent extends Component {
// }
this.isDropdownFilter = true;
- if (this.props.showConfig.sDropDownType === 'sql' && value === '@#*000@') {
+ if (this.props.showConfig.sDropDownType === "sql" && value === "@#*000@") {
this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name);
if (this.mounted) {
- this.setState({ dataValue: '' });
+ this.setState({ dataValue: "" });
}
return;
}
- if (this.props.showConfig.sDropDownType === 'sql' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */
- value = '';
+ if (this.props.showConfig.sDropDownType === "sql" && value === "=+@") {
+ /* 如果是选择空值,则将特殊字符过滤为空值 */
+ value = "";
}
- if (this.props.showConfig.sDropDownType === 'const' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */
- value = '';
+ if (this.props.showConfig.sDropDownType === "const" && value === "=+@") {
+ /* 如果是选择空值,则将特殊字符过滤为空值 */
+ value = "";
}
/* 回带值声明 */
@@ -2533,56 +2888,75 @@ export default class CommonComponent extends Component {
/* 回带值赋值(sName:value) */
returnValue[this.props.showConfig.sName] =
// this.firstDataIndex === 's' && this.props.textArea ? value.target.value :
- this.firstDataIndex === 'i' ? commonUtils.isEmpty(value) ? undefined : this.props.showConfig.sName === 'iOrder' ? value : parseInt(value, 0) :
- this.firstDataIndex === 'd' ? commonUtils.isEmpty(value) ? dMachine ? '' : undefined : value : // this.floatNumberCheck(value) :
- this.firstDataIndex === 't' ? commonUtils.isEmpty(value) ? null : value :
- this.firstDataIndex === 'b' ? value.target.checked : value === null ? undefined : value;
+ this.firstDataIndex === "i"
+ ? commonUtils.isEmpty(value)
+ ? undefined
+ : this.props.showConfig.sName === "iOrder"
+ ? value
+ : parseInt(value, 0)
+ : this.firstDataIndex === "d"
+ ? commonUtils.isEmpty(value)
+ ? dMachine
+ ? ""
+ : undefined
+ : value // this.floatNumberCheck(value) :
+ : this.firstDataIndex === "t"
+ ? commonUtils.isEmpty(value)
+ ? null
+ : value
+ : this.firstDataIndex === "b"
+ ? value.target.checked
+ : value === null
+ ? undefined
+ : value;
if (!this.props.showConfig.bMultipleChoice) {
const { sAssignField } = this.props.showConfig;
// const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(item.sSlaveId) ? item.sSlaveId : item.sId) === newKey.toString());
- let res = '';
+ let res = "";
if (dropDownDataNew.length > 0) {
if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) {
res = this.props.showConfig.sVisColumnName;
} else {
- res = Object.keys(dropDownDataNew[0]).length > 0 ? Object.keys(dropDownDataNew[0])[0] : '';
+ res = Object.keys(dropDownDataNew[0]).length > 0 ? Object.keys(dropDownDataNew[0])[0] : "";
}
}
const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(res) ? item[res] : item.sId) === value.toString());
if (!commonUtils.isEmpty(sAssignField)) {
/* 赋值数组 */
- const sAssignFieldObj = sAssignField.split(',');
+ const sAssignFieldObj = sAssignField.split(",");
if (commonUtils.isNotEmptyObject(changeData)) {
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- const sValueName = child.split(':')[1].trim();
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ const sValueName = child.split(":")[1].trim();
returnValue[sFieldName] = changeData[sValueName] || changeData.value;
}
}
} else if (!this.props.showConfig.bCanInput) {
// 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- returnValue[sFieldName] = '';
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ returnValue[sFieldName] = "";
}
}
}
}
} else {
const { sAssignField } = this.props.showConfig;
- const changeData = dropDownDataNew.filter(item => (`,${value.toString()},`).includes((!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`)));
+ const changeData = dropDownDataNew.filter(item =>
+ `,${value.toString()},`.includes(!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`)
+ );
if (!commonUtils.isEmpty(sAssignField)) {
/* 赋值数组 */
- const sAssignFieldObj = sAssignField.split(',');
+ const sAssignFieldObj = sAssignField.split(",");
if (commonUtils.isNotEmptyArr(changeData)) {
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- const sValueName = child.split(':')[1].trim();
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ const sValueName = child.split(":")[1].trim();
const valueArr = [];
- changeData.forEach((itemData) => {
+ changeData.forEach(itemData => {
valueArr.push(itemData[sValueName]);
});
returnValue[sFieldName] = valueArr.toString();
@@ -2591,22 +2965,32 @@ export default class CommonComponent extends Component {
} else if (!this.props.showConfig.bCanInput) {
// 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了
for (const child of sAssignFieldObj) {
- if (child.indexOf(':') > -1) {
- const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim();
- returnValue[sFieldName] = '';
+ if (child.indexOf(":") > -1) {
+ const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim();
+ returnValue[sFieldName] = "";
}
}
}
}
}
- if (this.state.searchPageNum !== 0 || this.state.searchTotalPageCount !== 1 || this.state.searchDropDownData !== [] || this.state.searchValue !== '' || this.state.spinState !== false) {
+ if (
+ this.state.searchPageNum !== 0 ||
+ this.state.searchTotalPageCount !== 1 ||
+ this.state.searchDropDownData !== [] ||
+ this.state.searchValue !== "" ||
+ this.state.spinState !== false
+ ) {
this.setState({
- searchPageNum: 0, searchTotalPageCount: 1, searchDropDownData: [], searchValue: '', spinState: false,
+ searchPageNum: 0,
+ searchTotalPageCount: 1,
+ searchDropDownData: [],
+ searchValue: "",
+ spinState: false,
});
}
// /* 调用父组件的回带函数 */
let bSpecial = true;
- if (location.pathname && location.pathname.includes('ResearchTableTree')) {
+ if (location.pathname && location.pathname.includes("ResearchTableTree")) {
bSpecial = false;
}
if (bSpecial && this.state.dataValue === returnValue[this.props.showConfig.sName]) {
@@ -2625,7 +3009,7 @@ export default class CommonComponent extends Component {
clearTimeout(this.onChangeTimer);
this.onChangeTimer = setTimeout(() => {
- this.onExecInstructSet('change');
+ this.onExecInstructSet("change");
}, 500);
};
// handleCompleteOptionEvent = (newValue, dateString) => {
@@ -2740,64 +3124,65 @@ export default class CommonComponent extends Component {
filterOption = (input, option) => {
const { pageNum, totalPageCount } = this.state;
const newInput = input.toString().trim(); /* 下拉框默认为空 不需要替换'--’ */
- if (pageNum <= totalPageCount && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) {
+ if (pageNum <= totalPageCount && this.props.showConfig.sDropDownType === "sql" && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) {
return true;
} else if (commonUtils.isNotEmptyObject(option.props.children)) {
try {
- return (!this.isDropdownFilter && this.props.showConfig.bCanInput) ? true : (option.props.children.toLowerCase().indexOf(newInput.toLowerCase()) >= 0);
+ return !this.isDropdownFilter && this.props.showConfig.bCanInput
+ ? true
+ : option.props.children.toLowerCase().indexOf(newInput.toLowerCase()) >= 0;
} catch (error) {
return false;
}
}
};
-
/**
* 小数校验
*/
- floatNumberCheck = (num) => {
+ floatNumberCheck = num => {
const dNetPrice = this.props.app?.decimals?.dNetPrice;
- const Maximum = commonFunc.showLocalMessage(this.props, 'Maximum', '最多输入${digit}位小数');
+ const Maximum = commonFunc.showLocalMessage(this.props, "Maximum", "最多输入${digit}位小数");
const { showConfig } = this.props;
const { sName, showName } = showConfig;
- const digit = sName.includes('Price') && dNetPrice ? dNetPrice : 6;
- const Maximun = Maximum.replace('${digit}', digit);
- if (typeof num === 'string') {
- num = num.replace('*', '');
+ const digit = sName.includes("Price") && dNetPrice ? dNetPrice : 6;
+ const Maximun = Maximum.replace("${digit}", digit);
+ if (typeof num === "string") {
+ num = num.replace("*", "");
}
const checkRule = new RegExp(`^(-?\\d+)(\\.?)(\\d{1,${digit}})?$`);
- if (!checkRule.test(num) && num && num !== '-' && num !== '.') {
+ if (!checkRule.test(num) && num && num !== "-" && num !== ".") {
message.warning(`【${showName}】【${sName}】${Maximun}`);
return undefined;
} else {
return num;
}
- }
+ };
/** 小数位控制 noinspection JSAnnotator控制 string | number */
- limitDecimals = (values) => {
- let reg = '';
+ limitDecimals = values => {
+ let reg = "";
if (this.floatNum > 0) {
reg = `^(\\d+).(${this.floatPrice})*$`;
} else {
- reg = '^(\\d+).(\\d\\d\\d\\d\\d\\d)*$';
+ reg = "^(\\d+).(\\d\\d\\d\\d\\d\\d)*$";
}
- if (typeof values === 'string') {
- if (values !== undefined && values.indexOf('.') <= -1) {
- reg = '^(\\d+)*$';
- return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1') : '';
+ if (typeof values === "string") {
+ if (values !== undefined && values.indexOf(".") <= -1) {
+ reg = "^(\\d+)*$";
+ return !isNaN(Number(values)) ? values.replace(new RegExp(reg), "$1") : "";
} else {
- return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1.$2') : '';
+ return !isNaN(Number(values)) ? values.replace(new RegExp(reg), "$1.$2") : "";
}
- } else if (typeof values === 'number') {
- if (values !== undefined && String(values).indexOf('.') <= -1) {
- reg = '^(\\d+)*$';
- return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1') : '';
+ } else if (typeof values === "number") {
+ if (values !== undefined && String(values).indexOf(".") <= -1) {
+ reg = "^(\\d+)*$";
+ return !isNaN(values) ? String(values).replace(new RegExp(reg), "$1") : "";
} else {
- return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1.$2') : '';
+ return !isNaN(values) ? String(values).replace(new RegExp(reg), "$1.$2") : "";
}
} else {
- return '';
+ return "";
}
};
@@ -2806,46 +3191,59 @@ export default class CommonComponent extends Component {
const { sControlName, sActiveKey } = showConfig; /* 弹出标志,弹出界面对应数据主字段 */
if (commonUtils.isNotEmptyObject(sControlName) && commonUtils.isNotEmptyObject(sActiveKey)) {
const printPdf = sControlName;
- if (commonUtils.isNotEmptyObject(printPdf) && printPdf === 'printPdf' && commonUtils.isNotEmptyObject(sActiveKey)) {
+ if (commonUtils.isNotEmptyObject(printPdf) && printPdf === "printPdf" && commonUtils.isNotEmptyObject(sActiveKey)) {
const { token } = app;
- const sActiveId = this.props.showConfig.sActiveId === '1' ? commonUtils.isEmpty(record.sFormId) ? record.sSrcFormId : record.sFormId : this.props.showConfig.sActiveId;
+ const sActiveId =
+ this.props.showConfig.sActiveId === "1"
+ ? commonUtils.isEmpty(record.sFormId)
+ ? record.sSrcFormId
+ : record.sFormId
+ : this.props.showConfig.sActiveId;
const printsId = record[sActiveKey];
- const urlPrint = `${commonConfig.file_host}printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`;
+ const urlPrint = `${
+ commonConfig.file_host
+ }printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`;
// const urlPrint = `${commonConfig.file_host}printReport/printPdfByFromDataId?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`;
window.open(urlPrint);
- } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes('picarrmodal')) { /* 蓝色链接跳转用Modal呈现 */
+ } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes("picarrmodal")) {
+ /* 蓝色链接跳转用Modal呈现 */
// this.props.onTabModalClick(name, sName, record, index, showConfig, configName);
this.props.onTabModalClick(this.props.name, this.props.showConfig.sName, record, undefined, showConfig, this.props.sName);
} else {
this.props.onViewClick(this.props.name, this.props.showConfig.sName, this.props.record);
}
- } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes('picarrmodal')) { /* 蓝色链接跳转用Modal呈现 */
+ } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes("picarrmodal")) {
+ /* 蓝色链接跳转用Modal呈现 */
// this.props.onTabModalClick(name, sName, record, index, showConfig, configName);
this.props.onTabModalClick(this.props.name, this.props.showConfig.sName, record, undefined, showConfig, this.props.sName);
} else {
this.props.onViewClick(this.props.name, this.props.showConfig.sName, this.props.record);
}
- }
+ };
/* 打开新窗口查看SQL编辑器 */
handleOpenWin = () => {
const { dataValue, showConfig, record } = this.props;
// eslint-disable-next-line prefer-destructuring
const sBtnName = showConfig.sName;
- const sBtnContent = commonUtils.isNotEmptyObject(dataValue) ? encodeURIComponent(dataValue) : '';
- const sBtnControlName = commonUtils.isNotEmptyObject(showConfig.sName) ? showConfig.sName : '';
+ const sBtnContent = commonUtils.isNotEmptyObject(dataValue) ? encodeURIComponent(dataValue) : "";
+ const sBtnControlName = commonUtils.isNotEmptyObject(showConfig.sName) ? showConfig.sName : "";
if (commonUtils.isNotEmptyObject(sBtnContent) && commonUtils.isNotEmptyObject(record)) {
- const sFormId = commonUtils.isNotEmptyObject(record.sParentId) ? record.sParentId : '';
+ const sFormId = commonUtils.isNotEmptyObject(record.sParentId) ? record.sParentId : "";
const urlPrint = `${commonConfig.server_host}template/getSql/${sBtnName}/?sBtnContent=${sBtnContent}&sBtnControlName=${sBtnControlName}&sFormId=${sFormId}`;
const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
// const newWin = window.open('','_blank');
- const features = `width=${w + 350},height=${h + 300}, top=0, left=0, toolbar=no, menubar=no,scrollbars=no,resizable=no, location =no, status=no`;
- const newWin = window.open('', 'SQL查看器', features);
- newWin.document.write(`
`);
+ const features = `width=${w + 350},height=${
+ h + 300
+ }, top=0, left=0, toolbar=no, menubar=no,scrollbars=no,resizable=no, location =no, status=no`;
+ const newWin = window.open("", "SQL查看器", features);
+ newWin.document.write(
+ `
`
+ );
// window.open(urlPrint);
} else {
- message.error('未找到对应过程名');
+ message.error("未找到对应过程名");
}
};
@@ -2855,34 +3253,36 @@ export default class CommonComponent extends Component {
const { name, record, showConfig } = this.props;
this.props.onRightArrow(name, showConfig.sName, record, undefined, showConfig);
}
- }
+ };
handlePreviewImage = (e, dataUrl) => {
e.stopPropagation();
this.props.onPreviewImage(e, dataUrl);
- }
+ };
handleViewChoose = () => {
- const bGycs = this.props.showConfig?.showName?.includes('工艺参数');
+ const bGycs = this.props.showConfig?.showName?.includes("工艺参数");
if (this.state.enabled || bGycs) this.props.onViewChoose(this.props.name, this.props.showConfig.sName, this.props.record);
- }
- handleMemoShow= () => {
+ };
+ handleMemoShow = () => {
this.props.onMemoShow(this.props.name, this.props.showConfig.sName, this.props.record, 0, this.props.showConfig);
- }
+ };
- handlePreviewOffice = (dataUrl) => {
+ handlePreviewOffice = dataUrl => {
this.props.onPreviewOffice(dataUrl);
- }
+ };
- handlePopupScroll = (e) => {
+ handlePopupScroll = e => {
e.persist();
const { target } = e;
- if (Math.ceil(target.scrollTop + target.offsetHeight) >= target.scrollHeight && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) {
- const {
- pageNum, searchPageNum, searchTotalPageCount, searchValue, totalPageCount,
- } = this.state;
+ if (
+ Math.ceil(target.scrollTop + target.offsetHeight) >= target.scrollHeight &&
+ this.props.showConfig.sDropDownType === "sql" &&
+ commonUtils.isEmptyArr(this.props.showConfig.dropDownData)
+ ) {
+ const { pageNum, searchPageNum, searchTotalPageCount, searchValue, totalPageCount } = this.state;
const nextPageNum = pageNum + 1;
const nextSearchPageNum = searchPageNum + 1;
- if (searchValue !== '') {
+ if (searchValue !== "") {
this.getDropDownData(nextSearchPageNum, searchTotalPageCount, searchValue);
} else {
this.getDropDownData(nextPageNum, totalPageCount, searchValue);
@@ -2890,12 +3290,12 @@ export default class CommonComponent extends Component {
}
};
- handleSearch = (value) => {
+ handleSearch = value => {
if (this.dropDownTimer) {
clearTimeout(this.dropDownTimer);
}
this.dropDownTimer = setTimeout(() => {
- if (this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) {
+ if (this.props.showConfig.sDropDownType === "sql" && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) {
this.setState({ spinState: true });
this.getDropDownData(1, 1, value);
}
@@ -2913,67 +3313,95 @@ export default class CommonComponent extends Component {
const btCostomIndex = gdsconfigformslave.findIndex(item => item.sControlName === `BtnCustom.${sName}`);
/* 获取innerinput控件 */
- const innerInput = btPopIndex > -1 && btCostomIndex > -1 ? (
-
- {this.getInnerInput(innerInputProps)}
- {this.getInnerButton()}
- {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])}
-
-
- ) : btPopIndex !== -1 ? (
-
- {this.getInnerInput(innerInputProps)}
- {this.getInnerButton()}
-
-
- ) : btCostomIndex !== -1 ? (
-
- {this.getInnerInput(innerInputProps)}
- {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])}
-
-
- ) : this.getInnerInput(innerInputProps);
-
- let viewInfo = '';
- if (this.props.showConfig.sDropDownType !== 'popup' && !commonUtils.isEmpty(this.props.showConfig.sActiveId) && !commonUtils.isEmpty(this.props.showConfig.sActiveKey) && (commonUtils.isNotEmptyObject(this.props.dataValue) || commonUtils.isNotEmptyNumber(this.props.dataValue))) {
+ const innerInput =
+ btPopIndex > -1 && btCostomIndex > -1 ? (
+
+ {this.getInnerInput(innerInputProps)}
+ {this.getInnerButton()}
+ {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])}
+
+
+ ) : btPopIndex !== -1 ? (
+
+ {this.getInnerInput(innerInputProps)}
+ {this.getInnerButton()}
+
+
+ ) : btCostomIndex !== -1 ? (
+
+ {this.getInnerInput(innerInputProps)}
+ {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])}
+
+
+ ) : (
+ this.getInnerInput(innerInputProps)
+ );
+
+ let viewInfo = "";
+ if (
+ this.props.showConfig.sDropDownType !== "popup" &&
+ !commonUtils.isEmpty(this.props.showConfig.sActiveId) &&
+ !commonUtils.isEmpty(this.props.showConfig.sActiveKey) &&
+ (commonUtils.isNotEmptyObject(this.props.dataValue) || commonUtils.isNotEmptyNumber(this.props.dataValue))
+ ) {
viewInfo = (
{this.props.dataValue}
-
);
+
+ );
}
- const sModelsType = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : '';
- const pleaseSelect = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'pleaseSelect') : '请选择' ;
- const combinedInfo = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'CombinedInfo') : '合版信息' ;
+ const sModelsType =
+ commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : "";
+ const pleaseSelect =
+ commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app)
+ ? commonFunc.showMessage(this.props.app.commonConst, "pleaseSelect")
+ : "请选择";
+ const combinedInfo =
+ commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app)
+ ? commonFunc.showMessage(this.props.app.commonConst, "CombinedInfo")
+ : "合版信息";
let bParamColor = false;
- if (this.props && sName === 'sParamValue' && this.props.dataValue) {
- if (this.props.dataValue === '选择色序' || this.props.record.sParamKey === 'sParam1001') {
+ if (this.props && sName === "sParamValue" && this.props.dataValue) {
+ if (this.props.dataValue === "选择色序" || this.props.record.sParamKey === "sParam1001") {
bParamColor = true;
}
}
- if (sName === 'sCombinedMemo' || sName === 'sColorSerialMemo' || bSColorSerialMemo || bParamColor || sName === 'sPositiveColor' || sName === 'sOppositeColor' || sName === 'sCombineProductNameNew' || sName === 'sParams' || sName === 'sParamsNew' || sName === 'sQuoParams' || (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes('Set') && sName === 'sCombinePartsNameNew')) {
- let sValue = '';
+ if (
+ sName === "sCombinedMemo" ||
+ sName === "sColorSerialMemo" ||
+ bSColorSerialMemo ||
+ bParamColor ||
+ sName === "sPositiveColor" ||
+ sName === "sOppositeColor" ||
+ sName === "sCombineProductNameNew" ||
+ sName === "sParams" ||
+ sName === "sParamsNew" ||
+ sName === "sQuoParams" ||
+ (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes("Set") && sName === "sCombinePartsNameNew")
+ ) {
+ let sValue = "";
/* 将合版信息json解析成需要的字符串形式 */
- if (sName === 'sCombinedMemo') {
+ if (sName === "sCombinedMemo") {
let JsonData = [];
if (commonUtils.isNotEmptyObject(this.props.dataValue)) {
try {
@@ -2983,10 +3411,10 @@ export default class CommonComponent extends Component {
}
}
if (commonUtils.isNotEmptyArr(JsonData)) {
- JsonData.forEach((item) => {
+ JsonData.forEach(item => {
sValue += `${item.sProductNo}:排${item.dCombineQty}个,`;
});
- sValue = commonUtils.isNotEmptyObject(sValue) ? sValue.substr(0, sValue.length - 1) : '';
+ sValue = commonUtils.isNotEmptyObject(sValue) ? sValue.substr(0, sValue.length - 1) : "";
}
} else if (sName === "sColorSerialMemo" || bSColorSerialMemo || sName === "sPositiveColor" || sName === "sOppositeColor" || bParamColor) {
let JsonData = [];
@@ -3034,8 +3462,8 @@ export default class CommonComponent extends Component {
className="sActiveIdStyle sActiveIdStyle_viewChooseSpan"
title={sValue}
style={{
- display: 'block',
- position: 'relative',
+ display: "block",
+ position: "relative",
// top: this.props.name === 'slaveInfo' ? '1px' : '',
// left: this.props.name === 'slaveInfo' ? '2px' : this.props.name === 'master' ? '1px' : '',
}}
@@ -3044,47 +3472,72 @@ export default class CommonComponent extends Component {
onClick={this.handleViewChoose}
className="viewChooseSpan"
style={{
- width: '100%', overflow: 'hidden', color: '#2f54eb', background: 'transparent',
+ width: "100%",
+ overflow: "hidden",
+ color: "#2f54eb",
+ background: "transparent",
}}
- > {commonUtils.isNotEmptyObject(sValue) ? sValue : sName === 'sCombinedMemo' ? combinedInfo : pleaseSelect}
+ >
+ {" "}
+ {commonUtils.isNotEmptyObject(sValue) ? sValue : sName === "sCombinedMemo" ? combinedInfo : pleaseSelect}
- );
+
+ );
}
/* commonClassify 制单日期、制单人员新增时设置保存时自动生成 */
- let speacilNote = '';
+ let speacilNote = "";
const { record } = this.props;
- const afterSave = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'afterSave') : '保存后自动生成';
- if (commonUtils.isNotEmptyObject(record) && commonUtils.isEmptyObject(record[sName]) && commonUtils.isNotEmptyObject(sName) && (sName === 'tCreateDate' || sName === 'sMakePerson')) {
- speacilNote = (