|
|
@@ -26,8 +26,7 @@ const EditableFormItem = ({
|
|
|
const iRef = useRef(null)
|
|
|
const [state, setState] = useState({
|
|
|
val: '',
|
|
|
- extraVal: '',
|
|
|
- popupVisible: false
|
|
|
+ extraVal: ''
|
|
|
})
|
|
|
|
|
|
useEffect(() => {
|
|
|
@@ -91,7 +90,6 @@ const EditableFormItem = ({
|
|
|
}
|
|
|
const save = async e => {
|
|
|
// console.log('失去焦点了', e)
|
|
|
- if (!e.currentTarget.value?.length) return
|
|
|
// console.log(e)
|
|
|
const { value, local = '' } = e.currentTarget
|
|
|
if (value === record || !value) {
|
|
|
@@ -99,7 +97,7 @@ const EditableFormItem = ({
|
|
|
return
|
|
|
}
|
|
|
await handleConfirm(value)
|
|
|
- setState({ ...state, val: value, extraVal: local, popupVisible: false })
|
|
|
+ setState({ ...state, val: value, extraVal: local })
|
|
|
toggleEdit()
|
|
|
}
|
|
|
|
|
|
@@ -115,11 +113,12 @@ const EditableFormItem = ({
|
|
|
<LazyCascader
|
|
|
ref={iRef}
|
|
|
defaultValue={state.val}
|
|
|
+ allowClear={false}
|
|
|
className="zh-width-100P"
|
|
|
autoFocus={true}
|
|
|
onChange={(value, local) => save({ currentTarget: { value, local } })}
|
|
|
- popupVisible={state.popupVisible}
|
|
|
- // onBlur={save}
|
|
|
+ popupVisible={true}
|
|
|
+ onBlur={save}
|
|
|
/>
|
|
|
)
|
|
|
break
|