fix: 功能完善修复。

This commit is contained in:
tianyongbao
2026-07-12 12:49:10 +08:00
parent aeb1e39920
commit cc1ccad308
25 changed files with 350 additions and 155 deletions

3
package-lock.json generated
View File

@@ -7,6 +7,7 @@
"": { "": {
"name": "uni-preset-vue", "name": "uni-preset-vue",
"version": "0.0.0", "version": "0.0.0",
"hasInstallScript": true,
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-4000820240401001", "@dcloudio/uni-app": "3.0.0-4000820240401001",
"@dcloudio/uni-app-plus": "3.0.0-4000820240401001", "@dcloudio/uni-app-plus": "3.0.0-4000820240401001",
@@ -12490,7 +12491,7 @@
}, },
"node_modules/uview-plus": { "node_modules/uview-plus": {
"version": "3.1.45", "version": "3.1.45",
"resolved": "https://registry.npmmirror.com/uview-plus/-/uview-plus-3.1.45.tgz", "resolved": "https://registry.npmjs.org/uview-plus/-/uview-plus-3.1.45.tgz",
"integrity": "sha512-JHgLp2heaMciLdGimO/v4tMM8iwb2vTEOk6sXqn5X198AHjM5A/IGzH84GZPvUISFTEJbxGEHiGPxpv2K26AGw==", "integrity": "sha512-JHgLp2heaMciLdGimO/v4tMM8iwb2vTEOk6sXqn5X198AHjM5A/IGzH84GZPvUISFTEJbxGEHiGPxpv2K26AGw==",
"dependencies": { "dependencies": {
"clipboard": "^2.0.11", "clipboard": "^2.0.11",

View File

@@ -39,7 +39,14 @@
"type-check": "vue-tsc --noEmit", "type-check": "vue-tsc --noEmit",
"clean:linux": "rm -rf dist || rm -rf node_modules", "clean:linux": "rm -rf dist || rm -rf node_modules",
"clean:windows": "rd /s /q dist || rd /s /q node_modules", "clean:windows": "rd /s /q dist || rd /s /q node_modules",
"postinstall": "node scripts/patch-u-input.js" "patch:u-input": "node scripts/patch-u-input.js",
"postinstall": "node scripts/patch-u-input.js",
"predev:mp-weixin": "node scripts/patch-u-input.js",
"prebuild:mp-weixin": "node scripts/patch-u-input.js",
"predev:h5": "node scripts/patch-u-input.js",
"prebuild:h5": "node scripts/patch-u-input.js",
"predev:app": "node scripts/patch-u-input.js",
"prebuild:app": "node scripts/patch-u-input.js"
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-4000820240401001", "@dcloudio/uni-app": "3.0.0-4000820240401001",

View File

@@ -2,10 +2,6 @@
* uView u-input 组件补丁 * uView u-input 组件补丁
* 直接用预存的补丁文件覆盖原始文件 * 直接用预存的补丁文件覆盖原始文件
* 使下拉选择框readonly/disabled超长文字可自动换行完整显示 * 使下拉选择框readonly/disabled超长文字可自动换行完整显示
*
* 修改内容详见 scripts/u-input.vue已修改好的完整文件
*
* 通过 package.json 的 postinstall 自动执行
*/ */
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');

View File

@@ -1,7 +1,7 @@
<template> <template>
<view <view
class="u-input" class="u-input"
:class="[inputClass, isSelectLike ? 'u-input--selectlike' : '']" :class="[inputClass, isSelectLike ? 'u-input--selectlike' : '', isSearchInput ? 'u-input--search-input' : '']"
:style="[wrapperStyle]" :style="[wrapperStyle]"
> >
<view class="u-input__content"> <view class="u-input__content">
@@ -205,6 +205,14 @@ export default {
isSelectLike() { isSelectLike() {
return this.type === 'select' || this.disabled || this.readonly return this.type === 'select' || this.disabled || this.readonly
}, },
isSearchInput() {
const customStyle = this.customStyle
if (typeof customStyle === 'string') {
return customStyle.includes('height: 66rpx') && customStyle.includes('border-radius: 24rpx')
}
const style = uni.$u.addStyle(customStyle)
return style.height === '66rpx' && (style.borderRadius === '24rpx' || style['border-radius'] === '24rpx')
},
// 是否显示清除控件 // 是否显示清除控件
isShowClear() { isShowClear() {
const { clearable, readonly, focused, innerValue } = this; const { clearable, readonly, focused, innerValue } = this;
@@ -241,7 +249,15 @@ export default {
style.paddingLeft = "9px"; style.paddingLeft = "9px";
style.paddingRight = "9px"; style.paddingRight = "9px";
} }
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)); const mergedStyle = uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
if (this.isSearchInput) {
mergedStyle.height = '66rpx';
mergedStyle.minHeight = '66rpx';
mergedStyle.boxSizing = 'border-box';
mergedStyle.paddingTop = '0';
mergedStyle.paddingBottom = '0';
}
return mergedStyle;
}, },
// 输入框的样式 // 输入框的样式
inputStyle() { inputStyle() {
@@ -354,18 +370,49 @@ export default {
flex: 1; flex: 1;
&--selectlike { &--selectlike {
/* 覆盖 inline style 的固定 height让选择型模式高度自适应 */ /* 覆盖 inline style 的固定 height普通选择型内容可自适应换行 */
/* 短文字垂直居中,长文字撑开高度自动换行 */ /* 短文字垂直居中,长文字撑开高度自动换行 */
height: auto !important; height: auto !important;
min-height: 68rpx; min-height: 68rpx;
.u-input__content, /* 只让展示文本本身不抢事件,保留外层点击与 suffix 插槽事件 */
.u-input__content__field-wrapper,
.u-input__content__field-wrapper__field { .u-input__content__field-wrapper__field {
pointer-events: none; pointer-events: none;
} }
} }
&--search-input {
/* 列表页顶部查询框必须同高;该 class 在组件内部计算,兼容小程序组件样式隔离 */
height: 66rpx !important;
min-height: 66rpx;
box-sizing: border-box;
padding-top: 0 !important;
padding-bottom: 0 !important;
.u-input__content,
.u-input__content__field-wrapper {
height: 100%;
align-items: center;
}
.u-input__content__field-wrapper__field--selectlike {
min-height: 0;
line-height: 32rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
word-break: normal;
}
.u-input__content__field-wrapper__field__text,
.u-input__content__field-wrapper__field__placeholder {
line-height: 32rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
&--radius, &--radius,
&--square { &--square {
border-radius: 4px; border-radius: 4px;

View File

@@ -19,9 +19,12 @@ export function login(username, password, code, uuid) {
} }
// 获取用户详细信息 // 获取用户详细信息
export function getInfo() { export function getInfo(silentAuth = false) {
return request({ return request({
'url': '/system/user/getInfo', 'url': '/system/user/getInfo',
headers: silentAuth ? {
silentAuth: true
} : undefined,
'method': 'get' 'method': 'get'
}) })
} }

View File

@@ -3,7 +3,7 @@
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-container"> <view class="search-container">
<view class="search-row"> <view class="search-row">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -18,8 +18,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="add-btn" @click="handleAdd()"> <view class="add-btn" @click="handleAdd()">
@@ -28,7 +27,7 @@
</view> </view>
</view> </view>
<view class="search-row"> <view class="search-row">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handleHealthRecord">
<u--input <u--input
v-model="queryParams.healthRecordName" v-model="queryParams.healthRecordName"
border="surround" border="surround"
@@ -43,8 +42,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handleHealthRecord">
</uni-icons> </uni-icons>
</view> </view>
<view class="filter-btn" @click="filterPanel = !filterPanel"> <view class="filter-btn" @click="filterPanel = !filterPanel">
@@ -63,24 +61,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -284,8 +284,12 @@ onLoad(() => {
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function dictStr(val, arr) { function dictStr(val, arr) {
let str = '' let str = ''

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,8 +17,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="filter-btn" @click="filterPanel = !filterPanel"> <view class="filter-btn" @click="filterPanel = !filterPanel">
@@ -44,24 +43,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -258,8 +259,12 @@ onLoad(() => {
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,8 +17,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="filter-btn" @click="filterPanel = !filterPanel"> <view class="filter-btn" @click="filterPanel = !filterPanel">
@@ -39,24 +38,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -190,8 +191,12 @@ onLoad(() => {
} }
}); });
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -3,7 +3,7 @@
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-container"> <view class="search-container">
<view class="search-row"> <view class="search-row">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -18,8 +18,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="add-btn" @click="handleAdd()"> <view class="add-btn" @click="handleAdd()">
@@ -51,8 +50,8 @@
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }"> <view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
<view class="filter-panel-content"> <view class="filter-panel-content">
<view class="filter-title">健康档案</view> <view class="filter-title">健康档案</view>
<view class="health-record-input"> <view class="health-record-input" @click="handleHealthRecord">
<u--input v-model="queryParams.healthRecordName" border="surround" type="select" @click="handleHealthRecord" placeholder="请选择健康档案" <u--input v-model="queryParams.healthRecordName" border="surround" type="select" placeholder="请选择健康档案"
suffixIcon="search" suffixIconStyle="color: #909399"> suffixIcon="search" suffixIconStyle="color: #909399">
</u--input> </u--input>
</view> </view>
@@ -69,24 +68,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -284,8 +285,12 @@ onLoad(() => {
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -36,24 +36,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -254,8 +256,12 @@ onLoad(() => {
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -37,24 +37,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -239,8 +241,12 @@ onLoad(() => {
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,8 +17,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="filter-btn" @click="filterPanel = !filterPanel"> <view class="filter-btn" @click="filterPanel = !filterPanel">
@@ -38,24 +37,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -187,8 +188,12 @@ onLoad(() => {
} }
}); });
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,8 +17,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="filter-btn" @click="filterPanel = !filterPanel"> <view class="filter-btn" @click="filterPanel = !filterPanel">
@@ -34,9 +33,9 @@
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }"> <view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
<view class="filter-panel-content"> <view class="filter-panel-content">
<view class="filter-title">健康档案</view> <view class="filter-title">健康档案</view>
<view class="health-record-input"> <view class="health-record-input" @click="handleHealthRecord">
<u--input v-model="queryParams.healthRecordName" border="surround" placeholder="请选择健康档案" <u--input v-model="queryParams.healthRecordName" border="surround" placeholder="请选择健康档案"
@click="handleHealthRecord" suffixIcon="search" suffixIconStyle="color: #909399"> suffixIcon="search" suffixIconStyle="color: #909399">
</u--input> </u--input>
</view> </view>
@@ -46,24 +45,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -213,8 +214,12 @@ onLoad(() => {
} }
}); });
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,13 +17,12 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handleHealthRecord">
<u--input <u--input
v-model="queryParams.healthRecordName" v-model="queryParams.healthRecordName"
border="surround" border="surround"
@@ -38,8 +37,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handleHealthRecord">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
@@ -151,24 +149,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -260,7 +260,7 @@
</div> --> </div> -->
<!-- 曲线图展示 --> <!-- 曲线图展示 -->
<view class="chart-container" v-if="listData.length>0 && viewMode === 'line'"> <view class="chart-container" v-if="chartVisible && listData.length>0 && viewMode === 'line'">
<qiun-data-charts <qiun-data-charts
type="line" type="line"
canvasId="doctorLineChart" canvasId="doctorLineChart"
@@ -273,7 +273,7 @@
</view> </view>
<!-- 柱状图展示 --> <!-- 柱状图展示 -->
<view class="chart-container" v-if="listData.length>0 && viewMode === 'column'"> <view class="chart-container" v-if="chartVisible && listData.length>0 && viewMode === 'column'">
<qiun-data-charts <qiun-data-charts
type="column" type="column"
canvasId="doctorColumnChart" canvasId="doctorColumnChart"
@@ -803,6 +803,7 @@ const { filterPanel, queryPersonParams, queryHealthRecordParams, queryParams} =
const windowHeight = computed(() => { const windowHeight = computed(() => {
uni.getSystemInfoSync().windowHeight - 50 uni.getSystemInfoSync().windowHeight - 50
}) })
const chartVisible = computed(() => !filterPanel.value && !timeShow.value && !settingPickShow.value && !showPerson.value && !showHealthRecord.value)
onLoad(() => { onLoad(() => {
getDict() getDict()
// getList() // getList()
@@ -831,8 +832,12 @@ function dictStr(val, arr) {
return str return str
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function confirm(e) { function confirm(e) {
const date = timeHandler(new Date(e.value), '-', ':') const date = timeHandler(new Date(e.value), '-', ':')

View File

@@ -46,7 +46,7 @@
</view> </view>
<view class="chart-box tall"> <view class="chart-box tall">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(trendChartData)" v-if="chartVisible && hasChartData(trendChartData)"
type="line" type="line"
:canvasId="`${canvasIdPrefix}_trend`" :canvasId="`${canvasIdPrefix}_trend`"
:chartData="trendChartData" :chartData="trendChartData"
@@ -68,7 +68,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(recordChartData)" v-if="chartVisible && hasChartData(recordChartData)"
type="column" type="column"
:canvasId="`${canvasIdPrefix}_record`" :canvasId="`${canvasIdPrefix}_record`"
:chartData="recordChartData" :chartData="recordChartData"
@@ -110,6 +110,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="chartVisible"
type="ring" type="ring"
:canvasId="`${canvasIdPrefix}_temp_ring`" :canvasId="`${canvasIdPrefix}_temp_ring`"
:chartData="temperatureRingData" :chartData="temperatureRingData"
@@ -136,7 +137,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(medicineChartData)" v-if="chartVisible && hasChartData(medicineChartData)"
type="bar" type="bar"
:canvasId="`${canvasIdPrefix}_medicine`" :canvasId="`${canvasIdPrefix}_medicine`"
:chartData="medicineChartData" :chartData="medicineChartData"
@@ -168,7 +169,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(doctorCostChartData)" v-if="chartVisible && hasChartData(doctorCostChartData)"
type="column" type="column"
:canvasId="`${canvasIdPrefix}_doctor`" :canvasId="`${canvasIdPrefix}_doctor`"
:chartData="doctorCostChartData" :chartData="doctorCostChartData"
@@ -208,7 +209,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(activityChartData)" v-if="chartVisible && hasChartData(activityChartData)"
type="mix" type="mix"
:canvasId="`${canvasIdPrefix}_activity`" :canvasId="`${canvasIdPrefix}_activity`"
:chartData="activityChartData" :chartData="activityChartData"
@@ -288,6 +289,7 @@ const selectedPersonId = ref(null)
const screenData = ref({}) const screenData = ref({})
const dictMap = ref({}) const dictMap = ref({})
const canvasIdPrefix = `h5_health_${Date.now()}` const canvasIdPrefix = `h5_health_${Date.now()}`
const chartVisible = computed(() => !showPerson.value)
const summary = computed(() => screenData.value.summary || {}) const summary = computed(() => screenData.value.summary || {})
const record = computed(() => screenData.value.record || {}) const record = computed(() => screenData.value.record || {})

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,13 +17,12 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handleHealthRecord">
<u--input <u--input
v-model="queryParams.healthRecordName" v-model="queryParams.healthRecordName"
border="surround" border="surround"
@@ -38,8 +37,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handleHealthRecord">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
@@ -216,24 +214,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -264,7 +264,7 @@
></u-datetime-picker> ></u-datetime-picker>
<!-- 曲线图展示 --> <!-- 曲线图展示 -->
<view class="chart-container" v-if="secondListData.length>0 && viewMode === 'line'"> <view class="chart-container" v-if="chartVisible && secondListData.length>0 && viewMode === 'line'">
<qiun-data-charts <qiun-data-charts
type="line" type="line"
canvasId="healthLineChart" canvasId="healthLineChart"
@@ -277,7 +277,7 @@
</view> </view>
<!-- 柱状图展示 --> <!-- 柱状图展示 -->
<view class="chart-container" v-if="secondListData.length>0 && viewMode === 'column'"> <view class="chart-container" v-if="chartVisible && secondListData.length>0 && viewMode === 'column'">
<qiun-data-charts <qiun-data-charts
type="column" type="column"
canvasId="healthColumnChart" canvasId="healthColumnChart"
@@ -657,6 +657,7 @@ const { filterPanel, queryPersonParams,queryHealthRecordParams, queryParams} = t
const windowHeight = computed(() => { const windowHeight = computed(() => {
uni.getSystemInfoSync().windowHeight - 50 uni.getSystemInfoSync().windowHeight - 50
}) })
const chartVisible = computed(() => !filterPanel.value && !timeShow.value && !settingPickShow.value && !showPerson.value && !showHealthRecord.value)
onLoad(() => { onLoad(() => {
getDict() getDict()
// getList() // getList()
@@ -688,8 +689,12 @@ if (data != null) {
} }
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function confirm(e) { function confirm(e) {
const date = timeHandler(new Date(e.value), '-', ':') const date = timeHandler(new Date(e.value), '-', ':')

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,13 +17,12 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handleHealthRecord">
<u--input <u--input
v-model="queryParams.healthRecordName" v-model="queryParams.healthRecordName"
border="surround" border="surround"
@@ -38,8 +37,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handleHealthRecord">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
@@ -68,6 +66,7 @@
</view> </view>
</view> </view>
<scroll-view class="summary-scroll" scroll-y :style="{ height: summaryScrollHeight }">
<view class="app-container"> <view class="app-container">
<view class="header-con" ref="searchHeightRef"> <view class="header-con" ref="searchHeightRef">
<view class="item"> <view class="item">
@@ -270,6 +269,7 @@
</view> </view>
</view> </view>
</view> </view>
</scroll-view>
<!-- 视图切换 --> <!-- 视图切换 -->
<view class="section-title" v-show="listData.length>0"> <view class="section-title" v-show="listData.length>0">
@@ -311,24 +311,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -358,7 +360,7 @@
></u-datetime-picker> ></u-datetime-picker>
<!-- 曲线图展示 --> <!-- 曲线图展示 -->
<view class="chart-container" v-if="listData.length>0 && viewMode === 'line'"> <view class="chart-container" v-if="chartVisible && listData.length>0 && viewMode === 'line'">
<qiun-data-charts <qiun-data-charts
type="line" type="line"
canvasId="marLineChart" canvasId="marLineChart"
@@ -371,7 +373,7 @@
</view> </view>
<!-- 柱状图展示 --> <!-- 柱状图展示 -->
<view class="chart-container" v-if="listData.length>0 && viewMode === 'column'"> <view class="chart-container" v-if="chartVisible && listData.length>0 && viewMode === 'column'">
<qiun-data-charts <qiun-data-charts
type="column" type="column"
canvasId="marColumnChart" canvasId="marColumnChart"
@@ -476,6 +478,21 @@ const timeShow= ref(false)
const time =ref( Number(new Date())) const time =ref( Number(new Date()))
const flag= ref(true) const flag= ref(true)
const mar = ref({}) const mar = ref({})
const summaryRowCount = computed(() => {
const hasValue = (key) => mar.value[key] != null
const dynamicRows = [
['top2Name', 'top3Name'],
['top4Name', 'top5Name'],
['top6Name', 'top7Name'],
['top8Name', 'top9Name'],
['top10Name', 'top11Name'],
['top12Name', 'top13Name'],
['top14Name', 'top15Name'],
['top16Name', 'top17Name']
].filter(([left, right]) => hasValue(left) || hasValue(right)).length
return 2 + dynamicRows
})
const summaryScrollHeight = computed(() => `${Math.min(summaryRowCount.value * 120, 480)}rpx`)
const tabShow = ref(false) const tabShow = ref(false)
const viewMode = ref('list') // 'list', 'line', 'column' const viewMode = ref('list') // 'list', 'line', 'column'
@@ -687,6 +704,7 @@ const { filterPanel, queryPersonParams,queryHealthRecordParams, queryParams} = t
const windowHeight = computed(() => { const windowHeight = computed(() => {
uni.getSystemInfoSync().windowHeight - 50 uni.getSystemInfoSync().windowHeight - 50
}) })
const chartVisible = computed(() => !filterPanel.value && !timeShow.value && !settingPickShow.value && !showPerson.value && !showHealthRecord.value)
onLoad(() => { onLoad(() => {
getDict() getDict()
// getList() // getList()
@@ -718,8 +736,12 @@ if (data != null) {
} }
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function confirm(e) { function confirm(e) {
const date = timeHandler(new Date(e.value), '-', ':') const date = timeHandler(new Date(e.value), '-', ':')
@@ -858,6 +880,12 @@ page {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
} }
.summary-scroll {
width: 100%;
background-color: #f5f7fa;
flex-shrink: 0;
overflow: hidden;
}
.app-container { .app-container {
background-color: #f5f7fa; background-color: #f5f7fa;
padding: 0; padding: 0;

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,8 +17,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
@@ -190,24 +189,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -238,7 +239,7 @@
></u-datetime-picker> ></u-datetime-picker>
<!-- 曲线图展示 --> <!-- 曲线图展示 -->
<view class="chart-container" v-if="listData.length>0 && viewMode === 'line'"> <view class="chart-container" v-if="chartVisible && listData.length>0 && viewMode === 'line'">
<qiun-data-charts <qiun-data-charts
type="line" type="line"
canvasId="milkLineChart" canvasId="milkLineChart"
@@ -251,7 +252,7 @@
</view> </view>
<!-- 柱状图展示 --> <!-- 柱状图展示 -->
<view class="chart-container" v-if="listData.length>0 && viewMode === 'column'"> <view class="chart-container" v-if="chartVisible && listData.length>0 && viewMode === 'column'">
<qiun-data-charts <qiun-data-charts
type="column" type="column"
canvasId="milkColumnChart" canvasId="milkColumnChart"
@@ -519,6 +520,7 @@ const { filterPanel, queryPersonParams, queryParams} = toRefs(data)
const windowHeight = computed(() => { const windowHeight = computed(() => {
uni.getSystemInfoSync().windowHeight - 50 uni.getSystemInfoSync().windowHeight - 50
}) })
const chartVisible = computed(() => !filterPanel.value && !timeShow.value && !settingPickShow.value && !showPerson.value)
onLoad(() => { onLoad(() => {
getDict() getDict()
// getList() // getList()
@@ -538,8 +540,12 @@ if (data != null) {
} }
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function confirm(e) { function confirm(e) {
const date = timeHandler(new Date(e.value), '-', ':') const date = timeHandler(new Date(e.value), '-', ':')

View File

@@ -95,7 +95,7 @@
</view> </view>
<view class="chart-box tall"> <view class="chart-box tall">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(temperatureChartData)" v-if="chartVisible && hasChartData(temperatureChartData)"
type="line" type="line"
:canvasId="`${canvasIdPrefix}_temp`" :canvasId="`${canvasIdPrefix}_temp`"
:chartData="temperatureChartData" :chartData="temperatureChartData"
@@ -117,6 +117,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="chartVisible"
type="ring" type="ring"
:canvasId="`${canvasIdPrefix}_mix`" :canvasId="`${canvasIdPrefix}_mix`"
:chartData="recordMixChartData" :chartData="recordMixChartData"
@@ -152,7 +153,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(medicineChartData)" v-if="chartVisible && hasChartData(medicineChartData)"
type="bar" type="bar"
:canvasId="`${canvasIdPrefix}_medicine`" :canvasId="`${canvasIdPrefix}_medicine`"
:chartData="medicineChartData" :chartData="medicineChartData"
@@ -184,7 +185,7 @@
</view> </view>
<view class="chart-box"> <view class="chart-box">
<qiun-data-charts <qiun-data-charts
v-if="hasChartData(doctorCostChartData)" v-if="chartVisible && hasChartData(doctorCostChartData)"
type="column" type="column"
:canvasId="`${canvasIdPrefix}_doctor`" :canvasId="`${canvasIdPrefix}_doctor`"
:chartData="doctorCostChartData" :chartData="doctorCostChartData"
@@ -293,6 +294,7 @@ const screenData = ref({})
const activeTab = ref('process') const activeTab = ref('process')
const dictMap = ref({}) const dictMap = ref({})
const canvasIdPrefix = `h5_record_${Date.now()}` const canvasIdPrefix = `h5_record_${Date.now()}`
const chartVisible = computed(() => !showPerson.value && !showRecord.value)
const record = computed(() => screenData.value.record || {}) const record = computed(() => screenData.value.record || {})
const summary = computed(() => screenData.value.summary || {}) const summary = computed(() => screenData.value.summary || {})

View File

@@ -2,7 +2,7 @@
<view class="container"> <view class="container">
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -17,13 +17,12 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
<view class="search-view"> <view class="search-view">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handleHealthRecord">
<u--input <u--input
v-model="queryParams.healthRecordName" v-model="queryParams.healthRecordName"
border="surround" border="surround"
@@ -38,8 +37,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handleHealthRecord">
</uni-icons> </uni-icons>
</view> </view>
</view> </view>
@@ -192,24 +190,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -240,7 +240,7 @@
></u-datetime-picker> ></u-datetime-picker>
<!-- 曲线图展示 --> <!-- 曲线图展示 -->
<view class="chart-container" v-if="hasSecondListData && viewMode === 'line'"> <view class="chart-container" v-if="chartVisible && hasSecondListData && viewMode === 'line'">
<qiun-data-charts <qiun-data-charts
type="line" type="line"
:canvasId="canvasIdPrefix + '_line'" :canvasId="canvasIdPrefix + '_line'"
@@ -253,7 +253,7 @@
</view> </view>
<!-- 柱状图展示 --> <!-- 柱状图展示 -->
<view class="chart-container" v-if="hasSecondListData && viewMode === 'column'"> <view class="chart-container" v-if="chartVisible && hasSecondListData && viewMode === 'column'">
<qiun-data-charts <qiun-data-charts
type="column" type="column"
:canvasId="canvasIdPrefix + '_column'" :canvasId="canvasIdPrefix + '_column'"
@@ -634,6 +634,7 @@ uni.getSystemInfo({
windowHeight.value = res.windowHeight - 50 windowHeight.value = res.windowHeight - 50
} }
}) })
const chartVisible = computed(() => !filterPanel.value && !timeShow.value && !settingPickShow.value && !showPerson.value && !showHealthRecord.value)
onLoad(() => { onLoad(() => {
getDict() getDict()
// getList() // getList()
@@ -666,8 +667,12 @@ if (data != null) {
} }
} }
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function confirm(e) { function confirm(e) {
const date = timeHandler(new Date(e.value), '-', ':') const date = timeHandler(new Date(e.value), '-', ':')

View File

@@ -3,7 +3,7 @@
<u-sticky offsetTop="0rpx" customNavHeight="0rpx"> <u-sticky offsetTop="0rpx" customNavHeight="0rpx">
<view class="search-container"> <view class="search-container">
<view class="search-row"> <view class="search-row">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handlePerson">
<u--input <u--input
v-model="queryParams.personName" v-model="queryParams.personName"
border="surround" border="surround"
@@ -18,8 +18,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handlePerson">
</uni-icons> </uni-icons>
</view> </view>
<view class="add-btn" @click="handleAdd()"> <view class="add-btn" @click="handleAdd()">
@@ -28,7 +27,7 @@
</view> </view>
</view> </view>
<view class="search-row"> <view class="search-row">
<view class="search-input-wrapper"> <view class="search-input-wrapper" @click="handleHealthRecord">
<u--input <u--input
v-model="queryParams.healthRecordName" v-model="queryParams.healthRecordName"
border="surround" border="surround"
@@ -43,8 +42,7 @@
type="search" type="search"
size="18" size="18"
color="#667eea" color="#667eea"
class="search-icon" class="search-icon">
@click="handleHealthRecord">
</uni-icons> </uni-icons>
</view> </view>
<view class="filter-btn" @click="filterPanel = !filterPanel"> <view class="filter-btn" @click="filterPanel = !filterPanel">
@@ -63,24 +61,26 @@
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(true)"
border="surround" border="surround"
v-model="queryParams.startTime" v-model="queryParams.startTime"
placeholder="请选择开始时间" placeholder="请选择开始时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(true)"></u-icon>
</template> </template>
</u-input> </u-input>
<u-input <u-input
:disabled="true" :disabled="true"
:disabledColor="'#fff'" :disabledColor="'#fff'"
class="dateInput" class="dateInput"
@click="openOrCloseDate(false)"
border="surround" border="surround"
v-model="queryParams.endTime" v-model="queryParams.endTime"
placeholder="请选择结束时间" placeholder="请选择结束时间"
> >
<template v-slot:suffix> <template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon> <u-icon name="calendar" @click.stop="openOrCloseDate(false)"></u-icon>
</template> </template>
</u-input> </u-input>
</view> </view>
@@ -227,8 +227,12 @@ onLoad(() => {
} }
}); });
function openOrCloseDate(data) { function openOrCloseDate(data) {
timeShow.value = !timeShow.value if (typeof data === 'boolean') {
flag.value = data flag.value = data
timeShow.value = true
} else {
timeShow.value = false
}
} }
function loadmore() { function loadmore() {
pageNum.value += 1 pageNum.value += 1

View File

@@ -9,8 +9,8 @@
<text class="app-subtitle">专业的健康管理工具</text> <text class="app-subtitle">专业的健康管理工具</text>
</view> </view>
<!-- 登录表单卡片 --> <!-- 登录表单卡片token 静默校验期间不展示任何提示 -->
<view class="form-card"> <view v-if="!checkingToken" class="form-card">
<!-- 账号输入 --> <!-- 账号输入 -->
<view class="input-item"> <view class="input-item">
<uni-icons type="person" size="20" color="#E8841A"></uni-icons> <uni-icons type="person" size="20" color="#E8841A"></uni-icons>
@@ -82,7 +82,7 @@ import config from '@/config.js'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { getWxCode } from '@/utils/geek'; import { getWxCode } from '@/utils/geek';
import { wxLogin } from '@/api/oauth'; import { wxLogin } from '@/api/oauth';
import { setToken } from '@/utils/auth'; import { getToken, setToken } from '@/utils/auth';
import { encrypt, decrypt } from '@/utils/jsencrypt' import { encrypt, decrypt } from '@/utils/jsencrypt'
// ========== 平台判断(条件编译)========== // ========== 平台判断(条件编译)==========
@@ -101,6 +101,7 @@ const useWxLogin = ref(false); // 是否使用微信登录
const globalConfig = ref(config); const globalConfig = ref(config);
const agree = ref(isH5 ? true : false); // H5 端默认勾选同意协议 const agree = ref(isH5 ? true : false); // H5 端默认勾选同意协议
const rememberPwd = ref(false); // 记住密码 const rememberPwd = ref(false); // 记住密码
const checkingToken = ref(true); // 是否正在校验本地 token
const loginForm = ref({ const loginForm = ref({
username: "", username: "",
password: "", password: "",
@@ -119,11 +120,31 @@ if (useWxLogin.value) {
}); });
}) })
} }
// 页面加载时检查是否记住了密码 // 页面加载时先校验本地 token仍有效则直接进入系统无效时再显示账号密码登录
onMounted(() => { onMounted(() => {
loadRememberedLogin() initLoginPage()
}); });
async function initLoginPage() {
const token = getToken()
if (token) {
checkingToken.value = true
try {
await userStore.getInfo(true)
goHome()
return
} catch (error) {
if (error && error.code === 401) {
userStore.resetToken()
}
}
}
checkingToken.value = false
loadRememberedLogin()
getCode()
}
// 读取本地记住的登录信息(仅 H5 // 读取本地记住的登录信息(仅 H5
function loadRememberedLogin() { function loadRememberedLogin() {
if (!isH5) return if (!isH5) return
@@ -209,10 +230,14 @@ async function pwdLogin() {
function loginSuccess(result) { function loginSuccess(result) {
// 设置用户信息 // 设置用户信息
userStore.getInfo().then(res => { userStore.getInfo().then(res => {
goHome()
})
}
function goHome() {
uni.switchTab({ uni.switchTab({
url: '/pages/health/homepage/index' url: '/pages/health/homepage/index'
}); });
})
} }
function agreeChange(){ function agreeChange(){
@@ -244,7 +269,6 @@ function handleUserAgrement() {
url: '/pages/common/agreement/index' url: '/pages/common/agreement/index'
}); });
}; };
getCode();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -40,9 +40,9 @@ const useUserStore = defineStore("user", {
}); });
}, },
// 获取用户信息 // 获取用户信息
getInfo() { getInfo(silentAuth = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo() getInfo(silentAuth)
.then((res: any) => { .then((res: any) => {
const user = res.user; const user = res.user;
const avatar = const avatar =
@@ -86,6 +86,16 @@ const useUserStore = defineStore("user", {
}); });
}); });
}, },
// 清理本地登录状态,不调用后端退出接口(用于本地 token 校验失败)
resetToken() {
this.token = "";
this.roles = [];
this.permissions = [];
this.name = "";
this.userId = "";
this.avatar = "";
removeToken();
},
}, },
persist: { persist: {
key: 'user-store', key: 'user-store',

View File

@@ -1,7 +1,9 @@
interface BaseRequestConfig { interface BaseRequestConfig {
headers?: { headers?: {
/** 是否在请求头中添加token 默认是 */ /** 是否在请求头中添加token 默认是 */
isToken: boolean isToken?: boolean,
/** token 失效时是否静默返回错误,不弹重新登录确认框 */
silentAuth?: boolean
}, },
/** 请求头配置 */ /** 请求头配置 */
header?: any, header?: any,

View File

@@ -9,8 +9,10 @@ let timeout = 10000
const baseUrl = config.baseUrl const baseUrl = config.baseUrl
const request = <T>(config: RequestConfig): Promise<ResponseData<T>> => { const request = <T>(config: RequestConfig): Promise<ResponseData<T>> => {
const metaHeaders = config.headers || {}
// 是否需要设置 token // 是否需要设置 token
const isToken = (config.headers || {}).isToken === false const isToken = metaHeaders.isToken === false
const silentAuth = metaHeaders.silentAuth === true
config.header = config.header || {} config.header = config.header || {}
if (getToken() && !isToken) { if (getToken() && !isToken) {
config.header['Authorization'] = 'Bearer ' + getToken() config.header['Authorization'] = 'Bearer ' + getToken()
@@ -42,6 +44,8 @@ const request = <T>(config: RequestConfig): Promise<ResponseData<T>> => {
// @ts-ignore // @ts-ignore
const msg: string = errorCode[code] || data.msg || errorCode['default'] const msg: string = errorCode[code] || data.msg || errorCode['default']
if (code === 401) { if (code === 401) {
const authError = { code: 401, msg: '无效的会话,或者会话已过期,请重新登录。' }
if (!silentAuth) {
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
if (res.confirm) { if (res.confirm) {
useUserStore().logOut().then(res => { useUserStore().logOut().then(res => {
@@ -49,13 +53,14 @@ const request = <T>(config: RequestConfig): Promise<ResponseData<T>> => {
}) })
} }
}) })
reject('无效的会话,或者会话已过期,请重新登录。') }
return reject(silentAuth ? authError : authError.msg)
} else if (code === 500) { } else if (code === 500) {
toast(msg) toast(msg)
reject('500') return reject('500')
} else if (code !== 200) { } else if (code !== 200) {
toast(msg) toast(msg)
reject(code) return reject(code)
} }
resolve(data) resolve(data)
}) })
@@ -68,7 +73,9 @@ const request = <T>(config: RequestConfig): Promise<ResponseData<T>> => {
} else if (message.includes('Request failed with status code')) { } else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常' message = '系统接口' + message.substr(message.length - 3) + '异常'
} }
if (!silentAuth) {
toast(message) toast(message)
}
reject(error) reject(error)
}) })
}) })