cropRecord.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div class="crop-record-page">
  3. <custom-header name="农情档案"></custom-header>
  4. <div class="farm-work-timeline">
  5. <div class="farm-work-item" v-for="(item, index) in farmWorkData" :key="index">
  6. <div class="timeline-left">
  7. <div class="timeline-dot"></div>
  8. <div class="timeline-line"></div>
  9. </div>
  10. <div class="timeline-right">
  11. <div class="farm-work-card" :class="['card-' + getRecordTypeText(item.speakTitleName), {'is-future': item.isFuture}]">
  12. <div class="type-box">{{ item.speakTitleName }}</div>
  13. <div class="farm-work-date" v-html="item.content.renderedContent"></div>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script setup>
  21. import CustomHeader from "@/components/customHeader.vue";
  22. import { ref, onMounted } from "vue";
  23. import { useRoute } from "vue-router";
  24. const route = useRoute();
  25. const cropRecordList = ref([]);
  26. onMounted(() => {
  27. getFarmWorkList();
  28. });
  29. const farmWorkData = ref([]);
  30. const typeObj = {
  31. 物候: "1",
  32. 异常: "2",
  33. 病虫: "3",
  34. 农事: "4",
  35. };
  36. const getRecordTypeText = (recordType) => {
  37. return typeObj[recordType];
  38. };
  39. const getFarmWorkList = () => {
  40. VE_API.container_phenology.getFarmSpeakInfo({ farmId: route.query.farmId }).then(({ data }) => {
  41. const res = data.filter((item) => item.content.hasException !== 0);
  42. farmWorkData.value = res || [];
  43. getPhenologyBroadcast();
  44. });
  45. };
  46. const getPhenologyBroadcast = () => {
  47. VE_API.container_phenology.phenologyBroadcast({ farmId: 93954 }).then(({ data }) => {
  48. farmWorkData.value.push({
  49. speakTitleName: "物候",
  50. isFuture: true,
  51. content: {
  52. renderedContent: data.content,
  53. },
  54. });
  55. });
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. .crop-record-page {
  60. width: 100%;
  61. min-height: 100vh;
  62. background: #f5f7fb;
  63. .farm-work-timeline {
  64. padding: 12px;
  65. height: calc(100% - 40px);
  66. .farm-work-item {
  67. display: flex;
  68. align-items: flex-start;
  69. position: relative;
  70. &:not(:last-child) {
  71. margin-bottom: 20px;
  72. }
  73. .timeline-left {
  74. display: flex;
  75. flex-direction: column;
  76. align-items: center;
  77. margin-right: 12px;
  78. position: relative;
  79. .timeline-dot {
  80. width: 6px;
  81. height: 6px;
  82. border-radius: 50%;
  83. border: 1px solid #2199f8;
  84. flex-shrink: 0;
  85. z-index: 1;
  86. }
  87. .timeline-line {
  88. width: 1px;
  89. height: 48px;
  90. background: #e5e6eb;
  91. position: absolute;
  92. top: 8px;
  93. }
  94. }
  95. .timeline-right {
  96. flex: 1;
  97. .farm-work-card {
  98. border: 1px solid #8bccff;
  99. border-radius: 4px;
  100. background: #f8fcff;
  101. padding: 12px;
  102. display: flex;
  103. align-items: center;
  104. color: #1d2129;
  105. font-size: 14px;
  106. line-height: 22px;
  107. display: flex;
  108. align-items: center;
  109. &.card-1 {
  110. border: 1px solid #8bccff;
  111. .type-box {
  112. background: #2199f8;
  113. }
  114. .farm-work-content {
  115. color: #2199f8;
  116. }
  117. }
  118. &.card-4 {
  119. border: 1px solid #ffbb83;
  120. .type-box {
  121. background: #ff953d;
  122. }
  123. .farm-work-content {
  124. color: #ff953d;
  125. }
  126. }
  127. &.card-2,
  128. &.card-3 {
  129. border: 1px solid #ff9c9c;
  130. .type-box {
  131. background: #fd7676;
  132. }
  133. .farm-work-content {
  134. color: #fd7676;
  135. }
  136. }
  137. &.is-future {
  138. padding: 0 12px;
  139. // opacity: 0.5;
  140. background: rgba(246, 250, 255, 0.5);
  141. .type-box {
  142. background: rgba(33, 153, 248, 0.5);
  143. }
  144. .farm-work-content {
  145. color: rgba(29, 33, 41, 0.5);
  146. }
  147. }
  148. .type-box {
  149. margin-right: 12px;
  150. padding: 0 5px;
  151. height: 20px;
  152. line-height: 20px;
  153. flex: none;
  154. font-size: 12px;
  155. color: #fff;
  156. border-radius: 0 4px 0 4px;
  157. }
  158. .farm-work-date {
  159. padding-right: 4px;
  160. &.is-future {
  161. // color: rgba(29, 33, 41, 0.5);
  162. }
  163. }
  164. .farm-work-desc {
  165. .farm-work-action {
  166. padding-right: 4px;
  167. }
  168. .farm-work-content {
  169. padding-right: 4px;
  170. }
  171. }
  172. }
  173. }
  174. &.is-estimated {
  175. .timeline-right {
  176. .farm-work-card {
  177. background: rgba(246, 250, 255, 0.5);
  178. border: 1px solid rgba(190, 218, 255, 0.5);
  179. .farm-work-date,
  180. .farm-work-desc {
  181. color: rgba(29, 33, 41, 0.5);
  182. }
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. </style>