薪资项目管理的公式修改
This commit is contained in:
parent
c4c24dd159
commit
df079f762f
|
|
@ -73,6 +73,24 @@ export default class FormalFormModal extends React.Component {
|
|||
this.formulaDatasourceList();
|
||||
}
|
||||
|
||||
triggerKeyDown = (e) => {
|
||||
const { value } = this.state;
|
||||
if (e.key === "Backspace" && value) {
|
||||
let propsTextarea = this.contentProps.refs.textareaNormal.refs.input.refs.input; // 获取dom节点实例
|
||||
const { end } = this.getPositionForTextArea(propsTextarea);
|
||||
const str = value.substring(end - 1, end);
|
||||
if (str === "}") {
|
||||
const index = value.lastIndexOf("{", end - 1);
|
||||
const currentValue = value.substring(index, end);
|
||||
console.log("currentValue", this.state.value, currentValue);
|
||||
console.log(this.state.value.replace(currentValue, "}"));
|
||||
this.setState({
|
||||
value: this.state.value.replace(currentValue, "}")
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
formulaDatasourceList = () => {
|
||||
const { salaryItemStore } = this.props;
|
||||
const { formulaDatasourceList } = salaryItemStore;
|
||||
|
|
@ -274,6 +292,7 @@ export default class FormalFormModal extends React.Component {
|
|||
value={value} onChange={(value) => this.handleChange(value)}
|
||||
noResize={true}
|
||||
style={{ fontSize: "14px", lineHeight: 1.2 }}
|
||||
onKeyDown={this.triggerKeyDown}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: "flex", height: "300px", marginTop: "10px" }}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue