罗广辉
2026-05-15 e3c2cd23253f3501be7d31e03955fbb6f4aa3556
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!-- 已执行 -->
<template>
  <WebViewPlus v-if="isApp" :src="`${viewUrl}`" @webMessage="onPostMessage"/>
</template>
 
<script setup>
import {onHide, onLoad, onShow} from "@dcloudio/uni-app";
import WebViewPlus from "@/components/WebViewPlus.vue";
import {getWebViewUrl} from "@/utils/index.js";
 
const wayLineJobInfoId = ref(null)
const viewUrl = ref('')
 
function onPostMessage(data) {
  if (data.type === 'back') {
    uni.switchTab({
      url: '/pages/inspectionTask/index'
    });
  } else if (data.type === 'control') {
    uni.redirectTo({
      url: `/pages/inspectionTask/execution/index?wayLineJobInfoId=${wayLineJobInfoId.value}`
    });
  } else if(data.type === 'workid') {
    uni.navigateTo({
      url: `/subPackages/workDetail/index?eventNum=${data.eventNum}&wLJobInfoId=${data.wLJobInfoId}&current=${data.current}`
    });
  }
}
 
onLoad((options) => {
  wayLineJobInfoId.value = options.wayLineJobInfoId
  viewUrl.value = getWebViewUrl('/execution', {wayLineJobInfoId: wayLineJobInfoId.value, waylineJobId: options.waylineJobId, batch_no: options.batch_no})
})
const isApp = ref(false)
onShow(() => {
  isApp.value = true
});
 
onHide(() => {
 
});
</script>
 
<style lang="scss" scoped></style>