Przeglądaj źródła

fix: 增加农事记录

lxf 6 dni temu
rodzic
commit
aeb88b7205

+ 5 - 5
src/App.vue

@@ -82,18 +82,18 @@
                 />
             </template>
         </tabbar-item> -->
-        <!-- <tabbar-item replace to="/agri_services" v-if="curRole == 0">
-            <span>农事服务</span>
+        <tabbar-item replace to="/agri_record">
+            <span>农事记录</span>
             <template #icon="props">
                 <img
                     :src="
                         props.active
-                            ? require('@/assets/img/tab_bar/service-active.png')
-                            : require('@/assets/img/tab_bar/service.png')
+                            ? require('@/assets/img/tab_bar/farm-active.png')
+                            : require('@/assets/img/tab_bar/farm.png')
                     "
                 />
             </template>
-        </tabbar-item> -->
+        </tabbar-item>
         <tabbar-item replace to="/user">
             <span>用户管理</span>
             <template #icon="props">

+ 7 - 0
src/router/globalRoutes.js

@@ -44,6 +44,13 @@ export default [
         meta: { keepAlive: true },
         component: () => import("@/views/old_mini/create_farm/index.vue"),
     },
+    // 农事记录
+    {
+        path: "/agri_record",
+        name: "AgriRecord",
+        meta: { showTabbar: true, keepAlive: true },
+        component: () => import("@/views/old_mini/agri_record/index.vue"),
+    },
     // 编辑地图
     {
         path: "/edit_map",

+ 86 - 0
src/views/old_mini/agri_record/index.vue

@@ -0,0 +1,86 @@
+<template>
+    <div class="agri-record-index" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
+        <div class="record-content">
+            <div>天气</div>
+            <div class="record-list">
+                <div class="line-title">农事记录</div>
+                <div class="task-content" v-loading="loading">
+                    <div class="task-item" v-for="(item, index) in taskList" :key="item.id || item.workRecordId">
+                        <task-item
+                            :key="1 + '-' + index"
+                            :itemIndex="1"
+                            :status="1"
+                            :item-data="item"
+                        >
+                        </task-item>
+                    </div>
+                    <div class="empty-data" v-if="noData">暂无数据</div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script setup>
+import { ref, onMounted, computed, onActivated } from "vue";
+import { useStore } from "vuex";
+import taskItem from "@/components/taskItem.vue";
+
+const store = useStore();
+const tabBarHeight = computed(() => store.state.home.tabBarHeight);
+
+onMounted(() => {
+});
+
+onActivated(() => {
+    getRecordList();
+});
+
+const taskList = ref([]);
+const loading = ref(false);
+const noData = ref(false);
+const getRecordList = () => {
+    const params = {
+        role: 2,
+        flowStatus: 5,  
+        includePrescription: true,
+    }
+    VE_API.z_farm_work_record
+        .getSimpleList(params)
+        .then(({ data }) => {
+            loading.value = false;
+            taskList.value = data;
+            if(data.length === 0) {
+                noData.value = true;
+            }
+        })
+};
+
+</script>
+
+<style lang="scss" scoped>
+.agri-record-index {
+    width: 100%;
+    height: 100vh;
+    box-sizing: border-box;
+    padding: 10px 12px;
+    background: linear-gradient(180deg, #F9F9F9 0%, #F0F8FF 31.47%, #F9F9F9 46.81%, #F9F9F9 69.38%, #F9F9F9 100%);
+    .line-title {
+        padding: 10px 0;
+        position: relative;
+        padding-left: 14px;
+        font-size: 16px;
+        &::before {
+            content: '';
+            position: absolute;
+            left: 5px;
+            top: 50%;
+            transform: translateY(-50%);
+            width: 4px;
+            height: 15px;
+            background: #2199f8;
+            border-radius: 20px;
+        }
+    }
+}
+</style>