lisy il y a 1 mois
Parent
commit
5ba214e429

+ 1 - 1
src/config.ts

@@ -14,7 +14,7 @@ interface ProjectConfig {
 
 
 const config: ProjectConfig = {
 const config: ProjectConfig = {
     baseUrl: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000',
     baseUrl: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000',
-    clientId: '20260119',
+    clientId: '20251229',
     tenantId: '000000',
     tenantId: '000000',
     appid: '1942409637969063940',
     appid: '1942409637969063940',
 };
 };

+ 1 - 1
src/manifest.json

@@ -56,7 +56,7 @@
     "quickapp": {},
     "quickapp": {},
     /* 小程序特有相关 */
     /* 小程序特有相关 */
     "mp-weixin": {
     "mp-weixin": {
-        "appid": "wxf11517e71e36169f",
+        "appid": "wxd52c8780db580e84",
         "setting": {
         "setting": {
             "urlCheck": false,
             "urlCheck": false,
             "minified": true
             "minified": true

+ 12 - 0
src/pages.json

@@ -137,6 +137,18 @@
                     "style": {
                     "style": {
                         "navigationBarTitleText": "种养殖任务列表"
                         "navigationBarTitleText": "种养殖任务列表"
                     }
                     }
+                },
+                {
+                    "path": "port-supervise/index",
+                    "style": {
+                        "navigationBarTitleText": "管理列表"
+                    }
+                },
+                {
+                    "path": "supervise-create/index",
+                    "style": {
+                        "navigationBarTitleText": "添加管理记录"
+                    }
                 }
                 }
             ]
             ]
         },
         },

+ 56 - 12
src/pages/plant/port/index.vue

@@ -23,19 +23,24 @@
         </view>
         </view>
         <view class="pd-24">
         <view class="pd-24">
             <up-swipe-action>
             <up-swipe-action>
-                <up-swipe-action-item v-for="(item, index) in list" :key="index" :options="options2" class="mb-20" @click="clickTempSwipe">
-                    <task :data="item" @click="$u.route({ type: 'navigateTo', url: '/plant/port/port-detail/index', params: { id: item?.id } })" />
+                <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 } })" />
                 </up-swipe-action-item>
                 </up-swipe-action-item>
             </up-swipe-action>
             </up-swipe-action>
         </view>
         </view>
         <view class="h-210" v-if="list?.length"></view>
         <view class="h-210" v-if="list?.length"></view>
         <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
         <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
-        <template #empty>
+        <template #empty v-if="subCurrent == 0">
             <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
             <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
                 <ut-empty class="mg-at" color="#ccc" size="28rpx" image="/static/images/plant/noEmptyBase.png">暂无进行中的养殖任务</ut-empty>
                 <ut-empty class="mg-at" color="#ccc" size="28rpx" image="/static/images/plant/noEmptyBase.png">暂无进行中的养殖任务</ut-empty>
                 <text class="c-#ccc f-s-28">点击下方按钮去添加吧~</text>
                 <text class="c-#ccc f-s-28">点击下方按钮去添加吧~</text>
             </view>
             </view>
         </template>
         </template>
+        <template #empty v-if="subCurrent == 1">
+            <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
+                <ut-empty class="mg-at" color="#ccc" size="28rpx" image="/static/images/plant/noEmptyBase.png">暂无已经结束的养殖任务</ut-empty>
+            </view>
+        </template>
         <template #bottom>
         <template #bottom>
             <ut-tabar activeTab="planting"></ut-tabar>
             <ut-tabar activeTab="planting"></ut-tabar>
         </template>
         </template>
@@ -46,8 +51,17 @@
     <ut-confirm-dialog v-model:show="showDeleteDialog" width="80vw" title="请选择要创建的任务类型" :confirmText="'确认选择'" :cancelText="'取消'" @confirm="handlechoseConfirm" @cancel="handleDeleteCancel">
     <ut-confirm-dialog v-model:show="showDeleteDialog" width="80vw" title="请选择要创建的任务类型" :confirmText="'确认选择'" :cancelText="'取消'" @confirm="handlechoseConfirm" @cancel="handleDeleteCancel">
         <view class="" v-for="item in pt_task_type" :key="item?.value">
         <view class="" v-for="item in pt_task_type" :key="item?.value">
             <view style="border: 1rpx solid" :style="{ backgroundColor: item?.value == basetype ? '#EBF6EE' : '#f7f7f7', borderColor: item?.value == basetype ? '#37A954' : 'transparent' }" class="pr-30 d-flex a-c mb-20 radius-100" @click="handlechose(item.value)">
             <view style="border: 1rpx solid" :style="{ backgroundColor: item?.value == basetype ? '#EBF6EE' : '#f7f7f7', borderColor: item?.value == basetype ? '#37A954' : 'transparent' }" class="pr-30 d-flex a-c mb-20 radius-100" @click="handlechose(item.value)">
