2 Commits 2d52b80f48 ... f3b6fe1c2e

Tác giả SHA1 Thông báo Ngày
  lisy f3b6fe1c2e Merge branch 'master' of http://git.yujin.shuziyunyao.com/yujin/forestry-wx 2 tuần trước cách đây
  lisy f391406b32 修改switch 2 tuần trước cách đây

+ 12 - 17
src/components/ut-tabar/ut-tabar.vue

@@ -4,30 +4,30 @@
             <image class="w-100%" src="/static/images/plant/bottombg.png" mode="widthFix" style="position: absolute; bottom: 0; left: 0; z-index: -1" />
             <view class="d-flex h-140 w-100% j-sa" style="position: absolute; bottom: 0; left: 0">
                 <view class="d-flex a-c flex1 j-sa">
-                    <view @click="goToSwitchWithParams('/pages/switch/index1', { type: 'plant', title: '种植端基地', path: '/pages/plant/base/index' })" class="c-#999 f-s-24 d-flex flex-cln">
-                        <image v-if="activeTab !== 'base'" class="w-80" src="/static/images/plant/bottomBase.png" mode="widthFix" />
-                        <image v-if="activeTab === 'base'" class="w-80" src="/static/images/plant/bottomBaseActive.png" mode="widthFix" />
+                    <view @click="$u.route({ type: 'switchTab', url: '/pages/plant/base/index' })" class="c-#999 f-s-24 d-flex flex-cln">
+                        <image v-if="activeTab !== 'base'" class="w-80 h-80" src="/static/images/plant/bottomBase.png" mode="widthFix" />
+                        <image v-if="activeTab === 'base'" class="w-80 h-80" src="/static/images/plant/bottomBaseActive.png" mode="widthFix" />
                         <view class="text-center" :class="activeTab === 'base' ? 'c-primary f-w-5' : ''">基地</view>
                     </view>
-                    <view @click="goToSwitchWithParams('/pages/switch/index2', { type: 'port', title: '种植端种养殖', path: '/pages/plant/port/index' })" class="c-#999 f-s-24 d-flex flex-cln">
-                        <image v-if="activeTab !== 'planting'" class="w-80" src="/static/images/plant/bottomPlantingBreeding.png" mode="widthFix" />
-                        <image v-if="activeTab === 'planting'" class="w-80" src="/static/images/plant/bottomPlantingBreedingActive.png" mode="widthFix" />
+                    <view @click="$u.route({ type: 'switchTab', url: '/pages/plant/port/index' })" class="c-#999 f-s-24 d-flex flex-cln">
+                        <image v-if="activeTab !== 'planting'" class="w-80 h-80" src="/static/images/plant/bottomPlantingBreeding.png" mode="widthFix" />
+                        <image v-if="activeTab === 'planting'" class="w-80 h-80" src="/static/images/plant/bottomPlantingBreedingActive.png" mode="widthFix" />
                         <view class="text-center" :class="activeTab === 'planting' ? 'c-primary f-w-5' : ''">种养殖</view>
                     </view>
                 </view>
                 <view class="w-126 d-flex a-c j-c p-rtv">
-                    <image v-if="activeTab !== 'warehouse'" class="w-80" src="/static/images/plant/bottomWarehouse.png" mode="widthFix" style="position: absolute; top: -40rpx" />
-                    <image v-if="activeTab === 'warehouse'" class="w-80" src="/static/images/plant/bottomWarehouseActive.png" mode="widthFix" style="position: absolute; top: -40rpx" />
+                    <image v-if="activeTab !== 'warehouse'" class="w-80 h-80" src="/static/images/plant/bottomWarehouse.png" mode="widthFix" style="position: absolute; top: -40rpx" />
+                    <image v-if="activeTab === 'warehouse'" class="w-80 h-80" src="/static/images/plant/bottomWarehouseActive.png" mode="widthFix" style="position: absolute; top: -40rpx" />
                 </view>
                 <view class="d-flex a-c flex1 j-sa">
                     <view class="c-#999 f-s-24 d-flex flex-cln">
-                        <image v-if="activeTab !== 'processing'" class="w-80" src="/static/images/plant/bottomProcessingPackaging.png" mode="widthFix" />
-                        <image v-if="activeTab === 'processing'" class="w-80" src="/static/images/plant/bottomProcessingPackagingActive.png" mode="widthFix" />
+                        <image v-if="activeTab !== 'processing'" class="w-80 h-80" src="/static/images/plant/bottomProcessingPackaging.png" mode="widthFix" />
+                        <image v-if="activeTab === 'processing'" class="w-80 h-80" src="/static/images/plant/bottomProcessingPackagingActive.png" mode="widthFix" />
                         <view class="text-center" :class="activeTab === 'processing' ? 'c-primary f-w-5' : ''">加工包装</view>
                     </view>
                     <view class="c-#999 f-s-24 d-flex flex-cln">
