接口对接
This commit is contained in:
		
							parent
							
								
									ec7c45bb29
								
							
						
					
					
						commit
						3472da566b
					
				| @ -1,11 +1,18 @@ | ||||
| import { CusButton } from '../components/button/Index' | ||||
| import { Layout } from '../components/layout/Index' | ||||
| import { Title } from '../components/title/Index' | ||||
| import { router } from '@kit.ArkUI' | ||||
| import { promptAction, router } from '@kit.ArkUI' | ||||
| import { Option } from '../../typings/Common' | ||||
| import VideoPlayer from '../components/player/Index' | ||||
| import { commandService } from '../../utils/CommandService' | ||||
| import { BusinessError } from '@kit.BasicServicesKit' | ||||
| 
 | ||||
| 
 | ||||
| interface RouterParams { | ||||
|   data: API.InspectAlarmItemVo | ||||
|   line: string | ||||
| } | ||||
| 
 | ||||
| @Extend(Text) | ||||
| function label() { | ||||
|   .fontFamily("Alimama") | ||||
| @ -54,9 +61,12 @@ struct Detail { | ||||
|   @State remark: string = "" | ||||
|   @State isFullScreen: boolean = false | ||||
|   @State url: string = "" | ||||
|   private line: string = "" | ||||
| 
 | ||||
|   aboutToAppear(): void { | ||||
|     let data: API.InspectAlarmItemVo = router.getParams() | ||||
|     let params = router.getParams() as RouterParams | ||||
|     let data = params.data | ||||
|     this.line = params.line | ||||
|     this.base[0].value = data.createTime || "" | ||||
|     this.base[1].value = data.alarmCode || "" | ||||
|     this.base[2].value = data.stageName || "" | ||||
| @ -65,7 +75,13 @@ struct Detail { | ||||
|   } | ||||
| 
 | ||||
|   submit() { | ||||
| 
 | ||||
|     commandService.submitAlarm(this.line, JSON.stringify({})).then(() => { | ||||
|       router.back() | ||||
|     }).catch((err: BusinessError) => { | ||||
|       promptAction.showToast({ | ||||
|         message: JSON.stringify(err) | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   build() { | ||||
|  | ||||
| @ -197,7 +197,11 @@ struct Home { | ||||
|                   WarnCard({ | ||||
|                     onDetail: () => { | ||||
|                       router.pushUrl({ | ||||
|                         url: "pages/alarm/Detail" | ||||
|                         url: "pages/alarm/Detail", | ||||
|                         params: { | ||||
|                           data: {}, | ||||
|                           line: "", | ||||
|                         } | ||||
|                       }) | ||||
|                     } | ||||
|                   }) | ||||
|  | ||||
| @ -82,9 +82,7 @@ export class CommandService { | ||||
|           if (message.type === CommandType.PostCmd) { | ||||
|             return new Promise<boolean>((_resolve, _reject) => { | ||||
|               this.service!.send(JSON.stringify(message)).then(() => { | ||||
|                 this.commandCallback.set(message.reqCode, (res: ResponseMessage) => { | ||||
|                   resolve(res) | ||||
|                 }) | ||||
|                 this.commandCallback.set(message.reqCode, (res: ResponseMessage) => resolve(res)) | ||||
|                 _resolve(true) | ||||
|               }).catch(_reject) | ||||
|             }) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user