接口对接

This commit is contained in:
lixiao 2025-09-29 11:30:30 +08:00
parent bd2afbf5db
commit 9ed095ea5c
7 changed files with 43 additions and 31 deletions

View File

@ -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 = {

View File

@ -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()

View File

@ -50,11 +50,11 @@ class RadioModifier implements ContentModifier<RadioConfiguration> {
@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"

View File

@ -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()

View File

@ -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,
}
})
}

View File

@ -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() {