-                        <image v-if="activeTab !== 'more'" class="w-80" src="/static/images/plant/bottomMore.png" mode="widthFix" />
-                        <image v-if="activeTab === 'more'" class="w-80" src="/static/images/plant/bottomMoreActive.png" mode="widthFix" />
+                        <image v-if="activeTab !== 'more'" class="w-80 h-80" src="/static/images/plant/bottomMore.png" mode="widthFix" />
+                        <image v-if="activeTab === 'more'" class="w-80 h-80" src="/static/images/plant/bottomMoreActive.png" mode="widthFix" />
                         <view class="text-center" :class="activeTab === 'more' ? 'c-primary f-w-5' : ''">更多</view>
                     </view>
                 </view>
@@ -38,14 +38,9 @@
 </template>
 
 <script setup lang="ts">
-import { goToSwitchPage } from '@/utils/public';
 defineProps<{
     activeTab?: string; // 当前活跃的tab标识符:'base' | 'planting' | 'warehouse' | 'processing' | 'more'
 }>();
 const windowInfo = uni.getWindowInfo();
 const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
-const goToSwitchWithParams = (pages: string, data: unknown): void => {
-    // 使用公共函数跳转到switch页面并传递参数
-    goToSwitchPage(pages, data);
-};
 </script>

+ 2 - 17
src/pages.json

@@ -42,18 +42,6 @@
             "style": {
                 "navigationBarTitleText": "生产端"
             }
-        },
-        {
-            "path": "pages/switch/index1",
-            "style": {
-                "navigationBarTitleText": "switch页面1"
-            }
-        },
-        {
-            "path": "pages/switch/index2",
-            "style": {
-                "navigationBarTitleText": "switch页面2"
-            }
         }
     ],
     "subPackages": [
@@ -188,13 +176,10 @@
         "custom": true,
         "list": [
             {
-                "pagePath": "pages/index/index"
-            },
-            {
-                "pagePath": "pages/switch/index1"
+                "pagePath": "pages/plant/base/index"
             },
             {
-                "pagePath": "pages/switch/index2"
+                "pagePath": "pages/plant/port/index"
             }
         ]
     },

+ 2 - 13
src/pages/index/index.vue

@@ -24,8 +24,8 @@
             </view>
             <!-- <view class="mb-80">{{ selectDictLabel(class_type, 1) }}</view> -->
             <view class="bg-blue-500 c-primary p-4 rounded">Hello UnoCSS!</view>
-            <up-button @click="goToSwitchWithParams('/pages/switch/index1', { type: 'plant', title: '种植端基地', path: '/pages/plant/base/index' })" text="index1" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
-            <up-button @click="goToSwitchWithParams('/pages/switch/index2', { type: 'port', title: '种植端种养殖', path: '/pages/plant/port/index' })" text="plantport" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
+            <up-button @click="$u.route({ type: 'switchTab', url: '/pages/plant/base/index' })" text="index1" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
+            <up-button @click="$u.route({ type: 'switchTab', url: '/pages/plant/port/index' })" text="plantport" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
             <up-button @click="$u.route({ type: 'navigateTo', url: '/pages/plant/base/index' })" text="plant" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
             <up-button @click="$u.route({ type: 'switchTab', url: '/pages/production/index' })" text="production" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
         </view>
@@ -35,9 +35,7 @@
 import { computed } from 'vue';
 import { useAuthStore } from '@/store/modules/auth';
 import { useUserStore } from '@/store/modules/user';
-import { useSwitchStore } from '@/store';
 import { checkAuth, logoutAndRedirect } from '@/utils/routeGuard';
-import { goToSwitchPage } from '@/utils/public';
 // const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 // const { class_type } = toRefs<any>(proxy?.useDict('class_type'));
 const title = ref('Hello');
@@ -46,7 +44,6 @@ const paging = ref<any>(null);
 // Store
 const authStore = useAuthStore();
 const userStore = useUserStore();
-const switchStore = useSwitchStore();
 
 // 计算属性
 const userInfo = computed(() => userStore.userInfo);
@@ -90,14 +87,6 @@ const onRefresh = () => {
     }
 };
 
-/**
- * 跳转到switch页面并传递参数
- */
-const goToSwitchWithParams = (pages: string, data: unknown): void => {
-    // 使用公共函数跳转到switch页面并传递参数
-    goToSwitchPage(pages, data);
-};
-
 /**
  * 前往登录页
  */

+ 8 - 10
src/pages/login/login.vue

@@ -116,11 +116,10 @@
 
 <script setup>
 import { ref, getCurrentInstance } from 'vue';
-import { useInfoStore, useSwitchStore } from '@/store';
+import { useInfoStore } from '@/store';
 import config from '@/config';
 import { debounce } from 'uview-plus';
 import { onLoad } from '@dcloudio/uni-app';
