diff --git a/components/n-verify/n-verify.vue b/components/n-verify/n-verify.vue
index 88fd290..8c2a1fa 100644
--- a/components/n-verify/n-verify.vue
+++ b/components/n-verify/n-verify.vue
@@ -59,7 +59,7 @@
diff --git a/pages/analysis/auncel/auncel-status.vue b/pages/analysis/auncel/auncel-status.vue
index fdf8e3b..c4f0c5a 100644
--- a/pages/analysis/auncel/auncel-status.vue
+++ b/pages/analysis/auncel/auncel-status.vue
@@ -3,27 +3,16 @@
-
+
-
- {{ auncel.weightData || '' }}
+
+ {{ getWeightText(auncel) }}
- {{ auncel.weightUnit }}
+ {{ auncel.weightUnit }}
@@ -36,6 +25,7 @@ import { ref, computed, onMounted, onUnmounted } from 'vue'
import { onUnload, onHide } from '@dcloudio/uni-app'
import { getTenantId } from '@/defaultBaseUrl'
import nx from '@/nx'
+const balanceBackground = new URL('/static/images/auncel.png', import.meta.url).href
// refs
const auncelList = ref([])
@@ -45,7 +35,7 @@ const userInfo = computed(() => nx.$store('user').userInfo)
// 页面加载
onMounted(() => {
- // getPageData()
+ getPageData()
// #ifdef H5
const regData = {
msgId: nx.$helper.uuid(),
@@ -87,24 +77,14 @@ function cleanup() {
function getPageData() {
nx.$api.laboratory
.getDeviceLaboratoryListBy({
- deviceType: 'auncel',
- status: '1',
- isEnable: '1',
- pageNo: 0,
- pageSize: -1
+ pageNo: 1,
+ pageSize: 999,
+ collectDeviceType: 'balance',
+ deviceStatus: '0',
+ isEnable: '1'
})
.then(res => {
- const dataList = res.records || []
- dataList.forEach(i => {
- i.weightData = ''
- i.weightUnit = ''
- i.isConnected = 0
- i.weightStable = 0
- i.temperature = 0
- i.humidity = 0
- i.controlRealName = ''
- })
- auncelList.value = dataList
+ auncelList.value = res.list
})
.catch(err => {
console.error('获取天平列表失败', err)
@@ -113,46 +93,71 @@ function getPageData() {
// WebSocket 事件处理器
function handleDeviceData(res) {
- if (res.deviceType !== 'auncel') return
- auncelList.value = auncelList.value.map(item => {
- if (item.id === res.deviceId) {
- return {
- ...item,
- weightData: res.weightData,
- weightUnit: res.weightUnit,
- weightStable: res.weightStable,
- isConnected: 1,
- controlRealName: res.controlRealName
+ if (res.deviceType === 'balance') {
+ auncelList.value.forEach(item => {
+ if (item.id === res.deviceId) {
+ item.weightData = res.weightData
+ item.weightUnit = res.weightUnit
+ item.weightStable = res.weightStable
+ item.isConnected = 1
+ item.controlRealName = res.controlRealName
}
- }
- return item
- })
+ })
+ }
}
function handleDeviceStatus(res) {
- auncelList.value = auncelList.value.map(item => {
- if (item.id === res.deviceId) {
- const updated = { ...item, isConnected: res.connected }
- if (res.connected === 0) {
- updated.weightData = '天平断开'
- updated.weightUnit = ''
- updated.weightStable = 0
+ if (res.deviceType === 'balance') {
+ auncelList.value.forEach(item => {
+ if (item.id === res.deviceId) {
+ item.isConnected = res.connected
+ if (res.connected == 0) {
+ item.weightData = '天平断开'
+ item.weightUnit = ''
+ item.weightStable = 0
+ }
}
- return updated
- }
- return item
- })
+ })
+ }
}
function handleConnClose() {
- auncelList.value = auncelList.value.map(i => ({
- ...i,
- weightData: '',
- weightUnit: '',
- weightStable: 0,
- controlRealName: '',
- isConnected: 0
- }))
+ auncelList.value.forEach(item => {
+ item.weightData = ''
+ item.weightUnit = ''
+ item.weightStable = 0
+ item.controlRealName = ''
+ item.isConnected = 0
+ })
+}
+
+function getWeightText(auncel) {
+ if (auncel.isConnected !== 1) {
+ return '天平断开'
+ }
+ return auncel.weightData || ''
+}
+
+function getWeightClass(auncel) {
+ if (auncel.weightStable === 0) return 'weight-data-yellow'
+ if (auncel.weightStable === 1) return 'weight-data'
+ if (auncel.weightStable === 2) return 'weight-data-warning'
+ return 'weight-data-yellow'
+}
+
+function getWeightStyle(auncel) {
+ if (auncel.isConnected !== 1) {
+ return {
+ textAlign: 'center',
+ paddingTop: '0',
+ fontSize: '28px'
+ }
+ }
+ return {
+ textAlign: 'right',
+ paddingTop: '10px',
+ fontSize: '32px'
+ }
}
@@ -170,7 +175,6 @@ function handleConnClose() {
}
.auncel-header {
- height: 100px;
display: flex;
flex-direction: column;
justify-content: center;
@@ -184,27 +188,18 @@ function handleConnClose() {
.auncel-name {
margin-top: 5px;
- font-size: 14px;
- color: #666;
}
.weight {
width: 100%;
- height: 40px;
- display: flex;
- flex-direction: row;
+ height: 60px;
+ position: relative;
box-sizing: border-box;
+ padding: 0 20px;
}
-
.weight-data,
.weight-data-yellow,
.weight-data-warning {
- flex-grow: 1;
- height: 100%;
- text-align: right;
- line-height: 40px;
- letter-spacing: 2px;
- font-size: 32px;
font-family: zzjc-lcd;
}
@@ -221,9 +216,10 @@ function handleConnClose() {
}
.weight-unit {
+ position: absolute;
+ right: 3px;
+ top: 8px;
color: #ffffff;
font-size: 24px;
- line-height: 40px;
- padding-left: 10px;
}
diff --git a/pages/analysis/sample/sample-report.vue b/pages/analysis/sample/sample-report.vue
index 69caa51..c27c179 100644
--- a/pages/analysis/sample/sample-report.vue
+++ b/pages/analysis/sample/sample-report.vue
@@ -117,7 +117,7 @@
@@ -324,11 +324,6 @@ const printTask = () => {
onMounted(() => {
getDicSampleProcessCodeList()
getAssayTask()
-
- // 监听 popup 关闭
- uni.$on('sample-detail-popup_close', () => {
- showDetailPopup.value = false
- })
})
onBackPress(() => {
diff --git a/pages/analysis/sample/sample-work-detail.vue b/pages/analysis/sample/sample-work-detail.vue
index d310afd..ac45e58 100644
--- a/pages/analysis/sample/sample-work-detail.vue
+++ b/pages/analysis/sample/sample-work-detail.vue
@@ -72,6 +72,7 @@
import { ref, reactive, computed, nextTick, onMounted } from 'vue'
+import { onLoad, onBackPress, onShow, onHide, onUnload } from '@dcloudio/uni-app'
import request from '@/nx/request'
import { calcAnalysisValue } from '@/nx/helper/calcAnalysisValue'
import { number } from 'mathjs'
@@ -207,6 +209,7 @@ import AuncelSelectPopup from '@/components/sample/auncel-select-popup.vue'
import { getTenantId } from '@/defaultBaseUrl'
import { useScreenOrientation } from '@/nx/hooks/useScreenOrientation'
import nx from '@/nx'
+import text from '@/uview-plus/components/u-text/text'
// 响应式数据定义
const elId = nx.$helper.uuid()
@@ -944,7 +947,7 @@ const listenDeviceData = () => {
//设备数据
uni.$on('deviceData', res => {
switch (res.deviceType) {
- case 'auncel':
+ case 'balance':
if (currentAuncel.id === res.deviceId) {
currentAuncel.weightData = res.weightData
currentAuncel.weightUnit = res.weightUnit
@@ -1233,7 +1236,7 @@ onBackPress(() => {
}
.auncel {
- width: 100%;
+ width: 90%;
height: 55vh;
background-image: url(/static/images/auncel.png);
background-repeat: no-repeat;
@@ -1263,31 +1266,29 @@ onBackPress(() => {
.weight {
font-size: 42px;
width: 100%;
- padding-right: 10px;
+ padding: 0 60px;
}
.weight-data {
color: #4cd964;
- text-align: right;
font-family: zzjc-lcd;
}
.weight-data-yellow {
color: #ffff00;
- text-align: center;
font-family: zzjc-lcd;
}
.weight-data-warning {
color: #ff3333;
- text-align: right;
font-family: zzjc-lcd;
}
.weight-unit {
+ position: absolute;
+ right: 30px;
color: #ffffff;
font-size: 32px;
- padding-right: 30px;
}
@media (max-width: 700px) {
.auncel {
diff --git a/pages/analysis/sample/sample-work-edit-task.vue b/pages/analysis/sample/sample-work-edit-task.vue
index aaa4665..334bf72 100644
--- a/pages/analysis/sample/sample-work-edit-task.vue
+++ b/pages/analysis/sample/sample-work-edit-task.vue
@@ -80,7 +80,7 @@