Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5ef4f38b
authored
May 15, 2026
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refactor(receptionCenter): 引入安全获取工具函数以优化数据处理
1 parent
56aca0f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
apps/uniappX/uniapp-x-simgle/pages/receptionCenter/tabs/ReceptionDashboardTab.uvue
apps/uniappX/uniapp-x-simgle/pages/receptionCenter/tabs/ReceptionDashboardTab.uvue
View file @
5ef4f38
...
@@ -46,6 +46,7 @@ import { computed, nextTick, ref } from 'vue'
...
@@ -46,6 +46,7 @@ import { computed, nextTick, ref } from 'vue'
import CardFlow from '../cards/CardFlow.uvue'
import CardFlow from '../cards/CardFlow.uvue'
import CardTimeBoard from '../cards/CardTimeBoard.uvue'
import CardTimeBoard from '../cards/CardTimeBoard.uvue'
import { useOrientation } from '@/services/adapter/hooks/index.uts'
import { useOrientation } from '@/services/adapter/hooks/index.uts'
import { get } from '@/utils/common.uts'
/** ✅ 工具函数:格式化日期为 YYYY-MM-DD */
/** ✅ 工具函数:格式化日期为 YYYY-MM-DD */
function formatYmd(date: Date): string {
function formatYmd(date: Date): string {
...
@@ -83,9 +84,9 @@ const props = defineProps<{
...
@@ -83,9 +84,9 @@ const props = defineProps<{
allReceptionRecords?: UTSJSONObject[] | null
allReceptionRecords?: UTSJSONObject[] | null
}>()
}>()
/** ✅ 工具函数:安全获取数字 */
/** ✅ 工具函数:安全获取数字
(禁止 obj[key] as any:Android 上 null 会触发 NPE cast to kotlin.Any)
*/
function getNum(obj: UTSJSONObject, key: string): number {
function getNum(obj: UTSJSONObject, key: string): number {
const v =
obj[key] as any
const v =
get(obj, key, null)
if (v == null) return 0
if (v == null) return 0
const n = typeof v == "number" ? v : parseFloat(`${v}`)
const n = typeof v == "number" ? v : parseFloat(`${v}`)
return isNaN(n) ? 0 : n
return isNaN(n) ? 0 : n
...
@@ -185,9 +186,9 @@ function calcTimeBoardData(records: UTSJSONObject[] | null): UTSJSONObject {
...
@@ -185,9 +186,9 @@ function calcTimeBoardData(records: UTSJSONObject[] | null): UTSJSONObject {
// today:今日接待数/时长
// today:今日接待数/时长
if (receptionDate == todayStr) {
if (receptionDate == todayStr) {
todayCount = todayCount + 1
todayCount = todayCount + 1
const durRaw = item["duration"] as any
// 避免 item["duration"] as any:UTS 转 Kotlin 时动态下标 + any 易解析异常,统一走 getNum
const durNum =
durRaw != null ? parseFloat(`${durRaw}`) : 0
const durNum =
getNum(item, "duration")
const durSec =
(typeof durNum == "number" && isNaN(durNum) != true && durNum > 0)
? Math.floor(durNum) : 0
const durSec =
durNum > 0
? Math.floor(durNum) : 0
todayTotalSeconds = todayTotalSeconds + durSec
todayTotalSeconds = todayTotalSeconds + durSec
}
}
j = j + 1
j = j + 1
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment