<!-- 已执行 -->
|
<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('')
|
// const viewUrl = ref(getWebViewUrl('/execution'))
|
|
// function onPostMessage(data) {
|
// console.log(data, '9999')
|
// if (data.type === 'taskDetails'){
|
// console.log('4444')
|
// uni.switchTab({
|
// url: '/subPackages/taskDetail/execution/index'
|
// });
|
// }
|
// }
|
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}¤t=${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(() => {
|
// 如果工单详情返回任务详情,那么tab栏对应的是关联事件一项
|
// isApp.value = false
|
});
|
</script>
|
|
<style lang="scss" scoped></style>
|