index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="base-container">
  3. <fnHeader :hideSwitch="true" :hideShadow="true"></fnHeader>
  4. <div class="content">
  5. <div class="left">
  6. <div @click="goBack">返回</div>
  7. <component v-if="workList && workList.length" :is="components[currentComponent]" :prescriptioData="workList[0]" />
  8. </div>
  9. <div class="right">
  10. <div class="excute-title">执行农事区域</div>
  11. <div ref="mapRef" class="bottom-map"></div>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script setup>
  17. import { onMounted, ref } from "vue";
  18. import fnHeader from "@/components/fnHeader.vue";
  19. import AreaMap from "./areaMap";
  20. import prescriptionBox from './components/prescriptionBox'
  21. import { useRouter, useRoute } from "vue-router";
  22. import { useStore } from "vuex";
  23. let store = useStore();
  24. const components = {
  25. prescriptionBox,
  26. };
  27. let areaMap = new AreaMap();
  28. const router = useRouter();
  29. const route = useRoute();
  30. const mapRef = ref();
  31. onMounted(() => {
  32. getList()
  33. areaMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
  34. });
  35. const workList = ref([])
  36. const getList = () => {
  37. VE_API.order.fetchWorkList().then(({data}) => {
  38. // data[0].orderStatus = data[0].orderStatus + 1
  39. // && (ROLETYPE.value == '0' || ROLETYPE.value == '3')
  40. if (route.query.data && JSON.parse(route.query.data)?.farmWorkId) {
  41. data = data.find(item => item.farmWorkLibId === JSON.parse(route.query.data)?.farmWorkId)
  42. workList.value = [data]
  43. } else {
  44. workList.value = data
  45. }
  46. console.log('dtafds,', data)
  47. })
  48. }
  49. const currentComponent = ref("prescriptionBox");
  50. const goBack = () => {
  51. router.go(-1)
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. .base-container {
  56. width: 100%;
  57. height: 100vh;
  58. color: #fff;
  59. position: relative;
  60. box-sizing: border-box;
  61. z-index: 1;
  62. background: #000;
  63. .content {
  64. width: 100%;
  65. height: calc(100% - 74px - 48px);
  66. display: flex;
  67. justify-content: space-between;
  68. box-sizing: border-box;
  69. .left {
  70. width: 512px;
  71. height: 100%;
  72. padding-top: 10px;
  73. box-sizing: border-box;
  74. }
  75. .right {
  76. width: calc(100% - 512px);
  77. height: 100%;
  78. .bottom-map {
  79. width: 100%;
  80. height: 100%;
  81. }
  82. }
  83. }
  84. }
  85. </style>