优化写法

This commit is contained in:
yj 2024-10-16 15:04:19 +08:00
parent 6fb7020836
commit bcd3adaf26
1 changed files with 5 additions and 9 deletions

View File

@ -10,9 +10,7 @@ const EquipmentManagement = forwardRef((props: any, ref: any) => {
setDeviceInfo({}) setDeviceInfo({})
let isOpen = await getKeyOpenChildWindow('shareScreenWindow') let isOpen = await getKeyOpenChildWindow('shareScreenWindow')
if (isOpen) { if (isOpen) {
if (props.getDriver) { props.getDriver?.(uid)
props.getDriver(uid)
}
} else { } else {
await onInvoke('getDrivers', { await onInvoke('getDrivers', {
uid uid
@ -96,12 +94,10 @@ const EquipmentManagement = forwardRef((props: any, ref: any) => {
<Button type="primary" className='m-ant-btn' onClick={async () => { <Button type="primary" className='m-ant-btn' onClick={async () => {
let isOpen = await getKeyOpenChildWindow('shareScreenWindow') let isOpen = await getKeyOpenChildWindow('shareScreenWindow')
if (isOpen) { if (isOpen) {
if (props.setDriver) { props.setDriver?.({
props.setDriver({ uid: callerUid,
uid: callerUid, driversJsonString: JSON.stringify(deviceInfo)
driversJsonString: JSON.stringify(deviceInfo) })
})
}
} else { } else {
await onInvoke('setDrivers', { await onInvoke('setDrivers', {
uid: callerUid, uid: callerUid,