diff --git a/pc4mobx/hrmSalary/components/FormInfo/index.js b/pc4mobx/hrmSalary/components/FormInfo/index.js index 5c14f828..d6940489 100644 --- a/pc4mobx/hrmSalary/components/FormInfo/index.js +++ b/pc4mobx/hrmSalary/components/FormInfo/index.js @@ -1,27 +1,28 @@ import React, { Component } from "react"; -import { WeaCheckbox, WeaFormItem, WeaSearchGroup } from "ecCom"; +import { WeaCheckbox, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; import { observer } from "mobx-react"; import { WeaSwitch } from "comsMobx"; +const getLabel = WeaLocaleProvider.getLabel; @observer export default class FormInfo extends Component { renderForm = () => { const { - formFields, form, colCount, itemRender, onSelectedChangeHandle, - showLabel, multiColumn, custLabelCol, childrenComponents + formFields, form, colCount, itemRender, onSelectedChangeHandle, showLabel, multiColumn, custLabelCol, + childrenComponents } = this.props; let groupArr = []; const formParams = form.getFormParams(); const labelVisible = showLabel == null || showLabel == true; const col = colCount ? colCount : 1; - const labelCol = labelVisible ? (custLabelCol || `${window.HrmEngineLabelCol}`) : 0; + const labelCol = labelVisible ? (custLabelCol || 6) : 0; const itemProps = { - ratio1to2: labelVisible && custLabelCol == null, + // ratio1to2: labelVisible && custLabelCol == null, style: { marginLeft: 0 }, tipPosition: "bottom", labelCol: { span: labelCol }, - wrapperCol: { span: 24 - labelCol } + wrapperCol: { span: 22 - labelCol } }; const textAreaProps = { minRows: 4, maxRows: 4 }; @@ -30,7 +31,7 @@ export default class FormInfo extends Component { fields.items.map((field, j) => { const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null; const showCheckbox = field.checkbox || false; - let label = field.label; + let label = getLabel(field.lanId, field.label); if (showCheckbox) label = { field.checkboxValue = v === "1"; @@ -38,13 +39,17 @@ export default class FormInfo extends Component { }}/>; let coms; if (customerRender == null) { - coms = ; + coms = ; } else { - coms = customerRender(field, textAreaProps, form, formParams); + coms = customerRender({ + ...field, helpfulTip: getLabel(field.helpfulTipLanId || "", field.helpfulTip || "") + }, textAreaProps, form, formParams); } Object.assign(itemProps, { label, error: form.getError(field) }); - let col = 1; + let col = colCount ? colCount : 1; if (multiColumn != null) {//检查有哪些字段需要一行显示多个 const idx = _.findIndex(multiColumn, item => item.key === field.domkey[0]); if (idx > -1) { @@ -61,7 +66,6 @@ export default class FormInfo extends Component { }); } } - coms != null && formItems.push({ com: ({coms}), col @@ -85,12 +89,10 @@ export default class FormInfo extends Component { }; render() { - const { formFields, className } = this.props; - if (formFields == null) return (
); + const { formFields, className, form } = this.props; + if (formFields == null || !form.isFormInit) return (
); return ( -
- {this.renderForm()} -
+
{this.renderForm()}
); } } diff --git a/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js index e70c6967..32a5e5b0 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js +++ b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js @@ -18,8 +18,10 @@ CodeMirror.extendMode("javascript", { if (this.jsonMode) { return /^[\[,{]$/.test(content) || /^}/.test(textAfter) || /^]/.test(textAfter); } else { - if (content == ";" && state.lexical && state.lexical.type == ")") return false; - return /^[;{}]$/.test(content) && !/^;/.test(textAfter); + if (content == ";" && state.lexical && state.lexical.type == "}") return false; + // if (content == ";" && state.lexical && state.lexical.type == ")") return false; + return /[=,]/.test(content) || /.*\)/.test(textAfter); + // return /^[;{}]$/.test(content) && !/^;/.test(textAfter); } } }); @@ -94,7 +96,8 @@ CodeMirror.defineExtension("autoFormatRange", function (from, to) { atSol = false; } if (!atSol && inner.mode.newlineAfterToken && - inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state)) + // inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state)) + inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos, stream.pos + 2) || text[i + 1] || "", inner.state)) newline(); } if (!stream.pos && outer.blankLine) outer.blankLine(state);