From 9ed095ea5cb7e55d9366c5438e8c27d876d9285b Mon Sep 17 00:00:00 2001 From: lixiao <932184220@qq.com> Date: Mon, 29 Sep 2025 11:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/api/typings.d.ts | 4 ++ entry/src/main/ets/pages/Login.ets | 11 +++-- entry/src/main/ets/pages/alarm/Detail.ets | 10 ++--- .../{Loading => loading}/Button.ets | 0 .../components/{Loading => loading}/Index.ets | 2 +- entry/src/main/ets/pages/home/Index.ets | 43 +++++++++++-------- entry/src/main/ets/pages/result/Detail.ets | 4 +- 7 files changed, 43 insertions(+), 31 deletions(-) rename entry/src/main/ets/pages/components/{Loading => loading}/Button.ets (100%) rename entry/src/main/ets/pages/components/{Loading => loading}/Index.ets (94%) diff --git a/entry/src/main/ets/api/typings.d.ts b/entry/src/main/ets/api/typings.d.ts index 17729a4..2028a48 100644 --- a/entry/src/main/ets/api/typings.d.ts +++ b/entry/src/main/ets/api/typings.d.ts @@ -217,6 +217,8 @@ declare namespace API { lineName?: string; /** 合格证品牌名称 */ manufactureBrandName?: string; + /** 机动车所有人 */ + motorVehicleOwner?: string /** 车型型号 */ model?: string; /** 生产时间(年/月拼接) */ @@ -233,6 +235,8 @@ declare namespace API { vehicleBrandName?: string; /** 车辆识别代号(VIN) */ vin?: string; + /** 车身颜色 */ + vehicleColor?: string }; type InspectRecordResultReq = { diff --git a/entry/src/main/ets/pages/Login.ets b/entry/src/main/ets/pages/Login.ets index 591001b..f9affe5 100644 --- a/entry/src/main/ets/pages/Login.ets +++ b/entry/src/main/ets/pages/Login.ets @@ -1,7 +1,6 @@ import router from '@ohos.router' -import { padLoginUsingPost } from '../api' import { getDeviceId } from '../utils/System' -import Loading from './components/Loading/Index' +import Loading from './components/loading/Index' @Component @@ -81,8 +80,12 @@ struct Index { let deviceId = await getDeviceId() router.pushUrl({ - // url: "pages/home/Index" - url: "pages/result/Detail" + url: "pages/home/Index" + // url: "pages/result/Detail" + }).then(() => { + setTimeout(() => { + router.clear() + }, 500) }) // this.controller.open() diff --git a/entry/src/main/ets/pages/alarm/Detail.ets b/entry/src/main/ets/pages/alarm/Detail.ets index f44008e..de18833 100644 --- a/entry/src/main/ets/pages/alarm/Detail.ets +++ b/entry/src/main/ets/pages/alarm/Detail.ets @@ -50,11 +50,11 @@ class RadioModifier implements ContentModifier { @Entry struct Detail { @State base: Option[] = [ - { label: "预警时间", value: "2025-09-13 10:48:11" }, - { label: "预警类型", value: "车辆异常" }, - { label: "阶段", value: "等待车辆进入" }, - { label: "步骤", value: "步骤1" }, - { label: "预警内容", value: "车主长时间为办理预录入或长时间逗留场地。" }, + { label: "预警时间", value: "" }, + { label: "预警类型", value: "" }, + { label: "阶段", value: "" }, + { label: "步骤", value: "" }, + { label: "预警内容", value: "" }, ] @State mediaHeight: number = 0 @State deal: string = "1" diff --git a/entry/src/main/ets/pages/components/Loading/Button.ets b/entry/src/main/ets/pages/components/loading/Button.ets similarity index 100% rename from entry/src/main/ets/pages/components/Loading/Button.ets rename to entry/src/main/ets/pages/components/loading/Button.ets diff --git a/entry/src/main/ets/pages/components/Loading/Index.ets b/entry/src/main/ets/pages/components/loading/Index.ets similarity index 94% rename from entry/src/main/ets/pages/components/Loading/Index.ets rename to entry/src/main/ets/pages/components/loading/Index.ets index 9747b26..bec3c3b 100644 --- a/entry/src/main/ets/pages/components/Loading/Index.ets +++ b/entry/src/main/ets/pages/components/loading/Index.ets @@ -29,7 +29,7 @@ export default struct Loading { .margin({ bottom: 24 }) .color(0x33a7f4) if (this.showCancel) { - CusButton({ label: "取消", buttonType: CusButtonType.Primary, buttonSize: CusButtonSize.Small }) + CusButton({ label: "关闭", buttonType: CusButtonType.Primary, buttonSize: CusButtonSize.Small }) .margin({ top: 12 }) .onClick(() => { this.controller.close() diff --git a/entry/src/main/ets/pages/home/Index.ets b/entry/src/main/ets/pages/home/Index.ets index 617a21b..e88f819 100644 --- a/entry/src/main/ets/pages/home/Index.ets +++ b/entry/src/main/ets/pages/home/Index.ets @@ -6,7 +6,7 @@ import { Block } from './components/Block' import { LineCard } from './components/LineCard' import { WarnCard } from './components/WarnCard' import { RingOptions, RingProgress } from '../ring/Index' -import { getPadIndexInfoUsingGet } from '../../api/padController' +import { getInspectAlarmUsingPost, getPadIndexInfoUsingGet } from '../../api/padController' import { getDeviceId } from '../../utils/System' @Component @@ -14,27 +14,25 @@ import { getDeviceId } from '../../utils/System' struct Home { @State currentTime: string = "" @State line: API.InspectLineInfoVo[] = [] - @State warn: number[] = [1, 2, 3, 4] - @State select: number = 0 + @State warn: API.InspectAlarmItemVo[] = [] + @State select: number = -1 @State statistics: RingOptions[] = [ - { color: 0xffcc31, count: 20 }, - { color: 0x33ff29, count: 60 }, - { color: 0xff3a48, count: 10 }, + { color: 0xffcc31, count: 0 }, + { color: 0x33ff29, count: 0 }, + { color: 0xff3a48, count: 0 }, ] - @State ring2: RingOptions[] = [ - { color: 0x034B61, count: 10, animate: false }, - { color: 0x06CDF5, count: 10 }, + @State warnRing: RingOptions[] = [ + { color: 0x034B61, count: 0, animate: false }, + { color: 0x06CDF5, count: 0 }, ] private timeTick: number = -1 onPageShow(): void { - setTimeout(() => { - router.clear() - }, 500) this.currentTime = dateFormat(new Date(), 'yyyy-MM-dd HH:mm:ss') this.timeTick = setInterval(() => { this.currentTime = dateFormat(new Date(), 'yyyy-MM-dd HH:mm:ss') }, 1000) + this.getData() } onPageHide(): void { @@ -64,6 +62,11 @@ struct Home { this.statistics[0].count = res.data?.indexCount?.finish || 0 this.statistics[0].count = res.data?.indexCount?.fail || 0 }) + + getInspectAlarmUsingPost({ lineId }).then(res => { + this.warn = res.data?.page?.rows || [] + this.warnRing[1].count = res.data?.dealNum || 0 + }) } build() { @@ -124,6 +127,7 @@ struct Home { }) }.width("100%").constraintSize({ minHeight: 100 }).onClick(() => { this.select = index + this.getData(item.id) }) }) }.width("100%").height("100%") @@ -188,7 +192,7 @@ struct Home { Column() { Row() { Image($rawfile("images/home/total_warn.png")).width(48).margin({ right: 6 }) - Text("124").fontSize(24).fontColor(0xFF3A48) + Text(this.warnRing[0].count.toString()).fontSize(24).fontColor(0xFF3A48) }.margin({ bottom: 6 }) Text("总预警异常事件个数").fontSize(14).fontColor(0xffffff) @@ -196,29 +200,30 @@ struct Home { Stack({ alignContent: Alignment.Center }) { - RingProgress({ - option: this.ring2, + option: this.warnRing, style: { height: 72, width: 72 }, strokeWidth: 10 }) Column() { - Text("75%").fontColor(0xffffff).fontSize(16) + Text((this.warnRing[1].count / this.warnRing[0].count * 100).toFixed(0) + "%") + .fontColor(0xffffff) + .fontSize(16) Text("已处理").fontColor(0xffffff).fontSize(14) } }.layoutWeight(1).height("100%") }.margin({ bottom: 12 }).height(80) List({ space: 12 }) { - ForEach(this.warn, (item: number, index: number) => { + ForEach(this.warn, (item: API.InspectAlarmItemVo, index: number) => { ListItem() { WarnCard({ onDetail: () => { router.pushUrl({ url: "pages/alarm/Detail", params: { - data: {}, - line: "", + data: item, + line: this.line[this.select]?.id, } }) } diff --git a/entry/src/main/ets/pages/result/Detail.ets b/entry/src/main/ets/pages/result/Detail.ets index 4dd1fc7..f5f0ded 100644 --- a/entry/src/main/ets/pages/result/Detail.ets +++ b/entry/src/main/ets/pages/result/Detail.ets @@ -66,7 +66,7 @@ struct Detail { this.base[3].value = res.data?.licensePlateType || "" this.base[4].value = res.data?.lineName || "" this.base[5].value = res.data?.robotName || "" - this.base[6].value = res.data?.createTime || "" + this.base[6].value = res.data?.motorVehicleOwner || "" this.base[7].value = res.data?.serialStatus || "" this.base[8].value = res.data?.results || "" this.base[9].value = res.data?.inspectorName || "" @@ -159,7 +159,7 @@ struct Detail { Column() { Label({ mode: 2, label: "号牌号码", value: this.data.licensePlateNumber }) Label({ mode: 2, label: "车辆品牌", value: this.data.vehicleBrandName }) - Label({ mode: 2, label: "车身颜色", value: "" }) + Label({ mode: 2, label: "车身颜色", value: this.data.vehicleColor }) }.margin({ right: 6 }).layoutWeight(1).justifyContent(FlexAlign.SpaceBetween).height("100%") Row() {