fix: 设置界面选项添加
This commit is contained in:
		
							parent
							
								
									8589d0ac76
								
							
						
					
					
						commit
						0073fb2ba2
					
				| @ -130,9 +130,19 @@ export interface ExaminerInfoType { | |||||||
| // 一些运行配置 | // 一些运行配置 | ||||||
| export interface EnvironmentConfigurationType { | export interface EnvironmentConfigurationType { | ||||||
|   udplocalIp?: string, |   udplocalIp?: string, | ||||||
|  | 
 | ||||||
|  |   // 前置机响应后置机端口 | ||||||
|   udplocalIpPort?: string, |   udplocalIpPort?: string, | ||||||
|  | 
 | ||||||
|  |   // 前置机响应后置机端口2 | ||||||
|  |   udplocalIpPortTwo?: string, | ||||||
|   udpOppositeIp?: string, |   udpOppositeIp?: string, | ||||||
|  | 
 | ||||||
|  |   // 后置机响应端口 | ||||||
|   udpOppositeIpPort?: string, |   udpOppositeIpPort?: string, | ||||||
|  | 
 | ||||||
|  |   // 后置机响应端口2 | ||||||
|  |   udpOppositeIpPortTwo?: string, | ||||||
|   tcplocalIp?: string, |   tcplocalIp?: string, | ||||||
|   tcplocalIpPort?: string, |   tcplocalIpPort?: string, | ||||||
|   tcpOppositeIp?: string, |   tcpOppositeIp?: string, | ||||||
| @ -149,6 +159,10 @@ export interface EnvironmentConfigurationType { | |||||||
|   isOpenLog?: string |   isOpenLog?: string | ||||||
|   //   板卡类型 1|2 |   //   板卡类型 1|2 | ||||||
|   boardType?: string |   boardType?: string | ||||||
|  |   //   车型 | ||||||
|  |   carType?: string | ||||||
|  |   //   是否开启差分 | ||||||
|  |   isOpenFiniteDifference?: string | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //全局配置 | //全局配置 | ||||||
| @ -202,3 +216,7 @@ interface FourInOneScreenType { | |||||||
| 
 | 
 | ||||||
| interface SystemParamConfigType {} | interface SystemParamConfigType {} | ||||||
| 
 | 
 | ||||||
|  | export interface CommonListType { | ||||||
|  |   label: string | ||||||
|  |   value: string | ||||||
|  | } | ||||||
| @ -1,5 +1,5 @@ | |||||||
| import HeaderComponent from './compontents/Header'; | import HeaderComponent from './compontents/Header'; | ||||||
| import { EnvironmentConfigurationType } from '../model'; | import { CommonListType, EnvironmentConfigurationType } from '../model'; | ||||||
| import common from '@ohos.app.ability.common'; | import common from '@ohos.app.ability.common'; | ||||||
| import FileUtils from '../utils/FileUtils'; | import FileUtils from '../utils/FileUtils'; | ||||||
| import { GlobalConfig } from '../config'; | import { GlobalConfig } from '../config'; | ||||||
| @ -43,19 +43,21 @@ struct TerminalInfoPage { | |||||||
|           Flex({ |           Flex({ | ||||||
|             wrap: FlexWrap.Wrap, |             wrap: FlexWrap.Wrap, | ||||||
|           }) { |           }) { | ||||||
|             blockComponent({ |             if (this.config.isOpenFiniteDifference === "1") { | ||||||
|               value: this.config.tcpOppositeIp, |               blockComponent({ | ||||||
|               change: (value: string) => { |                 value: this.config.tcpOppositeIp, | ||||||
|                 this.config.tcpOppositeIp = value; |                 change: (value: string) => { | ||||||
|               } |                   this.config.tcpOppositeIp = value; | ||||||
|             }) |                 } | ||||||
|             blockComponent({ |               }) | ||||||
|               label: "响应端口", |               blockComponent({ | ||||||
|               value: this.config.tcpOppositePort, |                 label: "差分响应端口", | ||||||
|               change: (value: string) => { |                 value: this.config.tcpOppositePort, | ||||||
|                 this.config.tcpOppositePort = value; |                 change: (value: string) => { | ||||||
|               } |                   this.config.tcpOppositePort = value; | ||||||
|             }) |                 } | ||||||
|  |               }) | ||||||
|  |             } | ||||||
|             blockComponent({ |             blockComponent({ | ||||||
|               label: "中心服务器IP", |               label: "中心服务器IP", | ||||||
|               value: this.config.centerIp, |               value: this.config.centerIp, | ||||||
| @ -64,7 +66,7 @@ struct TerminalInfoPage { | |||||||
|               } |               } | ||||||
|             }) |             }) | ||||||
|             blockComponent({ |             blockComponent({ | ||||||
|               label: "响应端口", |               label: "中心响应端口", | ||||||
|               value: this.config.centerPort, |               value: this.config.centerPort, | ||||||
|               change: (value: string) => { |               change: (value: string) => { | ||||||
|                 this.config.centerPort = value; |                 this.config.centerPort = value; | ||||||
| @ -78,12 +80,21 @@ struct TerminalInfoPage { | |||||||
|               } |               } | ||||||
|             }) |             }) | ||||||
|             blockComponent({ |             blockComponent({ | ||||||
|               label: "响应端口", |               label: "后置机响应端口", | ||||||
|               value: this.config.udpOppositeIpPort, |               value: this.config.udpOppositeIpPort, | ||||||
|               change: (value: string) => { |               change: (value: string) => { | ||||||
|                 this.config.udpOppositeIpPort = value; |                 this.config.udpOppositeIpPort = value; | ||||||
|               } |               } | ||||||
|             }) |             }) | ||||||
|  |             if (this.config.carType === "4") { | ||||||
|  |               blockComponent({ | ||||||
|  |                 label: "后置机响应端口2", | ||||||
|  |                 value: this.config.udpOppositeIpPortTwo, | ||||||
|  |                 change: (value: string) => { | ||||||
|  |                   this.config.udpOppositeIpPortTwo = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |             } | ||||||
|             blockComponent({ |             blockComponent({ | ||||||
|               label: "前置机IP", |               label: "前置机IP", | ||||||
|               value: this.config.udplocalIp, |               value: this.config.udplocalIp, | ||||||
| @ -99,6 +110,15 @@ struct TerminalInfoPage { | |||||||
|                 this.config.udplocalIpPort = value; |                 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({ |             // blockComponent({ | ||||||
|             //   label: "TCP本地端口", |             //   label: "TCP本地端口", | ||||||
|             //   value: this.config.tcplocalIpPort, |             //   value: this.config.tcplocalIpPort, | ||||||
| @ -127,12 +147,28 @@ struct TerminalInfoPage { | |||||||
|                 this.config.dnsServers = value; |                 this.config.dnsServers = value; | ||||||
|               } |               } | ||||||
|             }) |             }) | ||||||
|  |             blockComponent({ | ||||||
|  |               label: "车型", | ||||||
|  |               type: 4, | ||||||
|  |               value: this.config.carType, | ||||||
|  |               change: (value: string) => { | ||||||
|  |                 this.config.carType = value; | ||||||
|  |               } | ||||||
|  |             }) | ||||||
|             blockComponent({ |             blockComponent({ | ||||||
|               label: "后置机类型", |               label: "后置机类型", | ||||||
|               type: 1, |               type: 1, | ||||||
|               value: (Number(this.config.rearMachineModel) - 1).toString(), |               value: this.config.rearMachineModel, | ||||||
|               change: (value: string) => { |               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({ |             blockComponent({ | ||||||
| @ -146,14 +182,14 @@ struct TerminalInfoPage { | |||||||
|             blockComponent({ |             blockComponent({ | ||||||
|               label: "板卡类型", |               label: "板卡类型", | ||||||
|               type: 3, |               type: 3, | ||||||
|               value: (Number(this.config.boardType) - 1).toString(), |               value: this.config.boardType, | ||||||
|               change: (value: string) => { |               change: (value: string) => { | ||||||
|                 this.config.boardType = (Number(value) + 1).toString(); |                 this.config.boardType = value; | ||||||
|               } |               } | ||||||
|             }) |             }) | ||||||
|           } |           } | ||||||
|           .backgroundColor("#282828") |           .backgroundColor("#282828") | ||||||
|           .height(500) |           .height(650) | ||||||
|           .borderRadius(20) |           .borderRadius(20) | ||||||
|           .margin(20) |           .margin(20) | ||||||
|           .padding({ |           .padding({ | ||||||
| @ -199,7 +235,7 @@ struct TerminalInfoPage { | |||||||
|           }) |           }) | ||||||
|         } |         } | ||||||
|         .width(1500) |         .width(1500) | ||||||
|         .height(660) |         .height(810) | ||||||
|         .backgroundColor("#fff") |         .backgroundColor("#fff") | ||||||
|         .borderRadius(20) |         .borderRadius(20) | ||||||
|       } |       } | ||||||
| @ -225,15 +261,70 @@ struct blockComponent { | |||||||
|   // 0 -输入框,1 -后置机类型,2 -日志开关,3 -板卡类型 |   // 0 -输入框,1 -后置机类型,2 -日志开关,3 -板卡类型 | ||||||
|   @State type: number = 0 |   @State type: number = 0 | ||||||
|   // '一型机', '二型机', '三型机', '一体机' |   // '一型机', '二型机', '三型机', '一体机' | ||||||
|   @State rearMachineModelList: string[] = ['一型机', '二型机', '三型机', '一体机'] |   @State rearMachineModelList: CommonListType[] = [ | ||||||
|   @State boardList: string[] = ['北云', '天宝MB2'] |     { | ||||||
|   @State logList: string[] = ['关', '开'] |       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() { |   build() { | ||||||
|     Row() { |     Row() { | ||||||
|       Row() { |       Row() { | ||||||
|         Text(this.label + ":").fontSize(20).fontColor("#E5CBA1") |         Text(this.label + ":").fontSize(20).fontColor("#E5CBA1") | ||||||
|       }.width("40%").padding({ |       }.width("35%").padding({ | ||||||
|         left: 15 |         left: 15 | ||||||
|       }) |       }) | ||||||
| 
 | 
 | ||||||
| @ -260,22 +351,22 @@ struct blockComponent { | |||||||
|             }) |             }) | ||||||
|         } else { |         } else { | ||||||
|           ForEach(this.type === 1 ? this.rearMachineModelList : |           ForEach(this.type === 1 ? this.rearMachineModelList : | ||||||
|             this.type === 2 ? this.logList : |             this.type === 2 || this.type === 5 ? this.logList : | ||||||
|             this.boardList, (item: string, index) => { |               this.type === 3 ? this.boardList : this.carTypeList, (item: CommonListType, index) => { | ||||||
|             Radio({ value: item, group: 'terRadioGroup' + this.type }) |             Radio({ value: item.label, group: 'terRadioGroup' + this.type }) | ||||||
|               .borderColor('#E5CBA1') |               .borderColor('#E5CBA1') | ||||||
|               .checked(index.toString() === this.value ? true : false) |               .checked(item.value === this.value ? true : false) | ||||||
|               .onChange((value: boolean) => { |               .onChange((value: boolean) => { | ||||||
|                 if (value) { |                 if (value) { | ||||||
|                   this.value = index.toString(); |                   this.value = item.value | ||||||
|                   this.change?.(index.toString()); |                   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 |         right: 15 | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user