-                <view class="radius-50% mg-8">
-                    <up-avatar size="90rpx" :src="item?.avatar || 'https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/common/avatar.png'" class="mr-20"></up-avatar>
+                <view class="radius-50% mg-8 bg-#F0F0F0" v-if="item?.value == '1'">
+                    <up-avatar size="90rpx" src="/static/images/plant/port/TaskType_plant.png"></up-avatar>
+                </view>
+                <view class="radius-50% mg-8 bg-#F0F0F0" v-if="item?.value == '2'">
+                    <up-avatar size="90rpx" src="/static/images/plant/port/TaskType_breeding.png"></up-avatar>
+                </view>
+                <view class="radius-50% mg-8 bg-#F0F0F0" v-if="item?.value == '11'">
+                    <up-avatar size="90rpx" src="/static/images/plant/port/TaskType_SeedlingBreeding.png"></up-avatar>
+                </view>
+                <view class="radius-50% mg-8 bg-#F0F0F0" v-if="item?.value == '21'">
+                    <up-avatar size="90rpx" src="/static/images/plant/port/TaskType_BreedingLivestock.png"></up-avatar>
                 </view>
                 </view>
                 <view class="c-#333 f-s-34">
                 <view class="c-#333 f-s-34">
                     {{ item?.label }}
                     {{ item?.label }}
@@ -66,12 +80,8 @@ import { onShareAppMessage } from '@dcloudio/uni-app';
 import Task from './models/task.vue';
 import Task from './models/task.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_task_type } = toRefs<any>(proxy?.useDict('pt_task_type'));
 const { pt_task_type } = toRefs<any>(proxy?.useDict('pt_task_type'));
-setTimeout(() => {
-    console.log(pt_task_type.value, 'pt_task_type');
-}, 2000);
-
 const list = ref<unknown[]>();
 const list = ref<unknown[]>();
-const form = ref({ taskType: '', keyword: '' });
+const form = ref({ taskType: '', keyword: '', status: 1 });
 const paging = ref();
 const paging = ref();
 const windowInfo = uni.getWindowInfo();
 const windowInfo = uni.getWindowInfo();
 const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
 const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
@@ -87,6 +97,11 @@ const subList = ref(['进行中', '已结束']);
 const subCurrent = ref(0);
 const subCurrent = ref(0);
 const sectionChange = (index: number) => {
 const sectionChange = (index: number) => {
     subCurrent.value = index;
     subCurrent.value = index;
+    if (index == 0) {
+        form.value.status = 1;
+    } else {
+        form.value.status = 9;
+    }
     paging.value.reload();
     paging.value.reload();
 };
 };
 const changeSeach = () => {
 const changeSeach = () => {
@@ -122,6 +137,16 @@ const options2 = reactive([
         },
         },
     },
     },
 ]);
 ]);
+const options = reactive([
+    {
+        text: '恢复任务',
+        style: {
+            backgroundColor: '#F19F18',
+            width: '80rpx',
+            fontSize: '28rpx',
+        },
+    },
+]);
 const onRefresh = () => {
 const onRefresh = () => {
     paging.value.reload();
     paging.value.reload();
 };
 };
