index.vue 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="farm-card-page">
  3. <custom-header name="农事方案"></custom-header>
  4. <div class="farm-card-content">
  5. <PlanList :farm-id="93301" :container-id="route.query.containerId || 2" :default-active="defaultActive">
  6. <template #default="{ menuData }">
  7. <div v-for="(section, index) in menuData" :key="index" class="content-section">
  8. <div
  9. class="section-item"
  10. v-for="(sub, subI) in section.farmWorkArrangeList"
  11. :key="index + '-' + subI"
  12. >
  13. <div class="section-id" :id="section.name + sub.farmWorkDetail?.name"></div>
  14. <record-item :record-item-data="sub" @click="handleClick(sub)">
  15. <template #title>
  16. <div class="box-title">
  17. <div class="title-l">
  18. {{ sub.farmWorkDetail?.name }}
  19. <span class="parent-text">{{ section.name }}</span>
  20. </div>
  21. <div class="title-r" v-if="curRole == 2">
  22. <el-icon color="#2199F8" size="16"><Edit /></el-icon>
  23. </div>
  24. </div>
  25. </template>
  26. </record-item>
  27. </div>
  28. </div>
  29. </template>
  30. </PlanList>
  31. </div>
  32. </div>
  33. </template>
  34. <script setup>
  35. import customHeader from "@/components/customHeader.vue";
  36. import { ref } from "vue";
  37. import { useRoute, useRouter } from "vue-router";
  38. import recordItem from "@/components/recordItem.vue";
  39. import PlanList from "@/components/pageComponents/PlanList.vue";
  40. const curRole = ref(localStorage.getItem("SET_USER_CUR_ROLE") || 0);
  41. const route = useRoute();
  42. const router = useRouter();
  43. // 菜单
  44. const defaultActive = ref("1-1");
  45. const handleClick = (sub) => {
  46. if (curRole.value == 2) {
  47. router.push(`/edit_plan?id=${sub.id}`);
  48. }
  49. };
  50. </script>
  51. <style scoped lang="scss">
  52. .farm-card-page {
  53. width: 100%;
  54. height: 100vh;
  55. background: #f5f7fb;
  56. .farm-card-content {
  57. width: 100%;
  58. height: calc(100vh - 40px);
  59. padding-top: 10px;
  60. ::v-deep .expert-prescription {
  61. height: 100%;
  62. .plan-menu {
  63. padding: 10px 0;
  64. border-radius: 0 10px 10px 0;
  65. }
  66. .box-title {
  67. display: flex;
  68. align-items: center;
  69. justify-content: space-between;
  70. padding-bottom: 8px;
  71. border-bottom: 1px solid #f5f5f5;
  72. margin-bottom: 8px;
  73. .title-l {
  74. font-size: 16px;
  75. font-weight: 600;
  76. color: #000;
  77. .parent-text {
  78. margin-left: 5px;
  79. font-size: 12px;
  80. font-weight: normal;
  81. padding: 4px 6px;
  82. border-radius: 14px;
  83. background: rgba(119, 119, 119, 0.1);
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. </style>