feat:页面修改
This commit is contained in:
@@ -49,7 +49,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:showAuncelSelector'])
|
||||
const emit = defineEmits(['update:showAuncelSelector', 'doSelect'])
|
||||
|
||||
// 响应式数据
|
||||
const auncelList = ref([])
|
||||
@@ -64,15 +64,12 @@ const open = () => {
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
console.log('auncel-selector close触发')
|
||||
auncelList.value = []
|
||||
uni.$emit('auncelSelector_close')
|
||||
closeDeviceListener()
|
||||
emit('update:showAuncelSelector', false)
|
||||
}
|
||||
|
||||
const getPageData = () => {
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
nx.$api.laboratory
|
||||
.getDeviceLaboratoryListBy({
|
||||
deviceType: 'auncel',
|
||||
@@ -93,11 +90,6 @@ const getPageData = () => {
|
||||
controlRealName: ''
|
||||
}))
|
||||
auncelList.value = dataList
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('加载天平列表失败:', err)
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -109,7 +101,7 @@ const doSelect = index => {
|
||||
return
|
||||
}
|
||||
|
||||
if (currentAuncel.controlRealName && currentAuncel.controlRealName !== userInfo.value.realname) {
|
||||
if (currentAuncel.controlRealName && currentAuncel.controlRealName !== userInfo.value.nickname) {
|
||||
uni.showToast({
|
||||
title: `当前天平正被“${currentAuncel.controlRealName}”使用,请选择其他天平!`,
|
||||
icon: 'none'
|
||||
@@ -132,15 +124,15 @@ const doSelect = index => {
|
||||
deviceCode: currentAuncel.code,
|
||||
deviceName: currentAuncel.name,
|
||||
isControl: true,
|
||||
controlRealName: userInfo.value.realname
|
||||
controlRealName: userInfo.value.nickname
|
||||
}
|
||||
}
|
||||
|
||||
const sendControl = () => {
|
||||
const controlData = JSON.stringify(controlDevice)
|
||||
nx.$measure.send(controlData)
|
||||
console.log('controlDevice', controlData)
|
||||
uni.$emit('auncelSelector_doSelect', controlDevice)
|
||||
emit('update:showAuncelSelector', false)
|
||||
emit('doSelect', controlDevice)
|
||||
}
|
||||
|
||||
if (delayFlag) {
|
||||
@@ -159,7 +151,7 @@ const releaseDeviceControl = deviceId => {
|
||||
data: {
|
||||
deviceId,
|
||||
isControl: false,
|
||||
controlRealName: userInfo.value.realname
|
||||
controlRealName: userInfo.value.nickname
|
||||
}
|
||||
}
|
||||
nx.$measure.send(JSON.stringify(controlDevice))
|
||||
|
||||
Reference in New Issue
Block a user