| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- <template>
- <el-dialog
- v-model="dialogVisible"
- width="60%"
- align-center
- class="picture-preview-wrap v-dialog"
- :show-close="false"
- append-to-body
- >
- <div class="picture-file">
- <album-carousel-item
- lbum-carousel-item
- v-if="images"
- :key="nameRef"
- :name="nameRef"
- :farmId="farmId"
- :images="images"
- :lock="lock"
- ></album-carousel-item>
- <div class="file-wrap">
- <div class="file-title">
- <img src="@/assets/images/common/chart-yellow.png" alt="" />
- 果树档案
- </div>
- <div class="overview-file">
- <div class="box-title">总体档案</div>
- <div class="base-data">
- <div class="base-item" v-for="item in photoBaseData" :key="item.label">
- <span class="label">{{ item.label }}</span>
- <div class="value">{{ item.value }}</div>
- </div>
- </div>
- <div class="list">
- <div class="list-item" v-for="item in photoList" :key="item.key">
- <div class="list-name">
- <img src="@/assets/images/common/title-icon.png" alt="" />
- {{ item.key }}
- </div>
- {{ item.statement }}
- </div>
- </div>
- </div>
- <div class="overview-file" v-if="images && images.length && images[currentIndex]?.detail1">
- <div class="box-title">产量详情</div>
- <div class="box-wrap">
- <div
- class="box-item"
- v-for="(value, key) in images[currentIndex].detail1"
- :key="key"
- @click="toggleAcitve(key)"
- :class="{ active: activeOuput === key }"
- >
- <div class="item-name">{{ key }}</div>
- <div class="item-val">{{ value }}{{ key !== "总枝条数" ? "%" : "" }}</div>
- </div>
- </div>
- </div>
- <div class="overview-file" v-if="images && images.length && images[currentIndex]?.detail2">
- <div class="box-title">质量详情</div>
- <div class="box-wrap">
- <div
- class="box-item"
- v-for="(value, key) in images[currentIndex].detail2"
- :key="key"
- @click="toggleAcitve(key)"
- :class="{ active: activeOuput === key }"
- >
- <div class="item-name">{{ key }}</div>
- <div class="item-val">{{ value }}%</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </el-dialog>
- </template>
- <script setup>
- import { ref, computed, onMounted, onUnmounted } from "vue";
- import "./cacheImg.js";
- 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 nameRef = ref("");
- const images = ref(null);
- const dialogVisible = ref(false);
- // 获取当前日期
- const currentDate = new Date();
- // 获取当前日期的前一个月
- const startDate = new Date(currentDate);
- startDate.setMonth(currentDate.getMonth() - 1);
- // 格式化日期
- const formattedStartDate = dateFormat(startDate, "YY-mm-dd");
- const formattedEndDate = dateFormat(currentDate, "YY-mm-dd");
- eventBus.on("click:point", function ({ farmId, sampleId, geoHash }) {
- let params = { sampleId, farmId, geoHash };
- console.log("geoHash", geoHash);
- getSampleFiles(geoHash);
- VE_API.miniimage.list(params).then((res) => {
- if (res.code === 0) {
- res.data.map((item) => {
- item.detail1 = { 总枝条数: "11000", 开花率: "56", 雄花比例: "38", 花穗率: "78" };
- item.detail2 = {
- 地形条件: "81",
- 透光率: "66",
- 通风率: "78",
- };
- });
- images.value = res.data;
- dialogVisible.value = true;
- console.log("images", images.value);
- }
- });
- });
- eventBus.on("change:watermark",function(name){
- nameRef.value = name
- })
- eventBus.on("click:point",function({farmId,sampleId}){
- let params = {sampleId,farmId}
- VE_API.miniimage.list(params).then(res => {
- if(res.code === 0){
- images.value = res.data
- dialogVisible.value = true
- }
- })
- })
- eventBus.off("albumCarousel", toggleActiveImg);
- eventBus.on("albumCarousel", toggleActiveImg);
- const currentIndex = ref(0);
- function toggleActiveImg(index) {
- currentIndex.value = index;
- }
- const getSampleFiles = (geoHash) => {
- photoList.value = [];
- VE_API.mini_farm.getSampleFiles({ geoHashSample: geoHash }).then((res) => {
- photoBaseData.value[0].value = res.data.meta_info.type_id;
- photoBaseData.value[1].value = res.data.meta_info.crown + "米";
- photoBaseData.value[2].value = res.data.meta_info.production + "斤";
- photoBaseData.value[3].value = res.data.meta_info.quality + "%";
- photoList.value.push(res.data.dp_alert_info);
- photoList.value.push(res.data.grow_alert_info);
- photoList.value.push(res.data.nutrition_info);
- });
- };
- const photoBaseData = ref([
- {
- label: "品种",
- value: "桂味",
- },
- {
- label: "冠幅",
- value: "10米",
- },
- {
- label: "预估产量",
- value: "2000斤",
- },
- {
- label: "高质果率",
- value: "72棵",
- },
- ]);
- const photoList = ref([
- { key: "营养", statement: "营养老熟 延迟,12月10日 末次老熟" },
- { key: "病虫", statement: "2月3日爆发啃食类虫害。" },
- { key: "异常", statement: "1月3日,花带叶30%。3月4日,花量过大。" },
- ]);
- const activeOuput = ref(1);
- const outputBox = ref([
- { id: 1, name: "花穗率", value: "78%" },
- { id: 2, name: "总枝条数", value: "11000" },
- { id: 3, name: "开花率", value: "56%" },
- { id: 4, name: "雄花比例", value: "38%" },
- ]);
- const qualityBox = ref([
- { id: 5, name: "通风率", value: "78%" },
- { id: 6, name: "透光率", value: "66%" },
- { id: 7, name: "地形条件", value: "81%" },
- ]);
- function toggleAcitve(id) {
- activeOuput.value = id;
- }
- </script>
- <style lang="scss" scoped>
- @import "src/styles/index";
- .picture-file {
- display: flex;
- .file-wrap {
- background: url("@/assets/images/home/file-bg.png") no-repeat top center / 100% 100%;
- margin-left: 12px;
- padding: 12px;
- .file-title {
- font-size: 20px;
- color: #ffd489;
- }
- .overview-file {
- padding-top: 20px;
- .box-title {
- font-size: 16px;
- padding-left: 13px;
- margin-bottom: 16px;
- position: relative;
- display: flex;
- justify-content: space-between;
- color: #fff;
- &::before {
- content: "";
- position: absolute;
- left: 0;
- top: 3px;
- width: 3px;
- height: 16px;
- background: #fff;
- border-radius: 11px;
- }
- }
- .title {
- color: #f3c11d;
- font-size: 16px;
- font-family: "PangMenZhengDao";
- margin-bottom: 20px;
- .big {
- width: 13px;
- height: 13px;
- margin: -10px 0 0 4px;
- }
- .small {
- width: 7px;
- height: 7px;
- margin-left: -3px;
- }
- }
- .base-data {
- background: rgba(207, 207, 207, 0.1);
- border-radius: 4px;
- padding: 6px 0;
- display: flex;
- .base-item {
- flex: 1;
- text-align: center;
- .label {
- font-size: 12px;
- color: #666666;
- }
- .value {
- padding-top: 2px;
- font-size: 16px;
- color: #ffffff;
- }
- }
- .base-item + .base-item {
- border-left: 1px solid rgba(102, 102, 102, 0.42);
- }
- }
- .list {
- margin-top: 15px;
- width: max-content;
- font-size: 14px;
- .list-item {
- color: #bbbbbb;
- display: flex;
- margin-bottom: 8px;
- .list-name {
- color: #f3c11d;
- margin-right: 6px;
- img {
- width: 17px;
- height: 13px;
- }
- }
- }
- }
- }
- .overview-file + .overview-file {
- margin-top: 8px;
- }
- .box-wrap {
- display: flex;
- .box-item {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 16px;
- background: rgba(207, 207, 207, 0.1);
- border-radius: 4px;
- border: 1px solid rgba(207, 207, 207, 0.1);
- cursor: pointer;
- .item-name {
- font-size: 12px;
- color: #666666;
- width: max-content;
- }
- .item-val {
- font-size: 18px;
- color: #fff;
- width: max-content;
- padding-top: 3px;
- }
- &.active {
- background: rgba(255, 212, 137, 0.16);
- border: 1px solid #ffd489;
- .item-name {
- color: #bbbbbb;
- }
- }
- }
- .box-item + .box-item {
- margin-left: 8px;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .picture-preview-wrap {
- background: none;
- }
- </style>
|