feat:天平调整
This commit is contained in:
@@ -2,6 +2,16 @@
|
||||
<view>
|
||||
<navbar-back title="天平状态"></navbar-back>
|
||||
<view class="p20">
|
||||
<view class="x-f flex-wrap pb2">
|
||||
<view
|
||||
v-for="value in options"
|
||||
class="location"
|
||||
:class="{ selected: deployLocation === value }"
|
||||
@click="handleSelectLocation(value)"
|
||||
>
|
||||
{{ value }}
|
||||
</view>
|
||||
</view>
|
||||
<up-grid :col="4" style="gap: 20px">
|
||||
<up-grid-item v-for="(auncel, index) in auncelList" :key="index">
|
||||
<view class="auncel-item" :style="{ backgroundImage: `url(${balanceBackground})` }">
|
||||
@@ -76,6 +86,12 @@ function cleanup() {
|
||||
uni.$off('connClose', handleConnClose)
|
||||
}
|
||||
|
||||
let deployLocation = ref('全部')
|
||||
const options = ref([])
|
||||
const handleSelectLocation = value => {
|
||||
deployLocation.value = value
|
||||
getPageData()
|
||||
}
|
||||
// 获取数据
|
||||
function getPageData() {
|
||||
nx.$api.laboratory
|
||||
@@ -84,10 +100,14 @@ function getPageData() {
|
||||
pageSize: 999,
|
||||
collectDeviceType: 'balance',
|
||||
deviceStatus: '0',
|
||||
isEnable: '1'
|
||||
isEnable: '1',
|
||||
deployLocation: deployLocation.value === '全部' ? '' : deployLocation.value
|
||||
})
|
||||
.then(res => {
|
||||
auncelList.value = res.list
|
||||
if (deployLocation.value === '全部') {
|
||||
options.value = ['全部', ...new Set(res.list.map(item => item.deployLocation).filter(loc => loc))]
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('获取天平列表失败', err)
|
||||
@@ -161,12 +181,28 @@ function getWeightStyle(auncel) {
|
||||
return {
|
||||
textAlign: 'right',
|
||||
paddingTop: '10px',
|
||||
fontSize: '32px'
|
||||
paddingRight:'20px',
|
||||
fontSize: '32px',
|
||||
lineHeight: 1
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.location {
|
||||
padding: 2px 4px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
margin-right: 6px;
|
||||
margin-top: 6px;
|
||||
cursor: pointer;
|
||||
&:hover,
|
||||
&.selected {
|
||||
color: #fff;
|
||||
background-color: #0055a2;
|
||||
border-color: transparent;
|
||||
}
|
||||
}
|
||||
.auncel-item {
|
||||
height: 180px;
|
||||
width: 180px;
|
||||
@@ -214,7 +250,7 @@ function getWeightStyle(auncel) {
|
||||
height: 60px;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
padding: 0 20px 0 10px;
|
||||
}
|
||||
.weight-data,
|
||||
.weight-data-yellow,
|
||||
|
||||
Reference in New Issue
Block a user