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