@@ -141,7 +166,26 @@ const handlechoseConfirm = () => {
 };
 };
 const clickTempSwipe = async (event: object) => {
 const clickTempSwipe = async (event: object) => {
     const { name, index } = event as any;
     const { name, index } = event as any;
-    if (index === 1) {
+    if (subCurrent.value == 1) {
+        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/plantationTask/recover/${name}`);
+        uni.hideLoading();
+        uni.showToast({
+            title: '恢复成功',
+            icon: 'success',
+        });
+        paging.value?.reload();
+    }
+    if (index === 1 && subCurrent.value == 0) {
         try {
         try {
             const res = await uni.showModal({
             const res = await uni.showModal({
                 title: '结束提示',
                 title: '结束提示',
@@ -153,7 +197,7 @@ const clickTempSwipe = async (event: object) => {
                 title: '结束中...',
                 title: '结束中...',
                 mask: true,
                 mask: true,
             });
             });
-            // await useClientRequest.get(`/plt-api/app/base/delById/${name}`);
+            await useClientRequest.get(`/plt-api/app/plantationTask/complete/${name}`);
             uni.hideLoading();
             uni.hideLoading();
             uni.showToast({
             uni.showToast({
                 title: '结束成功',
                 title: '结束成功',

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

@@ -1,6 +1,6 @@
 <template>
 <template>
     <!-- 养殖 -->
     <!-- 养殖 -->
-    <view class="" v-if="data.taskType === '2'" @click="$emit('click')">
+    <view class="" v-if="data.taskType === '2'">
         <view class="b-radius bg-#fff pd-10 p-rtv">
         <view class="b-radius bg-#fff pd-10 p-rtv">
             <image class="w-80 h-34" src="/static/images/plant/port/Task_Breeding.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
             <image class="w-80 h-34" src="/static/images/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 j-ed f-s-22 c-#666">{{ data?.plannedStartDate }}至{{ data?.plannedEndDate }}</view>
@@ -21,7 +21,7 @@
                     <view class="c-#666">暂无完善种源信息</view>
                     <view class="c-#666">暂无完善种源信息</view>
                 </view>
                 </view>
             </view>
             </view>
-            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8">
+            <view class="d-flex a-c f-s-28 pd-16 pt-8 pb-8" @click="$emit('click')">
                 <view class="c-#666 w-s-no">基地:</view>
                 <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">
                 <view class="c-#333 f-w-5 tx-ov w-s-no ov-hd d-flex a-c">
                     {{ data?.baseRef?.baseInfo?.address }}基地
                     {{ data?.baseRef?.baseInfo?.address }}基地
@@ -52,7 +52,7 @@
                         <text class="f-s-26">种源信息</text>
                         <text class="f-s-26">种源信息</text>
                     </view>
                     </view>
                 </up-button>
                 </up-button>
-                <up-button :customStyle="customStyle2">
+                <up-button :customStyle="customStyle2" @click="$emit('toSupervise')">
                     <view class="d-flex a-c j-c">
                     <view class="d-flex a-c j-c">
                         <image class="w-28 h-24" src="/static/images/plant/port/Task_Breeding_management.png" mode="widthFix" />
                         <image class="w-28 h-24" src="/static/images/plant/port/Task_Breeding_management.png" mode="widthFix" />
                         <text class="f-s-26">饲养管理</text>
                         <text class="f-s-26">饲养管理</text>

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

@@ -694,7 +694,7 @@
                     <view class="d-flex pt-20 pb-20">
                     <view class="d-flex pt-20 pb-20">
                         <view class="">个体标识({{ animalIds.length }}个)</view>
                         <view class="">个体标识({{ animalIds.length }}个)</view>
                         <view class="flex1"></view>
                         <view class="flex1"></view>
-                        <view class="border-#79C58C radius-100 c-primary f-s-24 pd4-10-20-10-20 d-flex a-c j-c">扫一扫添加</view>
+                        <view class="border-#79C58C radius-100 c-primary f-s-24 pd4-10-20-10-20 d-flex a-c j-c" @click="">扫一扫添加</view>
                     </view>
                     </view>
                     <view class="d-flex gap-20 mb-20">
                     <view class="d-flex gap-20 mb-20">
                         <view @click="showDeleteDialog = true" class="b-radius border-#AFDDBB bg-#FBFDFB c-primary w-100% d-flex j-c a-c h-100 f-s-34">手动输入添加</view>
                         <view @click="showDeleteDialog = true" class="b-radius border-#AFDDBB bg-#FBFDFB c-primary w-100% d-flex j-c a-c h-100 f-s-34">手动输入添加</view>
@@ -745,7 +745,7 @@ import type { TaskType, YesNoType, TimeRange, PlantInfo, DelegateInfo, Inoculati
 import Drawer_laboratory from './models/drawer_laboratory.vue';
 import Drawer_laboratory from './models/drawer_laboratory.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 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>(
 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 form = ref<PlantationTaskForm>({
 const form = ref<PlantationTaskForm>({
     deawerData: null,
     deawerData: null,

+ 2 - 2
src/plant/port/port-create/models/baseinfo.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
     <view class="border-#AFDDBB pd-26 pb-10 pt-10 bg-#FBFDFB p-rtv">
     <view class="border-#AFDDBB pd-26 pb-10 pt-10 bg-#FBFDFB p-rtv">
         <!-- 关闭按钮 -->
         <!-- 关闭按钮 -->
-        <view v-if="showClose" class="c-#F81242 f-s-30 ab2-10-20" style="position: absolute; right: 10rpx; top: 0rpx" @click="handleClose"> × </view>
+        <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>
         <!-- 标签显示:GAP和三无一全 -->
         <!-- 标签显示:GAP和三无一全 -->
         <view v-if="+modeValue?.gapFlag || +modeValue?.swyqRes" class="pt-8 pb-8 d-flex pr-20 pl-20" style="width: max-content; margin-top: -10rpx; margin-left: -26rpx; background: linear-gradient(90deg, #5eba75, #c6e391); border-bottom-right-radius: 88rpx">
         <view v-if="+modeValue?.gapFlag || +modeValue?.swyqRes" class="pt-8 pb-8 d-flex pr-20 pl-20" style="width: max-content; margin-top: -10rpx; margin-left: -26rpx; background: linear-gradient(90deg, #5eba75, #c6e391); border-bottom-right-radius: 88rpx">
             <view v-if="+modeValue?.gapFlag && !+modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地</view>
             <view v-if="+modeValue?.gapFlag && !+modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地</view>
@@ -59,7 +59,7 @@ const props = withDefaults(
     }>(),
     }>(),
     {
     {
         showClose: true,
         showClose: true,
-    }
+    },
 );
 );
 setTimeout(() => {
 setTimeout(() => {
     console.log(props?.modeValue);
     console.log(props?.modeValue);

+ 45 - 0
src/plant/port/port-supervise/index.vue

@@ -0,0 +1,45 @@
+<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="pd-24">
+            <Task_card :data="taskDate" />
+            <view class="d-flex a-c j-sb pt-20">
+                <view class="startline-title pl-24 ml-24 mb-16">管理记录</view>
+                <view class="bg-#37A954 b-radius pd4-10-20-10-20 d-flex a-c" style="width: max-content" @click="$u.route({ type: 'navigateTo', url: '/plant/port/supervise-create/index', params: { id: item?.id } })">
+                    <up-icon name="plus" color="#fff"></up-icon>
+                    <view class="c-#fff f-s-22">添加管理记录</view>
+                </view>
+            </view>
+        </view>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import Task_card from './models/task_card.vue';
+const paging = ref();
+const list = ref([]);
+const taskId = ref('');
+const taskDate = ref('');
+const query = async (pageNo: number, pageSize: number) => {
+    const res = await useClientRequest.get('/plt-api/app/plantationTask/list', {
+        pageNo,
+        pageSize,
+    });
+    // if (res) {
+    //     const { rows } = res;
+    //     paging.value.complete(rows);
+    // }
+};
+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;
+});
+</script>

+ 42 - 0
src/plant/port/port-supervise/models/task_card.vue

@@ -0,0 +1,42 @@
+<template>
+    <!-- 养殖 -->
+    <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="/static/images/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>
+</template>
+<script setup lang="ts">
+const props = defineProps<{ data: any }>();
+console.log(props.data);
+</script>

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

@@ -0,0 +1,240 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="添加管理记录" :fixed="false">
+                <template #left><view class=""></view></template>
+            </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.startDate" mode="datetime" dateFields="day">
+                            <view class="d-flex mr-20">
+                                <up-input v-model="form.operationDate.startDate" placeholder="请选择操作开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
+                            </view>
+                        </ut-datetime-picker>
+                        <ut-datetime-picker v-model="form.operationDate.endDate" mode="datetime" dateFields="day">
+                            <view class="d-flex">
+                                <up-input v-model="form.operationDate.endDate" placeholder="请选择操作结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
+                            </view>
+                        </ut-datetime-picker>
+                    </up-form-item>
+
+                    <!-- 操作类型 -->
+                    <ut-action-sheet v-model="form.operationType" :tabs="operationTypeOptions" title="选择操作类型">
+                        <up-form-item borderBottom label="操作类型" required prop="operationType" id="operationTypepppp">
+                            <view v-if="form.operationType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(operationTypeOptions, form.operationType) }}</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 :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
+                        <view v-if="!deawerData" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB" @click="openDrawer">
+                            <view class=""></view>
+                            <view class="f-s-34 c-primary">请选择种养殖所在的基地</view>
+                        </view>
+                        <view class="w-100%" v-else>
+                            <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
+                        </view>
+                    </up-form-item>
+                    <!-- 操作方式 -->
+                    <up-form-item borderBottom label="操作方式" required prop="operationMethod" id="operationMethodpppp">
+                        <up-input v-model="form.operationMethod" placeholder="请输入操作方式" border="none"></up-input>
+                    </up-form-item>
+
+                    <!-- 记录人 -->
+                    <up-form-item borderBottom label="记录人" required prop="recorder" id="recorderpppp">
+                        <up-input v-model="form.recorder" placeholder="请输入记录人" border="none"></up-input>
+                    </up-form-item>
+
+                    <!-- 是否使用物料 -->
+                    <up-form-item borderBottom label="是否使用物料" required prop="useMaterial" id="useMaterialpppp">
+                        <up-radio-group v-model="form.useMaterial">
+                            <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
+                        </up-radio-group>
+                    </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>
+                </view>
+            </up-form>
+        </view>
+        <template #bottom>
+            <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
+                <up-button type="warning" @click="saveDraft()">暂存</up-button>
+                <up-button type="primary" @click="save()">提交</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';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { yes_no } = toRefs<any>(proxy?.useDict('yes_no'));
+const deawerData = ref();
+// 表单数据
+const form = ref({
+    operationDate: {
+        startDate: null as string | null,
+        endDate: null as string | null,
+    },
+    operationType: null as string | null,
+    operationMethod: '',
+    recorder: '',
+    useMaterial: '0' as '0' | '1',
+    remark: '',
+});
+
+// 操作类型选项(示例,可以根据实际需求调整)
+const operationTypeOptions = ref([
+    { label: '浇水', value: '1' },
+    { label: '施肥', value: '2' },
+    { label: '除草', value: '3' },
+    { label: '病虫害防治', value: '4' },
+    { label: '修剪', value: '5' },
+    { label: '其他', value: '6' },
+]);
+
+// 自定义校验函数:操作日期校验
+const validateOperationDate = (rule: any, value: any, callback: any) => {
+    if (!value) {
+        callback(new Error('请选择操作日期'));
+        return;
+    }
+    const { startDate, endDate } = value;
+    if (!startDate) {
+        callback(new Error('请选择操作开始时间'));
+        return;
+    }
+    if (!endDate) {
+        callback(new Error('请选择操作结束时间'));
+        return;
+    }
+    const start = new Date(startDate);
+    const end = new Date(endDate);
+    if (end <= start) {
+        callback(new Error('操作结束时间必须晚于开始时间'));
+        return;
+    }
+    callback();
+};
+
+// 表单验证规则
+const rules = reactive({
+    operationDate: [{ validator: validateOperationDate, trigger: 'blur' }],
+    operationType: [{ required: true, message: '请选择操作类型' }],
+    operationMethod: [{ required: true, message: '请输入操作方式' }],
+    recorder: [{ required: true, message: '请输入记录人' }],
+    useMaterial: [{ required: true, message: '请选择是否使用物料' }],
+    remark: [{ required: false, message: '请输入备注' }],
+});
+
+// 字典标签选择函数(从 port-create 复制)
+const selectDictLabel = (dict: any[], value: any) => {
+    if (!dict || dict.length === 0) return '';
+    const item = dict.find((item) => item.value === value);
+    return item ? item.label : '';
+};
+
+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 save = () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                console.log('开始提交管理记录');
+                await upFormRef.value?.validate();
+                console.log('校验完成');
+
+                const params = {
+                    ...form.value,
+                    startDate: form.value.operationDate.startDate,
+                    endDate: form.value.operationDate.endDate,
+                };
+
+                console.log('提交参数:', params);
+
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/managementRecord/save', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '提交成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        uni.navigateBack();
+                    }, 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 saveDraft = () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                const params = {
+                    ...form.value,
+                    startDate: form.value.operationDate.startDate,
+                    endDate: form.value.operationDate.endDate,
+                };
+
+                console.log('暂存参数:', params);
+
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/managementRecord/draft', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '暂存成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        uni.navigateBack();
+                    }, 1000);
+                }
+            } catch (error: any) {
+                console.log('暂存错误:', error);
+            }
+        },
+        1000,
+        true,
+    );
+};
+</script>

+ 0 - 0
src/static/images/plant/port/任务类型-种畜繁育.png → src/static/images/plant/port/TaskType_BreedingLivestock.png


+ 0 - 0
src/static/images/plant/port/任务类型-种苗繁育.png → src/static/images/plant/port/TaskType_SeedlingBreeding.png


+ 0 - 0
src/static/images/plant/port/任务类型-养殖.png → src/static/images/plant/port/TaskType_breeding.png


+ 0 - 0
src/static/images/plant/port/任务类型-种植.png → src/static/images/plant/port/TaskType_plant.png