return (
<Dialog
// 方法绑定在外层,才可以调用快捷键的方法
++onKeyDown={e => this.onKeyDown(e)}
>
<PatientDatasShow />
<div className="text-align-center">
<Button
type="primary"
// disabled={!patInfo.masterPatientIndex || !patInfo.updateMedicare}
className="margin-right-10"
onClick={() => this.preSettle()}
>
选项1Y
</Button>
<Button className="margin-right-10" onClick={() => this.preSettle({ forceFlag: 'turnToCash' })}>
选项2Z
</Button>
</div>
</Dialog>
);
// 设置快捷键(Y:选项1Y Z:选项2Z)
onKeyDown = (event) => {
const { patInfo } = this.state;
if (isWZRMYY && patInfo.updateMedicare && (event.keyCode === 89 || event.keyCode === 121)) {
event.returnvalue = false;
this.preSettle();
return false;
}
if (isWZRMYY && (event.keyCode === 90 || event.keyCode === 122)) {
event.returnvalue = false;
this.preSettle({ forceFlag: 'turnToCash' });
return false;
}
}
// A-Z对应的ASCII码为65-90(大写字母),a-z对应的为97-122(小写字母)
给按钮设置快捷键
最新推荐文章于 2024-11-04 17:05:06 发布