albumCarousel.vue 11 KB

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