routerView.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="blacklog-container">
  3. <!-- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" @clickLeft="back">
  4. </uni-nav-bar> -->
  5. <!-- <div style="height: 88rpx;width: 100%;"></div> -->
  6. <web-view style="margin-top: 88rpx;" :src="webViewUrl" ref="webViewRef" @message="getMessage"></web-view>
  7. </view>
  8. </template>
  9. <script>
  10. import Vue from "vue";
  11. import {
  12. getParentIdListByDeptId
  13. } from '@/api/common.js'
  14. export default {
  15. data() {
  16. return {
  17. isShow: false,
  18. webViewUrl: '',
  19. title: '申请'
  20. }
  21. },
  22. methods: {
  23. getMessage(event) {
  24. let data = event.detail.data
  25. console.log(data, 'dsdsd')
  26. if (data[0].type == 'selectWork') {
  27. uni.navigateTo({
  28. url: `/pages/salesServiceManagement/accessory/components/selectWork?isPieCar=1`
  29. })
  30. }
  31. }
  32. },
  33. mounted() {
  34. uni.$off('updateWorkData')
  35. uni.$on('updateWorkData', ({
  36. data
  37. }) => {
  38. this.$nextTick(() => {
  39. console.log(this.$scope.$getAppWebview(), 'this.$refs.webViewRef')
  40. let webView = this.$scope.$getAppWebview()
  41. if (webView) {
  42. webView.children()[0].evalJS(`window.x_sun('${
  43. JSON.stringify({
  44. id: data.id, // 列表工单ID
  45. code: data.code, // 列表工单编号(要显示的code)
  46. name: data.planName // 列表工单名称(可选,根据弹窗需求传递)
  47. })
  48. }')`)
  49. }
  50. })
  51. })
  52. },
  53. async onLoad(option = {}) {
  54. let headers = {};
  55. const value = uni.getStorageSync("token"); //取存本地的token
  56. // const apiInfo = uni.getStorageSync("apiInfo"); //取存本地的token
  57. console.log(Vue.prototype.apiUrl, 'apiInfo')
  58. headers = {
  59. "content-type": "application/json",
  60. "zoomwin-token": value,
  61. Authorization: value,
  62. "zoomwin-sid": uni.getStorageSync("userInfo").sessionId,
  63. serverInfo: Vue.prototype.apiUrl || '',
  64. };
  65. //http://192.168.1.105:18086
  66. let params = JSON.parse(option.params)
  67. let userInfo = uni.getStorageSync("userInfo")
  68. params.userInfo = {
  69. userId: userInfo.userId,
  70. groupId: userInfo.groupId
  71. }
  72. let html = params.type == 'add' ? 'a.html' : 'c.html'
  73. this.title = params.type == 'add' ? '申请' : '审批'
  74. try {
  75. params.userInfo.groupIdList = await getParentIdListByDeptId(params.userInfo.groupId)
  76. } catch {
  77. params.userInfo.groupIdList = []
  78. }
  79. console.log(params)
  80. setTimeout(() => {
  81. this.webViewUrl =
  82. `/hybrid/html/${html}?params=${JSON.stringify(params)}&headers=${JSON.stringify(headers)}`
  83. this.isShow = true
  84. })
  85. },
  86. }
  87. </script>
  88. <style>
  89. </style>