Ver Fonte

Merge branch 'master' of http://git.yujin.shuziyunyao.com/yujin/forestry-wx

huangxw há 1 mês atrás
pai
commit
77d721f1fc

+ 11 - 10
src/components/ut-action-sheet/ut-action-sheet.vue

@@ -96,6 +96,7 @@ const options = computed(() => {
             name: item.label,
             value: item.value,
             span,
+            remark: item.remark,
         };
     });
 });
@@ -197,16 +198,16 @@ watch(
     { immediate: true },
 );
 </script>
-<script  lang="ts">  
-export default {  
-  options: {  
-    // 微信小程序中 options 选项  
-    multipleSlots: true, //  在组件定义时的选项中启动多slot支持,默认启用  
-    styleIsolation: 'shared', //  启动样式隔离。当使用页面自定义组件,希望父组件影响子组件样式时可能需要配置。具体配置选项参见:微信小程序自定义组件的样式  
-    addGlobalClass: true, //  表示页面样式将影响到自定义组件,但自定义组件中指定的样式不会影响页面。这个选项等价于设置 styleIsolation: apply-shared  
-    virtualHost: true //  将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等,而是希望自定义组件内部的第一层节点能够响应 flex 布局或者样式由自定义组件本身完全决定  
-  }  
-}  
+<script lang="ts">
+export default {
+    options: {
+        // 微信小程序中 options 选项
+        multipleSlots: true, //  在组件定义时的选项中启动多slot支持,默认启用
+        styleIsolation: 'shared', //  启动样式隔离。当使用页面自定义组件,希望父组件影响子组件样式时可能需要配置。具体配置选项参见:微信小程序自定义组件的样式
+        addGlobalClass: true, //  表示页面样式将影响到自定义组件,但自定义组件中指定的样式不会影响页面。这个选项等价于设置 styleIsolation: apply-shared
+        virtualHost: true, //  将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等,而是希望自定义组件内部的第一层节点能够响应 flex 布局或者样式由自定义组件本身完全决定
+    },
+};
 </script>
 <style lang="scss" scoped>
 .ut-custom-item-sheet {

+ 38 - 0
src/pages.json

@@ -175,6 +175,30 @@
                     "style": {
                         "navigationBarTitleText": "种植管理记录详情"
                     }
+                },
+                {
+                    "path": "supervise/supervise-raising-create/index",
+                    "style": {
+                        "navigationBarTitleText": "添加饲养管理记录"
+                    }
+                },
+                {
+                    "path": "supervise/supervise-material-create/index",
+                    "style": {
+                        "navigationBarTitleText": "投入物料记录"
+                    }
+                },
+                {
+                    "path": "supervise/supervise-material-detail/index",
+                    "style": {
+                        "navigationBarTitleText": "投入物料记录详情"
+                    }
+                },
+                {
+                    "path": "port-Information/index",
+                    "style": {
+                        "navigationBarTitleText": "种源信息列表"
+                    }
                 }
             ]
         },
@@ -389,6 +413,20 @@
                     "style": {
                         "navigationBarTitleText": "选择操作个体"
                     }
+                },
+                // 选择农资
+                {
+                    "path": "supervise-material/index",
+                    "style": {
+                        "navigationBarTitleText": "选择农资"
+                    }
+                },
+                // 选择操作时间
+                {
+                    "path": "species-info/index",
+                    "style": {
+                        "navigationBarTitleText": "选择种源信息"
+                    }
                 }
             ]
         },

+ 1 - 1
src/pages/plant/port/index.vue

@@ -24,7 +24,7 @@
         <view class="pd-24">
             <up-swipe-action>
                 <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="subCurrent === 0 ? options2 : options" class="mb-20" @click="clickTempSwipe">
-                    <task :data="item" @click="$u.route({ type: 'navigateTo', url: '/plant/port/port-detail/index', params: { id: item?.id } })" @toSupervise="$u.route({ type: 'navigateTo', url: '/plant/port/port-supervise/index', params: { id: item?.id } })" />
+                    <task :data="item" @click="$u.route({ type: 'navigateTo', url: '/plant/port/port-detail/index', params: { id: item?.id } })" @toSupervise="$u.route({ type: 'navigateTo', url: '/plant/port/port-supervise/index', params: { id: item?.id } })" @toInformation="$u.route({ type: 'navigateTo', url: '/plant/port/port-Information/index', params: { id: item?.id } })" />
                 </up-swipe-action-item>
             </up-swipe-action>
         </view>

+ 6 - 6
src/pages/plant/port/models/task.vue

@@ -46,13 +46,13 @@
                 <up-line color="#f7f7f7"></up-line>
             </view>
             <view class="pd-16 pt-8 pb-8 d-flex j-sb gap-20">
-                <up-button :customStyle="customStyle1">
+                <up-button :customStyle="customStyle1" @click="$emit('toInformation')">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Species_source_information.png" mode="widthFix" />
                         <text class="f-s-26">种源信息</text>
                     </view>
                 </up-button>
-                <up-button :customStyle="customStyle2">
+                <up-button :customStyle="customStyle2" @click="$emit('toSupervise')">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Breeding_management.png" mode="widthFix" />
                         <text class="f-s-26">饲养管理</text>
@@ -118,7 +118,7 @@
                 <up-line color="#f7f7f7"></up-line>
             </view>
             <view class="pd-16 pt-8 pb-8 d-flex j-sb gap-20">
-                <up-button :customStyle="customStyle1">
+                <up-button :customStyle="customStyle1" @click="$emit('toInformation')">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Species_source_information.png" mode="widthFix" />
                         <text class="f-s-26">种源信息</text>
@@ -192,7 +192,7 @@
                 <up-line color="#f7f7f7"></up-line>
             </view>
             <view class="pd-16 pt-8 pb-8 d-flex j-sb gap-20">
-                <up-button :customStyle="customStyle1">
+                <up-button :customStyle="customStyle1" @click="$emit('toInformation')">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Species_source_information.png" mode="widthFix" />
                         <text class="f-s-26">种源信息</text>
@@ -260,13 +260,13 @@
                 <up-line color="#f7f7f7"></up-line>
             </view>
             <view class="pd-16 pt-8 pb-8 d-flex j-sb gap-20">
-                <up-button :customStyle="customStyle1">
+                <up-button :customStyle="customStyle1" @click="$emit('toInformation')">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Species_source_information.png" mode="widthFix" />
                         <text class="f-s-26">种源信息</text>
                     </view>
                 </up-button>
-                <up-button :customStyle="customStyle2">
+                <up-button :customStyle="customStyle2" @click="$emit('toSupervise')">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Breeding_management.png" mode="widthFix" />
                         <text class="f-s-26">饲养管理</text>

+ 2 - 1
src/plant/port/port-create/index.vue

@@ -594,7 +594,8 @@
                                         <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
                                     </view>
                                 </ut-action-sheet>
-                                <view v-if="form.inoculation?.inoculationUnit" class="f-s-30 c-333 f-w-5 w-100">{{ selectDictLabel(pt_inoculation_unit, form.inoculation?.inoculationUnit) }}</view>
+                                <view v-if="form.inoculation?.inoculationUnit">/</view>
+                                <view v-if="form.inoculation?.inoculationUnit" class="f-s-30 c-333 f-w-5 w-100" style="text-align: right">{{ selectDictLabel(pt_inoculation_unit, form.inoculation?.inoculationUnit) }}</view>
                             </view>
                         </up-form-item>
                         <view class="h-1" id="plantpppp"></view>

+ 1 - 2
src/plant/port/port-detail/index.vue

@@ -344,7 +344,6 @@
                 <view class="bg-#fff pd-24 mb-20">
                     <template v-for="(item, index) in animalIds" :key="index">
                         <view class="pd-34 border-#37A954 mb-20 d-flex flex-cln b-radius">
-                            <text>{{ +index + 1 }}</text>
                             <text>{{ item }}</text>
                         </view>
                     </template>
@@ -373,7 +372,7 @@ import Baseinfo from '../port-create/models/baseinfo.vue';
 import { useClientRequest } from '@/utils/request';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_feed_amount_unit, pt_planting_mg_unit, pt_inoculation_unit, pt_inoculation_dosage_unit, pt_transplant_method, pt_plantation_type, pt_sowing_method, pt_area_unit, pt_plantation_method, pt_reproduction_type, pt_scale_unit, pt_feeding_method, pt_mg_method, pt_task_gap_flag, pt_task_type, pt_org_type, yes_no } = toRefs<any>(
-    proxy?.useDict('pt_feed_amount_unit', 'pt_planting_mg_unit', 'pt_inoculation_unit', 'pt_inoculation_dosage_unit', 'pt_transplant_method', 'pt_plantation_type', 'pt_sowing_method', 'pt_area_unit', 'pt_plantation_method', 'pt_reproduction_type', 'pt_scale_unit', 'pt_feeding_method', 'pt_mg_method', 'pt_task_gap_flag', 'pt_task_type', 'pt_org_type', 'yes_no')
+    proxy?.useDict('pt_feed_amount_unit', 'pt_planting_mg_unit', 'pt_inoculation_unit', 'pt_inoculation_dosage_unit', 'pt_transplant_method', 'pt_plantation_type', 'pt_sowing_method', 'pt_area_unit', 'pt_plantation_method', 'pt_reproduction_type', 'pt_scale_unit', 'pt_feeding_method', 'pt_mg_method', 'pt_task_gap_flag', 'pt_task_type', 'pt_org_type', 'yes_no'),
 );
 const paging = ref();
 const list = ref();

+ 234 - 0
src/plant/port/port-information/index.vue

