let isComposition = false;
<Col span={8}>
<Item name={'replaceStandardNo'} label="代替标准号:">
<Select
disabled={!!selectedPj}
showSearch
allowClear
onClear={() => infoForm.setFieldValue('replaceStandardNo', '')}
defaultActiveFirstOption={false}
filterOption={false}
onSearch={(txt) => handleChange(txt, 'replace')}
notFoundContent={null}
optionLabelProp="title"
dropdownRender={(menu) => (
<>
{!replaceLoading ? (
menu
) : (
<div style={{ height: '160px' }}>
<LoadingTip status={0} />
</div>
)}
</>
)}
options={replaceNoOpts
.filter((el) => el.standardNo)
.map((el) => ({
label: `${el.standardName} / ${el.standardNo}`,
value: el.standardNo,
}))}
onCompositionStart={handleComposition}
onCompositionEnd={handleComposition}
></Select>
</Item>
</Col>
// 输入拼音时搜索文字的处理
const handleComposition = (ev) => {
isComposition = ev.type !== 'compositionend';
};
// 立项搜索值变化函数
const handleChange = debounce((txt, from) => {
let searchTxt;
if (!isComposition) {
searchTxt = txt;
}
from === 'project'
? searchTxt !== undefined && getProjectList(searchTxt)
: searchTxt !== undefined && getReplaceNo(searchTxt);
}, 300);