index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <custom-header name="农场详情" bgColor="#f2f3f5"></custom-header>
  3. <div class="farm-details-page">
  4. <div class="tab-wrapper">
  5. <div v-for="tab in tabs" :key="tab.key" class="tab-item"
  6. :class="{ 'tab-item--active': activeTab === tab.key }" @click="activeTab = tab.key">
  7. {{ tab.label }}
  8. </div>
  9. </div>
  10. <!-- 作物档案 -->
  11. <div class="archives-time-line" v-show="activeTab === 'crop'">
  12. <div class="archives-time-line-header" @click="handleJump">
  13. <div class="line-title">作物档案</div>
  14. <div class="filter-wrapper">
  15. <el-date-picker style="width: 110px" v-model="date" type="year" placeholder="全部日期" />
  16. </div>
  17. </div>
  18. <!-- 品种选择 -->
  19. <div class="variety-tabs">
  20. <div
  21. v-for="v in varietyTabs"
  22. :key="v.key"
  23. class="variety-tab"
  24. :class="{ 'variety-tab--active': activeVariety === v.key }"
  25. @click="activeVariety = v.key"
  26. >
  27. {{ v.label }}
  28. </div>
  29. </div>
  30. <div class="archives-time-line-content">
  31. <div class="report-box" v-if="hasReport">
  32. <div class="box-content">
  33. <div class="box-title" @click="handleReportClick">
  34. <span>农情互动报告</span>
  35. <el-icon>
  36. <CaretRight />
  37. </el-icon>
  38. </div>
  39. <span class="box-text">根据近期农情采集情况</span>
  40. </div>
  41. <img src="@/assets/img/monitor/report-icon.png" alt="" class="report-icon" />
  42. </div>
  43. <div class="time-line" :class="{ 'no-report': !hasReport }">
  44. <archives-farm-time-line :farmId="farmId"></archives-farm-time-line>
  45. </div>
  46. </div>
  47. </div>
  48. <!-- 农场信息 -->
  49. <div class="farm-info" v-show="activeTab === 'farm'">
  50. <div class="map"></div>
  51. <div class="info-box">
  52. <div class="line-title">基本信息</div>
  53. <div class="info-list">
  54. <div class="info-row">
  55. <span class="info-label">农场名称:</span>
  56. <span class="info-value">{{ farmInfo.name }}</span>
  57. </div>
  58. <div class="info-row">
  59. <span class="info-label">联系人:</span>
  60. <span class="info-value">{{ farmInfo.contact }}</span>
  61. </div>
  62. <div class="info-row">
  63. <span class="info-label">联系电话:</span>
  64. <span class="info-value">{{ farmInfo.phone }}</span>
  65. </div>
  66. <div class="info-row">
  67. <span class="info-label">种植作物:</span>
  68. <div class="info-value crop-tags">
  69. <span v-for="crop in farmInfo.crops" :key="crop" class="crop-tag">
  70. {{ crop }}
  71. </span>
  72. </div>
  73. </div>
  74. <div class="info-row">
  75. <span class="info-label">农场位置:</span>
  76. <span class="info-value">{{ farmInfo.location }}</span>
  77. </div>
  78. </div>
  79. </div>
  80. <el-divider class="info-divider" />
  81. <div class="info-box">
  82. <div class="line-title">农场设施</div>
  83. <div class="info-list">
  84. <div class="info-row">
  85. <span class="info-label">土壤类型:</span>
  86. <span class="info-value">砂质土</span>
  87. </div>
  88. <div class="info-row">
  89. <span class="info-label">灌溉方式:</span>
  90. <div class="info-value crop-tags">
  91. <span v-for="crop in farmInfo.crops" :key="crop" class="crop-tag">
  92. {{ crop }}
  93. </span>
  94. </div>
  95. </div>
  96. <div class="info-row info-row-column">
  97. <span class="info-label">农机设备:</span>
  98. <div class="info-value">
  99. <div class="device-box">
  100. <div
  101. class="device-item"
  102. v-for="device in farmDevices"
  103. :key="device.id"
  104. >
  105. <span class="device-name">{{ device.name }}</span>
  106. <span class="device-count">{{ device.count }}架</span>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="info-row info-row-column">
  112. <span class="info-label">希望改善问题:</span>
  113. <div class="info-value problem-tags">
  114. <span
  115. v-for="item in improveProblems"
  116. :key="item"
  117. class="problem-tag"
  118. >
  119. {{ item }}
  120. </span>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. <script setup>
  129. import { ref, onMounted } from "vue";
  130. import { useRouter } from "vue-router";
  131. import customHeader from "@/components/customHeader.vue";
  132. import ArchivesFarmTimeLine from "@/components/pageComponents/ArchivesFarmTimeLine.vue";
  133. const router = useRouter();
  134. const tabs = [
  135. { key: "crop", label: "作物档案" },
  136. { key: "farm", label: "农场信息" },
  137. ];
  138. const handleReportClick = () => {
  139. router.push("/farm_picture");
  140. }
  141. const activeTab = ref("crop");
  142. // 品种选择(作物档案内)
  143. const varietyTabs = [
  144. { key: "feizixiao", label: "妃子笑" },
  145. { key: "guiwei", label: "桂味" },
  146. { key: "nuomici", label: "糯米糍" },
  147. { key: "xiantaofang", label: "仙桃芳" },
  148. ];
  149. const activeVariety = ref("feizixiao");
  150. const farmInfo = {
  151. name: "从化荔博园",
  152. contact: "张扬",
  153. phone: "19871533125",
  154. crops: ["桂味", "糯米糍", "井岗红糯"],
  155. location: "广东省广州市从化区某某街道",
  156. };
  157. const farmDevices = [
  158. { id: 1, name: "植保无人机", count: 10 },
  159. { id: 2, name: "植保无人机", count: 10 },
  160. { id: 3, name: "植保无人机", count: 10 },
  161. { id: 4, name: "植保无人机", count: 10 },
  162. { id: 5, name: "植保无人机", count: 10 },
  163. { id: 6, name: "植保无人机", count: 10 },
  164. ];
  165. const improveProblems = ["土壤改良", "树势增强", "品质提升"];
  166. // onMounted(() => {
  167. // getReport();
  168. // });
  169. const date = ref(new Date());
  170. const farmId = ref(766);
  171. const hasReport = ref(true);
  172. const getReport = () => {
  173. VE_API.farm.growthReportByFarm({ farmId: farmId.value, limit: 20 }).then(({ data }) => {
  174. if (data && data.length > 0) {
  175. hasReport.value = true;
  176. } else {
  177. hasReport.value = false;
  178. }
  179. });
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .farm-details-page {
  184. background: #f2f3f5;
  185. height: 100vh;
  186. padding: 10px 12px;
  187. .tab-wrapper {
  188. display: flex;
  189. align-items: center;
  190. gap: 8px;
  191. .tab-item {
  192. padding: 5px 12px;
  193. border-radius: 25px;
  194. color: #8B8B8B;
  195. background: #F7F8FA;
  196. }
  197. .tab-item--active {
  198. background: #1990ff;
  199. color: #ffffff;
  200. }
  201. }
  202. .line-title {
  203. position: relative;
  204. padding-left: 14px;
  205. font-size: 16px;
  206. &::before {
  207. content: "";
  208. position: absolute;
  209. left: 5px;
  210. top: 50%;
  211. transform: translateY(-50%);
  212. width: 4px;
  213. height: 15px;
  214. background: #2199f8;
  215. border-radius: 20px;
  216. }
  217. }
  218. .archives-time-line {
  219. position: relative;
  220. height: calc(100% - 102px);
  221. .archives-time-line-header {
  222. display: flex;
  223. align-items: center;
  224. justify-content: space-between;
  225. margin: 12px 0;
  226. .filter-wrapper {
  227. display: flex;
  228. gap: 10px;
  229. }
  230. }
  231. .variety-tabs {
  232. display: flex;
  233. align-items: center;
  234. gap: 8px;
  235. margin-bottom: 12px;
  236. .variety-tab {
  237. padding: 4px 12px;
  238. border-radius: 2px;
  239. color: #767676;
  240. background: #fff;
  241. }
  242. .variety-tab--active {
  243. background: #2199F8;
  244. color: #ffffff;
  245. }
  246. }
  247. .archives-time-line-content {
  248. height: calc(100% - 84px);
  249. background: #fff;
  250. border-radius: 8px;
  251. padding: 10px;
  252. box-sizing: border-box;
  253. .report-box {
  254. background: linear-gradient(120deg, #eef8ff, #bbe3ff);
  255. border-radius: 4px;
  256. padding: 6px 0 0 16px;
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. margin-bottom: 12px;
  261. .box-content {
  262. .box-title {
  263. font-size: 16px;
  264. color: #2199f8;
  265. font-weight: 500;
  266. margin-bottom: 4px;
  267. display: flex;
  268. align-items: center;
  269. }
  270. .box-text {
  271. color: #4e5969;
  272. }
  273. }
  274. .report-icon {
  275. width: 120px;
  276. height: 85px;
  277. }
  278. }
  279. .time-line {
  280. height: calc(100% - 100px);
  281. &.no-report {
  282. height: 100%;
  283. }
  284. }
  285. }
  286. }
  287. .farm-info {
  288. background: #fff;
  289. border-radius: 8px;
  290. padding: 10px;
  291. margin-top: 12px;
  292. .map {
  293. width: 100%;
  294. height: 142px;
  295. background: red;
  296. border-radius: 5px;
  297. }
  298. .info-box {
  299. margin-top: 12px;
  300. .info-list {
  301. margin-top: 10px;
  302. margin-left: 5px;
  303. .info-row {
  304. display: flex;
  305. align-items: flex-start;
  306. margin-bottom: 6px;
  307. .info-label {
  308. min-width: 80px;
  309. color: #4E5969;
  310. }
  311. .crop-tags {
  312. display: flex;
  313. flex-wrap: wrap;
  314. gap: 6px;
  315. }
  316. .crop-tag {
  317. padding: 2px 8px;
  318. background: #E8F3FF;
  319. color: #2199f8;
  320. border-radius: 2px;
  321. font-size: 12px;
  322. }
  323. .problem-tags {
  324. display: flex;
  325. flex-wrap: wrap;
  326. gap: 6px;
  327. .problem-tag {
  328. padding: 2px 8px;
  329. background: rgba(58, 173, 148, 0.1);
  330. color: #3AAD94;
  331. border-radius: 2px;
  332. font-size: 13px;
  333. }
  334. }
  335. .device-box {
  336. padding: 6px;
  337. border-radius: 4px;
  338. border: 0.5px solid rgba(33, 153, 248, 0.2);
  339. display: flex;
  340. flex-wrap: wrap;
  341. justify-content: space-between;
  342. .device-item {
  343. display: flex;
  344. padding: 4px 0;
  345. gap: 15px;
  346. font-size: 13px;
  347. color: #1D2129;
  348. .device-count {
  349. padding: 2px 8px;
  350. background: #E8F3FF;
  351. color: #2199f8;
  352. border-radius: 2px;
  353. }
  354. }
  355. }
  356. }
  357. .info-row-column {
  358. display: flex;
  359. flex-direction: column;
  360. gap: 4px;
  361. }
  362. }
  363. }
  364. }
  365. }
  366. </style>