@@ -0,0 +1,234 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom empty-view-text="该任务暂未关联种源信息">
+        <template #top>
+            <ut-navbar title="种源信息" :fixed="false"> </ut-navbar>
+        </template>
+        <view class="pd-24">
+            <Task_card :data="taskDate" />
+            <view class="d-flex a-c j-sb pt-20 pb-20">
+                <view class="startline-title mb-16">种源信息</view>
+                <view class="d-flex a-c gap-10">
+                    <view class="bg-#37A954 radius-10 pd4-10-20-10-20 d-flex a-c" style="width: max-content" @click="addManagementRecord()">
+                        <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
+                        <view class="c-#fff f-s-22">添加种源信息</view>
+                    </view>
+                </view>
+            </view>
+            <ut-search ref="searchRef" v-model="from.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜管理类型、物料、记录人" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+            <view class="pd-10"></view>
+            <up-swipe-action>
+                <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="options2" class="mb-20" @click="clickTempSwipe">
+                    <view class="bg-#fff b-radius pd-24" @click="gotoDetail(item)">
+                        <view class="d-flex a-c j-sb">
+                            <view class="f-s-34 f-w-5 pb-10" v-if="item?.opMethod !== '99'">{{ selectDictLabel(+taskDate.baseType == 1 ? pt_op_method : +taskDate.baseType == 2 ? pt_raise_op_method : pt_breed_op_method, item?.opMethod) }}</view>
+                            <view class="f-s-34 f-w-5 pb-10" v-else>{{ item?.cusOp }}</view>
+                            <view class="d-flex a-c">
+                                <view class="f-s-22 c-#666">{{ item?.activityStart }}</view>
+                                <view class="f-s-22 c-#666">至</view>
+                                <view class="f-s-22 c-#666">{{ item?.activityEnd }}</view>
+                            </view>
+                        </view>
+                        <view class="d-flex pd4-8-0-8-0">
+                            <view class="c-#666 f-s-28 w-s-no">使用物料:</view>
+                            <view class="c-#333 f-s-28 f-w-5 w-s-no tx-ov ov-hd"></view>
+                        </view>
+                        <view v-if="item?.mgName" class="d-flex pd4-8-0-8-0">
+                            <view class="c-#666 f-s-28">记录人:</view>
+                            <view class="c-#333 f-s-28 f-w-5">{{ item?.mgName }}</view>
+                        </view>
+                        <view v-if="item?.targetType == '1'" class="d-flex pd4-8-0-8-0">
+                            <view class="c-#666 f-s-28 w-s-no">操作地块:</view>
+                            <view class="c-#333 f-s-28 f-w-5" v-if="+item?.landFlag">全部{{ +taskDate?.baseType == 1 ? '地块' : +taskDate?.baseType == 2 ? '圈舍' : '培养架' }}</view>
+                            <view class="c-#333 f-s-28 f-w-5 d-flex a-c w-s-no tx-ov ov-hd" v-else>
+                                <template v-if="item?.lands?.length == 0">
+                                    <text>{{ '-' }}</text>
+                                </template>
+                                <view v-else v-for="(data, indexs) in item?.lands">
+                                    <text v-if="indexs !== 0">、</text>
+                                    <text>{{ data?.landName }}</text>
+                                </view>
+                            </view>
+                        </view>
+                        <view v-else class="d-flex pd4-8-0-8-0">
+                            <view class="c-#666 f-s-28 w-s-no">操作个体:</view>
+                            <template v-if="item?.animalIds?.length == 0">
+                                <text>{{ '-' }}</text>
+                            </template>
+                            <view v-else v-for="(data, indexs) in item?.animalIds">
+                                <text v-if="indexs !== 0">、</text>
+                                <text class="c-#333 f-s-28 f-w-5">{{ data }}</text>
+                            </view>
+                        </view>
+                        <view v-if="item?.remark" class="d-flex pd4-8-0-8-0">
+                            <view class="c-#666 f-s-28 w-s-no">备注:</view>
+                            <view class="c-#333 f-s-28 f-w-5 w-s-no tx-ov ov-hd">{{ item?.remark }}</view>
+                        </view>
+                    </view>
+                </up-swipe-action-item>
+            </up-swipe-action>
+        </view>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import Task_card from './models/task_card.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_op_method, pt_breed_op_method, pt_raise_op_method } = toRefs<any>(proxy?.useDict('pt_op_method', 'pt_breed_op_method', 'pt_raise_op_method'));
+const paging = ref();
+const list = ref<any>([]);
+const taskId = ref('');
+const taskDate = ref<any>();
+const from = ref({
+    keyword: '',
+    activityType: '',
+});
+const list1 = reactive([
+    { name: '全部', value: '' },
+    { name: '管理记录', value: 1 },
+    { name: '投料记录', value: 2 },
+]);
+const changeType = (tabItem: any) => {
+    from.value.activityType = tabItem.value;
+    paging.value.reload();
+};
+const query = async (pageNo: number, pageSize: number) => {
+    const res = await useClientRequest.get('/plt-api/app/plantationActivity/list', {
+        pageNo,
+        pageSize,
+        ...from.value,
+        taskId: taskId.value,
+    });
+    if (res) {
+        const { rows } = res;
+        paging.value.complete(rows);
+    }
+};
+// 添加种源信息
+const addManagementRecord = () => {
+    uni.$u.route({
+        type: 'navigateTo',
+        url: '/tools/species-info/index',
+    });
+};
+//添加投入物料记录
+const addInputMaterialRecord = () => {
+    console.log('添加投入物料记录');
+    uni.$u.route({
+        type: 'navigateTo',
+        url: '/plant/port/supervise/supervise-material-create/index',
+        params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 1, id: taskDate?.value?.id },
+    });
+};
+const changeSeach = async () => {
+    paging.value.reload();
+};
+const options2 = reactive([
+    {
+        text: '删除',
+        style: {
+            backgroundColor: '#F74C30',
+            width: '80rpx',
+            fontSize: '28rpx',
+        },
+    },
+    {
+        text: '编辑',
+        style: {
+            backgroundColor: '#37A954',
+            width: '80rpx',
+            fontSize: '28rpx',
+        },
+    },
+]);
+const clickTempSwipe = async (event: object) => {
+    const { name, index } = event as any;
+    // 在list中id找到对应的name
+    const activityType = list.value.find((item: any) => item.id === name)?.activityType;
+    list.value.forEach((item: any) => {});
+    if (index === 0) {
+        try {
+            const res = await uni.showModal({
+                title: '删除提示',
+                content: '删除后,将不能恢复,请谨慎操作!若已使用物料,删除后物料将自动退回相应仓库。',
+                confirmColor: '#f56c6c',
+            });
+            if (!res.confirm) return;
+            await uni.showLoading({
+                title: '删除中...',
+                mask: true,
+            });
+            await useClientRequest.get(`/plt-api/app/plantationActivity/deleteActivity/${name}`);
+            uni.hideLoading();
+            uni.showToast({
+                title: '删除成功',
+                icon: 'success',
+            });
+            paging.value?.reload();
+        } catch (error) {
+            console.error('删除任务失败:', error);
+        }
+    } else {
+        if (activityType == '2') {
+            uni.$u.route({
+                type: 'navigateTo',
+                url: '/plant/port/supervise/supervise-material-create/index',
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name },
+            });
+        } else if (taskDate?.value?.taskType == '1') {
+            uni.$u.route({
+                type: 'navigateTo',
+                url: `/plant/port/supervise/supervise-plant-create/index`,
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name },
+            });
+        } else if (taskDate?.value?.taskType == '11' || taskDate?.value?.taskType == '21') {
+            uni.$u.route({
+                type: 'navigateTo',
+                url: '/plant/port/supervise/supervise-breeding-create/index',
+                //参数说明 baseId:基地id,taskId:任务id,add:1新增,id:任务id,landType:地块类型
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name, landType: taskDate?.value?.baseType },
+            });
+        } else {
+            uni.$u.route({
+                type: 'navigateTo',
+                url: '/plant/port/supervise/supervise-raising-create/index',
+                //参数说明 baseId:基地id,taskId:任务id,add:1新增,id:任务id,landType:地块类型
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name, landType: taskDate?.value?.baseType },
+            });
+        }
+    }
+};
+const gotoDetail = async (item: any) => {
+    if (item?.activityType == '2') {
+        uni.$u.route({
+            type: 'navigateTo',
+            url: `/plant/port/supervise/supervise-material-detail/index`,
+            params: {
+                id: item?.id,
+            },
+        });
+    } else if (item?.activityType == '1') {
+        uni.$u.route({
+            type: 'navigateTo',
+            url: `/plant/port/supervise/supervise-plant-detail/index`,
+            params: {
+                id: item?.id,
+            },
+        });
+    }
+};
+onMounted(async () => {
+    const res = await useClientRequest.get(`/plt-api/app/plantationTask/getInfo/${taskId.value}`, {
+        pageNo: 1,
+        pageSize: 10,
+    });
+    taskDate.value = res.data;
+});
+onLoad((options: any) => {
+    taskId.value = options?.id;
+    //接收 uni.$emit('updatesuperviselist');
+    uni.$on('updatesuperviselist', () => {
+        paging.value?.reload();
+    });
+});
+</script>

+ 140 - 0
src/plant/port/port-information/models/task_card.vue

