albumCarousel.vue 12 KB

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