diff --git a/src/components/QRcodeDeviceDialog/index.vue b/src/components/QRcodeDeviceDialog/index.vue index 115a364..f91f7f7 100644 --- a/src/components/QRcodeDeviceDialog/index.vue +++ b/src/components/QRcodeDeviceDialog/index.vue @@ -32,7 +32,7 @@ setTimeout(() => { // deviceDetaiRef.value.loading = true if (code.trim()) { - if (code) { + if (code && `${businessType.value}` && `${businessStatus.value}`) { tableLoading.value = true const param = { customerId: customerId.value, // 委托方id diff --git a/src/components/QRcodeDeviceDialog/index.vue b/src/components/QRcodeDeviceDialog/index.vue index 115a364..f91f7f7 100644 --- a/src/components/QRcodeDeviceDialog/index.vue +++ b/src/components/QRcodeDeviceDialog/index.vue @@ -32,7 +32,7 @@ setTimeout(() => { // deviceDetaiRef.value.loading = true if (code.trim()) { - if (code) { + if (code && `${businessType.value}` && `${businessStatus.value}`) { tableLoading.value = true const param = { customerId: customerId.value, // 委托方id diff --git a/src/components/ScanSampleDialog/index.vue b/src/components/ScanSampleDialog/index.vue index a6492f9..9ec6aaa 100644 --- a/src/components/ScanSampleDialog/index.vue +++ b/src/components/ScanSampleDialog/index.vue @@ -95,22 +95,24 @@ status: businessStatus.value, // 场景状态 strSet: [labelId], // 扫码集合 } - getReaderSampleList(param).then((res) => { - if (res && res.data && res.data.length) { - const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) - if (index === -1) { - list.value.push({ - ...res.data[0], - checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 - certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 - requireCertifications: 0, // 应出具证书数量 - }) + if (`${businessType.value}` && `${businessStatus.value}` && [labelId].length) { + getReaderSampleList(param).then((res) => { + if (res && res.data && res.data.length) { + const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) + if (index === -1) { + list.value.push({ + ...res.data[0], + checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 + certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 + requireCertifications: 0, // 应出具证书数量 + }) + } + else { + console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) + } } - else { - console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) - } - } - }) + }) + } } } @@ -139,9 +141,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/components/QRcodeDeviceDialog/index.vue b/src/components/QRcodeDeviceDialog/index.vue index 115a364..f91f7f7 100644 --- a/src/components/QRcodeDeviceDialog/index.vue +++ b/src/components/QRcodeDeviceDialog/index.vue @@ -32,7 +32,7 @@ setTimeout(() => { // deviceDetaiRef.value.loading = true if (code.trim()) { - if (code) { + if (code && `${businessType.value}` && `${businessStatus.value}`) { tableLoading.value = true const param = { customerId: customerId.value, // 委托方id diff --git a/src/components/ScanSampleDialog/index.vue b/src/components/ScanSampleDialog/index.vue index a6492f9..9ec6aaa 100644 --- a/src/components/ScanSampleDialog/index.vue +++ b/src/components/ScanSampleDialog/index.vue @@ -95,22 +95,24 @@ status: businessStatus.value, // 场景状态 strSet: [labelId], // 扫码集合 } - getReaderSampleList(param).then((res) => { - if (res && res.data && res.data.length) { - const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) - if (index === -1) { - list.value.push({ - ...res.data[0], - checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 - certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 - requireCertifications: 0, // 应出具证书数量 - }) + if (`${businessType.value}` && `${businessStatus.value}` && [labelId].length) { + getReaderSampleList(param).then((res) => { + if (res && res.data && res.data.length) { + const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) + if (index === -1) { + list.value.push({ + ...res.data[0], + checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 + certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 + requireCertifications: 0, // 应出具证书数量 + }) + } + else { + console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) + } } - else { - console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) - } - } - }) + }) + } } } @@ -139,9 +141,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/components/scanEquipmentDialog/index.vue b/src/components/scanEquipmentDialog/index.vue index 81511a6..8fc1825 100644 --- a/src/components/scanEquipmentDialog/index.vue +++ b/src/components/scanEquipmentDialog/index.vue @@ -137,9 +137,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/components/QRcodeDeviceDialog/index.vue b/src/components/QRcodeDeviceDialog/index.vue index 115a364..f91f7f7 100644 --- a/src/components/QRcodeDeviceDialog/index.vue +++ b/src/components/QRcodeDeviceDialog/index.vue @@ -32,7 +32,7 @@ setTimeout(() => { // deviceDetaiRef.value.loading = true if (code.trim()) { - if (code) { + if (code && `${businessType.value}` && `${businessStatus.value}`) { tableLoading.value = true const param = { customerId: customerId.value, // 委托方id diff --git a/src/components/ScanSampleDialog/index.vue b/src/components/ScanSampleDialog/index.vue index a6492f9..9ec6aaa 100644 --- a/src/components/ScanSampleDialog/index.vue +++ b/src/components/ScanSampleDialog/index.vue @@ -95,22 +95,24 @@ status: businessStatus.value, // 场景状态 strSet: [labelId], // 扫码集合 } - getReaderSampleList(param).then((res) => { - if (res && res.data && res.data.length) { - const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) - if (index === -1) { - list.value.push({ - ...res.data[0], - checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 - certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 - requireCertifications: 0, // 应出具证书数量 - }) + if (`${businessType.value}` && `${businessStatus.value}` && [labelId].length) { + getReaderSampleList(param).then((res) => { + if (res && res.data && res.data.length) { + const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) + if (index === -1) { + list.value.push({ + ...res.data[0], + checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 + certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 + requireCertifications: 0, // 应出具证书数量 + }) + } + else { + console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) + } } - else { - console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) - } - } - }) + }) + } } } @@ -139,9 +141,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/components/scanEquipmentDialog/index.vue b/src/components/scanEquipmentDialog/index.vue index 81511a6..8fc1825 100644 --- a/src/components/scanEquipmentDialog/index.vue +++ b/src/components/scanEquipmentDialog/index.vue @@ -137,9 +137,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/store/modules/websocket.ts b/src/store/modules/websocket.ts index fdaf528..3e3f3a8 100644 --- a/src/store/modules/websocket.ts +++ b/src/store/modules/websocket.ts @@ -99,6 +99,7 @@ this.wsIsReconnect = false if (this.websocket) { this.websocket.close() + this.messageList = [] ElMessage.success('websocket已断开') } if (this.wsPingTimer) { @@ -110,6 +111,7 @@ this.wsReconnectTimer = null } this.wsStatus = false + this.messageList = [] }, // websocket重连 reConnectWebsocket() { diff --git a/src/components/QRcodeDeviceDialog/index.vue b/src/components/QRcodeDeviceDialog/index.vue index 115a364..f91f7f7 100644 --- a/src/components/QRcodeDeviceDialog/index.vue +++ b/src/components/QRcodeDeviceDialog/index.vue @@ -32,7 +32,7 @@ setTimeout(() => { // deviceDetaiRef.value.loading = true if (code.trim()) { - if (code) { + if (code && `${businessType.value}` && `${businessStatus.value}`) { tableLoading.value = true const param = { customerId: customerId.value, // 委托方id diff --git a/src/components/ScanSampleDialog/index.vue b/src/components/ScanSampleDialog/index.vue index a6492f9..9ec6aaa 100644 --- a/src/components/ScanSampleDialog/index.vue +++ b/src/components/ScanSampleDialog/index.vue @@ -95,22 +95,24 @@ status: businessStatus.value, // 场景状态 strSet: [labelId], // 扫码集合 } - getReaderSampleList(param).then((res) => { - if (res && res.data && res.data.length) { - const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) - if (index === -1) { - list.value.push({ - ...res.data[0], - checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 - certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 - requireCertifications: 0, // 应出具证书数量 - }) + if (`${businessType.value}` && `${businessStatus.value}` && [labelId].length) { + getReaderSampleList(param).then((res) => { + if (res && res.data && res.data.length) { + const index = list.value.findIndex((item: { sampleId: string }) => item.sampleId === res.data[0].sampleId) + if (index === -1) { + list.value.push({ + ...res.data[0], + checkDate: res.data[0].checkDate ? dayjs(res.data[0].checkDate).format('YYYY-MM-DD') : res.data[0].checkDate, // 检定日期 + certificateValid: res.data[0].certificateValid ? dayjs(res.data[0].certificateValid).format('YYYY-MM-DD') : res.data[0].certificateValid, // 证书有效期 + requireCertifications: 0, // 应出具证书数量 + }) + } + else { + console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) + } } - else { - console.log(`${list.value[index].sampleName}${list.value[index].sampleModel}${list.value[index].manufactureNo}已经添加过`) - } - } - }) + }) + } } } @@ -139,9 +141,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/components/scanEquipmentDialog/index.vue b/src/components/scanEquipmentDialog/index.vue index 81511a6..8fc1825 100644 --- a/src/components/scanEquipmentDialog/index.vue +++ b/src/components/scanEquipmentDialog/index.vue @@ -137,9 +137,7 @@ // 断开websocket function stopWebScket() { - if (websocket && websocket.wsStatus) { - websocket.destroyWebSocket() - } + websocket.destroyWebSocket() } // 重连 const reStartWebScket = () => { diff --git a/src/store/modules/websocket.ts b/src/store/modules/websocket.ts index fdaf528..3e3f3a8 100644 --- a/src/store/modules/websocket.ts +++ b/src/store/modules/websocket.ts @@ -99,6 +99,7 @@ this.wsIsReconnect = false if (this.websocket) { this.websocket.close() + this.messageList = [] ElMessage.success('websocket已断开') } if (this.wsPingTimer) { @@ -110,6 +111,7 @@ this.wsReconnectTimer = null } this.wsStatus = false + this.messageList = [] }, // websocket重连 reConnectWebsocket() { diff --git a/src/views/dataManagement/indexBak.vue b/src/views/dataManagement/indexBak.vue new file mode 100644 index 0000000..9876bc8 --- /dev/null +++ b/src/views/dataManagement/indexBak.vue @@ -0,0 +1,16 @@ + + +