@@ -0,0 +1,140 @@
+<template>
+    <!-- 种植 -->
+    <view class="" v-if="data?.taskType === '1'" @click="$emit('click')">
+        <view class="b-radius bg-#fff pd-10 p-rtv">
+            <image class="w-80 h-34" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Planting.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+            <view class="d-flex j-ed f-s-22 c-#666">{{ data?.plannedStartDate }}至{{ data?.plannedEndDate }}</view>
+            <view class="d-flex a-ed pd-16 pt-8 pb-8">
+                <view class="c-#333 f-s-34 f-w-5 mr-6">{{ data?.variety }}</view>
+                <view class="c-#666 f-s-26">{{ data?.genusName }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">种植批号:</view>
+                <view class="c-#333 f-w-5">{{ data?.plantationCode }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">基地:</view>
+                <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd d-flex a-c">
+                    {{ data?.baseRef?.baseInfo?.address }}基地
+                    <text v-if="data?.landIds.length == 0">全部地块</text>
+                    <view v-else>
+                        <text v-for="(item, index) in data?.baseRef?.baseInfo?.landList" :key="index"><text v-if="index != 0">、</text> {{ item?.landName }}</text>
+                    </view>
+                </view>
+            </view>
+            <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">种植面积:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingAmount }}{{ data?.plantingUnit }}</view>
+                </view>
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">种植量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingMgAmount }}{{ data?.plantingMgUnit }}</view>
+                </view>
+            </view>
+        </view>
+    </view>
+    <!-- 养殖 -->
+    <view class="" v-if="data?.taskType === '2'" @click="$emit('click')">
+        <view class="b-radius bg-#fff pd-10 p-rtv">
+            <image class="w-80 h-34" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Breeding.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+            <view class="d-flex j-ed f-s-22 c-#666">{{ data?.plannedStartDate }}至{{ data?.plannedEndDate }}</view>
+            <view class="d-flex a-ed pd-16 pt-8 pb-8">
+                <view class="c-#333 f-s-34 f-w-5 mr-6">{{ data?.variety }}</view>
+                <view class="c-#666 f-s-26">{{ data?.genusName }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">养殖批号:</view>
+                <view class="c-#333 f-w-5">{{ data?.plantationCode }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">基地:</view>
+                <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd d-flex a-c">
+                    {{ data?.baseRef?.baseInfo?.address }}基地
+                    <text v-if="data?.landIds.length == 0">全部地块</text>
+                    <view v-else>
+                        <text v-for="(item, index) in data?.baseRef?.baseInfo?.landList" :key="index"><text v-if="index != 0">、</text> {{ item?.landName }}</text>
+                    </view>
+                </view>
+                <view class="flex1 d-flex j-ed"><up-icon name="arrow-right" size="34rpx"></up-icon></view>
+            </view>
+            <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">养殖区域:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.breedScale }}{{ data?.breedScaleUnit }}</view>
+                </view>
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">养殖量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingMgAmount }}{{ data?.plantingMgUnit }}</view>
+                </view>
+            </view>
+        </view>
+    </view>
+    <!-- 种苗繁育 -->
+    <view class="" v-if="data?.taskType === '11'" @click="$emit('click')">
+        <view class="b-radius bg-#fff pd-10 p-rtv">
+            <image class="w-112 h-34" src="/static/images/plant/port/Task_Seedling_breeding.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+            <view class="d-flex j-ed f-s-22 c-#666">{{ data?.plannedStartDate }}至{{ data?.plannedEndDate }}</view>
+            <view class="d-flex a-ed pd-16 pt-8 pb-8">
+                <view class="c-#333 f-s-34 f-w-5 mr-6">{{ data?.variety }}</view>
+                <view class="c-#666 f-s-26">{{ data?.genusName }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">繁育批号:</view>
+                <view class="c-#333 f-w-5">{{ data?.plantationCode }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">基地:</view>
+                <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd d-flex a-c">
+                    {{ data?.baseRef?.baseInfo?.address }}基地
+                    <text v-if="data?.landIds.length == 0">全部地块</text>
+                    <view v-else>
+                        <text v-for="(item, index) in data?.baseRef?.baseInfo?.landList" :key="index"><text v-if="index != 0">、</text> {{ item?.landName }}</text>
+                    </view>
+                </view>
+            </view>
+            <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
+                <view v-if="data?.baseType == '3'" class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">接种数量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.inoculationAmount }}{{ data?.inoculationUnit }}</view>
+                </view>
+                <view v-else class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">种植面积:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingAmount }}{{ data?.plantingUnit }}</view>
+                </view>
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">繁育量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingMgAmount }}{{ data?.plantingMgUnit }}</view>
+                </view>
+            </view>
+        </view>
+    </view>
+    <!-- 种畜繁育 -->
+    <view class="" v-if="data?.taskType === '21'" @click="$emit('click')">
+        <view class="b-radius bg-#fff pd-10 p-rtv">
+            <image class="w-112 h-34" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Breeding_Livestock.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+            <view class="d-flex j-ed f-s-22 c-#666">{{ data?.plannedStartDate }}至{{ data?.plannedEndDate }}</view>
+            <view class="d-flex a-ed pd-16 pt-8 pb-8">
+                <view class="c-#333 f-s-34 f-w-5 mr-6">{{ data?.variety }}</view>
+                <view class="c-#666 f-s-26">{{ data?.genusName }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">繁育批号:</view>
+                <view class="c-#333 f-w-5">{{ data?.plantationCode }}</view>
+            </view>
+            <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">养殖区域:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.breedScale }}{{ data?.breedScaleUnit }}</view>
+                </view>
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">养殖量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingMgAmount }}{{ data?.plantingMgUnit }}</view>
+                </view>
+            </view>
+        </view>
+    </view>
+</template>
+<script setup lang="ts">
+const props = defineProps<{ data: any }>();
+</script>

+ 97 - 20
src/plant/port/port-supervise/index.vue

@@ -1,24 +1,34 @@
 <template>
     <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
         <template #top>
-            <ut-navbar title="种植管理" :fixed="false"> </ut-navbar>
+            <ut-navbar :title="title" :fixed="false"> </ut-navbar>
         </template>
         <view class="pd-24">
             <Task_card :data="taskDate" />
             <view class="d-flex a-c j-sb pt-20 pb-20">
                 <view class="startline-title mb-16">管理记录</view>
-                <view class="bg-#37A954 radius-10 pd4-10-20-10-20 d-flex a-c" style="width: max-content" @click="addManagementRecord()">
-                    <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
-                    <view class="c-#fff f-s-22">添加管理记录</view>
+                <view class="d-flex a-c gap-10">
+                    <view v-if="taskDate?.taskType == '2' || taskDate?.taskType == '21'" class="bg-#18BECA radius-10 pd4-10-20-10-20 d-flex a-c" style="width: max-content" @click="addInputMaterialRecord()">
+                        <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
+                        <view class="c-#fff f-s-22">添加投入物料记录</view>
+                    </view>
+                    <view class="bg-#37A954 radius-10 pd4-10-20-10-20 d-flex a-c" style="width: max-content" @click="addManagementRecord()">
+                        <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
+                        <view class="c-#fff f-s-22">添加管理记录</view>
+                    </view>
                 </view>
             </view>
-            <ut-search ref="searchRef" v-model="from.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜管理类型、物料、记录人" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+            <view v-if="taskDate?.taskType == '2' || taskDate?.taskType == '21'" class="d-flex a-c">
+                <up-tabs :list="list1" @change="changeType" lineWidth="30"></up-tabs>
+                <ut-search ref="searchRef" v-model="from.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜管理类型、物料、记录人" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+            </view>
+            <ut-search v-else ref="searchRef" v-model="from.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜管理类型、物料、记录人" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
             <view class="pd-10"></view>
             <up-swipe-action>
                 <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="options2" class="mb-20" @click="clickTempSwipe">
                     <view class="bg-#fff b-radius pd-24" @click="gotoDetail(item)">
                         <view class="d-flex a-c j-sb">
-                            <view class="f-s-34 f-w-5 pb-10" v-if="item?.opMethod !== '99'">{{ selectDictLabel(+taskDate.lands[0]?.landType == 1 ? pt_op_method : pt_breed_op_method, item?.opMethod) }}</view>
+                            <view class="f-s-34 f-w-5 pb-10" v-if="item?.opMethod !== '99'">{{ selectDictLabel(+taskDate.baseType == 1 ? pt_op_method : +taskDate.baseType == 2 ? pt_raise_op_method : pt_breed_op_method, item?.opMethod) }}</view>
                             <view class="f-s-34 f-w-5 pb-10" v-else>{{ item?.cusOp }}</view>
                             <view class="d-flex a-c">
                                 <view class="f-s-22 c-#666">{{ item?.activityStart }}</view>
@@ -36,9 +46,12 @@
                         </view>
                         <view v-if="item?.targetType == '1'" class="d-flex pd4-8-0-8-0">
                             <view class="c-#666 f-s-28 w-s-no">操作地块:</view>
-                            <view class="c-#333 f-s-28 f-w-5" v-if="+item?.landFlag">全部{{ +taskDate.lands[0]?.landType == 1 ? '地块' : +taskDate.lands[0]?.landType == 2 ? '圈舍' : '培养架' }}</view>
+                            <view class="c-#333 f-s-28 f-w-5" v-if="+item?.landFlag">全部{{ +taskDate?.baseType == 1 ? '地块' : +taskDate?.baseType == 2 ? '圈舍' : '培养架' }}</view>
                             <view class="c-#333 f-s-28 f-w-5 d-flex a-c w-s-no tx-ov ov-hd" v-else>
-                                <view v-for="(data, indexs) in item?.lands">
+                                <template v-if="item?.lands?.length == 0">
+                                    <text>{{ '-' }}</text>
+                                </template>
+                                <view v-else v-for="(data, indexs) in item?.lands">
                                     <text v-if="indexs !== 0">、</text>
                                     <text>{{ data?.landName }}</text>
                                 </view>
@@ -46,7 +59,10 @@
                         </view>
                         <view v-else class="d-flex pd4-8-0-8-0">
                             <view class="c-#666 f-s-28 w-s-no">操作个体:</view>
-                            <view v-for="(data, indexs) in item?.animalIds">
+                            <template v-if="item?.animalIds?.length == 0">
+                                <text>{{ '-' }}</text>
+                            </template>
+                            <view v-else v-for="(data, indexs) in item?.animalIds">
                                 <text v-if="indexs !== 0">、</text>
                                 <text class="c-#333 f-s-28 f-w-5">{{ data }}</text>
                             </view>
@@ -66,14 +82,25 @@
 import { useClientRequest } from '@/utils/request';
 import Task_card from './models/task_card.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { pt_op_method, pt_breed_op_method } = toRefs<any>(proxy?.useDict('pt_op_method', 'pt_breed_op_method'));
+const { pt_op_method, pt_breed_op_method, pt_raise_op_method } = toRefs<any>(proxy?.useDict('pt_op_method', 'pt_breed_op_method', 'pt_raise_op_method'));
 const paging = ref();
 const list = ref<any>([]);
 const taskId = ref('');
 const taskDate = ref<any>();
 const from = ref({
     keyword: '',
+    activityType: '',
 });
+const title = ref('种植管理');
+const list1 = reactive([
+    { name: '全部', value: '' },
+    { name: '管理记录', value: 1 },
+    { name: '投料记录', value: 2 },
+]);
+const changeType = (tabItem: any) => {
+    from.value.activityType = tabItem.value;
+    paging.value.reload();
+};
 const query = async (pageNo: number, pageSize: number) => {
     const res = await useClientRequest.get('/plt-api/app/plantationActivity/list', {
         pageNo,
@@ -86,6 +113,7 @@ const query = async (pageNo: number, pageSize: number) => {
         paging.value.complete(rows);
     }
 };
+// 添加管理记录
 const addManagementRecord = () => {
     console.log(taskDate?.value);
     if (taskDate?.value?.taskType == '1') {
@@ -101,8 +129,24 @@ const addManagementRecord = () => {
             //参数说明 baseId:基地id,taskId:任务id,add:1新增,id:任务id,landType:地块类型
             params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 1, id: taskDate?.value?.id, landType: taskDate?.value?.lands[0]?.landType, variety: taskDate?.value?.variety },
         });
+    } else if (taskDate?.value?.taskType == '2' || taskDate?.value?.taskType == '21') {
+        uni.$u.route({
+            type: 'navigateTo',
+            url: '/plant/port/supervise/supervise-raising-create/index',
+            //参数说明 baseId:基地id,taskId:任务id,add:1新增,id:任务id,landType:地块类型
+            params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 1, id: taskDate?.value?.id, landType: taskDate?.value?.lands[0]?.landType, variety: taskDate?.value?.variety },
+        });
     }
 };
+//添加投入物料记录
+const addInputMaterialRecord = () => {
+    console.log('添加投入物料记录');
+    uni.$u.route({
+        type: 'navigateTo',
+        url: '/plant/port/supervise/supervise-material-create/index',
+        params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 1, id: taskDate?.value?.id },
+    });
+};
 const changeSeach = async () => {
     paging.value.reload();
 };
@@ -126,6 +170,9 @@ const options2 = reactive([
 ]);
 const clickTempSwipe = async (event: object) => {
     const { name, index } = event as any;
+    // 在list中id找到对应的name
+    const activityType = list.value.find((item: any) => item.id === name)?.activityType;
+    list.value.forEach((item: any) => {});
     if (index === 0) {
         try {
             const res = await uni.showModal({
@@ -149,30 +196,53 @@ const clickTempSwipe = async (event: object) => {
             console.error('删除任务失败:', error);
         }
     } else {
-        if (taskDate?.value?.taskType == '1') {
+        if (activityType == '2') {
+            uni.$u.route({
+                type: 'navigateTo',
+                url: '/plant/port/supervise/supervise-material-create/index',
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name },
+            });
+        } else if (taskDate?.value?.taskType == '1') {
             uni.$u.route({
                 type: 'navigateTo',
                 url: `/plant/port/supervise/supervise-plant-create/index`,
                 params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name },
             });
-        } else if (taskDate?.value?.taskType == '11') {
+        } else if (taskDate?.value?.taskType == '11' || taskDate?.value?.taskType == '21') {
             uni.$u.route({
                 type: 'navigateTo',
                 url: '/plant/port/supervise/supervise-breeding-create/index',
                 //参数说明 baseId:基地id,taskId:任务id,add:1新增,id:任务id,landType:地块类型
-                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name, landType: taskDate?.value?.lands[0]?.landType },
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name, landType: taskDate?.value?.baseType },
+            });
+        } else {
+            uni.$u.route({
+                type: 'navigateTo',
+                url: '/plant/port/supervise/supervise-raising-create/index',
+                //参数说明 baseId:基地id,taskId:任务id,add:1新增,id:任务id,landType:地块类型
+                params: { baseId: taskDate?.value?.baseId, taskId: taskId.value, add: 0, id: name, landType: taskDate?.value?.baseType },
             });
         }
     }
 };
 const gotoDetail = async (item: any) => {
-    uni.$u.route({
-        type: 'navigateTo',
-        url: `/plant/port/supervise/supervise-plant-detail/index`,
-        params: {
-            id: item?.id,
-        },
-    });
+    if (item?.activityType == '2') {
+        uni.$u.route({
+            type: 'navigateTo',
+            url: `/plant/port/supervise/supervise-material-detail/index`,
+            params: {
+                id: item?.id,
+            },
+        });
+    } else if (item?.activityType == '1') {
+        uni.$u.route({
+            type: 'navigateTo',
+            url: `/plant/port/supervise/supervise-plant-detail/index`,
+            params: {
+                id: item?.id,
+            },
+        });
+    }
 };
 onMounted(async () => {
     const res = await useClientRequest.get(`/plt-api/app/plantationTask/getInfo/${taskId.value}`, {
@@ -180,6 +250,13 @@ onMounted(async () => {
         pageSize: 10,
     });
     taskDate.value = res.data;
+    if (taskDate.value?.baseType == '1') {
+        title.value = '种植管理';
+    } else if (taskDate.value?.baseType == '2') {
+        title.value = '饲养管理';
+    } else {
+        title.value = '繁育管理';
+    }
 });
 onLoad((options: any) => {
     taskId.value = options?.id;

+ 26 - 2
src/plant/port/port-supervise/models/task_card.vue

@@ -94,7 +94,7 @@
                 </view>
             </view>
             <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
-                <view v-if="data?.lands[0]?.landType == '3'" class="d-flex a-c w-50%">
+                <view v-if="data?.baseType == '3'" class="d-flex a-c w-50%">
                     <view class="c-#666 w-s-no">接种数量:</view>
                     <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.inoculationAmount }}{{ data?.inoculationUnit }}</view>
                 </view>
@@ -109,8 +109,32 @@
             </view>
         </view>
     </view>
+    <!-- 种畜繁育 -->
+    <view class="" v-if="data?.taskType === '21'" @click="$emit('click')">
+        <view class="b-radius bg-#fff pd-10 p-rtv">
+            <image class="w-112 h-34" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Breeding_Livestock.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+            <view class="d-flex j-ed f-s-22 c-#666">{{ data?.plannedStartDate }}至{{ data?.plannedEndDate }}</view>
+            <view class="d-flex a-ed pd-16 pt-8 pb-8">
+                <view class="c-#333 f-s-34 f-w-5 mr-6">{{ data?.variety }}</view>
+                <view class="c-#666 f-s-26">{{ data?.genusName }}</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">繁育批号:</view>
+                <view class="c-#333 f-w-5">{{ data?.plantationCode }}</view>
+            </view>
+            <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">养殖区域:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.breedScale }}{{ data?.breedScaleUnit }}</view>
+                </view>
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">养殖量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">{{ data?.plantingMgAmount }}{{ data?.plantingMgUnit }}</view>
+                </view>
+            </view>
+        </view>
+    </view>
 </template>
 <script setup lang="ts">
 const props = defineProps<{ data: any }>();
-console.log(props.data);
 </script>

+ 3 - 1
src/plant/port/supervise/models/individualinfo.vue

@@ -1,6 +1,8 @@
 <template>
     <view class="d-flex j-sb b-radius border-#AFDDBB bg-#FBFDFB mb-20 pd-24 p-rtv" v-for="(item, index) in modelValue?.checkBox" :key="index">
-        <view v-if="showClose" @click="handleDelete(index)" class="d-flex j-c a-c c-#FF4444 f-s-28" style="position: absolute; top: 0; right: 10rpx">X</view>
+        <view v-if="showClose" @click="handleDelete(index)" class="d-flex j-c a-c c-#FF4444 f-s-28" style="position: absolute; top: 10rpx; right: 10rpx">
+            <up-icon name="close" color="#FF4444" size="12"></up-icon>
+        </view>
         <view class="flex1 ov-hd">
             <view class="ov-hd tx-ov d-flex a-c">
                 <view class="c-primary f-s-24 f-w-5 bg-#EBF6EE pd4-4-12-4-6 b-radius" style="font-style: italic">{{ Number(index) + 1 < 10 ? '0' + (Number(index) + 1) : Number(index) + 1 }}</view>

+ 144 - 24
src/plant/port/supervise/models/materialinfo.vue

@@ -1,57 +1,177 @@
 <template>
-    <view class="bg-#FBFDFB border-#AFDDBB pd-24 b-radius">
-        <view v-if="showClose" class="c-#F81242 f-s-36 ab2-10-10 pl-20 pr-10" style="position: absolute; right: 10rpx; top: 0rpx" @click="handleClose"> × </view>
+    <view v-for="(data, index) in datasModel" :key="index" class="bg-#FBFDFB border-#AFDDBB pd-24 b-radius mb-10">
+        <view v-if="showClose" class="c-#F81242 f-s-36 ab2-10-10 pl-20 pr-10" style="position: absolute; right: 10rpx; top: 0rpx" @click="() => handleClose(index)"> × </view>
         <view class="d-flex a-c pb-10">
-            <view class="c-primary pd-4 bg-#E7F4EA radius-10" style="font-style: italic">01</view>
-            <view class="c-#333 f-s-34 f-w-5 ml-10">磷酸酶</view>
+            <view class="c-primary pd-4 bg-#E7F4EA radius-10" style="font-style: italic">{{ index + 1 < 10 ? '0' + (index + 1) : index + 1 }}</view>
+            <view class="c-#333 f-s-34 f-w-5 ml-10">{{ data?.materialName }}</view>
         </view>
         <view class="pt-6 pb-6 d-flex a-c">
             <view class="c-#666 f-s-28"> 入库批次号:</view>
-            <view class="c-#333 f-s-28 f-w-5"> 2021-07-01</view>
+            <view class="c-#333 f-s-28 f-w-5">{{ data?.batchCode }}</view>
         </view>
         <view class="pt-6 pb-6 d-flex a-c">
             <view class="c-#666 f-s-28"> 供应商:</view>
-            <view class="c-#333 f-s-28 f-w-5"> 2021-07-01</view>
+            <view class="c-#333 f-s-28 f-w-5">{{ data?.supplier }}</view>
         </view>
         <view class="pt-6 pb-6 d-flex a-c">
-            <view class="c-#666 f-s-28"> 所在库房:</view>
-            <view class="c-#333 f-s-28 f-w-5"> 2021-07-01</view>
+            <view class="c-#666 f-s-28 w-s-no"> 所在库房:</view>
+            <view class="c-#333 f-s-28 f-w-5">{{ data?.warehouses }}</view>
         </view>
-        <view class="pt-6 pb-6 d-flex mb-12">
+        <view class="pt-6 pb-6 d-flex mb-12" v-if="showClose">
             <view class="w-50% d-flex a-c">
                 <view class="c-#666 f-s-28"> 入库量:</view>
-                <view class="c-#333 f-s-28 f-w-5"> 2021-07-01</view>
+                <view class="c-#333 f-s-28 f-w-5">{{ data?.capacity }}{{ data?.unit }}</view>
             </view>
             <view class="w-50% d-flex a-c">
                 <view class="c-#666 f-s-28"> 剩余量:</view>
-                <view class="c-primary f-s-28 f-w-5"> 2021-07-01</view>
+                <view class="c-primary f-s-28 f-w-5">{{ data?.restAmount }}{{ data?.unit }}</view>
             </view>
         </view>
-        <up-line color="#AFDDBB" style="margin-left: -24rpx; margin-right: -24rpx; width: auto"></up-line>
-        <view class="f-s-28 c-#666 pt-16">本次使用量:</view>
-        <view class="pt-6 pb-6 d-flex a-c">
+        <view v-if="!showClose" class="pt-6 pb-6 d-flex a-c">
+            <view class="c-#666 f-s-28 w-s-no">本次使用量:</view>
+            <view class="c-#333 f-s-28 f-w-5">{{ data?.quantity }}{{ data?.unit }}</view>
+        </view>
+        <up-line v-if="showClose" color="#AFDDBB" style="margin-left: -24rpx; margin-right: -24rpx; width: auto"></up-line>
+        <view v-if="showClose" class="f-s-28 c-#666 pt-16">本次使用量:</view>
+        <view v-if="showClose" class="pt-6 pb-6 d-flex a-c">
             <view class="flex1 mr-10">
-                <up-input v-model="form.Usage" placeholder="请输入本次使用量" border="bottom" style="padding-left: 0">
+                <up-input v-model="inputsModel[index].inputAmount" placeholder="请输入本次使用量" border="bottom" style="padding-left: 0" type="number" :error="hasError(index)" :errorMessage="getErrorMessage(index)">
                     <template #suffix>
-                        <view class="c-#333 f-s-28 f-w-5">kg</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ data?.unit }}</view>
                     </template>
                 </up-input>
             </view>
             <view class="">
-                <up-radio-group v-model="form.AllUse">
-                    <up-radio shape="circle" label="全部使用"></up-radio>
-                </up-radio-group>
+                <up-checkbox label="全部使用" usedAlone v-model:checked="useAllFlags[index]" @change="handleUseAllChange(index)"></up-checkbox>
             </view>
         </view>
     </view>
 </template>
 <script setup lang="ts">
-//从外部获取数据
+import { ref, watch, computed } from 'vue';
+
+// 从外部获取数据
 const props = defineProps<{
     showClose?: boolean;
 }>();
-const form = reactive({
-    Usage: '',
-    AllUse: false,
-});
+
+// 双向绑定
+const datasModel = defineModel<any[]>('datas', { default: () => [] });
+const inputsModel = defineModel<any[]>('inputs', { default: () => [] });
+setTimeout(() => {
+    console.log(inputsModel.value, 'inputsModel');
+    console.log(datasModel.value, 'datasModel');
+}, 2000);
+// 用于跟踪"全部使用"复选框的状态
+const useAllFlags = ref<boolean[]>([]);
+
+// 初始化 inputsModel 数据结构
+const initInputsModel = () => {
+    if (!datasModel.value || datasModel.value.length === 0) {
+        inputsModel.value = [];
+        useAllFlags.value = [];
+        return;
+    }
+    // 确保 inputsModel 与 datasModel 长度一致
+    const newInputs = [...inputsModel.value];
+    const newUseAllFlags = [...useAllFlags.value];
+
+    datasModel.value.forEach((data, index) => {
+        if (!newInputs[index] || newInputs[index].id !== data.id) {
+            newInputs[index] = {
+                id: data.id,
+                inputAmount: '',
+            };
+        }
+        if (newUseAllFlags[index] === undefined) {
+            newUseAllFlags[index] = false;
+        }
+    });
+    1;
+    // 移除多余的元素
+    if (newInputs.length > datasModel.value.length) {
+        newInputs.splice(datasModel.value.length);
+        newUseAllFlags.splice(datasModel.value.length);
+    }
+
+    inputsModel.value = newInputs;
+    useAllFlags.value = newUseAllFlags;
+};
+
+// 监听 datasModel 变化,初始化 inputsModel
+watch(
+    () => datasModel.value,
+    () => {
+        initInputsModel();
+    },
+    { immediate: true, deep: true },
+);
+watch(
+    () =>
+        inputsModel.value.map((item, idx) => ({
+            amount: item.inputAmount,
+            index: idx,
+            rest: datasModel.value[idx]?.restAmount,
+        })),
+    (newItems) => {
+        newItems.forEach(({ amount, index, rest }) => {
+            const numAmount = Number(amount) || 0;
+            if (numAmount >= rest) {
+                inputsModel.value[index].inputAmount = rest;
+                useAllFlags.value[index] = true;
+            } else {
+                useAllFlags.value[index] = false;
+            }
+        });
+    },
+    { deep: true, flush: 'post' },
+);
+// 处理"全部使用"复选框变化
+const handleUseAllChange = (index: number) => {
+    console.log(useAllFlags.value[index], datasModel.value[index]);
+
+    if (!useAllFlags.value[index] && datasModel.value[index]) {
+        inputsModel.value[index].inputAmount = datasModel.value[index].restAmount;
+    } else if (useAllFlags.value[index]) {
+        inputsModel.value[index].inputAmount = '';
+    }
+};
+
+// // 验证输入量
+// const validateInputAmount = async (index: number) => {
+//     const inputAmount = inputsModel.value[index]?.inputAmount || 0;
+//     const restAmount = datasModel.value[index]?.restAmount || 0;
+
+//     if (inputAmount > restAmount) {
+//         // 如果超过剩余量,自动调整为剩余量
+//         inputsModel.value[index].inputAmount = '';
+//         await nextTick();
+//         inputsModel.value[index].inputAmount = restAmount;
+//         useAllFlags.value[index] = true;
+//     }
+// };
+
+// 检查是否有错误
+const hasError = (index: number): boolean => {
+    const inputAmount = inputsModel.value[index]?.inputAmount || 0;
+    const restAmount = datasModel.value[index]?.restAmount || 0;
+    return inputAmount > restAmount;
+};
+
+// 获取错误信息
+const getErrorMessage = (index: number): string => {
+    const inputAmount = inputsModel.value[index]?.inputAmount || 0;
+    const restAmount = datasModel.value[index]?.restAmount || 0;
+    if (inputAmount > restAmount) {
+        return `使用量不能超过剩余量 ${restAmount}`;
+    }
+    return '';
+};
+
+// 处理关闭物料
+const handleClose = (index: number) => {
+    datasModel.value.splice(index, 1);
+    inputsModel.value.splice(index, 1);
+    useAllFlags.value.splice(index, 1);
+};
 </script>

+ 36 - 12
src/plant/port/supervise/supervise-breeding-create/index.vue

@@ -100,20 +100,22 @@
                     <!-- 是否使用物料 -->
                     <up-form-item borderBottom label="是否使用物料" required prop="inputFlag" id="inputFlagpppp">
                         <view class="d-flex flex-cln">
-                            <view v-if="!+isAdd" class="c-#B52B21 f-s-24">因物料修改涉及退库操作,不支持修改物料信息如有错误,请删除此条管理记录,重新添加。</view>
+                            <view v-if="!isAdd" class="c-#B52B21 f-s-24">因物料修改涉及退库操作,不支持修改物料信息如有错误,请删除此条管理记录,重新添加。</view>
                             <up-radio-group v-model="form.inputFlag">
-                                <up-radio :disabled="!+isAdd" :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
+                                <up-radio :disabled="!isAdd" :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
                             </up-radio-group>
                         </view>
                     </up-form-item>
                     <!-- 使用物料 -->
-                    <up-form-item v-if="+form.inputFlag" borderBottom label="使用物料" required prop="inputFlag" id="inputFlagpppp">
-                        <view v-if="!Material" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goMaterial()">
-                            <view class=""></view>
-                            <view class="f-s-34 c-primary">请选择此次农事使用的物料</view>
-                        </view>
-                        <view v-else class="w-100%">
-                            <Materialinfo :showClose="true" />
+                    <up-form-item v-if="+form.inputFlag" borderBottom label="使用物料" required prop="inputs" id="inputspppp">
+                        <view class="d-flex flex-cln w-100%">
+                            <view class="w-100%">
+                                <Materialinfo :showClose="Boolean(isAdd)" v-model:datas="MaterialData" v-model:inputs="form.inputs" />
+                            </view>
+                            <view v-if="Boolean(isAdd)" class="d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goMaterial()">
+                                <view class=""></view>
+                                <view class="f-s-34 c-primary">请选择此次农事使用的物料</view>
+                            </view>
                         </view>
                     </up-form-item>
                     <!-- 备注 -->
@@ -177,7 +179,7 @@ const form = ref({
     //是否使用物料
     inputFlag: '0' as '0' | '1',
     //物料列表
-    inputs: [],
+    inputs: [] as any,
     remark: '',
     imgs: null as string | null,
     videos: null as string | null,
@@ -376,7 +378,6 @@ const goIndividual = () => {
         data?.checkBox.forEach((item: any) => {
             //判断有没有重复的值,如果有这个就不添加,没有就添加
             if (individualLandIds.value.checkBox.some((item2: any) => item2 === item)) {
-                console.log('????', item);
                 flag = true;
             } else {
                 individualLandIds.value.checkBox.push(item);
@@ -393,18 +394,31 @@ const goIndividual = () => {
     });
     uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-individual/index', params: { baseId: baseId.value, landType, taskId: form.value.taskId } });
 };
+const MaterialData = ref([]);
 //去选择物料
 const goMaterial = () => {
     if (!+isAdd.value) {
         return;
     }
+    uni.$once('updateMaterial', function (data) {
+        MaterialData.value = data?.data;
+        data?.data.forEach((i) => {
+            //判断 MaterialData.value中的id是否有i.id
+            if (!MaterialData.value.find((item) => item.id === i.id)) {
+                MaterialData.value.push(i);
+            }
+        });
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-material/index', params: { baseId: baseId.value } });
 };
 onLoad(async (options: any) => {
     baseId.value = options?.baseId;
     form.value.taskId = options?.taskId;
-    isAdd.value = options?.add;
+    isAdd.value = Boolean(+options?.add);
     landType.value = options?.landType;
     variety.value = options?.variety;
+    console.log(Boolean(isAdd.value), 'isAdd.value', isAdd.value);
+
     individualLandIds.value = {
         checkBox: [],
         variety: variety.value,
@@ -434,6 +448,16 @@ onLoad(async (options: any) => {
             checkBox: res.data.animalIds,
             variety: variety.value,
         };
+        MaterialData.value = res.data.inputMaterialList;
+        res.data.inputMaterialList.forEach((i) => {
+            if (!form.value.inputs) {
+                form.value.inputs = [];
+            }
+            form.value.inputs.push({
+                id: i.id,
+                inputAmount: +i.quantity,
+            });
+        });
     }
 });
 </script>

+ 219 - 0
src/plant/port/supervise/supervise-material-create/index.vue

@@ -0,0 +1,219 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="投入物料记录" :fixed="false"></ut-navbar>
+        </template>
+        <view>
+            <view class="pd-24 bg-#fff">
+                <up-alert title="注意:投入物料记录可用于记录此次任务投入过的物料,不分 管理具体事务、圈舍和时间记录。" type="info" class="b-radius"></up-alert>
+            </view>
+            <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
+                <view class="bg-#fff pd-24 pt-0 mb-20">
+                    <!-- 使用物料 -->
+                    <up-form-item borderBottom label="使用物料" required prop="inputs" id="inputsgpppp">
+                        <view class="d-flex flex-cln w-100%">
+                            <view v-if="!isAdd" class="c-#B52B21 f-s-24">因物料修改涉及退库操作,不支持修改物料信息如有错误,请删除此条管理记录,重新添加。</view>
+                            <view class="w-100%">
+                                <Materialinfo :showClose="isAdd" v-model:datas="MaterialData" v-model:inputs="form.inputs" />
+                            </view>
+                            <view v-if="isAdd" class="d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goMaterial()">
+                                <view class=""></view>
+                                <view class="f-s-34 c-primary">请选择此次农事使用的物料</view>
+                            </view>
+                        </view>
+                    </up-form-item>
+                    <!-- 操作日期 -->
+                    <view class="h-1" id="operationDatepppp"></view>
+                    <!-- 记录人 -->
+                    <up-form-item borderBottom label="记录人" required prop="mgName" id="mgNamepppp">
+                        <up-input v-model="form.mgName" placeholder="请输入记录人" border="none"></up-input>
+                    </up-form-item>
+                    <!-- 备注 -->
+                    <up-form-item borderBottom label="备注/说明" prop="remark" id="remarkpppp">
+                        <up-input v-model="form.remark" placeholder="如:“防治阔叶杂草”、“花期追肥”" border="none"></up-input>
+                    </up-form-item>
+                    <up-form-item label="过程图片" prop="imgs" borderBottom id="imgspppp">
+                        <ut-upload v-model="form.imgs" :max-count="9" accept="image"></ut-upload>
+                    </up-form-item>
+                    <up-form-item label="过程视频" prop="videos" borderBottom id="videospppp">
+                        <ut-upload v-model="form.videos" :max-count="9" accept="video"></ut-upload>
+                    </up-form-item>
+                </view>
+            </up-form>
+        </view>
+        <template #bottom>
+            <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
+                <up-button v-if="+isAdd" type="primary" @click="save()">确认添加</up-button>
+                <up-button v-else type="primary" @click="change()">确认修改</up-button>
+            </view>
+        </template>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { ref, reactive, computed, getCurrentInstance, type ComponentInternalInstance } from 'vue';
+import { useClientRequest } from '@/utils/request';
+import { useInfoStore } from '@/store';
+import Baseinfo from '../models/baseinfo.vue';
+import Materialinfo from '../models/materialinfo.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { yes_no, pt_activity_input_material } = toRefs<any>(proxy?.useDict('yes_no', 'pt_activity_input_material'));
+const deawerData = ref();
+const infoStore = useInfoStore();
+// 表单数据
+const form = ref({
+    taskId: '',
+    //管理类型 1-农事管理 2-投料
+    activityType: '2',
+    opRemark: '',
+    mgName: infoStore.userInfo?.name,
+    inputFlag: '1',
+    //物料列表
+    inputs: [] as any,
+    remark: '',
+    imgs: null as string | null,
+    videos: null as string | null,
+});
+const baseId = ref('');
+const Material = ref();
+//判断是新增还是修改
+const isAdd = ref(true);
+// 表单验证规则
+const rules = reactive({
+    mgName: [{ required: true, message: '请输入记录人' }],
+    remark: [{ required: false, message: '请输入备注' }],
+});
+const paging = ref();
+const list = ref();
+const upFormRef = ref<any>();
+
+const query = async (pageNo: number, pageSize: number) => {
+    const res = await useClientRequest.get('/plt-api/app/plantationTask/list', {
+        pageNo,
+        pageSize,
+    });
+    // return res.data;
+};
+const MaterialData = ref([]);
+// 提交表单
+const save = () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                console.log('开始提交管理记录');
+                await upFormRef.value?.validate();
+                console.log('校验完成');
+                const params = {
+                    ...form.value,
+                };
+                console.log('提交参数:', params);
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/plantationActivity/saveActivity', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '提交成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
+                    }, 1000);
+                }
+            } catch (error: any) {
+                console.log('表单验证错误:', error);
+                // 滚动到第一个错误字段
+                if (error && error[0]?.field) {
+                    const firstErrorField = error[0].field + 'pppp';
+                    paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+                }
+                return;
+            }
+        },
+        1000,
+        true,
+    );
+};
+//修改提交表单
+const change = () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                console.log('开始提交管理记录');
+                await upFormRef.value?.validate();
+                console.log('校验完成');
+
+                const params = {
+                    ...form.value,
+                };
+
+                console.log('提交参数:', params);
+
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/plantationActivity/updateActivity', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '提交成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
+                    }, 1000);
+                }
+            } catch (error: any) {
+                console.log('表单验证错误:', error);
+                // 滚动到第一个错误字段
+                if (error && error[0]?.field) {
+                    const firstErrorField = error[0].field + 'pppp';
+                    paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+                }
+                return;
+            }
+        },
+        1000,
+        true,
+    );
+};
+const goMaterial = () => {
+    if (!+isAdd.value) {
+        return;
+    }
+    uni.$once('updateMaterial', function (data) {
+        MaterialData.value = data?.data;
+        data?.data.forEach((i) => {
+            //判断 MaterialData.value中的id是否有i.id
+            if (!MaterialData.value.find((item) => item.id === i.id)) {
+                MaterialData.value.push(i);
+            }
+        });
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-material/index', params: { baseId: baseId.value } });
+};
+onLoad(async (options: any) => {
+    baseId.value = options?.baseId;
+    form.value.taskId = options?.taskId;
+    isAdd.value = Boolean(+options?.add);
+    if (!+isAdd.value) {
+        const res = await useClientRequest.get(`/plt-api/app/plantationActivity/getInfo/${options.id}`);
+        if (!res || res.code !== 200) return;
+        form.value = res.data;
+        MaterialData.value = res.data.inputMaterialList;
+        res.data.inputMaterialList.forEach((i) => {
+            if (!form.value.inputs) {
+                form.value.inputs = [];
+            }
+            form.value.inputs.push({
+                id: i.id,
+                inputAmount: +i.quantity,
+            });
+        });
+    }
+});
+</script>

+ 87 - 0
src/plant/port/supervise/supervise-material-detail/index.vue

@@ -0,0 +1,87 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#fff" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="管理记录详情" :fixed="false"></ut-navbar>
+        </template>
+        <view class="pd-24 pt-0">
+            <view v-if="+data?.inputFlag" class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30 pb-10">投入物料名称:</text>
+                <view v-for="(item, indexs) in data?.inputMaterialList" :key="indexs" class="bg-#FBFDFB border-#AFDDBB pd-24 b-radius mb-10">
+                    <view class="d-flex a-c pb-10">
+                        <view class="c-primary pd-4 bg-#E7F4EA radius-10" style="font-style: italic">{{ Number(indexs) + 1 < 10 ? '0' + (Number(indexs) + 1) : Number(indexs) + 1 }}</view>
+                        <view class="c-#333 f-s-34 f-w-5 ml-10">{{ item?.materialName }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex a-c">
+                        <view class="c-#666 f-s-28"> 入库批次号:</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ item?.batchCode }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex a-c">
+                        <view class="c-#666 f-s-28"> 供应商:</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ item?.supplier }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex a-c">
+                        <view class="c-#666 f-s-28 w-s-no"> 所在库房:</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ item?.warehouses }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex mb-12">
+                        <view class="w-50% d-flex a-c">
+                            <view class="c-#666 f-s-28">本次使用量:</view>
+                            <view class="c-#333 f-s-28 f-w-5">{{ item?.quantity }}{{ item?.unit }}</view>
+                        </view>
+                    </view>
+                </view>
+            </view>
+            <view class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30">记录人:</text>
+                <text class="c-#333 f-s-30">{{ data?.mgName || '-' }}</text>
+            </view>
+            <view class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30">备注/说明:</text>
+                <text class="c-#333 f-s-30">{{ data?.remark || '-' }}</text>
+            </view>
+            <view class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30">过程图片:</text>
+                <ut-album v-if="data?.imgs" :urls="data?.imgs"></ut-album>
+                <view v-else>{{ '-' }}</view>
+            </view>
+            <view class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30">过程视频:</text>
+                <ut-album v-if="data?.videos" :urls="data?.videos"></ut-album>
+                <view v-else>{{ '-' }}</view>
+            </view>
+        </view>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+const list = ref<any>([]);
+const data = ref<any>();
+const paging = ref();
+const ID = ref('');
+const deawerData = ref<any>({});
+const individualLandIds = ref<any>([]);
+const query = async () => {
+    const res = await useClientRequest.get(`/plt-api/app/plantationActivity/getInfo/${ID.value}`);
+    if (!res || res.code !== 200) return;
+    data.value = res.data;
+    deawerData.value = {
+        ...res.data.baseInfo,
+        area: res?.data?.baseInfo?.gapInfo?.area,
+        areaUnit: res?.data?.baseInfo?.gapInfo?.areaUnit,
+        adcodeName: res?.data?.baseInfo?.gapInfo?.adcodeName,
+        medicineName: res?.data?.baseInfo?.gapInfo?.medicineName,
+        aloneChecked: res?.data?.inputFlag == '1' ? true : false,
+        data: res.data.lands,
+    };
+    individualLandIds.value = {
+        checkBox: res.data.animalIds,
+        variety: res.data.variety,
+    };
+};
+onMounted(() => {
+    query();
+});
+onLoad((options: any) => {
+    ID.value = options?.id;
+});
+</script>

