albumCarousel.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <el-dialog
  3. v-model="dialogVisible"
  4. width="60%"
  5. align-center
  6. class="picture-preview-wrap v-dialog"
  7. :show-close="false"
  8. append-to-body
  9. @close="closeDialog"
  10. >
  11. <div class="picture-file">
  12. <div class="left-img">
  13. <!-- v-loading="isLoadingImg" element-loading-background="rgba(0, 0, 0, 0.3)" -->
  14. <album-carousel-item
  15. lbum-carousel-item
  16. v-if="images"
  17. :key="nameRef"
  18. :name="nameRef"
  19. :farmId="farmId"
  20. :images="images"
  21. :lock="lock"
  22. ></album-carousel-item>
  23. </div>
  24. <div class="file-wrap">
  25. <div class="file-title">
  26. <img src="@/assets/images/common/chart-yellow.png" alt="" />
  27. 果树档案
  28. </div>
  29. <div class="overview-file">
  30. <div class="box-title">总体档案</div>
  31. <div class="base-data">
  32. <div class="base-item" v-for="item in photoBaseData" :key="item.label">
  33. <span class="label">{{ item.label }}</span>
  34. <div class="value">{{ item.value }}</div>
  35. </div>
  36. </div>
  37. <div class="list">
  38. <div class="list-item" v-for="item in photoList" :key="item.key">
  39. <div class="list-name">
  40. <img src="@/assets/images/common/title-icon.png" alt="" />
  41. {{ item.key }}
  42. </div>
  43. {{ item.statement }}
  44. </div>
  45. </div>
  46. </div>
  47. <div class="overview-file">
  48. <div class="box-title">产量详情</div>
  49. <div class="box-wrap">
  50. <div
  51. class="box-item"
  52. v-for="(item, index) in outputBox"
  53. :key="index"
  54. @click="toggleAcitve(item.name)"
  55. :class="{ active: activeOuput === item.name }"
  56. >
  57. <div class="item-name">{{ item.name }}</div>
  58. <div class="item-val">{{ item.value }}</div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="overview-file">
  63. <div class="box-title">质量详情</div>
  64. <div class="box-wrap">
  65. <div
  66. class="box-item"
  67. v-for="(item, index) in qualityBox"
  68. :key="index"
  69. @click="toggleAcitve(item.name)"
  70. :class="{ active: activeOuput === item.name }"
  71. >
  72. <div class="item-name">{{ item.name }}</div>
  73. <div class="item-val">{{ item.value }}</div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </el-dialog>
  80. </template>
  81. <script setup>
  82. import { ref, computed, onMounted, onUnmounted } from "vue";
  83. import "./cacheImg.js";
  84. import AlbumCarouselItem from "./albumCarouselItem";
  85. import { dateFormat } from "@/utils/date_util.js";
  86. import eventBus from "@/api/eventBus";
  87. const lock = ref(false);
  88. const farmId = ref(766);
  89. const nameRef = ref("");
  90. const isLoadingImg = ref(true)
  91. const images = ref(null);
  92. const dialogVisible = ref(false);
  93. // 获取当前日期
  94. const currentDate = new Date();
  95. // 获取当前日期的前一个月
  96. const startDate = new Date(currentDate);
  97. startDate.setMonth(currentDate.getMonth() - 1);
  98. // 格式化日期
  99. const formattedStartDate = dateFormat(startDate, "YY-mm-dd");
  100. const formattedEndDate = dateFormat(currentDate, "YY-mm-dd");
  101. eventBus.on("change:watermark",function(name){
  102. nameRef.value = name
  103. })
  104. const outputBox = ref([
  105. { id: 1, name: "花穗率", value: "" },
  106. { id: 2, name: "总枝条数", value: "" },
  107. { id: 3, name: "开花率", value: "" },
  108. { id: 4, name: "雄花比例", value: "" },
  109. ]);
  110. const qualityBox = ref([
  111. { id: 5, name: "通风率", value: "" },
  112. { id: 6, name: "透光率", value: "" },
  113. { id: 7, name: "地形条件", value: "" },
  114. ]);
  115. eventBus.on("click:point",function({farmId,sampleId, data}){
  116. sampleId = data.id;
  117. isLoadingImg.value = true
  118. let params = {sampleId,farmId}
  119. VE_API.miniimage.list(params).then(res => {
  120. if(res.code === 0){
  121. dialogVisible.value = true
  122. images.value = res.data
  123. isLoadingImg.value = false
  124. }
  125. })
  126. photoBaseData.value[0].value = data.pz;
  127. photoBaseData.value[1].value = data.sgbmj + "平方米";
  128. photoBaseData.value[2].value = data.cl + "斤";
  129. photoBaseData.value[3].value = data.spgl + "%";
  130. outputBox.value[0].value = data.hsl ? (data.hsl + "%") : "--";
  131. outputBox.value[1].value = data.zzts? data.zzts : "--";
  132. outputBox.value[2].value = data.khl? (data.khl + "%") : "--";
  133. outputBox.value[3].value = data.xhl? (data.xhl + "%") : "--";
  134. qualityBox.value[0].value = data.tfl? (data.tfl + "%") : "--";
  135. qualityBox.value[1].value = data.tgl? (data.tgl + "%") : "--";
  136. qualityBox.value[2].value = data.dxtj? (data.dxtj + "%") : "--";
  137. })
  138. eventBus.off("albumCarousel", toggleActiveImg);
  139. eventBus.on("albumCarousel", toggleActiveImg);
  140. const currentIndex = ref(0);
  141. function toggleActiveImg(index) {
  142. currentIndex.value = index;
  143. }
  144. const getSampleFiles = (geoHash) => {
  145. photoList.value = [];
  146. VE_API.mini_farm.getSampleFiles({ geoHashSample: geoHash }).then((res) => {
  147. photoBaseData.value[0].value = res.data.meta_info.type_id;
  148. photoBaseData.value[1].value = res.data.meta_info.crown + "平方米";
  149. photoBaseData.value[2].value = res.data.meta_info.production + "斤";
  150. photoBaseData.value[3].value = res.data.meta_info.quality + "%";
  151. photoList.value.push(res.data.dp_alert_info);
  152. photoList.value.push(res.data.grow_alert_info);
  153. photoList.value.push(res.data.nutrition_info);
  154. });
  155. };
  156. const photoBaseData = ref([
  157. {
  158. label: "品种",
  159. value: "桂味",
  160. },
  161. {
  162. label: "冠幅",
  163. value: "10米",
  164. },
  165. {
  166. label: "预估产量",
  167. value: "2000斤",
  168. },
  169. {
  170. label: "高质果率",
  171. value: "72棵",
  172. },
  173. ]);
  174. const photoList = ref([
  175. {key: "病虫", statement: "病虫 2025年02月19日,发现毛毡病异常1级"},
  176. {key: "异常", statement: "2025年03月17日,发现花量大异常3级"},
  177. {key: "营养", statement: "无营养异常"},
  178. ]);
  179. const activeOuput = ref(null);
  180. // 产量详情
  181. function toggleAcitve(name) {
  182. activeOuput.value = name;
  183. if (name.indexOf("开花") > -1) {
  184. eventBus.emit("change:watermark", "开花目标框")
  185. } else if (name.indexOf("花穗") > -1) {
  186. eventBus.emit("change:watermark", "花穗目标框")
  187. } else if (name.indexOf("雄花") > -1) {
  188. eventBus.emit("change:watermark", "雄花目标框")
  189. } else if (name.indexOf("枝条数") > -1) {
  190. eventBus.emit("change:watermark", "")
  191. } else {
  192. eventBus.emit("change:watermark", "")
  193. }
  194. }
  195. function closeDialog() {
  196. activeOuput.value = null
  197. eventBus.emit("change:watermark", "")
  198. }
  199. // 质量详情
  200. function toggleQualityAcitve() {
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. @import "src/styles/index";
  205. .picture-file {
  206. display: flex;
  207. .left-img {
  208. min-width: 500px;
  209. min-height: 300px;
  210. }
  211. .file-wrap {
  212. background: url("@/assets/images/home/file-bg.png") no-repeat top center / 100% 100%;
  213. margin-left: 12px;
  214. padding: 12px;
  215. .file-title {
  216. font-size: 20px;
  217. color: #ffd489;
  218. }
  219. .overview-file {
  220. padding-top: 20px;
  221. .box-title {
  222. font-size: 16px;
  223. padding-left: 13px;
  224. margin-bottom: 16px;
  225. position: relative;
  226. display: flex;
  227. justify-content: space-between;
  228. color: #fff;
  229. &::before {
  230. content: "";
  231. position: absolute;
  232. left: 0;
  233. top: 3px;
  234. width: 3px;
  235. height: 16px;
  236. background: #fff;
  237. border-radius: 11px;
  238. }
  239. }
  240. .title {
  241. color: #f3c11d;
  242. font-size: 16px;
  243. font-family: "PangMenZhengDao";
  244. margin-bottom: 20px;
  245. .big {
  246. width: 13px;
  247. height: 13px;
  248. margin: -10px 0 0 4px;
  249. }
  250. .small {
  251. width: 7px;
  252. height: 7px;
  253. margin-left: -3px;
  254. }
  255. }
  256. .base-data {
  257. background: rgba(207, 207, 207, 0.1);
  258. border-radius: 4px;
  259. padding: 6px 0;
  260. display: flex;
  261. .base-item {
  262. flex: 1;
  263. text-align: center;
  264. .label {
  265. font-size: 12px;
  266. color: #666666;
  267. }
  268. .value {
  269. padding-top: 2px;
  270. font-size: 16px;
  271. color: #ffffff;
  272. }
  273. }
  274. .base-item + .base-item {
  275. border-left: 1px solid rgba(102, 102, 102, 0.42);
  276. }
  277. }
  278. .list {
  279. margin-top: 15px;
  280. width: max-content;
  281. font-size: 14px;
  282. .list-item {
  283. color: #bbbbbb;
  284. display: flex;
  285. margin-bottom: 8px;
  286. .list-name {
  287. color: #f3c11d;
  288. margin-right: 6px;
  289. img {
  290. width: 17px;
  291. height: 13px;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. .overview-file + .overview-file {
  298. margin-top: 8px;
  299. }
  300. .box-wrap {
  301. display: flex;
  302. .box-item {
  303. flex: 1;
  304. display: flex;
  305. flex-direction: column;
  306. justify-content: center;
  307. align-items: center;
  308. padding: 16px;
  309. background: rgba(207, 207, 207, 0.1);
  310. border-radius: 4px;
  311. border: 1px solid rgba(207, 207, 207, 0.1);
  312. cursor: pointer;
  313. .item-name {
  314. font-size: 12px;
  315. color: #666666;
  316. width: max-content;
  317. }
  318. .item-val {
  319. font-size: 18px;
  320. color: #fff;
  321. width: max-content;
  322. padding-top: 3px;
  323. }
  324. &.active {
  325. background: rgba(255, 212, 137, 0.16);
  326. border: 1px solid #ffd489;
  327. .item-name {
  328. color: #bbbbbb;
  329. }
  330. }
  331. }
  332. .box-item + .box-item {
  333. margin-left: 8px;
  334. }
  335. }
  336. }
  337. }
  338. </style>
  339. <style lang="scss">
  340. .picture-preview-wrap {
  341. background: none;
  342. }
  343. </style>