clyg.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div>
  3. <Title title="产量预估">
  4. <template v-slot:title-slot>
  5. <div class="slot-right">
  6. <div class="btn" @click="toPage">
  7. <div :class="['yse-events', 'text']">全景化信息图</div>
  8. </div>
  9. </div>
  10. </template>
  11. </Title>
  12. <div class="content-box">
  13. <div class="box-header">总产量预计:{{ overlayShow?'***':obj.totalOutput }}斤</div>
  14. <div class="box-body">
  15. <div class="left">
  16. <div class="pie">
  17. <span class="num">{{ overlayShow?'***':obj.fruiting }}枝条</span><br />
  18. <span>挂果潜力</span>
  19. </div>
  20. </div>
  21. <div class="right">
  22. <div class="progress-box" v-for="(item, index) in list" :key="index">
  23. <div class="progress-text">
  24. <div class="name">
  25. {{ overlayShow?'品种'+(index+1):item.name }}
  26. <span>({{ overlayShow?'***':item.flowerCount }}/{{ overlayShow?'***':item.totalCount }}枝)</span>
  27. </div>
  28. <div class="number">{{ overlayShow?'***':item.output }}斤</div>
  29. </div>
  30. <div class="progress-bar">
  31. <div
  32. class="progress-bar-fill"
  33. :style="{
  34. width: (item.flowerCount / item.totalCount) * 100 + '%',
  35. }"
  36. ></div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <!-- 遮罩锁 -->
  42. <div class="overlay" v-show="overlayShow">
  43. <el-icon color="#fff" size="50px"><Lock /></el-icon>
  44. </div>
  45. <!-- <div class="box-footer">{{ obj.desc }}</div> -->
  46. </div>
  47. </div>
  48. </template>
  49. <script setup>
  50. import { onMounted, reactive, toRefs,ref,onBeforeUnmount } from "vue";
  51. import {useRouter} from "vue-router";
  52. import { useStore } from "vuex";
  53. import Title from "../../../components/title";
  54. // 在组件或全局监听器中监听自定义事件
  55. function handleStorageUpdate(e) {
  56. curGardenId.value = e.detail
  57. initData()
  58. }
  59. // 在组件或全局监听器中监听自定义事件
  60. window.addEventListener('storageChanged', handleStorageUpdate);
  61. // 组件销毁前移除监听
  62. onBeforeUnmount(()=>{
  63. window.removeEventListener('storageChanged', handleStorageUpdate);
  64. })
  65. // 遮罩锁
  66. const overlayShow = ref(true)
  67. const router = useRouter();
  68. const getters = useStore().getters;
  69. const curGardenId = ref(getters.userinfo.curGardenId);
  70. onMounted(() => {
  71. initData();
  72. });
  73. const infoObj = reactive({
  74. list: [],
  75. obj: {},
  76. });
  77. const { list, obj } = toRefs(infoObj);
  78. const initData = async () => {
  79. const { code, data } = await VE_API.znxy.outputCalc({ gardenId: curGardenId.value });
  80. infoObj.list = data.data;
  81. infoObj.obj = data;
  82. };
  83. const toPage = () =>{
  84. router.push({path:'/regionalInformation'})
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .content-box {
  89. width: 100%;
  90. height: calc(100% - 48px);
  91. padding: 10px 13px;
  92. box-sizing: border-box;
  93. position: relative;
  94. .box-header {
  95. background-image: url("@/assets/img/znxy/clyg_title_bg.png");
  96. background-repeat: no-repeat;
  97. background-size: 100% 100%;
  98. width: 270px;
  99. height: 24px;
  100. font-weight: normal;
  101. color: #03e4d7;
  102. line-height: 23px;
  103. padding-left: 12px;
  104. box-sizing: border-box;
  105. margin-top: 5px;
  106. }
  107. .box-body {
  108. width: 100%;
  109. height: calc(100% - 21px);
  110. display: flex;
  111. align-items: center;
  112. justify-content: space-between;
  113. padding-top: 8px;
  114. box-sizing: border-box;
  115. .left {
  116. width: 35%;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. .pie {
  121. width: 106px;
  122. height: 106px;
  123. background-image: url("@/assets/img/znxy/clyg_pie.png");
  124. background-repeat: no-repeat;
  125. background-size: 100% 100%;
  126. color: #35f5ff;
  127. box-sizing: border-box;
  128. text-align: center;
  129. font-size: 12px;
  130. .num {
  131. color: #ffffff;
  132. padding-top: 25px;
  133. margin-bottom: 2px;
  134. display: inline-block;
  135. }
  136. }
  137. }
  138. .right {
  139. width: 55%;
  140. height: 100%;
  141. color: #fff;
  142. .progress-box {
  143. width: 100%;
  144. height: 33.33%;
  145. .progress-text {
  146. display: flex;
  147. align-items: center;
  148. justify-content: space-between;
  149. margin-bottom: 7px;
  150. position: relative;
  151. .name {
  152. span {
  153. color: #03e4d7;
  154. }
  155. }
  156. .number {
  157. background: rgba(81, 233, 240, 0.2);
  158. border-radius: 12px;
  159. padding: 2px 8px;
  160. box-sizing: border-box;
  161. }
  162. &::before {
  163. content: "";
  164. position: absolute;
  165. left: -15px;
  166. width: 10px;
  167. height: 10px;
  168. background: #87d3d2;
  169. border-radius: 50%;
  170. }
  171. }
  172. .progress-bar {
  173. width: 100%;
  174. height: 9px;
  175. background: #095f5e;
  176. border-radius: 5px;
  177. overflow: hidden;
  178. .progress-bar-fill {
  179. height: 9px;
  180. background: linear-gradient(
  181. 93deg,
  182. rgba(7, 33, 38, 0.5),
  183. rgba(255, 255, 255, 0.5)
  184. );
  185. border-radius: 5px;
  186. width: 70%;
  187. }
  188. }
  189. }
  190. &.right > div.progress-box:nth-of-type(2) {
  191. .progress-text {
  192. .name {
  193. span {
  194. color: #b2ca7f;
  195. }
  196. }
  197. .number {
  198. background: rgba(114, 196, 26, 0.2);
  199. }
  200. &::before {
  201. background: #b9d086;
  202. }
  203. }
  204. .progress-bar {
  205. background: #466921;
  206. .progress-bar-fill {
  207. background: linear-gradient(
  208. 93deg,
  209. rgba(7, 33, 38, 0.5),
  210. rgba(255, 255, 255, 0.5)
  211. );
  212. }
  213. }
  214. }
  215. &.right > div.progress-box:nth-of-type(3) {
  216. .progress-text {
  217. .name {
  218. span {
  219. color: #d1a587;
  220. }
  221. }
  222. .number {
  223. background: rgba(242, 118, 29, 0.2);
  224. }
  225. &::before {
  226. background: #d0a486;
  227. }
  228. }
  229. .progress-bar {
  230. background: #6c3814;
  231. .progress-bar-fill {
  232. background: linear-gradient(
  233. 93deg,
  234. rgba(7, 33, 38, 0.5),
  235. rgba(255, 255, 255, 0.5)
  236. );
  237. }
  238. }
  239. }
  240. }
  241. }
  242. .overlay{
  243. position: absolute;
  244. top: 0;
  245. background: rgba(1, 18, 23,.7);
  246. width: 95%;
  247. height: 100%;
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. }
  252. .box-footer {
  253. width: 100%;
  254. height: 38px;
  255. background-image: url("@/assets/img/znxy/clyg_footer_bg.png");
  256. background-repeat: no-repeat;
  257. background-size: 100% 100%;
  258. font-size: 12px;
  259. color: #ffffff;
  260. box-sizing: border-box;
  261. padding: 3px 4px 0 4px;
  262. overflow: hidden;
  263. text-overflow: ellipsis;
  264. display: -webkit-box;
  265. -webkit-box-orient: vertical;
  266. -webkit-line-clamp: 2; /* 设置显示的行数 */
  267. }
  268. }
  269. .slot-right {
  270. width: 70%;
  271. cursor: pointer;
  272. display: flex;
  273. flex-direction: row;
  274. justify-content: right;
  275. align-items: center;
  276. padding-right: 12px;
  277. .btn {
  278. cursor: pointer;
  279. background: url("@/assets/img/tabs_btn3.png") no-repeat center center /
  280. 100% 100%;
  281. margin-right: 5px;
  282. color: rgba(180,255,251,.8);
  283. font-weight: bold;
  284. font-size: 15px;
  285. width: 124px;
  286. height: 32px;
  287. text-align: center;
  288. line-height: 32px;
  289. }
  290. }
  291. </style>