fix: 智聪健康微信小程序版本,代码提交。
This commit is contained in:
@@ -2,19 +2,66 @@
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="0rpx" customNavHeight="0rpx">
|
||||
<view class="search-view">
|
||||
<u-input v-model="queryParams.personName" border="false" type="select" @click="handlePerson" placeholder="请选择人员" suffixIcon="search"
|
||||
suffixIconStyle="color: #909399" class="search-input">
|
||||
</u-input>
|
||||
<view class="search-input-wrapper">
|
||||
<u--input
|
||||
v-model="queryParams.personName"
|
||||
border="surround"
|
||||
readonly
|
||||
placeholder="请选择人员"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input">
|
||||
</u--input>
|
||||
<uni-icons
|
||||
type="search"
|
||||
size="18"
|
||||
color="#667eea"
|
||||
class="search-icon"
|
||||
@click="handlePerson">
|
||||
</uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="search-view">
|
||||
<u-input v-model="queryParams.healthRecordName" border="false" type="select" @click="handleHealthRecord" placeholder="请选择健康档案" suffixIcon="search"
|
||||
suffixIconStyle="color: #909399" class="search-input">
|
||||
</u-input>
|
||||
<view class="search-input-wrapper">
|
||||
<u--input
|
||||
v-model="queryParams.healthRecordName"
|
||||
border="surround"
|
||||
readonly
|
||||
placeholder="请选择健康档案"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input">
|
||||
</u--input>
|
||||
<uni-icons
|
||||
type="search"
|
||||
size="18"
|
||||
color="#667eea"
|
||||
class="search-icon"
|
||||
@click="handleHealthRecord">
|
||||
</uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="search-view">
|
||||
<u-input v-model="queryParams.time" placeholder="请选择测量日期" border="false" type="select" readonly suffixIcon="calendar"
|
||||
suffixIconStyle="color: #909399" class="search-input">
|
||||
</u-input>
|
||||
<view class="search-input-wrapper">
|
||||
<u--input
|
||||
v-model="queryParams.time"
|
||||
border="surround"
|
||||
readonly
|
||||
placeholder="请选择测量日期"
|
||||
placeholderStyle="color: #909399"
|
||||
color="#333333"
|
||||
customStyle="background: rgba(102, 126, 234, 0.08); border: 2rpx solid rgba(102, 126, 234, 0.3); border-radius: 24rpx; height: 66rpx"
|
||||
class="search-input">
|
||||
</u--input>
|
||||
<uni-icons
|
||||
type="calendar"
|
||||
size="18"
|
||||
color="#667eea"
|
||||
class="search-icon">
|
||||
</uni-icons>
|
||||
</view>
|
||||
<view class="filter-btn" @click="filterPanel = !filterPanel">
|
||||
<uni-icons type="list" size="18" color="#667eea"></uni-icons>
|
||||
<text>筛选</text>
|
||||
@@ -69,7 +116,7 @@
|
||||
<uni-icons type="checkmarkempty" size="20" color="#ffffff"></uni-icons>
|
||||
</view>
|
||||
<view class="info-sum">
|
||||
<view class="title">正常( <36.9℃)</view>
|
||||
<view class="title">正常(低于36.9℃)</view>
|
||||
<view class="num">{{ temp.normalTempCount }}<span>次</span></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -98,7 +145,7 @@
|
||||
<uni-icons type="fire-filled" size="20" color="#ffffff"></uni-icons>
|
||||
</view>
|
||||
<view class="info-sum">
|
||||
<view class="title">高烧(>38.5℃)</view>
|
||||
<view class="title">高烧(高于38.5℃)</view>
|
||||
<view class="num">{{ temp.higherTempCount }}<span>次</span></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -106,7 +153,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 视图切换 -->
|
||||
<view class="section-title" v-show="secondListData.length>0">
|
||||
<view class="section-title" v-show="hasSecondListData">
|
||||
<view class="title-decorator"></view>
|
||||
<text class="title-text">体温统计</text>
|
||||
<view class="view-switch">
|
||||
@@ -137,7 +184,7 @@
|
||||
|
||||
<!-- 筛选面板 -->
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel" :style="{ height: windowHeight + 'px' }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">测量日期</view>
|
||||
<view class="selcet-content" style="padding: 0 24rpx">
|
||||
@@ -193,10 +240,10 @@
|
||||
></u-datetime-picker>
|
||||
|
||||
<!-- 曲线图展示 -->
|
||||
<view class="chart-container" v-if="secondListData.length>0 && viewMode === 'line'">
|
||||
<view class="chart-container" v-if="hasSecondListData && viewMode === 'line'">
|
||||
<qiun-data-charts
|
||||
type="line"
|
||||
canvasId="tempLineChart"
|
||||
:canvasId="canvasIdPrefix + '_line'"
|
||||
:chartData="chartData"
|
||||
:opts="lineChartOpts"
|
||||
:loadingType="1"
|
||||
@@ -204,17 +251,17 @@
|
||||
</view>
|
||||
|
||||
<!-- 柱状图展示 -->
|
||||
<view class="chart-container" v-if="secondListData.length>0 && viewMode === 'column'">
|
||||
<view class="chart-container" v-if="hasSecondListData && viewMode === 'column'">
|
||||
<qiun-data-charts
|
||||
type="column"
|
||||
canvasId="tempColumnChart"
|
||||
:canvasId="canvasIdPrefix + '_column'"
|
||||
:chartData="chartData"
|
||||
:opts="columnChartOpts"
|
||||
:loadingType="1"
|
||||
/>
|
||||
</view>
|
||||
<!-- 列表展示 -->
|
||||
<u-list v-show="!tabShow && viewMode === 'list'" :spaceHeight="720" lowerThreshold="100">
|
||||
<u-list v-if="!tabShow && viewMode === 'list'" :spaceHeight="720" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header">
|
||||
@@ -225,21 +272,21 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="header-right">
|
||||
<text class="amount-label">测量次数:</text>
|
||||
<text class="amount-label">测量次数</text>
|
||||
<text class="amount-value">{{ item.count }}次</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-body">
|
||||
<view class="detail-row">
|
||||
<text class="row-label">最高体温:</text>
|
||||
<text class="row-label">最高体温</text>
|
||||
<text class="row-value">{{ item.max }} ℃</text>
|
||||
</view>
|
||||
<view class="detail-row">
|
||||
<text class="row-label">最低体温:</text>
|
||||
<text class="row-label">最低体温</text>
|
||||
<text class="row-value">{{ item.min }} ℃</text>
|
||||
</view>
|
||||
<view class="detail-row">
|
||||
<text class="row-label">平均体温:</text>
|
||||
<text class="row-label">平均体温</text>
|
||||
<text class="row-value">{{ item.average }} ℃</text>
|
||||
</view>
|
||||
<view class="detail-label">
|
||||
@@ -276,7 +323,14 @@ import { getDicts } from '@/api/system/dict/data.js'
|
||||
import { timeHandler } from '@/utils/common.ts'
|
||||
import {onLoad,onShow} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
import {reactive ,toRefs,ref,computed,getCurrentInstance }from "vue";
|
||||
|
||||
// 获取当前实例
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
// 生成唯一的canvas ID,避免微信小程序多实例冲突
|
||||
const canvasIdPrefix = 'temp_' + Date.now()
|
||||
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
@@ -300,6 +354,11 @@ const firstType = ref("primary")
|
||||
const secondType = ref("default")
|
||||
const secondListData = ref([])
|
||||
|
||||
// 计算属性 - 判断是否有数据
|
||||
const hasSecondListData = computed(() => {
|
||||
return secondListData.value && secondListData.value.length > 0
|
||||
})
|
||||
|
||||
// 曲线图配置
|
||||
const lineChartOpts = computed(() => {
|
||||
const dataCount = secondListData.value ? secondListData.value.length : 0
|
||||
@@ -307,7 +366,7 @@ const lineChartOpts = computed(() => {
|
||||
|
||||
return {
|
||||
color: ['#667eea'],
|
||||
padding: [15, 15, 60, 5],
|
||||
padding: [15, 15, 30, 5],
|
||||
enableScroll: false,
|
||||
enableMarkLine: true,
|
||||
dataLabel: false,
|
||||
@@ -475,12 +534,17 @@ const chartData = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤和验证数据
|
||||
const validData = secondListData.value.filter(item => {
|
||||
return item && item.time && item.value !== undefined && item.value !== null
|
||||
})
|
||||
|
||||
return {
|
||||
categories: secondListData.value.map(item => item.time || ''),
|
||||
categories: validData.map(item => item.time || ''),
|
||||
series: [
|
||||
{
|
||||
name: '体温',
|
||||
data: secondListData.value.map(item => {
|
||||
data: validData.map(item => {
|
||||
const value = parseFloat(item.value)
|
||||
return isNaN(value) ? 0 : value
|
||||
})
|
||||
@@ -510,9 +574,14 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { filterPanel, queryPersonParams,queryHealthRecordParams, queryParams} = toRefs(data)
|
||||
const windowHeight = computed(() => {
|
||||
uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
|
||||
// 修复微信小程序windowHeight计算
|
||||
const windowHeight = ref(0)
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
windowHeight.value = res.windowHeight - 50
|
||||
}
|
||||
})
|
||||
onLoad(() => {
|
||||
getDict()
|
||||
// getList()
|
||||
@@ -623,8 +692,10 @@ function settingCancel() {
|
||||
}
|
||||
function handlePerson() {
|
||||
if (personList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '人员为空 ', type: 'warning'
|
||||
uni.showToast({
|
||||
title: '人员为空',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
showPerson.value = true
|
||||
@@ -655,8 +726,10 @@ function settingCancel() {
|
||||
}
|
||||
function handleHealthRecord() {
|
||||
if (healthRecordList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '健康档案为空 ', type: 'warning'
|
||||
uni.showToast({
|
||||
title: '健康档案为空',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
showHealthRecord.value = true
|
||||
@@ -823,13 +896,13 @@ page {
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
margin: 16rpx 24rpx 60rpx;
|
||||
margin: 16rpx 24rpx 30rpx;
|
||||
padding: 16rpx;
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%);
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
width: calc(100% - 48rpx);
|
||||
height: 550rpx;
|
||||
height: 500rpx;
|
||||
overflow: visible;
|
||||
position: relative;
|
||||
}
|
||||
@@ -844,16 +917,55 @@ page {
|
||||
z-index: 100;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.search-input-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.search-icon {
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.search-input {
|
||||
background: rgba(102, 126, 234, 0.08);
|
||||
color: #333333;
|
||||
flex: 1;
|
||||
margin-right: 16rpx;
|
||||
width: 100%;
|
||||
margin-right: 0;
|
||||
border-radius: 24rpx;
|
||||
border: 2rpx solid rgba(102, 126, 234, 0.3);
|
||||
height: 66rpx !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
/* H5端placeholder样式 */
|
||||
:deep(input::placeholder) {
|
||||
color: #909399 !important;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
:deep(input::-webkit-input-placeholder) {
|
||||
color: #909399 !important;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
:deep(input::-moz-placeholder) {
|
||||
color: #909399 !important;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
/* 输入文字颜色 */
|
||||
:deep(.u-input__content__field-wrapper__field) {
|
||||
color: #333333 !important;
|
||||
}
|
||||
|
||||
:deep(input) {
|
||||
color: #333333 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-btn {
|
||||
|
||||
Reference in New Issue
Block a user