+ 71 - 17
src/plant/port/supervise/supervise-plant-create/index.vue

@@ -38,7 +38,7 @@
                         <up-input v-model="form.cusOp" placeholder="请输入自填操作类型" border="none"></up-input>
                     </up-form-item>
                     <!-- 操作地块 -->
-                    <up-form-item :borderBottom="false" label="操作地块" required prop="landIds" id="baseIdpppp">
+                    <up-form-item :borderBottom="false" label="操作地块" prop="landIds" id="baseIdpppp">
                         <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goSelectBase()">
                             <view class=""></view>
                             <view class="f-s-34 c-primary">请选择操作地块</view>
@@ -65,13 +65,15 @@
                         </view>
                     </up-form-item>
                     <!-- 使用物料 -->
-                    <up-form-item v-if="+form.inputFlag" borderBottom label="使用物料" required prop="inputFlag" id="inputFlagpppp">
-                        <view v-if="!Material" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goMaterial()">
-                            <view class=""></view>
-                            <view class="f-s-34 c-primary">请选择此次农事使用的物料</view>
-                        </view>
-                        <view v-else class="w-100%">
-                            <Materialinfo :showClose="true" />
+                    <up-form-item v-if="+form.inputFlag" borderBottom label="使用物料" required prop="inputs" id="inputspppp">
+                        <view class="d-flex flex-cln w-100%">
+                            <view class="w-100%">
+                                <Materialinfo :showClose="isAdd" v-model:datas="MaterialData" v-model:inputs="form.inputs" />
+                            </view>
+                            <view v-if="isAdd" class="d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goMaterial()">
+                                <view class=""></view>
+                                <view class="f-s-34 c-primary">请选择此次农事使用的物料</view>
+                            </view>
                         </view>
                     </up-form-item>
                     <!-- 备注 -->
