feat:天平调整

This commit is contained in:
houjunxiang
2026-01-16 21:11:48 +08:00
parent 6ecbf27b25
commit 3fdc27eb74
6 changed files with 115 additions and 36 deletions

View File

@@ -1,7 +1,19 @@
<template>
<view>
<u-popup :show="showAuncelSelector" closeable @close="close" @open="open" mode="right">
<view class="p10">天平选择</view>
<view class="p10">
<view>天平选择</view>
<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>
</view>
<scroll-view scroll-y="true" class="content">
<u-grid :col="3" @click="doSelect" style="gap: 20px">
<u-grid-item v-for="(auncel, index) in auncelList" :index="index" :key="index">
@@ -62,6 +74,12 @@ const close = () => {
emit('update:showAuncelSelector', false)
}
let deployLocation = ref('全部')
const options = ref([])
const handleSelectLocation = value => {
deployLocation.value = value
getPageData()
}
const getPageData = () => {
nx.$api.laboratory
.getDeviceLaboratoryListBy({
@@ -69,10 +87,14 @@ const 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))]
}
})
}
@@ -221,7 +243,9 @@ function getWeightStyle(auncel) {
}
return {
textAlign: 'right',
fontSize: '32px'
fontSize: '32px',
paddingRight:'20px',
lineHeight: 1
}
}
</script>
@@ -232,6 +256,20 @@ function getWeightStyle(auncel) {
height: 90vh;
padding: 0 20px 40px 20px;
}
.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;
@@ -265,7 +303,7 @@ function getWeightStyle(auncel) {
flex: 1;
font-size: 28px;
padding-top: 10px;
padding: 10px 30px 0 30px;
padding: 10px 30px 0 10px;
position: relative;
}
.weight-data,

View File

@@ -1,14 +1,14 @@
// 在此不用配置接口前缀
const isDev = process.env.NODE_ENV === 'development'
// 正式环境
// const BaseUrl = isDev ? 'http://172.17.19.29:48080/admin-api' : 'http://172.17.19.29:48080/admin-api'
// const upgradeBaseUrl = isDev? 'http://172.17.19.29:48080/admin-api':'http://172.17.19.29:48080/admin-api'
// const websocketUrl = isDev ? 'ws://172.17.19.11:30330' : 'ws://172.17.19.11:30330'
const BaseUrl = isDev ? 'http://172.17.19.29:48080/admin-api' : 'http://172.17.19.29:48080/admin-api'
const upgradeBaseUrl = isDev? 'http://172.17.19.29:48080/admin-api':'http://172.17.19.29:48080/admin-api'
const websocketUrl = isDev ? 'ws://172.17.19.11:30330' : 'ws://172.17.19.11:30330'
// 公司测试环境
const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api'
const upgradeBaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api'
const websocketUrl = isDev ? 'ws://192.168.26.116:888/ws' : 'ws://192.168.26.116:888/ws'
// const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api'
// const upgradeBaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api'
// const websocketUrl = isDev ? 'ws://192.168.26.116:888/ws' : 'ws://192.168.26.116:888/ws'
const tenantId = '1'
export const clientId = 'zgty_lims'

View File

@@ -2,8 +2,8 @@
"name" : "实验室管理系统",
"appid" : "__UNI__4B3B4B0",
"description" : "实验室管理系统",
"versionName" : "1.0.3",
"versionCode" : 103,
"versionName" : "1.0.6",
"versionCode" : 106,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,
@@ -95,21 +95,21 @@
/* JSONUserAgent **/
"useragent" : {
/* userAgent */
"value" : "LIMS-PDA/1.0.3",
"value" : "LIMS-PDA/1.0.6",
/* BooleanvalueuserAgent */
"concatenate" : true
},
/* JSONAndroidUserAgentuseragent */
"useragent_android" : {
/* userAgent */
"value" : "LIMS-PDA/1.0.3",
"value" : "LIMS-PDA/1.0.6",
/* BooleanvalueuserAgent */
"concatenate" : true
},
/* JSONiOSUserAgentuseragent */
"useragent_ios" : {
/* userAgent */
"value" : "LIMS-PDA/1.0.3",
"value" : "LIMS-PDA/1.0.6",
/* BooleanvalueuserAgent */
"concatenate" : true
}

View File

@@ -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,

View File

@@ -52,9 +52,7 @@
v-for="(sample, index) in sampleDataList"
:key="index"
class="u-tab-item"
:class="[
currentSampleIndex === index ? 'u-tab-item-active' : '',
]"
:class="[currentSampleIndex === index ? 'u-tab-item-active' : '']"
:data-current="index"
@tap.stop="switchSample(index, false)"
>
@@ -1050,6 +1048,7 @@ const listenDeviceData = () => {
switch (res.deviceType) {
case 'balance':
if (currentAuncel.value.id === res.deviceId) {
console.log('天平信息', res)
currentAuncel.value.weightData = res.weightData
currentAuncel.value.weightUnit = res.weightUnit
currentAuncel.value.weightStable = res.weightStable
@@ -1077,6 +1076,7 @@ const listenDeviceData = () => {
//控制设备状态
uni.$on('controlDevice', res => {
if (currentAuncel.value.id === res.deviceId) {
console.log('控制', res.deviceId)
currentAuncel.value.id = ''
currentAuncel.value.name = ''
currentAuncel.value.code = ''
@@ -1442,7 +1442,8 @@ onBackPress(() => {
.weight {
font-size: 42px;
width: 100%;
padding: 0 60px;
padding-right: 80px;
line-height: 1;
}
.weight-data {

View File

@@ -160,11 +160,16 @@ async function loadTaskDetail() {
label: item.fieldName,
fieldKey: item.fieldKey,
type: item.fieldType,
placeholder: '请输入'
placeholder: '请输入',
hidden:false
}
if (customConfig?.componentProps?.options) {
field.options = customConfig.componentProps.options
}
if(customConfig.hidden){
field.hidden = true
}
return field
})
formFields.value = [...staticFormSchema, ...dynamicFormSchema]
@@ -282,7 +287,6 @@ async function handleSave(change) {
let params = {}
const dynamicData = Object.fromEntries(Object.entries(realFormData.value).filter(([key]) => key !== 'assayTime'))
console.log(dynamicData)
if (change) {
// 计算样品数据
updateTableDataByConfigFields()
@@ -367,7 +371,7 @@ function saveHeadData() {
* todo 关联字段在动态字段的change事件处理
* */
function pickerConfirm(event, field) {
if (field.type == 'date') {
if (field.type == 'Date') {
field.value = nx.$dayjs(event.value).valueOf()
field.showPicker = false
return