Commit dc5d9c19e4d6e951242a450dde90d7ab831a68ba
1 parent
dcd5fff5
处理websocket断开问题;
Showing
1 changed file
with
11 additions
and
0 deletions
src/components/QuickQuote/index.jsx
| ... | ... | @@ -502,6 +502,17 @@ const QuickQuoteEvent = props => { |
| 502 | 502 | |
| 503 | 503 | // 核价按钮 |
| 504 | 504 | addState.handleCalcPrice = async () => { |
| 505 | + if (props.app.webSocket === null || props.app.webSocket?.readyState !== WebSocket.OPEN) { | |
| 506 | + console.log("================webSocket连接======================"); | |
| 507 | + props.dispatch({ | |
| 508 | + type: "app/createWebSocket", | |
| 509 | + payload: { reStart: true, dispatch: props.dispatch }, | |
| 510 | + }); | |
| 511 | + | |
| 512 | + // 暂停2秒 | |
| 513 | + await new Promise(resolve => setTimeout(resolve, 2000)); | |
| 514 | + } | |
| 515 | + | |
| 505 | 516 | const { masterConfig, masterData = {}, slaveConfig, slaveData = [], selectedNode = {}, extraParts = {} } = state; |
| 506 | 517 | const selectProduct = commonFunc.showLocalMessage(props, "selectProduct", "请先选择产品"); |
| 507 | 518 | if (commonUtils.isEmptyObject(selectedNode)) { | ... | ... |