Browse Source

加入虚拟果园点位

shuhao 1 month ago
parent
commit
860443e1d1

+ 9 - 0
feiniao-pc-vue.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <output url="file://$MODULE_DIR$/bin" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 3 - 3
package.json

@@ -3,9 +3,9 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
-    "serve": "vue-cli-service serve --mode dev",
-    "serve2": "vue-cli-service serve --mode local",
-    "serve3": "vue-cli-service serve --mode pro",
+    "servedev": "vue-cli-service serve --mode dev",
+    "servelocal": "vue-cli-service serve --mode local",
+    "servepro": "vue-cli-service serve --mode pro",
     "build": "vue-cli-service build --mode pro",
     "build2": "vue-cli-service build --mode dev",
     "lint": "vue-cli-service lint"

+ 8 - 0
src/api/modules/farm_files.js

@@ -0,0 +1,8 @@
+const config = require("../config")
+
+module.exports = {
+    last: {
+        url: config.base_url + "z_farm_files/last",
+        type: "get",
+    }
+}

+ 20 - 24
src/components/PdfDialog.vue

@@ -10,9 +10,10 @@
   >
     <div class="dialog-box">
       <div class="title">
+        <div class="btn" @click="handleExport">导出</div>
         <div class="myclose cursor-pointer" @click="closeDialog"></div>
       </div>
-      <iframe class="my-body" :src="src"></iframe>
+      <iframe class="my-body" :src="src" id="my-pdf"></iframe>
     </div>
   </el-dialog>
 </template>
@@ -21,31 +22,26 @@
 import {onMounted, toRefs, ref,watch} from "vue";
 import {base_img_url2} from "../api/config"
 import vueshowpdf from 'vueshowpdf'
-const emit = defineEmits(["closeDialog"]);
+import eventBus from "@/api/eventBus";
+
 const title = ref(null)
-const props = defineProps({
-  showDialog: {
-    type: Boolean,
-    default: true,
-  },
-  title:{
-    type:String,
-    default:""
-  },
-  src:{
-    type:String,
-    default:""
-  }
-});
-const {rowData, showDialog } = toRefs(props);
-onMounted(async () => {
+const src=ref()
+const showDialog=ref(false);
 
+
+onMounted(async () => {
 })
 
 function closeDialog(){
   showDialog.value = false;
-  emit("closeDialog")
 }
+function gybgListener(e){
+  showDialog.value = true;
+  src.value = e.filename;
+  title.value = e.title;
+}
+eventBus.off("homePage:gybg",gybgListener)
+eventBus.on("homePage:gybg",gybgListener)
 
 </script>
 
@@ -58,12 +54,12 @@ $body-height:calc(100% - $title-height);
   position: fixed;
   left: calc(50% - 700px);
   top:0px;
-  width: 1400px;
+  width: 80%;
   height: calc(100% - 100px);
   background: rgba(1,17,22,0.8);
-  box-shadow: 0px 0px 20px 0px #00FFF0;
+  box-shadow: 0px 0px 20px 0px #232323;
   border-radius: 4px;
-  border: 2px solid rgba(81,233,240,0.6);
+  border: 2px solid #232323;
   z-index: 99999;
 
   .title{
@@ -71,9 +67,9 @@ $body-height:calc(100% - $title-height);
     width: 100%;
     height: $title-height;
     box-sizing: border-box;
-    background: rgba(0,77,101,0.8);
+    background: #232323;
     border-radius: 4px 4px 0px 0px;
-    border-bottom: 2px solid rgba(81,233,240,0.3);
+    border-bottom: 2px solid #232323;
     .myclose{
       position: absolute;
       right: 0px;

+ 12 - 3
src/views/home/components/homePage.vue

@@ -3,7 +3,7 @@
     <div class="chart-item">
       <chart-box name="气象预警" arrow="left">
         <template #title-right>
-          <div class="button">果园报告</div>
+          <div class="button" @click="gybg">果园报告</div>
         </template>
         <div class="base-wrap">
           <!-- <div class="base-item">111</div> -->
@@ -91,6 +91,9 @@ import timeLine from "@/components/timeLine.vue";
 import barChart from "@/components/charts/barChart.vue";
 import pieChart from "@/components/charts/pieChart.vue";
 import oneLineChart from "@/components/charts/oneLineChart.vue";
+import eventBus from "@/api/eventBus";
+import {useStore} from "vuex";
+let store = useStore()
 
 // 物候调节
 const phenologyXData = ["新梢褪绿", "花芽萌动","花蕾抽出","花穗伸长"]
@@ -148,6 +151,12 @@ const phenologyYData1 = [{
 // 营养评估
 const evaluateXData = ["低", "中", "高"]
 const evaluateYData = [1, 8, 7]
+
+const gybg= ()=>{
+  VE_API.farm_files.last({farmId: 766,key:"pdf_report"}).then(({data})=>{
+    eventBus.emit("homePage:gybg",{filename:data.path,title:"果园报告"})
+  })
+}
 </script>
 
 <style lang="scss" scoped>
@@ -271,7 +280,7 @@ const evaluateYData = [1, 8, 7]
         .text-item{
           display: flex;
           align-items: center;
-          
+
           .circle{
             width: 4px;
             height: 4px;
@@ -290,4 +299,4 @@ const evaluateYData = [1, 8, 7]
     }
   }
 }
-</style>
+</style>

+ 2 - 1
src/views/home/index.vue

@@ -88,6 +88,7 @@
     :curIndex="urlsIndex"
   ></PicturePreview>
   <album-carousel></album-carousel>
+  <PdfDialog title="果园报告" ></PdfDialog>
 </template>
 
 <script setup>
@@ -110,7 +111,7 @@ import {useStore} from "vuex";
 import RegionLayer from "./map/regionLayer";
 import eventBus from "@/api/eventBus";
 import AlbumCarousel from "./album_compoents/albumCarousel.vue";
-
+import PdfDialog from "../../components/PdfDialog"
 let store = useStore()
 const components = {
   homePage,