-import { goToSwitchPage } from '@/utils/public';
 import { recursiveDecodeURIComponent } from '@/utils/ruoyi';
 import { useClientRequest } from '@/utils/request';
 const pages = ref(getCurrentPages());
@@ -214,15 +213,14 @@ const weixinLogin = async () => {
         uni.hideLoading();
         // 重定向或跳转首页
         // 获取redirect参数
-        const redirectUrl = redirect.value || '/pages/switch/index1';
+        const redirectUrl = redirect.value || '/pages/plant/base/index';
         // switchTab 页面
-        const switchTabs = ['/pages/switch/index1'];
+        const switchTabs = ['/pages/plant/base/index', '/pages/plant/port/index'];
         if (switchTabs.includes(redirectUrl)) {
-            //从缓存中获取参数,然后跳转
-            const switchStore = useSwitchStore();
-            const params = switchStore.getAndClearParamsForPage(redirectUrl);
-            // 使用公共函数跳转到switch页面并传递参数
-            goToSwitchPage(redirectUrl, params);
+            uni.$u.route({
+                type: 'switchTab',
+                url: redirectUrl,
+            });
             return;
         }
         uni.$u.route({
@@ -264,7 +262,7 @@ const homeBack = () => {
         uni.navigateBack();
     } else {
         const redirectUrl = redirect.value || '/pages/list/index';
-        const switchTabs = ['/pages/index/index', '/pages/find/index/index', '/pages/cart/index', '/pages/list/index', '/pages/user/index'];
+        const switchTabs = ['/pages/plant/base/index', '/pages/plant/port/index'];
         if (switchTabs.includes(redirectUrl)) {
             uni.$u.route({
                 type: 'switchTab',

+ 5 - 0
src/pages/plant/port/index.vue

@@ -187,6 +187,10 @@
                 </view>
             </view>
         </view>
+        <up-button open-type="share" :customStyle="{ borderColor: 'rgba(0,0,0,0)', padding: '0 10rpx', height: '36rpx' }">
+            <image class="small-icon mr-5" style="width: 28rpx" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/common/share_icon.png" mode="widthFix" />
+            <span class="f-s-24">分享</span>
+        </up-button>
         <view class="h-210" v-if="list?.length"></view>
         <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
         <template #empty>
@@ -221,6 +225,7 @@
 </template>
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
+import { onShareAppMessage } from '@dcloudio/uni-app';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_task_type } = toRefs<any>(proxy?.useDict('pt_task_type'));
 setTimeout(() => {

+ 0 - 30
src/pages/switch/index1.vue

@@ -1,30 +0,0 @@
-<template>
-    <Plant1 v-if="switchType == 'plant'" />
-</template>
-<script setup lang="ts">
-import { onLoad } from '@dcloudio/uni-app';
-import { getSwitchPageParams } from '@/utils/public';
-import Plant1 from '../plant/base/index.vue';
-const switchType = ref('');
-onLoad(() => {
-    // 使用公共函数获取参数
-    const params = getSwitchPageParams();
-    if (params) {
-        console.log('从store获取的参数:', params);
-        // 示例:如果params包含用户信息
-        if (params.type) {
-            switchType.value = params.type;
-        }
-
-        // 示例:如果params包含跳转信息
-        if (params.title) {
-            console.log('页面标题:', params.title);
-        }
-        if (params.path) {
-            console.log('目标路径:', params.path);
-        }
-    } else {
-        console.log('未找到参数或参数已过期');
-    }
-});
-</script>

+ 0 - 30
src/pages/switch/index2.vue

@@ -1,30 +0,0 @@
-<template>
-    <Port1 v-if="switchType == 'port'" />
-</template>
-<script setup lang="ts">
-import { onLoad } from '@dcloudio/uni-app';
-import { getSwitchPageParams } from '@/utils/public';
-import Port1 from '../plant/port/index.vue';
-const switchType = ref('');
-onLoad(() => {
-    // 使用公共函数获取参数
-    const params = getSwitchPageParams();
-    if (params) {
-        console.log('从store获取的参数:', params);
-        // 示例:如果params包含用户信息
-        if (params.type) {
-            switchType.value = params.type;
-        }
-
-        // 示例:如果params包含跳转信息
-        if (params.title) {
-            console.log('页面标题:', params.title);
-        }
-        if (params.path) {
-            console.log('目标路径:', params.path);
-        }
-    } else {
-        console.log('未找到参数或参数已过期');
-    }
-});
-</script>

+ 39 - 9
src/plant/port/port-create/index.vue

@@ -7,9 +7,9 @@
             <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
                 <view class="startline-title pl-24 ml-26 mb-16">基地信息</view>
                 <view class="bg-#fff pd-26">
-                    <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-26"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈 舍/组培架。</view>
+                    <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-26 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈 舍/组培架。</view>
                 </view>
-                <view class="bg-#fff pd-26 mb-20">
+                <view class="bg-#fff pd-26 mb-20 pt-0">
                     <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="plantBase">
                         <view class="w-100% d-flex a-c j-c pd-26 b-radius bg-#FBFDFB border-#AFDDBB" @click="openDrawer">
                             <view class=""></view>
@@ -68,27 +68,52 @@
                             </template>
                         </up-form-item>
                     </ut-action-sheet>
-                    <up-form-item borderBottom label="养殖时间" required prop="queryType6">
+                    <up-form-item :borderBottom="false" label="养殖时间" required prop="queryType6">
                         <ut-datetime-picker v-model="form.queryType6.startDate" mode="date" dateFields="month">
                             <view class="d-flex mr-20">
-                                <up-input v-model="form.queryType6.startDate" placeholder="请选择养殖开始时间" border="none"></up-input>
-                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
+                                <up-input v-model="form.queryType6.startDate" placeholder="请选择养殖开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
                             </view>
                         </ut-datetime-picker>
                         <ut-datetime-picker v-model="form.queryType6.endDate" mode="date" dateFields="month">
                             <view class="d-flex">
-                                <up-input v-model="form.queryType6.endDate" placeholder="请选择养殖结束时间" border="none"></up-input>
-                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
+                                <up-input v-model="form.queryType6.endDate" placeholder="请选择养殖结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
                             </view>
                         </ut-datetime-picker>
                     </up-form-item>
+                    <up-form-item borderBottom label="养殖面积" required prop="plantBaseArea">
+                        <view class="d-flex a-c j-sb w-100%">
+                            <up-input style="padding-left: 0" v-model="form.plantBaseArea" placeholder="请输入养殖批号" border="none"></up-input>
+                            <view class="c-#333 f-s-32 f-w-5">平方米</view>
+                        </view>
+                    </up-form-item>
+                    <up-form-item borderBottom label="养殖区域" required prop="BreedingArea">
+                        <view class="d-flex a-c j-sb w-100%">
+                            <up-input v-model="form.BreedingArea" placeholder="请输入养殖区域" border="none"></up-input>
+                            <view class="c-#333 f-s-32 f-w-5">个</view>
+                        </view>
+                    </up-form-item>
+                    <up-form-item borderBottom label="养殖量" required prop="orgType">
+                        <up-input v-model="form.breedingVolume" placeholder="请输入养殖区域" border="none"></up-input>
+                        <ut-action-sheet v-model="form.breedingVolume" :tabs="pt_org_type" title="选择单位">
+                            <view class="d-flex a-c">
+                                <view v-if="form.queryType1" class="f-s-30 c-333 f-w-5 w-100">{{ selectDictLabel(pt_org_type, form.queryType1) }}</view>
+                                <view v-else class="f-s-30 c-ccc f-w-4 w-100">单位</view>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
+                            </view>
+                        </ut-action-sheet>
+                    </up-form-item>
+                    <up-form-item borderBottom label="备注" required prop="BreedingArea">
+                        <up-input v-model="form.BreedingArea" placeholder="请输入备注" border="none"></up-input>
+                    </up-form-item>
                 </view>
             </up-form>
         </view>
     </z-paging>
 
     <!-- 添加drawer组件 -->
-    <Drawer v-if="drawerVisible" v-model="drawerVisible" @open="onDrawerOpen" @close="onDrawerClose" />
+    <Drawer v-if="drawerVisible" :baseType="form.baseType" v-model="drawerVisible" @open="onDrawerOpen" @close="onDrawerClose" />
 </template>
 
 <script setup lang="ts">
@@ -97,6 +122,7 @@ import Drawer from './models/drawer.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_task_type, pt_org_type, yes_no } = toRefs<any>(proxy?.useDict('pt_task_type', 'pt_org_type', 'yes_no'));
 const form = ref({
+    baseType: '',
     queryType: '',
     queryType1: '',
     queryType2: '',
@@ -107,6 +133,9 @@ const form = ref({
         startDate: '',
         endDate: '',
     },
+    plantBaseArea: '',
+    BreedingArea: '',
+    breedingVolume: '',
 });
 const paging = ref<unknown>('paging');
 const list = ref<unknown>([]);
@@ -135,6 +164,7 @@ function onDrawerClose() {
 }
 
 onLoad((options) => {
-    console.log(options);
+    console.log(options?.baseType, '??????');
+    form.value.baseType = options?.baseType;
 });
 </script>

+ 152 - 46
src/plant/port/port-create/models/drawer.vue

@@ -13,37 +13,67 @@
             <view class="f-s-26 w-150 h-54 radius-100 bg-#f7f7f7 d-flex a-c j-c mr-20 c-#333" @click="changeSelect(1)" :style="{ backgroundColor: activeSelect == 1 ? '#37A954' : '', color: activeSelect == 1 ? '#FFF' : '' }">GAP基地</view>
             <view class="f-s-26 w-200 h-54 radius-100 bg-#f7f7f7 d-flex a-c j-c mr-20 c-#333" @click="changeSelect(2)" :style="{ backgroundColor: activeSelect == 2 ? '#37A954' : '', color: activeSelect == 2 ? '#FFF' : '' }">三无一全基地</view>
         </view>
-        <view class="w-700 d-flex" id="scroll">
-            <scroll-view class="w-50% bg-#f7f7f7 c-#fff" :style="`height: calc(100vh - ${top}px)`" scroll-y="true">
-                <view v-for="(item, index) in 10" :key="index" class="border-#E6E6E6 pd-20 title" :class="{ activeTitle: activeBase == index }" @click="changeBase(index)">
-                    <view class="">
-                        <text class="base">香格里拉市虎跳峡镇宝山村基地 </text>
-                        <text class="area">12000平方米</text>
-                    </view>
-                    <view class="pt-10">
-                        <view class="label">GAP</view>
+        <view class="w-700 d-flex flex-cln" id="scroll">
+            <view class="d-flex">
+                <scroll-view class="w-50% bg-#f7f7f7 c-#fff" :style="`height: calc(100vh - 70px - ${top}px)`" scroll-y="true" @scrolltolower="scrolltolower">
+                    <view v-for="(item, index) in list" :key="index" class="border-#E6E6E6 pd-20 title" :class="{ activeTitle: activeBase == index }" @click="changeBase(index, item)">
+                        <view class="">
+                            <text class="base">{{ item?.baseName }}</text>
+                            <text class="area">{{ item?.gapInfo?.area }}{{ item?.gapInfo?.areaUnit }}</text>
+                        </view>
+                        <view class="pt-10 d-flex">
+                            <view v-if="+item?.gapFlag" class="label mr-10">GAP</view>
+                            <view v-if="+item?.swyqRes" class="label">三无一全</view>
+                        </view>
                     </view>
+                </scroll-view>
+                <scroll-view class="w-50% pd-16" :style="`height: calc(100vh - ${top}px)`" scroll-y="true">
+                    <up-checkbox v-if="mixData.length > 0" label="全选" labelColor="#333" name="agree" usedAlone :checked="aloneChecked" @change="handleAllCheckboxChange"></up-checkbox>
+                    <!-- 复选框组包含全选框 -->
+                    <up-checkbox-group activeColor="#37a954" :modelValue="checkBox" @change="handleCheckboxGroupChange" iconPlacement="right" placement="column">
+                        <up-checkbox v-for="(item, index) in mixData" :key="index" :name="item?.id" :label="item?.landName"></up-checkbox>
+                    </up-checkbox-group>
+                </scroll-view>
+            </view>
+            <view v-if="medicineName || swyqVarietyName" class="w-700 c-primary bg-#EBF6EE f-s-24" style="position: fixed; bottom: 140rpx; right: 0">
+                <view class="pd4-10-20-10-20 d-flex a-c">
+                    <view class="">该基地获评:</view>
+                    <view class="" v-if="medicineName">{{ medicineName }}GAP基地</view>
+                    <view class="" v-if="medicineName && swyqVarietyName">和</view>
+                    <view class="" v-if="swyqVarietyName">{{ swyqVarietyName }}三无一全基地 </view>
                 </view>
-            </scroll-view>
-            <scroll-view class="w-50% pd-16" :style="`height: calc(100vh - ${top}px)`" scroll-y="true">
-                <up-checkbox label="全选" labelColor="#333" name="agree" usedAlone :checked="aloneChecked" @change="handleAllCheckboxChange"></up-checkbox>
-                <!-- 复选框组包含全选框 -->
-                <up-checkbox-group activeColor="#37a954" :modelValue="checkBox" @change="handleCheckboxGroupChange" iconPlacement="right" placement="column">
-                    <up-checkbox v-for="(item, index) in mixData" :key="index" :name="item?.name" :label="item?.label"></up-checkbox>
-                </up-checkbox-group>
-            </scroll-view>
+            </view>
+            <view class="w-700 bg-#fff h-100 d-flex a-c gap-20 pt-20 pb-20" style="position: fixed; bottom: 0; right: 0">
+                <up-button @click="handleClose" style="margin-left: 20rpx">取消</up-button>
+                <up-button type="primary" @click="confirm" style="margin-right: 20rpx">确定</up-button>
+            </view>
         </view>
     </up-popup>
 </template>
 <script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
 import { ref, reactive, watch, computed } from 'vue';
 const instance = getCurrentInstance();
-defineProps<{
-    modelValue: boolean;
-}>();
+const props = defineProps<{ modelValue: boolean; baseType?: string }>();
 const form = ref({
     keyword: '',
+    tempFlag: 0,
+    gapFlag: '',
+    swyqRes: '',
+    baseType: '',
 });
+// 左侧基地列表数据
+const list = ref<any[]>([]);
+//左侧GAP基地的名称(种植的作物)
+const medicineName = ref<string>('');
+//左侧三无一全基地的名称
+const swyqVarietyName = ref<string>('');
+// 右侧地块数据
+const mixData = ref<any[]>([]);
+// 当前选择基地
+const baseID = ref(-1);
+// 请求的次数
+const pageNum = ref(1);
 // 定义emit事件:通知父组件状态变化
 const emit = defineEmits<{
     (e: 'update:modelValue', value: boolean): void;
@@ -64,7 +94,27 @@ function handleOpen() {
 // 处理切换搜索
 const activeSelect = ref(0);
 const changeSelect = (index: number) => {
+    if (activeSelect.value == index) return;
+    activeBase.value = -1;
     activeSelect.value = index;
+    if (index == 0) {
+        form.value.gapFlag = '';
+        form.value.swyqRes = '';
+    } else if (index == 1) {
+        form.value.gapFlag = '1';
+        form.value.swyqRes = '';
+    } else if (index == 2) {
+        form.value.gapFlag = '';
+        form.value.swyqRes = '1';
+    }
+    pageNum.value = 1;
+    list.value = [];
+    medicineName.value = '';
+    swyqVarietyName.value = '';
+    allCheckboxNames.value = [];
+    checkBox.value = [];
+    aloneChecked.value = false;
+    getBaseInfo(pageNum.value, 10);
 };
 
 // 处理搜索
@@ -73,34 +123,26 @@ const changeSeach = () => {
     // 这里可以添加实际的搜索逻辑
 };
 // 切换基地>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-const activeBase = ref(0);
-const changeBase = (index: number) => {
+const activeBase = ref(-1);
+const changeBase = (index: number, item: any) => {
+    if (activeBase.value == index) return;
     activeBase.value = index;
+    baseID.value = item.id;
+    medicineName.value = '';
+    swyqVarietyName.value = '';
+    allCheckboxNames.value = [];
+    checkBox.value = [];
+    aloneChecked.value = false;
+    if (item.gapInfo?.medicineName) {
+        medicineName.value = item.gapInfo.medicineName;
+    }
+    if (item.gapInfo?.swyqVarietyName) {
+        swyqVarietyName.value = item.swyqVarietyName;
+    }
 };
 // 选择checkbox>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 // 所有复选框的name值
-//模拟数据
-const mixData = ref([
-    {
-        name: 'red',
-        label: '红色',
-    },
-    {
-        name: 'green',
-        label: '绿色',
-    },
-    {
-        name: 'blue',
-        label: '蓝色',
-    },
-]);
-let allCheckboxNames: string[] = [];
-setTimeout(() => {
-    mixData.value.forEach((item) => {
-        allCheckboxNames.push(item.name);
-    });
-}, 2000);
-
+let allCheckboxNames = ref<string[]>([]);
 let checkBox = ref<string[]>([]);
 const aloneChecked = ref(false);
 
@@ -109,7 +151,7 @@ const handleAllCheckboxChange = (value: boolean) => {
     aloneChecked.value = value;
     if (value) {
         // 全选:将checkBox设置为所有name
-        checkBox.value = [...allCheckboxNames];
+        checkBox.value = [...allCheckboxNames.value];
     } else {
         // 取消全选:清空checkBox
         checkBox.value = [];
@@ -120,10 +162,70 @@ const handleAllCheckboxChange = (value: boolean) => {
 const handleCheckboxGroupChange = (value: string[]) => {
     checkBox.value = value;
     // 检查是否所有复选框都被选中
-    const allSelected = allCheckboxNames.every((name) => value.includes(name));
+    const allSelected = allCheckboxNames.value.every((name) => value.includes(name));
     aloneChecked.value = allSelected;
 };
 const top = ref(0);
+
+//scroll-view滚动监听
+const scrolltolower = () => {
+    console.log('滚动到底部');
+    pageNum.value += 1;
+    getBaseInfo(pageNum.value, 10);
+};
+// 获取基地信息
+const getBaseInfo = async (pageNum: number, pageSize: number) => {
+    const params = {
+        pageNum,
+        pageSize,
+        ...form.value,
+    };
+    const res = await useClientRequest.get('/plt-api/app/base/pageList', params);
+    if (res) {
+        const { rows } = res;
+        list.value.push(...rows);
+    }
+};
+// 提交
+const confirm = () => {
+    if (baseID.value == -1) {
+        uni.showToast({
+            title: '请选择基地',
+            icon: 'none',
+        });
+        return;
+    } else {
+        list.value.forEach((item) => {
+            if (item.id == baseID.value) {
+                if (item?.baseType !== props.baseType) {
+                    uni.showToast({
+                        title: '请选择符合类型的基地',
+                        icon: 'none',
+                    });
+                    return;
+                } else {
+                    console.log(item, 'item');
+                    console.log(checkBox.value);
+                }
+            }
+        });
+    }
+};
+watch(
+    () => baseID.value,
+    async () => {
+        const res = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: baseID.value });
+        console.log(res);
+        const { rows } = res;
+        mixData.value = rows;
+        allCheckboxNames.value = [];
+        checkBox.value = [];
+        aloneChecked.value = false;
+        mixData.value.forEach((item) => {
+            allCheckboxNames.value.push(item.id);
+        });
+    }
+);
 onMounted(() => {
     const querys = uni.createSelectorQuery().in(instance?.proxy);
     querys
@@ -132,6 +234,7 @@ onMounted(() => {
             top.value = data.top;
         })
         .exec();
+    getBaseInfo(pageNum.value, 10);
 });
 </script>
 <style scoped lang="scss">
@@ -143,6 +246,8 @@ onMounted(() => {
         font-size: 28rpx;
         color: #333;
         font-weight: 500;
+        margin-right: 20rpx;
+        word-break: break-all;
     }
     .area {
         font-size: 24rpx;
@@ -166,6 +271,7 @@ onMounted(() => {
         font-size: 28rpx;
         color: #fff;
         font-weight: 500;
+        margin-right: 20rpx;
     }
     .area {
         font-size: 24rpx;

+ 0 - 1
src/store/index.ts

@@ -10,4 +10,3 @@ export { useDictStore } from './modules/dict';
 export { useUserStore, type UserInfo as UserInfoType, type UserProfile } from './modules/user';
 export { useAuthStore, type LoginForm, type LoginResponse } from './modules/auth';
 export { useInfoStore } from './modules/info';
-export { useSwitchStore, type SwitchPageParams } from './modules/switch';

+ 0 - 143
src/store/modules/switch.ts

@@ -1,143 +0,0 @@
-import { defineStore } from 'pinia';
-import { ref } from 'vue';
-import type { StorageLike } from 'pinia-plugin-persistedstate';
-
-// 为 UniApp 创建适配的 storage(与 store/index.ts 保持一致)
-const uniStorage: StorageLike = {
-    getItem: (key: string): string | null => {
-        try {
-            return uni.getStorageSync(key);
-        } catch (error) {
-            console.error('读取存储失败:', error);
-            return null;
-        }
-    },
-    setItem: (key: string, value: string): void => {
-        try {
-            uni.setStorageSync(key, value);
-        } catch (error) {
-            console.error('写入存储失败:', error);
-        }
-    },
-};
-
-// 判断当前是测试版还是正式版
-const accountInfo = uni.getAccountInfoSync();
-const prefixMap = {
-    release: 'prod_', // production的缩写
-    trial: 'beta_', // beta测试版
-    develop: 'dev_', // development的缩写
-};
-
-const SWITCH_STORE_KEY = `${prefixMap[accountInfo?.miniProgram?.envVersion] || 'dev_'}switch_store`;
-
-/**
- * Switch页面跳转参数存储接口
- */
-export interface SwitchPageParams {
-    [key: string]: {
-        data: any; // 存储的参数数据
-        timestamp: number; // 存储时间戳
-        expire?: number; // 过期时间(毫秒),可选
-    };
-}
-
-/**
- * Switch页面跳转参数存储Store
- * 用于在小程序switch页面跳转时传递参数
- * 简化版:只保留基于页面路径的方法,获取数据后自动清除
- */
-export const useSwitchStore = defineStore(
-    'switch',
-    () => {
-        // 存储所有switch页面跳转参数
-        const switchParams = ref<SwitchPageParams>({});
-
-        /**
-         * 为指定页面路径设置参数
-         * @param pagePath 目标页面路径(如:'/pages/switch/index1')
-         * @param data 要存储的参数数据
-         * @param expire 过期时间(毫秒),默认1分钟
-         */
-        const setParamsForPage = (pagePath: string, data: any, expire: number = 1 * 60 * 1000): void => {
-            const params = {
-                data,
-                timestamp: Date.now(),
-                expire,
-            };
-
-            // 使用页面路径作为键存储
-            switchParams.value[pagePath] = params;
-        };
-
-        /**
-         * 获取指定页面路径的参数
-         * @param pagePath 目标页面路径(如:'/pages/switch/index1')
-         * @returns 存储的参数数据,如果不存在或已过期则返回null
-         */
-        const getAndClearParamsForPage = (pagePath: string): any => {
-            // 从内存中获取
-            const params = switchParams.value[pagePath];
-
-            // 检查参数是否存在
-            if (!params) {
-                return null;
-            }
-
-            // 检查是否过期
-            const { data, timestamp, expire } = params;
-            // if (expire && Date.now() - timestamp > expire) {
-            //     // 清理过期数据
-            //     delete switchParams.value[pagePath];
-            //     return null;
-            // }
-
-            // // 获取数据后清理
-            // delete switchParams.value[pagePath];
-
-            return data;
-        };
-
-        /**
-         * 清除指定页面路径的参数
-         * @param pagePath 目标页面路径(如:'/pages/switch/index1')
-         */
-        const clearParamsForPage = (pagePath: string): void => {
-            // 从内存中删除
-            delete switchParams.value[pagePath];
-        };
-
-        /**
-         * 清理所有过期的switch页面跳转参数
-         */
-        const cleanupExpiredParams = (): void => {
-            const now = Date.now();
-
-            // 清理内存中的过期参数
-            Object.keys(switchParams.value).forEach((key) => {
-                const params = switchParams.value[key];
-                if (params.expire && now - params.timestamp > params.expire) {
-                    delete switchParams.value[key];
-                }
-            });
-        };
-
-        return {
-            // 状态
-            switchParams,
-
-            // 方法
-            setParamsForPage,
-            getAndClearParamsForPage,
-            clearParamsForPage,
-            cleanupExpiredParams,
-        };
-    },
-    {
-        // 启用持久化
-        persist: {
-            key: SWITCH_STORE_KEY,
-            storage: uniStorage,
-        },
-    }
-);

+ 0 - 48
src/utils/public.ts

@@ -1,5 +1,3 @@
-import { useSwitchStore } from '@/store';
-
 // 全局uni对象
 export function debounce<T extends (...args: any[]) => any>(fn: T, delay: number = 500): (...args: Parameters<T>) => void {
     let timer: number | null = null;
@@ -116,52 +114,6 @@ export const makePhoneCall = (phoneNumber: string): void => {
 export interface SwitchPageOptions {
     expire?: number; // 过期时间(毫秒),默认5分钟
 }
-
-/**
- * 跳转到switch页面并传递参数(只能使用switchTab跳转)
- * @param pagePath 目标页面路径(如:'/pages/switch/index1')
- * @param data 要传递的参数数据
- * @param options 跳转选项
- */
-export function goToSwitchPage(pagePath: string, data?: any, options: SwitchPageOptions = {}): void {
-    const switchStore = useSwitchStore();
-    const { expire = 5 * 60 * 1000 } = options;
-
-    // 设置参数
-    if (data !== undefined) {
-        switchStore.setParamsForPage(pagePath, data, expire);
-        console.log(`已为页面 ${pagePath} 设置参数`);
-    }
-
-    // 执行跳转(只能使用switchTab)
-    uni.switchTab({ url: pagePath });
-}
-
-/**
- * 获取当前页面的switch跳转参数
- * @returns 存储的参数数据,如果不存在或已过期则返回null
- */
-export function getSwitchPageParams(): any {
-    const switchStore = useSwitchStore();
-
-    // 获取当前页面路径
-    const pages = getCurrentPages();
-    if (!pages || pages.length === 0) {
-        console.warn('无法获取当前页面路径');
-        return null;
-    }
-
-    const currentPage = pages[pages.length - 1];
-    const pagePath = `/${currentPage.route}`;
-
-    // 获取参数
-    const params = switchStore.getAndClearParamsForPage(pagePath);
-
-    // 清理过期参数
-    switchStore.cleanupExpiredParams();
-
-    return params;
-}
 // 生成一个随机id并且唯一
 export function generateUniqueId(): string {
     const timestamp = Date.now().toString(36); // 将当前时间戳转换为36进制字符串

+ 0 - 3
src/utils/request.ts

@@ -31,7 +31,6 @@ export const request = ({ url, method = 'GET', data = {}, isToken = true, header
         }
         const fulllpathParams = fullPath.split('?');
         const fullpathstr = fulllpathParams.length > 1 ? `${fulllpathParams[0]}?${fulllpathParams[fulllpathParams.length - 1]}` : fulllpathParams[0];
-        console.log(isToken, '?????', url, fullpathstr);
         // 获取当前页面路径
         uni.$u.route({
             type: 'redirect',
@@ -69,8 +68,6 @@ export const request = ({ url, method = 'GET', data = {}, isToken = true, header
                     uni.hideLoading();
                     useInfoStore().removeToken();
                     let fullPath = recursiveDecodeURIComponent(getCurrentPage()?.$page?.fullPath);
-                    console.log(fullPath, '====');
-                    
                     const isLoginPage = recursiveDecodeURIComponent(fullPath).indexOf('/pages/login/login') !== -1;
                     if (isLoginPage) {
                         return;