瀏覽代碼

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-pc-vue

wangsisi 1 月之前
父節點
當前提交
38ae2b1266

+ 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",
+    }
+}

+ 5 - 0
src/api/modules/miniimage.js

@@ -5,4 +5,9 @@ module.exports = {
         url: config.base_dev_url + "image/list?key="+config.mini_key,
         type: "post",
     }
+    ,
+    getByFarmIdAndDate: {
+        url: config.base_dev_url + "lz_weather7d/getByFarmIdAndDate/{farmId}/{date}?key="+config.mini_key,
+        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;

+ 6 - 1
src/components/toolList.vue

@@ -7,6 +7,8 @@
 <script setup>
 import {ref} from 'vue'
 import eventBus from "@/api/eventBus";
+import {useRouter} from "vue-router";
+const router = useRouter();
 const props = defineProps({
   direction: {
     type: String,
@@ -28,6 +30,9 @@ const active = ref(0)
 const handleActive = (value,index) =>{
     active.value = index
     emit('handleActive',value)
+    if(index == 0){
+      router.push('/warningHome')
+    }
 }
 </script>
 
@@ -84,4 +89,4 @@ const handleActive = (value,index) =>{
     }
   }
 }
-</style>
+</style>

+ 5 - 1
src/styles/index.scss

@@ -6,4 +6,8 @@
 $screenWidth:414;
 @function rpx($value){
   @return  $screenWidth / 750 * $value + px;
-}
+}
+
+.v-dialog{
+  background-color: #00000000;
+}

+ 14 - 15
src/views/home/album_compoents/albumCarousel.vue

@@ -1,14 +1,15 @@
 <template>
-    <el-dialog
-        v-model="dialogVisible"
-        width="60%"
-        class="picture-preview-wrap v-dialog"
-        :show-close="false"
-        top="10vh"
-        append-to-body
-    >
-    <album-carousel-item v-if="images" :images="images"></album-carousel-item>
-    </el-dialog>
+  <el-dialog
+      v-model="dialogVisible"
+      width="60%"
+      height="80%"
+      class="picture-preview-wrap v-dialog"
+      :show-close="false"
+      top="10vh"
+      append-to-body
+  >
+    <album-carousel-item v-if="images" :farmId="farmId" :images="images" :lock="lock"></album-carousel-item>
+  </el-dialog>
 </template>
 
 <script setup>
@@ -18,6 +19,8 @@ import AlbumCarouselItem from "./albumCarouselItem";
 import {dateFormat} from "@/utils/date_util.js"
 import eventBus from "@/api/eventBus";
 
+const lock = ref(false);
+const farmId = ref(766);
 
 const images = ref(null);
 const dialogVisible = ref(false)
@@ -32,7 +35,7 @@ const formattedStartDate = dateFormat(startDate, 'YY-mm-dd');
 const formattedEndDate = dateFormat(currentDate, 'YY-mm-dd');
 
 eventBus.on("click:point",function({name}){
-  let params = {sampleId: name,farmId: 766, startDate: formattedStartDate, endDate: formattedEndDate}
+  let params = {sampleId: name,farmId: farmId.value, startDate: formattedStartDate, endDate: formattedEndDate}
   VE_API.miniimage.list(params).then(res => {
     if(res.code === 0){
       images.value = res.data
@@ -43,10 +46,6 @@ eventBus.on("click:point",function({name}){
 
 
 
-onMounted(() => {
-
-});
-
 </script>
 
 <style lang="scss" scoped>

+ 23 - 7
src/views/home/album_compoents/albumCarousel7d.vue

@@ -1,6 +1,6 @@
 <template>
   <template v-for="(images,index) in imagesList" :key="index">
-    <album-carousel-item  :images="images"></album-carousel-item>
+    <album-carousel-item :farmId="farmId" :images="images"></album-carousel-item>
     <div style="height: 5px"></div>
   </template>
 </template>
@@ -11,12 +11,13 @@ import AlbumDrawBoxItem from "./albumCarouselItem";
 import "./cacheImg.js"
 import AlbumCarouselItem from "./albumCarouselItem";
 import {dateFormat} from "@/utils/date_util.js"
+import eventBus from "@/api/eventBus";
 
 const props =defineProps({
-  sampleId:{
-    type: [Number, String],
-    required: false
-  },
+  // sampleId:{
+  //   type: [Number, String],
+  //   required: false
+  // },
   farmId:{
     type: [Number, String],
     required: true
@@ -27,9 +28,9 @@ const props =defineProps({
   }
 })
 const imagesList = ref([]);
+let params = {farmId: props.farmId}
 
 onMounted(() => {
-  let params = {sampleId: props.sampleId,farmId: props.farmId}
   if(props.farmWork?.executeDate){
     let execcuteDate = new Date(props.farmWork.executeDate)
     let beforeExecuteDate = new Date(props.farmWork.beforeExecuteDate)
@@ -38,6 +39,19 @@ onMounted(() => {
     params.startDate = dateFormat(pastDate, "YY-mm-dd");
     params.endDate = dateFormat(futureDate, "YY-mm-dd");
   }
+  // getImageList(params)
+});
+
+const updateData = () =>{
+  params.farmId = props.farmId
+  getImageList(params)
+}
+
+onUnmounted(()=>{
+  eventBus.off("chart:updateOption",updateData)
+})
+
+const getImageList = (params) =>{
   VE_API.image.list(params).then(res => {
     if(res.code === 0){
       let result = splitByWeek(res.data, params.startDate, params.endDate);
@@ -51,7 +65,9 @@ onMounted(() => {
       }
     }
   })
-});
+}
+
+eventBus.on("chart:updateOption",updateData)
 
 function splitByWeek(items, startDate, endDate) {
   // 将开始时间和结束时间转换为时间戳

+ 18 - 4
src/views/home/album_compoents/albumCarouselItem.vue

@@ -5,12 +5,18 @@
       <photo-provider v-if="images" :photo-closable="true" @visibleChange="handleVisibleChange">
         <template  v-for="(photo, index) in images"
                    :key="photo.id">
-          <album-draw-box  :photo="photo" :current="currentIndex" :index="index" :length="images.length"
+          <album-draw-box  :farmId="farmId" :photo="photo" :current="currentIndex" :index="index" :length="images.length"
           ></album-draw-box>
         </template>
       </photo-provider>
     </div>
-
+    <div class="blur-bg" v-if="lock && currentIndex !== 0">
+      <div class="blur-content">
+        <div class="blur-img">
+          <img src="@/assets/img/gallery/camera-icon.png" />
+        </div>
+      </div>
+    </div>
 
     <!-- 左右箭头 -->
     <div @click.stop="prev" v-if="currentIndex !== 0" class="arrow left-arrow">
@@ -34,6 +40,14 @@ const props =defineProps({
   images:{
     type: Array,
     required: true
+  },
+  farmId:{
+    type: [Number,String],
+    required: true
+  },
+  lock:{
+    type: Boolean,
+    default: true
   }
 })
 const {images} = toRefs(props);
@@ -108,8 +122,8 @@ const clearAndRestartTimer = () => {
 @import "src/styles/index";
 .carousel-container {
   position: relative;
-  width: 800px;
-  height: 600px;
+  width: 100%;
+  height: 100%;
   overflow: hidden;
   margin: 0 auto;
   .carousel-wrapper {

+ 49 - 18
src/views/home/album_compoents/albumDrawBox.vue

@@ -3,7 +3,7 @@
       class="carousel-item"
       :src="watermark || base_img_url2 + photo.filename + resize"
   >
-    <img v-if="Math.abs(current - index) < 3" crossorigin="anonymous" @load="drawWatermark($event,photo.markText)" loading="lazy" :src="watermark || (base_img_url2 + (photo.resFilename ? photo.resFilename : photo.filename) + resize)" style="width: 100%;" />
+    <img v-if="Math.abs(current - index) < 3" crossorigin="anonymous" @load="drawWatermark($event)" loading="lazy" :src="watermark || (base_img_url2 + (photo.resFilename ? photo.resFilename : photo.filename) + resize)" style="width: 100%;" />
     <canvas  ref="canvasRef" style="position: absolute;"></canvas>
     <div class="tag-text" v-if="showTagBox" >
       <span v-html="photo.growText"></span>
@@ -20,11 +20,16 @@ import { ref, onMounted, onBeforeUnmount, defineProps } from "vue";
 import { base_img_url2 } from "@/api/config";
 import {imageCache} from "./cacheImg.js"
 import {dateFormat} from "@/utils/date_util.js"
-const resize = "?x-oss-process=image/resize,p_80/format,webp/quality,q_40";
+const resize = "?x-oss-process=image/resize,p_30/format,webp/quality,q_40";
+
 const canvasRef = ref(null);
 const watermark = ref(null)
 
 const props = defineProps({
+  farmId:{
+    type: [Number,String],
+    required: true
+  },
   photo:{
     type: Object,
     required: true
@@ -42,24 +47,35 @@ const props = defineProps({
     required: true
   }
 })
-
-function drawWatermark(event, markText) {
-  // console.log("markText:"+markText)
-  if(!watermark.value && markText){
-    let obj = JSON.parse(markText)
-    const img = event.target;
-    const canvas = canvasRef.value;
-    let scale = 3
-    canvas.width = img.width * scale;
-    canvas.height = img.height * scale;
-    const ctx = canvas.getContext('2d');
-    ctx.scale(scale, scale)
-    ctx.drawImage(img, 0, 0, img.width, img.height);
-    drawBottom(ctx, img.width, img.height)
-    watermark.value = canvas.toDataURL();
+let img = null;
+function drawWatermark(event) {
+  img = event.target
+  if(!watermark.value){
+    let param = {farmId:props.farmId, date: props.photo.uploadDate}
+    let weather = null
+    VE_API.miniimage.getByFarmIdAndDate(param).then((res)=>{
+      if(res.code === 0){
+        weather = res.data
+        drawWatermark2(img,weather)
+      }else{
+        drawWatermark2(img,null)
+      }
+    })
   }
 }
 
+function drawWatermark2(img,weather) {
+  const canvas = canvasRef.value;
+  let scale = 3
+  canvas.width = img.width * scale;
+  canvas.height = img.height * scale;
+  const ctx = canvas.getContext('2d');
+  ctx.scale(scale, scale)
+  ctx.drawImage(img, 0, 0, img.width, img.height);
+  drawBottom(ctx, img.width, img.height, weather)
+  watermark.value = canvas.toDataURL();
+}
+
 let data = {year:props.photo.uploadDate.substring(0,4),
   monthDay:dateFormat(new Date(props.photo.uploadDate),'mm/dd'),
   address:props.photo.district.replaceAll("\"","") + props.photo.gardenName,
@@ -70,7 +86,22 @@ let data = {year:props.photo.uploadDate.substring(0,4),
   shotCode:props.photo.shotCode
 }
 // console.log(data)
-const drawBottom = (ctx, imgWidth, imgHeight) => {
+const drawBottom = (ctx, imgWidth, imgHeight, weather) => {
+  if(weather){
+    data["temp"] = weather.tempMin+"°C"
+    let fushe = "光照优"
+    if(weather.uvIndex > 5){
+      fushe = "辐射过高"
+    }else if(weather.uvIndex < 1){
+      fushe = "光照差"
+    }
+    data["fushe"] = fushe
+    let shidu = "湿度适宜"
+    if(weather.humidity < 10){
+      shidu = "干旱缺水"
+    }
+    data["shidu"] = shidu
+  }
   // 设置遮罩的高度为imgHeight的1/6
   const maskHeight = imgHeight / 4;
 

+ 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,

+ 1 - 1
src/views/home/map/samplePointLayer.js

@@ -93,7 +93,7 @@ class SamplePointLayer {
 
   initData(farmId, regionId){
     let that = this
-    VE_API.sample.list({farmId,regionId}).then(({data})=>{
+    VE_API.sample.list({farmId:766,regionId:2}).then(({data})=>{
       // data[0].status = 9
       let features = []
       for(let item of data){