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

View File

@@ -1,14 +1,14 @@
// 在此不用配置接口前缀 // 在此不用配置接口前缀
const isDev = process.env.NODE_ENV === 'development' 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 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 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 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 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 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 websocketUrl = isDev ? 'ws://192.168.26.116:888/ws' : 'ws://192.168.26.116:888/ws'
const tenantId = '1' const tenantId = '1'
export const clientId = 'zgty_lims' export const clientId = 'zgty_lims'

View File

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

View File

@@ -2,6 +2,16 @@
<view> <view>
<navbar-back title="天平状态"></navbar-back> <navbar-back title="天平状态"></navbar-back>
<view class="p20"> <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 :col="4" style="gap: 20px">
<up-grid-item v-for="(auncel, index) in auncelList" :key="index"> <up-grid-item v-for="(auncel, index) in auncelList" :key="index">
<view class="auncel-item" :style="{ backgroundImage: `url(${balanceBackground})` }"> <view class="auncel-item" :style="{ backgroundImage: `url(${balanceBackground})` }">
@@ -76,6 +86,12 @@ function cleanup() {
uni.$off('connClose', handleConnClose) uni.$off('connClose', handleConnClose)
} }
let deployLocation = ref('全部')
const options = ref([])
const handleSelectLocation = value => {
deployLocation.value = value
getPageData()
}
// 获取数据 // 获取数据
function getPageData() { function getPageData() {
nx.$api.laboratory nx.$api.laboratory
@@ -84,10 +100,14 @@ function getPageData() {
pageSize: 999, pageSize: 999,
collectDeviceType: 'balance', collectDeviceType: 'balance',
deviceStatus: '0', deviceStatus: '0',
isEnable: '1' isEnable: '1',
deployLocation: deployLocation.value === '全部' ? '' : deployLocation.value
}) })
.then(res => { .then(res => {
auncelList.value = res.list auncelList.value = res.list
if (deployLocation.value === '全部') {
options.value = ['全部', ...new Set(res.list.map(item => item.deployLocation).filter(loc => loc))]
}
}) })
.catch(err => { .catch(err => {
console.error('获取天平列表失败', err) console.error('获取天平列表失败', err)
@@ -161,12 +181,28 @@ function getWeightStyle(auncel) {
return { return {
textAlign: 'right', textAlign: 'right',
paddingTop: '10px', paddingTop: '10px',
fontSize: '32px' paddingRight:'20px',
fontSize: '32px',
lineHeight: 1
} }
} }
</script> </script>
<style scoped> <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 { .auncel-item {
height: 180px; height: 180px;
width: 180px; width: 180px;
@@ -214,7 +250,7 @@ function getWeightStyle(auncel) {
height: 60px; height: 60px;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
padding: 0 20px; padding: 0 20px 0 10px;
} }
.weight-data, .weight-data,
.weight-data-yellow, .weight-data-yellow,

View File

@@ -52,13 +52,11 @@
v-for="(sample, index) in sampleDataList" v-for="(sample, index) in sampleDataList"
:key="index" :key="index"
class="u-tab-item" class="u-tab-item"
:class="[ :class="[currentSampleIndex === index ? 'u-tab-item-active' : '']"
currentSampleIndex === index ? 'u-tab-item-active' : '',
]"
:data-current="index" :data-current="index"
@tap.stop="switchSample(index, false)" @tap.stop="switchSample(index, false)"
> >
<!-- sample.rollbackStatus === 'in_progress' ? 'u-tab-item-disabled' : '' 退回disabled暂不显示 --> <!-- sample.rollbackStatus === 'in_progress' ? 'u-tab-item-disabled' : '' 退回disabled暂不显示 -->
<u-badge type="warning" :value="index + 1"></u-badge> <u-badge type="warning" :value="index + 1"></u-badge>
<view class="ml20"> <view class="ml20">
<view> <view>
@@ -69,7 +67,7 @@
</view> </view>
</scroll-view> </scroll-view>
<u-button <u-button
v-if="taskIngredientsStatus === 'allow_submit'||taskIsIngredients == '0'" v-if="taskIngredientsStatus === 'allow_submit' || taskIsIngredients == '0'"
class="btn-operation" class="btn-operation"
type="primary" type="primary"
@click="submitTask()" @click="submitTask()"
@@ -362,7 +360,7 @@ const customBack = () => {
} }
const navRightClick = () => { const navRightClick = () => {
let url = `/pages/analysis/sample/sample-work-edit-task?currentTaskId=${ taskId.value}&configReportTemplateKey=${configReportTemplateKey.value}` let url = `/pages/analysis/sample/sample-work-edit-task?currentTaskId=${taskId.value}&configReportTemplateKey=${configReportTemplateKey.value}`
uni.navigateTo({ uni.navigateTo({
url: url url: url
}) })
@@ -770,10 +768,10 @@ function updateTableDataByConfigFields() {
if (!columnObj) continue if (!columnObj) continue
tab.tableData.forEach(row => { tab.tableData.forEach(row => {
// 赋值配置列参与计算 // 赋值配置列参与计算
if(row[columnObj.fieldIndex]){ if (row[columnObj.fieldIndex]) {
row[columnObj.fieldIndex].value = dynamicFormData[key] row[columnObj.fieldIndex].value = dynamicFormData[key]
calcRowAnalysisValue(row, columnObj, tab.columns) calcRowAnalysisValue(row, columnObj, tab.columns)
} }
}) })
} }
} }
@@ -788,7 +786,7 @@ function setValueToSample() {
nx.$test.object(currentSampleData.value[item.fieldIndex]) nx.$test.object(currentSampleData.value[item.fieldIndex])
) { ) {
currentSampleData.value[item.fieldIndex].value = item.value currentSampleData.value[item.fieldIndex].value = item.value
currentSampleData.value[item.fieldIndex].symbol = item.symbol currentSampleData.value[item.fieldIndex].symbol = item.symbol
} }
}) })
} }
@@ -931,7 +929,7 @@ async function getSampleAnalysisByTaskId() {
businessAssayTasNo, businessAssayTasNo,
formValue, formValue,
ingredientsStatus, ingredientsStatus,
isIngredients isIngredients
} = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value) } = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value)
title.value = '样品分析-任务单编号:' + businessAssayTasNo title.value = '样品分析-任务单编号:' + businessAssayTasNo
taskIngredientsStatus.value = ingredientsStatus taskIngredientsStatus.value = ingredientsStatus
@@ -965,8 +963,8 @@ function setValueToField() {
group.fields.forEach(field => { group.fields.forEach(field => {
let value = getFieldValue(field) let value = getFieldValue(field)
field.value = value field.value = value
let symbol = getFieldSymbol(field) let symbol = getFieldSymbol(field)
field.symbol = symbol field.symbol = symbol
}) })
} }
} }
@@ -1050,6 +1048,7 @@ const listenDeviceData = () => {
switch (res.deviceType) { switch (res.deviceType) {
case 'balance': case 'balance':
if (currentAuncel.value.id === res.deviceId) { if (currentAuncel.value.id === res.deviceId) {
console.log('天平信息', res)
currentAuncel.value.weightData = res.weightData currentAuncel.value.weightData = res.weightData
currentAuncel.value.weightUnit = res.weightUnit currentAuncel.value.weightUnit = res.weightUnit
currentAuncel.value.weightStable = res.weightStable currentAuncel.value.weightStable = res.weightStable
@@ -1077,6 +1076,7 @@ const listenDeviceData = () => {
//控制设备状态 //控制设备状态
uni.$on('controlDevice', res => { uni.$on('controlDevice', res => {
if (currentAuncel.value.id === res.deviceId) { if (currentAuncel.value.id === res.deviceId) {
console.log('控制', res.deviceId)
currentAuncel.value.id = '' currentAuncel.value.id = ''
currentAuncel.value.name = '' currentAuncel.value.name = ''
currentAuncel.value.code = '' currentAuncel.value.code = ''
@@ -1442,7 +1442,8 @@ onBackPress(() => {
.weight { .weight {
font-size: 42px; font-size: 42px;
width: 100%; width: 100%;
padding: 0 60px; padding-right: 80px;
line-height: 1;
} }
.weight-data { .weight-data {

View File

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