albumCarousel.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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. { id: 3, name: "雌花比例", value: "" },
  109. ]);
  110. const qualityBox = ref([
  111. { id: 5, name: "通风率", value: "" },
  112. { id: 6, name: "透光率", value: "" },
  113. { id: 7, name: "病虫比例", value: "" },
  114. ]);
  115. const showTag = ref(false)
  116. eventBus.on("click:point",function({farmId,sampleId, data}){
  117. sampleId = data.id;
  118. getSampleFiles(data.geoHashSample);
  119. photoBaseData.value[0].value = data.pz;
  120. isLoadingImg.value = true
  121. let startDate = new Date(currentDate);
  122. startDate.setMonth(currentDate.getMonth() - 2);
  123. // 格式化日期
  124. let params = {sampleId,farmId,startDate:dateFormat(startDate, "YY-mm-dd")}
  125. VE_API.miniimage.list(params).then(res => {
  126. if(res.code === 0){
  127. dialogVisible.value = true
  128. images.value = res.data
  129. isLoadingImg.value = false
  130. }
  131. })
  132. showTag.value = data.nonghu == 1 ? true : false
  133. // photoBaseData.value[0].value = data.pz;
  134. // photoBaseData.value[1].value = data?.sgbmj ? data?.sgbmj + "平方米" : "--";
  135. // photoBaseData.value[2].value = data?.zzts ? data.zzts + "" : "--";
  136. // photoBaseData.value[3].value = data?.sl ? data?.sl + "年" : "--";
  137. // outputBox.value[0].value = data?.cl ? (data.cl + "斤") : "--";
  138. // outputBox.value[1].value = data?.spgl? (data.spgl + "%") : "--";
  139. // qualityBox.value[0].value = data?.tfl? (data.tfl + "%") : "--";
  140. // qualityBox.value[1].value = data?.tgl? (data.tgl + "%") : "--";
  141. // qualityBox.value[2].value = data?.dxtj? (data.dxtj + "%") : "--";
  142. })
  143. eventBus.off("albumCarousel", toggleActiveImg);
  144. eventBus.on("albumCarousel", toggleActiveImg);
  145. const currentIndex = ref(0);
  146. function toggleActiveImg(index) {
  147. currentIndex.value = index;
  148. }
  149. const getSampleFiles = (geoHash) => {
  150. // photoList.value = [];
  151. VE_API.mini_farm.getSampleFiles({ geoHashSample: geoHash }).then(({data}) => {
  152. photoBaseData.value[0].value = data.meta_info.type_id;
  153. let pj = "--"
  154. if(data.meta_info.crown){
  155. pj = Math.sqrt(data.meta_info.crown * 1.2).toFixed(1);
  156. }
  157. photoBaseData.value[1].value = data.meta_info.crown + "平方米(蓬径"+pj+"米)";
  158. photoBaseData.value[2].value = data.meta_info.branch_num ;
  159. photoBaseData.value[3].value = data.meta_info.age + "年"
  160. photoList.value[0].key = data.meta_info.dp_alert_info.key
  161. photoList.value[0].statement = data.meta_info.dp_alert_info.statement
  162. photoList.value[1].key = data.meta_info.grow_alert_info.key
  163. photoList.value[1].statement = data.meta_info.grow_alert_info.statement
  164. photoList.value[2].key = data.meta_info.nutrition_info.key
  165. photoList.value[2].statement = data.meta_info.nutrition_info.statement
  166. photoList.value[3].key = data.meta_info.prescription_info.key
  167. photoList.value[3].statement = data.meta_info.prescription_info.statement
  168. // if(data.production_info.production){
  169. // data.production_info.production = (data.production_info.production * 1.3).toFixed(1)
  170. // }
  171. outputBox.value[0].value = data.production_info.production + "斤"
  172. outputBox.value[1].value = data.production_info.quality.toFixed(0) + "%"
  173. outputBox.value[2].value = data.production_info.cihua_ratio.toFixed(0) + "%"
  174. qualityBox.value[0].value = data.ecology_info.ventilation + "%"
  175. qualityBox.value[1].value = data.ecology_info.transmittance + "%"
  176. qualityBox.value[2].value = data.ecology_info.dp_situation+"%"
  177. });
  178. };
  179. const photoBaseData = ref([
  180. {
  181. label: "品种",
  182. value: "--",
  183. },
  184. {
  185. label: "冠幅表面积",
  186. value: "--",
  187. },
  188. {
  189. label: "总枝条",
  190. value: "--",
  191. },
  192. {
  193. label: "树龄",
  194. value: "--",
  195. },
  196. ]);
  197. const photoList = ref([
  198. {key: "病虫", statement: "--"},
  199. {key: "异常", statement: "--"},
  200. {key: "营养", statement: "--"},
  201. {key: "农事", statement: "--"},
  202. ]);
  203. const activeOuput = ref(null);
  204. // 产量详情
  205. function toggleAcitve(name) {
  206. activeOuput.value = name;
  207. if (name.indexOf("开花") > -1) {
  208. eventBus.emit("change:watermark", "开花目标框")
  209. } else if (name.indexOf("花穗") > -1) {
  210. eventBus.emit("change:watermark", "花穗目标框")
  211. } else if (name.indexOf("雄花") > -1) {
  212. eventBus.emit("change:watermark", "雄花目标框")
  213. } else if (name.indexOf("枝条数") > -1) {
  214. eventBus.emit("change:watermark", "")
  215. } else {
  216. eventBus.emit("change:watermark", "")
  217. }
  218. }
  219. function closeDialog() {
  220. activeOuput.value = null
  221. eventBus.emit("change:watermark", "")
  222. eventBus.emit("resetImgIndex")
  223. }
  224. // 质量详情
  225. function toggleQualityAcitve() {
  226. }
  227. </script>
  228. <style lang="scss" scoped>
  229. @import "src/styles/index";
  230. .picture-file {
  231. display: flex;
  232. .left-img {
  233. min-width: 780px;
  234. min-height: 300px;
  235. }
  236. .file-wrap {
  237. background: url("@/assets/images/home/file-bg.png") no-repeat top center / 100% 100%;
  238. margin-left: 12px;
  239. padding: 12px;
  240. .file-title {
  241. font-size: 20px;
  242. color: #ffd489;
  243. display: flex;
  244. align-items: center;
  245. .tag {
  246. border: 1px solid #FFD489;
  247. border-radius: 4px;
  248. font-size: 12px;
  249. display: inline-block;
  250. width: 44px;
  251. height: 20px;
  252. text-align: center;
  253. line-height: 18px;
  254. margin-left: 3px;
  255. padding: 1px 4px;
  256. }
  257. }
  258. .overview-file {
  259. padding-top: 20px;
  260. .box-title {
  261. font-size: 16px;
  262. padding-left: 13px;
  263. margin-bottom: 16px;
  264. position: relative;
  265. display: flex;
  266. justify-content: space-between;
  267. color: #fff;
  268. &::before {
  269. content: "";
  270. position: absolute;
  271. left: 0;
  272. top: 3px;
  273. width: 3px;
  274. height: 16px;
  275. background: #fff;
  276. border-radius: 11px;
  277. }
  278. }
  279. .title {
  280. color: #f3c11d;
  281. font-size: 16px;
  282. font-family: "PangMenZhengDao";
  283. margin-bottom: 20px;
  284. .big {
  285. width: 13px;
  286. height: 13px;
  287. margin: -10px 0 0 4px;
  288. }
  289. .small {
  290. width: 7px;
  291. height: 7px;
  292. margin-left: -3px;
  293. }
  294. }
  295. .base-data {
  296. background: rgba(207, 207, 207, 0.1);
  297. border-radius: 4px;
  298. padding: 6px 0;
  299. display: flex;
  300. .base-item {
  301. flex: 1;
  302. text-align: center;
  303. .label {
  304. font-size: 12px;
  305. color: #666666;
  306. }
  307. .value {
  308. padding-top: 2px;
  309. font-size: 16px;
  310. color: #ffffff;
  311. }
  312. }
  313. .base-item + .base-item {
  314. border-left: 1px solid rgba(102, 102, 102, 0.42);
  315. }
  316. }
  317. .list {
  318. margin-top: 15px;
  319. width: max-content;
  320. font-size: 14px;
  321. .list-item {
  322. color: #bbbbbb;
  323. display: flex;
  324. margin-bottom: 8px;
  325. .list-name {
  326. color: #f3c11d;
  327. margin-right: 6px;
  328. img {
  329. width: 17px;
  330. height: 13px;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. .overview-file + .overview-file {
  337. margin-top: 8px;
  338. }
  339. .box-wrap {
  340. display: flex;
  341. .box-item {
  342. min-width: 140px;
  343. box-sizing: border-box;
  344. display: flex;
  345. flex-direction: column;
  346. justify-content: center;
  347. align-items: center;
  348. padding: 6px;
  349. background: rgba(207, 207, 207, 0.1);
  350. border-radius: 4px;
  351. border: 1px solid rgba(207, 207, 207, 0.1);
  352. cursor: pointer;
  353. .item-name {
  354. font-size: 12px;
  355. color: #666666;
  356. width: max-content;
  357. }
  358. .item-val {
  359. font-size: 18px;
  360. color: #fff;
  361. width: max-content;
  362. padding-top: 3px;
  363. }
  364. &.active {
  365. background: rgba(255, 212, 137, 0.16);
  366. border: 1px solid #ffd489;
  367. .item-name {
  368. color: #bbbbbb;
  369. }
  370. }
  371. }
  372. .box-item + .box-item {
  373. margin-left: 8px;
  374. }
  375. }
  376. }
  377. }
  378. </style>
  379. <style lang="scss">
  380. .picture-preview-wrap {
  381. background: none;
  382. }
  383. </style>