Переглянути джерело

feat:修改bug,添加处方维护页面

wangsisi 2 тижнів тому
батько
коміт
7d1580f760

BIN
src/assets/img/home/back.png


BIN
src/assets/img/home/checked-bg.png


BIN
src/assets/img/home/page-bg.png


+ 1 - 1
src/components/chatWindow.vue

@@ -346,7 +346,7 @@ watch(
                     
                     if(params.type === 'quotation') {
                         message.cardType = 'quotation';
-                        message.title = params.farmWorkName + '已生成报价'
+                        message.title = '向您发送了一张服务报价单'
                         const jsonParams = {
                             id:params.id,
                             farmWorkOrderId:params.farmWorkOrderId,

+ 6 - 2
src/components/pageComponents/PlanList.vue

@@ -75,6 +75,10 @@ const props = defineProps({
         type: [Number, String],
         default: null,
     },
+    containerId: {
+        type: [Number, String],
+        default: null,
+    },
 });
 
 const curRole = localStorage.getItem("SET_USER_CUR_ROLE")
@@ -113,14 +117,14 @@ onMounted(() => {
     }
 });
 
-watch(() => props.schemeId, (newVal) => {
+watch(() => (props.schemeId || props.containerId), (newVal) => {
     if(newVal){
         getListBySchemeId();
     }
 });
 
 const getListBySchemeId = () => {
-    VE_API.home.listBySchemeId({ schemeId: props.schemeId }).then(({ data }) => {
+    VE_API.home.listBySchemeId({ schemeId: props.schemeId,containerId: props.containerId }).then(({ data }) => {
         menuData.value = data;
     });
 };

+ 13 - 1
src/components/pageComponents/TabList.vue

@@ -77,10 +77,21 @@ const handleTabClick = (index, tab) => {
     display: flex;
     align-items: center;
     gap: 8px;
+    overflow-x: auto;
+    overflow-y: hidden;
+    -webkit-overflow-scrolling: touch;
+    scrollbar-width: none; /* Firefox */
+    -ms-overflow-style: none; /* IE and Edge */
+    
+    &::-webkit-scrollbar {
+        display: none; /* Chrome, Safari, Opera */
+    }
     
     .tab-item {
         border-radius: 20px;
         text-align: center;
+        white-space: nowrap;
+        flex-shrink: 0;
     }
     
     // 标签数量 <= 2 时的样式
@@ -88,7 +99,7 @@ const handleTabClick = (index, tab) => {
         gap: 8px;
         
         .tab-item {
-            padding: 5px 12px;
+            padding: 4px 12px;
         }
     }
     
@@ -115,6 +126,7 @@ const handleTabClick = (index, tab) => {
         .tab-item {
             background: #F7F8FA;
             color: #8B8B8B;
+            padding: 4px 12px;
             
             &.active {
                 background: rgba(33, 153, 248, 0.1);

+ 7 - 0
src/router/globalRoutes.js

@@ -338,4 +338,11 @@ export default [
         name: "ServiceList",
         component: () => import("@/views/old_mini/user/subPages/serviceList.vue"),
     },
+    // 处方页面
+    {
+        path: "/prescription",
+        name: "Prescription",
+        meta: { keepAlive: true },
+        component: () => import("@/views/old_mini/home/subPages/prescriptionPage.vue"),
+    },
 ];

+ 22 - 0
src/views/old_mini/create_farm/index.vue

@@ -465,6 +465,16 @@ const rules = reactive({
 const curRole = localStorage.getItem('SET_USER_CUR_ROLE');
 
 const submitForm = (formEl) => {
+    // if(route.query.type === 'client'){
+    //     router.push({
+    //         path: "/prescription",
+    //         query: {
+    //             farmId: 766,
+    //             containerId: 3,
+    //         },
+    //     });
+    //     return;
+    // }
     if (!formEl) return;
     formEl.validate((valid) => {
         if (valid) {
@@ -484,6 +494,17 @@ const submitForm = (formEl) => {
             if (route.query.type === 'edit' && route.query.farmId) {
                 params.farmId = route.query.farmId;
             }
+
+            if(route.query.type === 'client'){
+                router.push({
+                    path: "/prescription",
+                    query: {
+                        farmId: params.farmId,
+                        containerId: params.containerId,
+                    },
+                });
+                return;
+            }
             
             const apiCall = route.query.type === 'edit' 
                 ? VE_API.farm.updateFarm(params)
@@ -511,6 +532,7 @@ const submitForm = (formEl) => {
                             }
                             router.replace(`/home?showSuccess=${showSuccess}`);
                         }
+                        
                     } else {
                         router.replace(`/home`);
                     }

+ 192 - 0
src/views/old_mini/home/subPages/prescriptionPage.vue

@@ -0,0 +1,192 @@
+<template>
+    <div class="prescription-page">
+        <div class="prescription-title">
+            <img @click="goBack" src="@/assets/img/home/back.png" alt="" />
+            <div class="title-name">农事处方维护单</div>
+            <div class="title-desc">请确定您的果园设施以及内容</div>
+        </div>
+        <div class="prescription-box">
+            <div class="box-title">
+                <img src="@/assets/img/home/label-icon.png" />
+                农场设施
+            </div>
+            <div class="box-content">
+                <div class="box-item" v-for="(group, i) in prescriptionList" :key="i">
+                    <div class="item-name">{{group.name}}</div>
+                    <div class="item-checkbox">
+                        <el-radio-group v-model="group.checked">
+                            <el-radio-button v-for="(item, index) in group.items" :key="index" :label="item.name" :value="item.name" />
+                        </el-radio-group>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="prescription-box">
+            <div class="box-title">
+                <img src="@/assets/img/home/label-icon.png" />
+                生产基础
+            </div>
+            <div class="box-content">
+                <div class="box-item" v-for="(group, i) in productList" :key="i">
+                    <div class="item-name">{{group.name}}</div>
+                    <div class="item-checkbox">
+                        <el-radio-group v-model="group.checked">
+                            <el-radio-button v-for="(item, index) in group.items" :key="index" :label="item.name" :value="item.name" />
+                        </el-radio-group>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="prescription-box">
+            <div class="box-title">
+                <img src="@/assets/img/home/label-icon.png" />
+                投入产出
+            </div>
+            <div class="box-content">
+                <div class="box-item" v-for="(group, i) in outputList" :key="i">
+                    <div class="item-name">{{group.name}}</div>
+                    <div class="item-checkbox">
+                        <el-radio-group v-model="group.checked">
+                            <el-radio-button v-for="(item, index) in group.items" :key="index" :label="item.name" :value="item.name" />
+                        </el-radio-group>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 按钮 -->
+        <div class="submit-btn">生成处方</div>
+    </div>
+</template>
+
+<script setup>
+import { ref } from "vue";
+import { useRouter } from "vue-router";
+const router = useRouter();
+const prescriptionList = ref([
+    {name: "喷药方式", items: [{name: "植保机"}, {name: "人工"}, {name: "喷药车"}]},
+    {name: "肥水设施", items: [{name: "漫灌"}, {name: "滴灌"}, {name: "喷灌"}, {name: "无"}]},
+    {name: "除草方式", items: [{name: "人工"}, {name: "除草机"}]},
+    {name: "生长调节", items: [{name: "人工"}, {name: "药物"}]},
+])
+const productList = ref([
+    {name: "土壤类型", items: [{name: "砂质土"}, {name: "黏质土"}, {name: "壤土"}]},
+    {name: "土壤改善", items: [{name: "结果树需要"}, {name: "全需要"}]},
+    {name: "除草方式", items: [{name: "结果树需要"}, {name: "全需要"}]},
+])
+const outputList = ref([
+    {name: "品质要求", items: [{name: "品质优先"}, {name: "质量优先"}]},
+    {name: "农残要求", items: [{name: "出口"}, {name: "商超"}, {name: "量贩"}]},
+])
+
+const goBack = () => {
+    router.go(-1)
+}
+</script>
+
+<style lang="scss" scoped>
+.prescription-page {
+  position: relative;
+  width: 100%;
+  height: 100vh;
+  overflow: auto;
+  box-sizing: border-box;
+  background: linear-gradient(to left, #E6F2FF, #8Fc5FE);
+  .prescription-title {
+    padding: 16px 14px;
+    background: url('@/assets/img/home/page-bg.png') no-repeat bottom right /149px 116px;
+    background-position-y: 30px;
+    img {
+        width: 24px;
+    }
+    .title-name {
+        font-size: 22px;
+        color: #2E2E2E;
+        text-shadow: 0px 1px 1px rgba(0,0,0,0.05);
+        font-weight: 800;
+        padding: 21px 0 4px 6px;
+    }
+    .title-desc {
+        font-size: 14px;
+        color: rgba(49,49,49,0.56);
+        padding-left: 6px;
+    }
+  }
+  .prescription-box {
+      background: #FFFFFF;
+      box-shadow: 0 2px 2px 0 rgba(0,0,0,0.1);
+      border-radius: 10px;
+      margin: 0 10px 10px;
+      box-sizing: border-box;
+      padding-bottom: 10px;
+      .box-title {
+        margin: 0 10px;
+        box-sizing: border-box;
+        border-bottom: 1px solid rgba(0,0,0,0.17);
+        font-weight: 800;
+        font-size: 18px;
+        color: #222222;
+        padding: 15px 0 10px;
+        img {
+            width: 14px;
+            height: 9px;
+        }
+      }
+      .box-content {
+        padding: 0 10px;
+        .box-item {
+            padding-top: 10px;
+            .item-name {
+                font-size: 15px;
+                color: rgba(0,0,0,0.9);
+            }
+            .item-checkbox {
+                ::v-deep {
+                    .el-radio-button {
+                        margin: 10px 7px 0 0;
+                      .el-radio-button__inner {
+                        border: none;
+                        background: #F1F1F1;
+                        border-radius: 8px;
+                        padding: 18px 30px;
+                        border: 2px solid rgba(255, 255, 255, 0);
+                        color: #000000;
+                        font-size: 15px;
+                      }
+                      &.is-active {
+                        &::after {
+                            content: "";
+                            position: absolute;
+                            z-index: 9;
+                            bottom: 0;
+                            right: 0;
+                            width: 18px;
+                            height: 16px;
+                            background: url('@/assets/img/home/checked-bg.png') no-repeat bottom right / 18px 16px;
+                        }
+                        .el-radio-button__original-radio:not(:disabled)+.el-radio-button__inner {
+                            background: #FFFFFF;
+                            color: #2199F8;
+                            border: 2px solid #2199F8;
+                            box-shadow: none;
+                        }  
+                      }
+                    }
+                }
+            }
+        }
+      }
+  }
+  .submit-btn {
+      height: 55px;
+      line-height: 55px;
+      background: #2199F8;
+      box-shadow: 0 2px 2px 0 rgba(0,0,0,0.1);
+      border-radius: 10px;
+      color: #FFFFFF;
+      font-size: 18px;
+      text-align: center;
+      margin: 0 10px 45px 10px;
+  }
+}
+</style>

+ 1 - 1
src/views/old_mini/mine/pages/serviceRecords.vue

@@ -44,7 +44,7 @@ onMounted(() => {
 const getUserList = async () => {
     const { data } = await VE_API.user.userList();
     if (data.length) {
-        recordList.value = data || [];
+        recordList.value = data.filter(item => item.serviceCount != 0);
     }
 };
 // 处理列表项点击

+ 23 - 2
src/views/old_mini/monitor/subPages/plan.vue

@@ -97,7 +97,7 @@
 </template>
 
 <script setup>
-import { reactive, ref, onMounted, computed } from "vue";
+import { reactive, ref, onMounted, computed, nextTick } from "vue";
 import customHeader from "@/components/customHeader.vue";
 import { useRouter, useRoute } from "vue-router";
 import detailDialog from "@/components/detailDialog.vue";
@@ -126,6 +126,20 @@ const statusList = reactive([
 const solarTerms = ref([]);
 const phenologyList = ref([]);
 
+// 获取当前季节
+const getCurrentSeason = () => {
+    const month = new Date().getMonth() + 1; // 1-12
+    if (month >= 3 && month <= 5) {
+        return "spring"; // 春季:3-5月
+    } else if (month >= 6 && month <= 8) {
+        return "summer"; // 夏季:6-8月
+    } else if (month >= 9 && month <= 11) {
+        return "autumn"; // 秋季:9-11月
+    } else {
+        return "winter"; // 冬季:12-2月
+    }
+};
+
 onMounted(() => {
     getFarmWorkPlan();
 });
@@ -162,6 +176,13 @@ const getFarmWorkPlan = () => {
                           reproductiveList: Array.isArray(it.reproductiveList) ? it.reproductiveList : [],
                       }))
                     : [];
+                
+                // 设置默认季节为当前季节,并自动滚动到对应位置
+                const currentSeason = getCurrentSeason();
+                // 等待 DOM 更新后自动选中并滚动到当前季节
+                nextTick(() => {
+                    handleSeasonClick(currentSeason);
+                });
             }
         })
         .catch((error) => {
@@ -182,7 +203,7 @@ const addNewTask = () => {
 const triggerFarmWork = () => {
     eventBus.emit("activeUpload:show", {
         gardenIdVal: route.query.farmId,
-        problemTitleVal: curFarmObj.value.farmWorkName,
+        problemTitleVal: '请选择您出现' + curFarmObj.value.farmWorkName + '的时间',
         arrangeIdVal: curFarmObj.value.id,
     });
 };

+ 5 - 2
src/views/old_mini/plan/index.vue

@@ -15,7 +15,7 @@
                         @change="handleTabChange"
                         class="tabs-list"
                     />
-                    <plan-list :farm-id="route.query.farmId" :schemeId="active" isEdit> </plan-list>
+                    <plan-list :farm-id="route.query.farmId" :schemeId="active" :containerId="containerId" isEdit> </plan-list>
                 </div>
             </Tab>
         </Tabs>
@@ -38,7 +38,9 @@ const curRole = localStorage.getItem("SET_USER_CUR_ROLE");
 
 const tabs = ref([]);
 const active = ref(null);
-const handleTabChange = (id) => {
+const containerId = ref(null);
+const handleTabChange = (id,item) => {
+    containerId.value = item.containerId;
     active.value = id;
 };
 
@@ -53,6 +55,7 @@ const getListMySchemes = () => {
         if (data.length) {
             tabs.value = data || [];
             active.value = data[0].id;
+            containerId.value = data[0].containerId;
         } else {
             getSchemes();
         }