@@ -125,7 +127,7 @@ const form = ref({
     //是否使用物料
     inputFlag: '0' as '0' | '1',
     //物料列表
-    inputs: [],
+    inputs: [] as any,
     remark: '',
     imgs: null as string | null,
     videos: null as string | null,
@@ -158,7 +160,42 @@ const validateOperationDate = (rule: any, value: any, callback: any) => {
     }
     callback();
 };
+// 自定义inputs校验函数
+const validateInputs = (rule: any, value: any, callback: any) => {
+    // value 应该是 inputs 数组
+    if (!value || !Array.isArray(value) || value.length === 0) {
+        callback(new Error('请至少添加一个物料并填写用量'));
+        return;
+    }
 
+    // 检查每个物料
+    for (const item of value) {
+        if (!item || typeof item !== 'object') {
+            callback(new Error('物料数据格式错误'));
+            return;
+        }
+
+        const { id, inputAmount } = item;
+
+        if (!id) {
+            callback(new Error('物料ID缺失'));
+            return;
+        }
+
+        if (inputAmount === undefined || inputAmount === null || inputAmount === '') {
+            callback(new Error('请填写物料用量'));
+            return;
+        }
+
+        const amount = Number(inputAmount);
+        if (isNaN(amount) || amount <= 0) {
+            callback(new Error('物料用量必须大于0'));
+            return;
+        }
+    }
+
+    callback();
+};
 // 自定义校验函数:自填操作类型校验(当opMethod为99时必填)
 const validateCusOp = (rule: any, value: any, callback: any) => {
     if (form.value.opMethod === '99' && !value) {
@@ -177,6 +214,7 @@ const rules = reactive({
     mgName: [{ required: true, message: '请输入记录人' }],
     inputFlag: [{ required: true, message: '请选择是否使用物料' }],
     remark: [{ required: false, message: '请输入备注' }],
+    inputs: [{ validator: validateInputs, trigger: 'blur' }],
 });
 const changeStartTime = () => {
     if (!form.value?.operationDate?.activityEnd) {
@@ -205,15 +243,12 @@ const save = () => {
                 console.log('开始提交管理记录');
                 await upFormRef.value?.validate();
                 console.log('校验完成');
-
                 const params = {
                     ...form.value,
                     ...form.value.operationDate,
-                    landFlag: deawerData?.value.aloneChecked ? '1' : '0',
+                    landFlag: deawerData?.value?.aloneChecked ? '1' : '0',
                 };
-
                 console.log('提交参数:', params);
-
                 // 这里需要根据实际 API 进行调整
                 const res = await useClientRequest.post('/plt-api/app/plantationActivity/saveActivity', params);
                 if (res.code == 200) {
@@ -256,7 +291,7 @@ const change = () => {
                 const params = {
                     ...form.value,
                     ...form.value.operationDate,
-                    landFlag: deawerData?.value.aloneChecked ? '1' : '0',
+                    landFlag: deawerData?.value?.aloneChecked ? '1' : '0',
                 };
 
                 console.log('提交参数:', params);
@@ -295,22 +330,31 @@ const change = () => {
 const goSelectBase = () => {
     uni.$once('updatelands', function (data) {
         deawerData.value = data;
-        console.log(deawerData.value);
-
         form.value.landIds = deawerData.value.checkBox;
     });
     uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-plot/index', params: { baseId: baseId.value } });
 };
+const MaterialData = ref([]);
 //去选择物料
 const goMaterial = () => {
     if (!+isAdd.value) {
         return;
     }
+    uni.$once('updateMaterial', function (data) {
+        MaterialData.value = data?.data;
+        data?.data.forEach((i) => {
+            //判断 MaterialData.value中的id是否有i.id
+            if (!MaterialData.value.find((item) => item.id === i.id)) {
+                MaterialData.value.push(i);
+            }
+        });
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-material/index', params: { baseId: baseId.value } });
 };
 onLoad(async (options: any) => {
     baseId.value = options?.baseId;
     form.value.taskId = options?.taskId;
-    isAdd.value = options?.add;
+    isAdd.value = Boolean(+options?.add);
     if (!+isAdd.value) {
         const res = await useClientRequest.get(`/plt-api/app/plantationActivity/getInfo/${options.id}`);
         if (!res || res.code !== 200) return;
@@ -329,6 +373,16 @@ onLoad(async (options: any) => {
             data: res.data.lands,
             checkBox: res.data.landIds,
         };
+        MaterialData.value = res.data.inputMaterialList;
+        res.data.inputMaterialList.forEach((i) => {
+            if (!form.value.inputs) {
+                form.value.inputs = [];
+            }
+            form.value.inputs.push({
+                id: i.id,
+                inputAmount: +i.quantity,
+            });
+        });
     }
 });
 </script>

+ 33 - 8
src/plant/port/supervise/supervise-plant-detail/index.vue

@@ -10,7 +10,7 @@
             </view>
             <view class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">操作类型:</text>
-                <text class="c-#333 f-s-30">{{ selectDictLabel(data?.baseInfo?.baseType === '1' ? pt_op_method : data?.baseInfo?.baseType === '3' ? pt_breed_op_method : '', data?.opMethod) }}</text>
+                <text class="c-#333 f-s-30">{{ selectDictLabel(data?.baseInfo?.baseType === '1' ? pt_op_method : data?.baseInfo?.baseType === '3' ? pt_breed_op_method : pt_raise_op_method, data?.opMethod) }}</text>
             </view>
             <view v-if="data?.opMethod === '99'" class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">自定义操作类型:</text>
@@ -18,7 +18,7 @@
             </view>
             <view v-if="data?.baseInfo?.baseType !== '1'" class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">操作对象:</text>
-                <text class="c-#333 f-s-30">{{ selectDictLabel(data?.baseInfo?.baseType === '3' ? pt_breed_op_object : data?.baseInfo?.baseType === '2' ? pt_breed_op_method : '', data?.targetType) }}</text>
+                <text class="c-#333 f-s-30">{{ selectDictLabel(data?.baseInfo?.baseType === '3' ? pt_breed_op_object : data?.baseInfo?.baseType === '3' ? pt_breed_op_object : pt_raise_op_object, data?.targetType) }}</text>
             </view>
             <view v-if="data?.baseInfo?.baseType == '1'" class="pt-16 pb-16 info-border-bottom d-flex flex-cln">
                 <text class="c-#666 f-s-30 pb-10">操作地块:</text>
@@ -42,19 +42,44 @@
             </view>
             <view v-if="+data?.inputFlag" class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">使用物料:</text>
-                <text class="c-#333 f-s-30">复合肥50kg、尿素20kg</text>
+                <view v-for="(item, indexs) in data?.inputMaterialList" :key="indexs" class="bg-#FBFDFB border-#AFDDBB pd-24 b-radius mb-10">
+                    <view class="d-flex a-c pb-10">
+                        <view class="c-primary pd-4 bg-#E7F4EA radius-10" style="font-style: italic">{{ Number(indexs) + 1 < 10 ? '0' + (Number(indexs) + 1) : Number(indexs) + 1 }}</view>
+                        <view class="c-#333 f-s-34 f-w-5 ml-10">{{ item?.materialName }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex a-c">
+                        <view class="c-#666 f-s-28"> 入库批次号:</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ item?.batchCode }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex a-c">
+                        <view class="c-#666 f-s-28"> 供应商:</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ item?.supplier }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex a-c">
+                        <view class="c-#666 f-s-28 w-s-no"> 所在库房:</view>
+                        <view class="c-#333 f-s-28 f-w-5">{{ item?.warehouses }}</view>
+                    </view>
+                    <view class="pt-6 pb-6 d-flex mb-12">
+                        <view class="w-50% d-flex a-c">
+                            <view class="c-#666 f-s-28">本次使用量:</view>
+                            <view class="c-#333 f-s-28 f-w-5">{{ item?.quantity }}{{ item?.unit }}</view>
+                        </view>
+                    </view>
+                </view>
             </view>
             <view class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">备注/说明:</text>
                 <text class="c-#333 f-s-30">{{ data?.remark || '-' }}</text>
             </view>
-            <view v-if="data?.imgs" class="pt-16 pb-16 info-border-bottom">
+            <view class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">过程图片:</text>
-                <ut-album :urls="data?.imgs"></ut-album>
+                <ut-album v-if="data?.imgs" :urls="data?.imgs"></ut-album>
+                <view v-else>{{ '-' }}</view>
             </view>
-            <view v-if="data?.videos" class="pt-16 pb-16 info-border-bottom">
+            <view class="pt-16 pb-16 info-border-bottom">
                 <text class="c-#666 f-s-30">过程视频:</text>
-                <ut-album :urls="data?.videos"></ut-album>
+                <ut-album v-if="data?.videos" :urls="data?.videos"></ut-album>
+                <view v-else>{{ '-' }}</view>
             </view>
         </view>
     </z-paging>
@@ -64,7 +89,7 @@ import { useClientRequest } from '@/utils/request';
 import Baseinfo from '../models/baseinfo.vue';
 import Individualinfo from '../models/individualinfo.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { yes_no, pt_op_method, pt_breed_op_method, pt_breed_op_object } = toRefs<any>(proxy?.useDict('yes_no', 'pt_op_method', 'pt_breed_op_method', 'pt_breed_op_object'));
+const { yes_no, pt_op_method, pt_breed_op_method, pt_breed_op_object, pt_raise_op_object, pt_raise_op_method } = toRefs<any>(proxy?.useDict('yes_no', 'pt_op_method', 'pt_breed_op_method', 'pt_breed_op_object', 'pt_raise_op_object', 'pt_raise_op_method'));
 const list = ref<any>([]);
 const data = ref<any>();
 const paging = ref();

+ 443 - 0
src/plant/port/supervise/supervise-raising-create/index.vue

@@ -0,0 +1,443 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="添加管理记录" :fixed="false"></ut-navbar>
+        </template>
+        <view class="pt-24">
+            <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
+                <view class="startline-title pl-24 ml-24 mb-16">管理记录信息</view>
+                <view class="bg-#fff pd-24 mb-20">
+                    <!-- 操作日期 -->
+                    <view class="h-1" id="operationDatepppp"></view>
+                    <up-form-item :borderBottom="false" label="操作日期" required prop="operationDate">
+                        <ut-datetime-picker v-model="form.operationDate.activityStart" mode="date" dateFields="day" @change="changeStartTime">
+                            <view class="d-flex mr-20">
+                                <up-input v-model="form.operationDate.activityStart" 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.operationDate.activityEnd" mode="date" dateFields="day">
+                            <view class="d-flex">
+                                <up-input v-model="form.operationDate.activityEnd" 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>
+                    <!-- 操作类型-->
+                    <ut-action-sheet v-model="form.opMethod" :tabs="pt_raise_op_method" title="选择操作类型" mode="custom">
+                        <up-form-item borderBottom label="操作类型" required prop="opMethod" id="opMethodpppp">
+                            <view v-if="form.opMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_raise_op_method, form.opMethod) }}</view>
+                            <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择操作类型</view>
+                            <template #right>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
+                            </template>
+                        </up-form-item>
+                    </ut-action-sheet>
+                    <!-- 自填操作类型 -->
+                    <up-form-item v-if="form.opMethod == '99'" borderBottom label="自填操作类型" required prop="cusOp" id="cusOppppp">
+                        <up-input v-model="form.cusOp" placeholder="请输入自填操作类型" border="none"></up-input>
+                    </up-form-item>
+                    <!-- 操作对象 -->
+                    <up-form-item borderBottom label="操作对象" required prop="targetType" id="targetTypeppppp">
+                        <up-radio-group v-model="form.targetType">
+                            <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in pt_raise_op_object" :key="index" :label="item.label" :name="item.value"></up-radio>
+                        </up-radio-group>
+                    </up-form-item>
+                    <!-- 操作组圈舍 -->
+                    <up-form-item v-if="form.targetType == '1'" :borderBottom="false" label="操作圈舍" prop="landIds" id="baseIdpppp">
+                        <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goSelectBase(landType || '')">
+                            <view class=""></view>
+                            <view class="f-s-34 c-primary">请选择操作圈舍</view>
+                        </view>
+                        <view class="w-100%" v-else>
+                            <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="'1'" />
+                        </view>
+                    </up-form-item>
+                    <!-- 操作个体选择 -->
+                    <up-form-item v-if="form.targetType == '2'" :borderBottom="false" label="操作个体选择" required prop="animalIds" id="animalIdspppp">
+                        <view class="flex1">
+                            <Individualinfo v-if="individualLandIds?.checkBox?.length > 0" v-model="individualLandIds" v-model:landIds="form.animalIds" />
+                            <view class="w-100% gap-20 d-flex a-c" id="selectanimalId">
+                                <view class="w-50% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="showDeleteDialog = true">
+                                    <view class=""></view>
+                                    <view class="f-s-34 c-primary">手动输入添加</view>
+                                </view>
+                                <view class="w-50% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goIndividual()">
+                                    <view class=""></view>
+                                    <view class="f-s-34 c-primary">从任务中快速选择</view>
+                                </view>
+                            </view>
+                        </view>
+                    </up-form-item>
+                    <!-- 操作方式 -->
+                    <up-form-item borderBottom label="操作方式" prop="opRemark" id="opRemarkpppp">
+                        <up-input v-model="form.opRemark" placeholder="如:人工锄草、机械中耕、喷雾器叶面喷施等" border="none"></up-input>
+                    </up-form-item>
+                    <!-- 记录人 -->
+                    <up-form-item borderBottom label="记录人" required prop="mgName" id="mgNamepppp">
+                        <up-input v-model="form.mgName" placeholder="请输入记录人" border="none"></up-input>
+                    </up-form-item>
+                    <!-- 是否使用物料 -->
+                    <up-form-item borderBottom label="是否使用物料" required prop="inputFlag" id="inputFlagpppp">
+                        <view class="d-flex flex-cln">
+                            <view v-if="!+isAdd" class="c-#B52B21 f-s-24">因物料修改涉及退库操作,不支持修改物料信息如有错误,请删除此条管理记录,重新添加。</view>
+                            <up-radio-group v-model="form.inputFlag">
+                                <up-radio :disabled="!+isAdd" :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
+                            </up-radio-group>
+                        </view>
+                    </up-form-item>
+                    <!-- 使用物料 -->
+                    <up-form-item v-if="+form.inputFlag" borderBottom label="使用物料" required prop="inputs" id="inputspppp">
+                        <view class="d-flex flex-cln w-100%">
+                            <view class="w-100%">
+                                <Materialinfo :showClose="isAdd" v-model:datas="MaterialData" v-model:inputs="form.inputs" />
+                            </view>
+                            <view v-if="isAdd" class="d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="goMaterial()">
+                                <view class=""></view>
+                                <view class="f-s-34 c-primary">请选择此次农事使用的物料</view>
+                            </view>
+                        </view>
+                    </up-form-item>
+                    <!-- 备注 -->
+                    <up-form-item borderBottom label="备注/说明" prop="remark" id="remarkpppp">
+                        <up-input v-model="form.remark" placeholder="如:“防治阔叶杂草”、“花期追肥”" border="none"></up-input>
+                    </up-form-item>
+                    <up-form-item label="过程图片" prop="imgs" borderBottom id="imgspppp">
+                        <ut-upload v-model="form.imgs" :max-count="9" accept="image"></ut-upload>
+                    </up-form-item>
+                    <up-form-item label="过程视频" prop="videos" borderBottom id="videospppp">
+                        <ut-upload v-model="form.videos" :max-count="9" accept="video"></ut-upload>
+                    </up-form-item>
+                </view>
+            </up-form>
+        </view>
+        <template #bottom>
+            <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
+                <up-button v-if="+isAdd" type="primary" @click="save()">确认添加</up-button>
+                <up-button v-else type="primary" @click="change()">确认修改</up-button>
+            </view>
+        </template>
+    </z-paging>
+    <ut-confirm-dialog v-model:show="showDeleteDialog" width="75vw" title="添加个体标识" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleAddConfirm" @cancel="handleAddCancel">
+        <view class="">
+            <view class="c-#333 f-s-28">个体标识号</view>
+            <view class="">
+                <up-input placeholder="请输入个体标识号" v-model="animalId" border="bottom"></up-input>
+            </view>
+        </view>
+    </ut-confirm-dialog>
+</template>
+<script setup lang="ts">
+import { ref, reactive, computed, getCurrentInstance, type ComponentInternalInstance } from 'vue';
+import { useClientRequest } from '@/utils/request';
+import { useInfoStore } from '@/store';
+import Baseinfo from '../models/baseinfo.vue';
+import Materialinfo from '../models/materialinfo.vue';
+import Individualinfo from '../models/individualinfo.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { yes_no, pt_raise_op_method, pt_op_method, pt_raise_op_object } = toRefs<any>(proxy?.useDict('yes_no', 'pt_raise_op_method', 'pt_op_method', 'pt_raise_op_object'));
+const deawerData = ref();
+const infoStore = useInfoStore();
+// 表单数据
+const form = ref({
+    taskId: '',
+    //管理类型 1-农事管理 2-投料
+    activityType: '1',
+    operationDate: {
+        activityStart: null as string | null,
+        activityEnd: null as string | null,
+    },
+    //作用对象类型 1-地块 2-动物
+    targetType: null as string | null,
+    opMethod: null as string | null,
+    cusOp: null as string | null,
+    //操作地块
+    landIds: [] as any,
+    animalIds: [] as any,
+    opRemark: '',
+    mgName: infoStore.userInfo?.name,
+    //是否使用物料
+    inputFlag: '0' as '0' | '1',
+    //物料列表
+    inputs: [] as any,
+    remark: '',
+    imgs: null as string | null,
+    videos: null as string | null,
+    landFlag: '0' as '0' | '1',
+});
+const baseId = ref('');
+const Material = ref();
+//判断是新增还是修改
+const isAdd = ref(true);
+//判断基地的类型
+const landType = ref<string>();
+//个体信息数组
+const individualLandIds = ref<any>({});
+//打开添加个体
+const showDeleteDialog = ref(false);
+const animalId = ref<any>([]);
+//个体名称
+const variety = ref<any>();
+const handleAddCancel = () => {
+    showDeleteDialog.value = false;
+    animalId.value = '';
+};
+const handleAddConfirm = () => {
+    individualLandIds.value.checkBox.push(animalId.value);
+    animalId.value = '';
+    showDeleteDialog.value = false;
+    form.value.animalIds = individualLandIds.value.checkBox;
+};
+// 自定义校验函数:操作日期校验
+const validateOperationDate = (rule: any, value: any, callback: any) => {
+    if (!value) {
+        callback(new Error('请选择操作日期'));
+        return;
+    }
+    const { activityStart, activityEnd } = value;
+    if (!activityStart) {
+        callback(new Error('请选择操作开始时间'));
+        return;
+    }
+    if (!activityEnd) {
+        callback(new Error('请选择操作结束时间'));
+        return;
+    }
+    const start = new Date(activityStart);
+    const end = new Date(activityEnd);
+    if (end < start) {
+        callback(new Error('操作结束时间必须晚于开始时间'));
+        return;
+    }
+    callback();
+};
+//
+const changeStartTime = () => {
+    if (!form.value?.operationDate?.activityEnd) {
+        form.value.operationDate.activityEnd = form.value.operationDate.activityStart;
+    }
+};
+// 自定义校验函数:自填操作类型校验(当opMethod为99时必填)
+const validateCusOp = (rule: any, value: any, callback: any) => {
+    if (form.value.opMethod === '99' && !value) {
+        callback(new Error('请输入自填操作类型'));
+        return;
+    }
+    callback();
+};
+
+// 表单验证规则
+const rules = reactive({
+    operationDate: [{ validator: validateOperationDate, trigger: 'blur' }],
+    opMethod: [{ required: true, message: '请选择操作类型' }],
+    cusOp: [{ validator: validateCusOp, trigger: 'blur' }],
+    opRemark: [{ required: false, message: '请输入操作方式' }],
+    mgName: [{ required: true, message: '请输入记录人' }],
+    inputFlag: [{ required: true, message: '请选择是否使用物料' }],
+    remark: [{ required: false, message: '请输入备注' }],
+    targetType: [{ required: true, message: '请选择作用对象类型' }],
+});
+
+const paging = ref();
+const list = ref();
+const upFormRef = ref<any>();
+const query = async (pageNo: number, pageSize: number) => {
+    const res = await useClientRequest.get('/plt-api/app/plantationTask/list', {
+        pageNo,
+        pageSize,
+    });
+    // return res.data;
+};
+const handleBaseinfoClose = () => {
+    deawerData.value = null;
+};
+// 提交表单
+const save = () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                console.log('开始提交管理记录');
+                await upFormRef.value?.validate();
+                console.log('校验完成');
+                const params = {
+                    ...form.value,
+                    ...form.value.operationDate,
+                    landFlag: deawerData?.value?.aloneChecked ? '1' : '0',
+                };
+
+                console.log('提交参数:', params);
+
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/plantationActivity/saveActivity', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '提交成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
+                    }, 1000);
+                }
+            } catch (error: any) {
+                console.log('表单验证错误:', error);
+                // 滚动到第一个错误字段
+                if (error && error[0]?.field) {
+                    const firstErrorField = error[0].field + 'pppp';
+                    paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+                }
+                return;
+            }
+        },
+        1000,
+        true,
+    );
+};
+//修改提交表单
+const change = () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                console.log('开始提交管理记录');
+                await upFormRef.value?.validate();
+                console.log('校验完成');
+
+                const params = {
+                    ...form.value,
+                    ...form.value.operationDate,
+                    landFlag: deawerData?.value?.aloneChecked ? '1' : '0',
+                };
+
+                console.log('提交参数:', params);
+
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/plantationActivity/updateActivity', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '提交成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
+                    }, 1000);
+                }
+            } catch (error: any) {
+                console.log('表单验证错误:', error);
+                // 滚动到第一个错误字段
+                if (error && error[0]?.field) {
+                    const firstErrorField = error[0].field + 'pppp';
+                    paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+                }
+                return;
+            }
+        },
+        1000,
+        true,
+    );
+};
+const MaterialData = ref([]);
+//去操作地块页面选择地块
+const goSelectBase = (landType: string) => {
+    uni.$once('updatelands', function (data) {
+        deawerData.value = data;
+        form.value.landIds = deawerData.value.checkBox;
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-plot/index', params: { baseId: baseId.value, landType } });
+};
+//去选择个体
+const goIndividual = () => {
+    uni.$once('updateIndividual', function (data) {
+        let flag = false;
+        data?.checkBox.forEach((item: any) => {
+            //判断有没有重复的值,如果有这个就不添加,没有就添加
+            if (individualLandIds.value.checkBox.some((item2: any) => item2 === item)) {
+                console.log('????', item);
+                flag = true;
+            } else {
+                individualLandIds.value.checkBox.push(item);
+                form.value.animalIds.push(item);
+            }
+        });
+        if (flag) {
+            uni.showToast({
+                title: '有重复的个体,已经帮您过滤的',
+                icon: 'none',
+            });
+        }
+        paging.value?.scrollIntoViewById('selectanimalId', 30, true);
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-individual/index', params: { baseId: baseId.value, landType, taskId: form.value.taskId } });
+};
+//去选择物料
+const goMaterial = () => {
+    if (!+isAdd.value) {
+        return;
+    }
+    uni.$once('updateMaterial', function (data) {
+        MaterialData.value = data?.data;
+        data?.data.forEach((i) => {
+            //判断 MaterialData.value中的id是否有i.id
+            if (!MaterialData.value.find((item) => item.id === i.id)) {
+                MaterialData.value.push(i);
+            }
+        });
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-material/index', params: { baseId: baseId.value } });
+};
+onLoad(async (options: any) => {
+    baseId.value = options?.baseId;
+    form.value.taskId = options?.taskId;
+    isAdd.value = Boolean(+options?.add);
+    landType.value = options?.landType;
+    variety.value = options?.variety;
+    individualLandIds.value = {
+        checkBox: [],
+        variety: variety.value,
+    };
+    if (landType.value == '3') {
+        form.value.targetType = '1';
+    }
+    if (!+isAdd.value) {
+        const res = await useClientRequest.get(`/plt-api/app/plantationActivity/getInfo/${options.id}`);
+        if (!res || res.code !== 200) return;
+        form.value = res.data;
+        form.value.operationDate = {
+            activityStart: res.data.activityStart,
+            activityEnd: res.data.activityEnd,
+        };
+        deawerData.value = {
+            ...res.data.baseInfo,
+            area: res?.data?.baseInfo?.gapInfo?.area,
+            areaUnit: res?.data?.baseInfo?.gapInfo?.areaUnit,
+            adcodeName: res?.data?.baseInfo?.gapInfo?.adcodeName,
+            medicineName: res?.data?.baseInfo?.gapInfo?.medicineName,
+            aloneChecked: res?.data?.inputFlag == '1' ? true : false,
+            data: res.data.lands,
+            checkBox: res.data.landIds,
+        };
+        individualLandIds.value = {
+            checkBox: res.data.animalIds,
+            variety: variety.value,
+        };
+        MaterialData.value = res.data.inputMaterialList;
+        res.data.inputMaterialList.forEach((i) => {
+            if (!form.value.inputs) {
+                form.value.inputs = [];
+            }
+            form.value.inputs.push({
+                id: i.id,
+                inputAmount: +i.quantity,
+            });
+        });
+    }
+});
+</script>

+ 57 - 0
src/tools/species-info/index.vue

@@ -0,0 +1,57 @@
+<template>
+    <z-paging ref="paging" v-model="list" paging-class="paging-btm-shadow" bgColor="#f7f7f7" safe-area-inset-bottom @query="query">
+        <template #top>
+            <ut-navbar title="请选择任务所使用的种源信息" :fixed="false"></ut-navbar>
+        </template>
+        <view class="d-flex a-c pd-24 pb-0 bg-#f7f7f7">
+            <view class="min-w-170 flex1">
+                <ut-action-sheet v-model="form.taskType" :tabs="[{ label: '全部', value: '' }, ...pt_seed_instore_type]" @change="changeSeach" title="选择原料类型">
+                    <view class="d-flex search-select-item a-c">
+                        <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ selectDictLabel(pt_seed_instore_type, form.taskType) || '全部' }}</view>
+                        <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
+                    </view>
+                </ut-action-sheet>
+            </view>
+            <view class="h-86 pl-20 w-100%">
+                <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜批次号、品种名、基地名" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+            </view>
+        </view>
+        <template v-for="(item, index) in list" :key="index">
+            <info-card />
+        </template>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import InfoCard from './models/info-card.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_seed_instore_type } = toRefs<any>(proxy?.useDict('pt_seed_instore_type'));
+const list = ref([]);
+const paging = ref();
+const form = ref({
+    keyword: '',
+    taskType: '',
+});
+const query = async (pageNo: number, pageSize: number) => {
+    const params = {
+        pageNo,
+        pageSize,
+        ...form.value,
+    };
+    const res = await useClientRequest.get('/plt-api/app/storageSeed/page', params);
+    const { rows } = res;
+    paging.value.complete(rows);
+};
+const changeSeach = () => {
+    paging.value.reload();
+};
+</script>
+<style lang="scss" scoped>
+.search-select-item {
+    height: 86rpx;
+    background-color: #fff;
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding: 12rpx;
+}
+</style>

+ 51 - 0
src/tools/species-info/models/info-card.vue

@@ -0,0 +1,51 @@
+<template>
+    <view class="pd-24 pb-10">
+        <view class="b-radius bg-#fff pd-10 p-rtv">
+            <image class="w-80 h-34" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/Task_Planting.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+            <view class="d-flex j-ed f-s-22 c-#666">2026-02-04 </view>
+            <view class="d-flex j-sb">
+                <view class="d-flex a-ed pd-16 pt-8 pb-8">
+                    <view class="c-#333 f-s-34 f-w-5 mr-6">{{ data?.seedName }}</view>
+                    <view class="c-#666 f-s-26">种苗</view>
+                </view>
+                <view class="">
+                    <view v-if="true" class="c-primary bg-#EBF6EE radius-34 pd4-4-12-4-12 f-s-24">已检验</view>
+                    <view v-else class="c-#F74C30 bg-#F9ECEA radius-34 pd4-4-12-4-12 f-s-24">未检验</view>
+                </view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">入库批号:</view>
+                <view class="c-#333 f-w-5">12312312312312312312</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">采收批号:</view>
+                <view class="c-#333 f-w-5">12312312312312312312</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">供应商:</view>
+                <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">阿萨德看见阿萨德那些支持你</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">存放库房:</view>
+                <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">ask滴哦i i哦啪啪</view>
+            </view>
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+                <view class="c-#666 w-s-no">入库量:</view>
+                <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">阿萨德看见阿萨德那些支持你</view>
+            </view>
+            <view class="d-flex f-s-28 pd-16 pt-8 pb-8">
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">出库量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">阿萨德看见阿萨德那些支持你</view>
+                </view>
+                <view class="d-flex a-c w-50%">
+                    <view class="c-#666 w-s-no">剩余量:</view>
+                    <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd">ask滴哦i i哦啪啪</view>
+                </view>
+            </view>
+        </view>
+    </view>
+</template>
+<script setup lang="ts">
+const props = defineProps<{ data: any }>();
+</script>

+ 136 - 0
src/tools/supervise-material/index.vue

@@ -0,0 +1,136 @@
+<template>
+    <z-paging ref="paging" v-model="list" paging-class="paging-btm-shadow" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="请选择使用农资信息" :fixed="false"></ut-navbar>
+        </template>
+        <view class="pd-24 pb-0">
+            <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜农资名称、批号、库房、供应商" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+        </view>
+        <view class="pd-24">
+            <view v-for="(item, index) in list" :key="index" class="b-radius pd-24 mb-20" :style="{ backgroundColor: isSelected(item) ? '#FBFDFB' : '#fff', border: isSelected(item) ? '2rpx solid #37a954' : '2rpx solid transparent' }" @click="toggleSelect(item)">
+                <view class="d-flex a-c">
+                    <view class="d-flex" style="align-items: flex-end">
+                        <view class="f-w-5 f-s-34 c-#333">{{ item?.materialName }}</view>
+                        <view class="f-s-24 c-#666 ml-10">化肥</view>
+                    </view>
+                    <view class="flex1"></view>
+                    <view v-if="item?.examinReport.length > 0" class="c-primary bg-#EBF6EE radius-34 pd4-4-12-4-12 f-s-24">已检验</view>
+                    <view v-else class="c-#F74C30 bg-#F9ECEA radius-34 pd4-4-12-4-12 f-s-24">未检验</view>
+                </view>
+                <view class="d-flex a-c pt-10 pb-10">
+                    <text class="c-#666 f-s-30 w-s-no">入库批号:</text>
+                    <text class="c-#333 f-w-5 f-s-30 ov-hd tx-ov w-s-no">{{ item?.batchCode }}</text>
+                </view>
+                <view class="d-flex a-c pt-10 pb-10">
+                    <text class="c-#666 f-s-30 w-s-no">供应商:</text>
+                    <text class="c-#333 f-w-5 f-s-30 ov-hd tx-ov w-s-no">{{ item?.supplier }}</text>
+                </view>
+                <view class="d-flex a-c pt-10 pb-10">
+                    <text class="c-#666 f-s-30 w-s-no">存放库房:</text>
+                    <text class="c-#333 f-w-5 f-s-30 ov-hd tx-ov w-s-no">{{ item?.warehouses }}</text>
+                </view>
+                <view class="d-flex a-c pt-10 pb-10">
+                    <text class="c-#666 f-s-30 w-s-no">入库量:</text>
+                    <text class="c-#333 f-w-5 f-s-30 ov-hd tx-ov w-s-no">{{ item?.capacity }}{{ item?.unit }}</text>
+                </view>
+                <view class="d-flex a-c pt-10 pb-10">
+                    <view class="d-flex ov-hd w-50%">
+                        <text class="c-#666 f-s-30 w-s-no">出库量:</text>
+                        <text class="c-#333 f-w-5 f-s-30 ov-hd tx-ov w-s-no">{{ item?.inputAmount }}{{ item?.unit }}</text>
+                    </view>
+                    <view class="d-flex ov-hd w-50%">
+                        <text class="c-primary f-s-30 w-s-no">剩余量:</text>
+                        <text class="c-primary f-w-5 f-s-30 ov-hd tx-ov w-s-no">{{ item?.restAmount }}{{ item?.unit }}</text>
+                    </view>
+                </view>
+            </view>
+        </view>
+        <template #bottom>
+            <view class="pd-24 bg-#fff">
+                <view class="b-radius bg-#fff d-flex a-c j-sb">
+                    <view class="d-flex c-primary f-s-26">
+                        <text>已选择:</text>
+                        <text>{{ selectedMaterials.length }}</text>
+                        <text>个物料</text>
+                    </view>
+                </view>
+                <view class="d-flex gap-20">
+                    <up-button @click="cancel()">取消</up-button>
+                    <up-button type="primary" @click="save()">确认选择</up-button>
+                </view>
+            </view>
+        </template>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+const list = ref<any>([]);
+const paging = ref();
+const form = ref({
+    keyword: '',
+});
+// 选中的物料数组
+const selectedMaterials = ref<any[]>([]);
+
+// 检查物料是否已选中
+const isSelected = (item: any) => {
+    // 使用 id 作为唯一标识符
+    return selectedMaterials.value.some((m) => m.id === item.id);
+};
+
+// 切换选择状态
+const toggleSelect = (item: any) => {
+    const index = selectedMaterials.value.findIndex((m) => m.id === item.id);
+
+    if (index > -1) {
+        // 已选中,取消选择
+        selectedMaterials.value.splice(index, 1);
+    } else {
+        // 未选中,添加选择
+        selectedMaterials.value.push(item);
+    }
+};
+
+// 搜索变化
+const changeSeach = () => {
+    paging.value.reload();
+};
+
+const query = async (pageNo: number, pageSize: number) => {
+    const params = {
+        pageNo,
+        pageSize,
+        ...form.value,
+    };
+    const res = await useClientRequest.get('/plt-api/app/material/list', params);
+    const { rows } = res;
+    paging.value.complete(rows);
+};
+
+// 取消
+const cancel = () => {
+    uni.navigateBack({
+        delta: 1,
+    });
+};
+
+// 确认选择
+const save = () => {
+    if (selectedMaterials.value.length === 0) {
+        return uni.showToast({
+            title: '请选择农资',
+            icon: 'none',
+        });
+    }
+    uni.$emit('updateMaterial', {
+        checkBox: selectedMaterials.value.map((m) => m.id), // 发送batchCode数组
+        data: selectedMaterials.value, // 发送完整的物料对象
+    });
+    uni.navigateBack({
+        delta: 1,
+    });
+};
+onUnload(() => {
+    uni.$off('updateMaterial');
+});
+</script>