From 0073fb2ba279755787835511f8a05c4c1e36325c Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Thu, 19 Jun 2025 09:59:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E7=BD=AE=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/model/Common.ets | 18 +++ entry/src/main/ets/pages/TerminalInfo.ets | 159 +++++++++++++++++----- 2 files changed, 143 insertions(+), 34 deletions(-) diff --git a/entry/src/main/ets/model/Common.ets b/entry/src/main/ets/model/Common.ets index f2ee943..086bb06 100644 --- a/entry/src/main/ets/model/Common.ets +++ b/entry/src/main/ets/model/Common.ets @@ -130,9 +130,19 @@ export interface ExaminerInfoType { // 一些运行配置 export interface EnvironmentConfigurationType { udplocalIp?: string, + + // 前置机响应后置机端口 udplocalIpPort?: string, + + // 前置机响应后置机端口2 + udplocalIpPortTwo?: string, udpOppositeIp?: string, + + // 后置机响应端口 udpOppositeIpPort?: string, + + // 后置机响应端口2 + udpOppositeIpPortTwo?: string, tcplocalIp?: string, tcplocalIpPort?: string, tcpOppositeIp?: string, @@ -149,6 +159,10 @@ export interface EnvironmentConfigurationType { isOpenLog?: string // 板卡类型 1|2 boardType?: string + // 车型 + carType?: string + // 是否开启差分 + isOpenFiniteDifference?: string } //全局配置 @@ -202,3 +216,7 @@ interface FourInOneScreenType { interface SystemParamConfigType {} +export interface CommonListType { + label: string + value: string +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/TerminalInfo.ets b/entry/src/main/ets/pages/TerminalInfo.ets index 886c0c5..7d1c21f 100644 --- a/entry/src/main/ets/pages/TerminalInfo.ets +++ b/entry/src/main/ets/pages/TerminalInfo.ets @@ -1,5 +1,5 @@ import HeaderComponent from './compontents/Header'; -import { EnvironmentConfigurationType } from '../model'; +import { CommonListType, EnvironmentConfigurationType } from '../model'; import common from '@ohos.app.ability.common'; import FileUtils from '../utils/FileUtils'; import { GlobalConfig } from '../config'; @@ -43,19 +43,21 @@ struct TerminalInfoPage { Flex({ wrap: FlexWrap.Wrap, }) { - blockComponent({ - value: this.config.tcpOppositeIp, - change: (value: string) => { - this.config.tcpOppositeIp = value; - } - }) - blockComponent({ - label: "响应端口", - value: this.config.tcpOppositePort, - change: (value: string) => { - this.config.tcpOppositePort = value; - } - }) + if (this.config.isOpenFiniteDifference === "1") { + blockComponent({ + value: this.config.tcpOppositeIp, + change: (value: string) => { + this.config.tcpOppositeIp = value; + } + }) + blockComponent({ + label: "差分响应端口", + value: this.config.tcpOppositePort, + change: (value: string) => { + this.config.tcpOppositePort = value; + } + }) + } blockComponent({ label: "中心服务器IP", value: this.config.centerIp, @@ -64,7 +66,7 @@ struct TerminalInfoPage { } }) blockComponent({ - label: "响应端口", + label: "中心响应端口", value: this.config.centerPort, change: (value: string) => { this.config.centerPort = value; @@ -78,12 +80,21 @@ struct TerminalInfoPage { } }) blockComponent({ - label: "响应端口", + label: "后置机响应端口", value: this.config.udpOppositeIpPort, change: (value: string) => { this.config.udpOppositeIpPort = value; } }) + if (this.config.carType === "4") { + blockComponent({ + label: "后置机响应端口2", + value: this.config.udpOppositeIpPortTwo, + change: (value: string) => { + this.config.udpOppositeIpPortTwo = value; + } + }) + } blockComponent({ label: "前置机IP", value: this.config.udplocalIp, @@ -99,6 +110,15 @@ struct TerminalInfoPage { this.config.udplocalIpPort = value; } }) + if (this.config.carType === "4") { + blockComponent({ + label: "后置机UDP本地端口2", + value: this.config.udplocalIpPortTwo, + change: (value: string) => { + this.config.udplocalIpPortTwo = value; + } + }) + } // blockComponent({ // label: "TCP本地端口", // value: this.config.tcplocalIpPort, @@ -127,12 +147,28 @@ struct TerminalInfoPage { this.config.dnsServers = value; } }) + blockComponent({ + label: "车型", + type: 4, + value: this.config.carType, + change: (value: string) => { + this.config.carType = value; + } + }) blockComponent({ label: "后置机类型", type: 1, - value: (Number(this.config.rearMachineModel) - 1).toString(), + value: this.config.rearMachineModel, change: (value: string) => { - this.config.rearMachineModel = (Number(value) + 1).toString(); + this.config.rearMachineModel = value; + } + }) + blockComponent({ + label: "是否开启差分", + type: 5, + value: this.config.isOpenFiniteDifference, + change: (value: string) => { + this.config.isOpenFiniteDifference = value; } }) blockComponent({ @@ -146,14 +182,14 @@ struct TerminalInfoPage { blockComponent({ label: "板卡类型", type: 3, - value: (Number(this.config.boardType) - 1).toString(), + value: this.config.boardType, change: (value: string) => { - this.config.boardType = (Number(value) + 1).toString(); + this.config.boardType = value; } }) } .backgroundColor("#282828") - .height(500) + .height(650) .borderRadius(20) .margin(20) .padding({ @@ -199,7 +235,7 @@ struct TerminalInfoPage { }) } .width(1500) - .height(660) + .height(810) .backgroundColor("#fff") .borderRadius(20) } @@ -225,15 +261,70 @@ struct blockComponent { // 0 -输入框,1 -后置机类型,2 -日志开关,3 -板卡类型 @State type: number = 0 // '一型机', '二型机', '三型机', '一体机' - @State rearMachineModelList: string[] = ['一型机', '二型机', '三型机', '一体机'] - @State boardList: string[] = ['北云', '天宝MB2'] - @State logList: string[] = ['关', '开'] + @State rearMachineModelList: CommonListType[] = [ + { + label: '一型机', + value: '1' + }, + { + label: '二型机', + value: '2' + }, + { + label: '三型机', + value: '3' + }, + { + label: '一体机', + value: '4' + } + ] + // '北云', '天宝MB2' + @State boardList: CommonListType[] = [ + { + label: '北云', + value: '1' + }, + { + label: '天宝MB2', + value: '2' + } + ] + @State logList: CommonListType[] = [ + { + label: '开启', + value: '1' + }, + { + label: '关闭', + value: '0' + } + ] + // 车型 "小车C1", "小车C2", "大车", "牵引车A2" + @State carTypeList: CommonListType[] = [ + { + label: '小车C1', + value: '1' + }, + { + label: '小车C2', + value: '2' + }, + { + label: '大车', + value: '3' + }, + { + label: '牵引车A2', + value: '4' + } + ] build() { Row() { Row() { Text(this.label + ":").fontSize(20).fontColor("#E5CBA1") - }.width("40%").padding({ + }.width("35%").padding({ left: 15 }) @@ -260,22 +351,22 @@ struct blockComponent { }) } else { ForEach(this.type === 1 ? this.rearMachineModelList : - this.type === 2 ? this.logList : - this.boardList, (item: string, index) => { - Radio({ value: item, group: 'terRadioGroup' + this.type }) + this.type === 2 || this.type === 5 ? this.logList : + this.type === 3 ? this.boardList : this.carTypeList, (item: CommonListType, index) => { + Radio({ value: item.label, group: 'terRadioGroup' + this.type }) .borderColor('#E5CBA1') - .checked(index.toString() === this.value ? true : false) + .checked(item.value === this.value ? true : false) .onChange((value: boolean) => { if (value) { - this.value = index.toString(); - this.change?.(index.toString()); + this.value = item.value + this.change?.(item.value); } }) - Text(item).fontSize(20).fontColor('#FFF') + Text(item.label).fontSize(20).fontColor('#FFF') }) } - }.width("60%").padding({ + }.width("65%").padding({ right: 15 }) }