lisy hai 1 mes
pai
achega
b9ce1272f3

+ 2 - 1
src/components/ut-action-sheet/ut-action-sheet.vue

@@ -19,7 +19,7 @@
                             <template v-for="(item, index) in options" :key="index">
                                 <ut-col :span="item.span">
                                     <view @click="clickCol(item)" class="ut-custom-item-sheet p-rtv" :class="{ active: checkeds[item.value] }"
-                                        >{{ item?.name }}
+                                        >{{ item?.remark || item?.name }}
                                         <image v-if="checkeds[item.value]" class="w-40 h-40 checked-icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-lm/price/checked1.png" mode="widthFix" />
                                     </view>
                                 </ut-col>
@@ -68,6 +68,7 @@ const options = computed(() => {
             name: item.label,
             value: item.value,
             span: item.elTagClass || 10,
+            remark: item.remark,
         };
     });
 });

+ 6 - 0
src/pages.json

@@ -149,6 +149,12 @@
                     "style": {
                         "navigationBarTitleText": "添加种植管理记录"
                     }
+                },
+                {
+                    "path": "supervise/supervise-plant-detail/index",
+                    "style": {
+                        "navigationBarTitleText": "种植管理记录详情"
+                    }
                 }
             ]
         },

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

@@ -52,7 +52,7 @@
                         <text class="f-s-26">种源信息</text>
                     </view>
                 </up-button>
-                <up-button :customStyle="customStyle2" @click="$emit('toSupervise')">
+                <up-button :customStyle="customStyle2">
                     <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" />
                         <text class="f-s-26">饲养管理</text>
@@ -198,7 +198,7 @@
                         <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="/static/images/plant/port/Task_Breeding_management.png" mode="widthFix" />
                         <text class="f-s-26"> 种植管理 </text>

+ 123 - 11
src/plant/port/port-supervise/index.vue

@@ -5,32 +5,140 @@
         </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/supervise-plant-create/index', params: { baseId: taskDate?.baseId } })">
-                    <up-icon name="plus" color="#fff"></up-icon>
+            <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="$u.route({ type: 'navigateTo', url: '/plant/port/supervise/supervise-plant-create/index', params: { baseId: taskDate?.baseId, taskId: taskId, add: 1, id: taskDate?.id } })">
+                    <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
                     <view class="c-#fff f-s-22">添加管理记录</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(pt_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 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 d-flex a-c w-s-no tx-ov ov-hd" v-else>
+                                <view v-for="(data, indexs) in item?.lands">
+                                    <text v-if="indexs !== 0">、</text>
+                                    <text>{{ data?.landName }}</text>
+                                </view>
+                            </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 } = toRefs<any>(proxy?.useDict('pt_op_method'));
 const paging = ref();
-const list = ref([]);
+const list = ref<any>([]);
 const taskId = ref('');
-const taskDate = ref('');
+const taskDate = ref<any>();
+const from = ref({
+    keyword: '',
+});
 const query = async (pageNo: number, pageSize: number) => {
-    const res = await useClientRequest.get('/plt-api/app/plantationTask/list', {
+    const res = await useClientRequest.get('/plt-api/app/plantationActivity/list', {
         pageNo,
         pageSize,
+        ...from.value,
+    });
+    if (res) {
+        const { rows } = res;
+        paging.value.complete(rows);
+    }
+};
+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;
+    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 {
+        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 },
+        });
+    }
+};
+const gotoDetail = async (item: any) => {
+    uni.$u.route({
+        type: 'navigateTo',
+        url: `/plant/port/supervise/supervise-plant-detail/index`,
+        params: {
+            id: item?.id,
+        },
     });
-    // if (res) {
-    //     const { rows } = res;
-    //     paging.value.complete(rows);
-    // }
 };
 onMounted(async () => {
     const res = await useClientRequest.get(`/plt-api/app/plantationTask/getInfo/${taskId.value}`, {
@@ -41,5 +149,9 @@ onMounted(async () => {
 });
 onLoad((options: any) => {
     taskId.value = options?.id;
+    //接收 uni.$emit('updatesuperviselist');
+    uni.$on('updatesuperviselist', () => {
+        paging.value?.reload();
+    });
 });
 </script>

+ 36 - 1
src/plant/port/port-supervise/models/task_card.vue

@@ -1,6 +1,41 @@
 <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="/static/images/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="" 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>

+ 57 - 0
src/plant/port/supervise/models/materialinfo.vue

@@ -0,0 +1,57 @@
+<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 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>
+        <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>
+        <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>
+        <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>
+        <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"> 2021-07-01</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>
+        </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 class="flex1 mr-10">
+                <up-input v-model="form.Usage" placeholder="请输入本次使用量" border="bottom" style="padding-left: 0">
+                    <template #suffix>
+                        <view class="c-#333 f-s-28 f-w-5">kg</view>
+                    </template>
+                </up-input>
+            </view>
+            <view class="">
+                <up-radio-group v-model="form.AllUse">
+                    <up-radio shape="circle" label="全部使用"></up-radio>
+                </up-radio-group>
+            </view>
+        </view>
+    </view>
+</template>
+<script setup lang="ts">
+//从外部获取数据
+const props = defineProps<{
+    showClose?: boolean;
+}>();
+const form = reactive({
+    Usage: '',
+    AllUse: false,
+});
+</script>

+ 146 - 66
src/plant/port/supervise/supervise-plant-create/index.vue

@@ -10,31 +10,35 @@
                     <!-- 操作日期 -->
                     <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="date" dateFields="day">
+                        <ut-datetime-picker v-model="form.operationDate.activityStart" mode="date" dateFields="day">
                             <view class="d-flex mr-20">
-                                <up-input v-model="form.operationDate.startDate" placeholder="请选择操作开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
+                                <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.endDate" mode="date" dateFields="day">
+                        <ut-datetime-picker v-model="form.operationDate.activityEnd" mode="date" dateFields="day">
                             <view class="d-flex">
-                                <up-input v-model="form.operationDate.endDate" placeholder="请选择操作结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
+                                <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.operationType" :tabs="operationTypeOptions" title="选择操作类型" mode="custom">
-                        <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>
+                    <ut-action-sheet v-model="form.opMethod" :tabs="pt_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_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="false" label="操作地块" required prop="baseId" id="baseIdpppp">
+                    <up-form-item :borderBottom="false" label="操作地块" required 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>
@@ -44,36 +48,49 @@
                         </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 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="recorder" id="recorderpppp">
-                        <up-input v-model="form.recorder" placeholder="请输入记录人" border="none"></up-input>
+                    <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="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 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="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" />
+                        </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="technicalFile" borderBottom id="technicalFilepppp">
-                        <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="image"></ut-upload>
+                    <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 type="warning" @click="saveDraft()">暂存</up-button>
-                <up-button type="primary" @click="save()">提交</up-button>
+                <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>
@@ -83,51 +100,58 @@ import { ref, reactive, computed, getCurrentInstance, type ComponentInternalInst
 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 } = toRefs<any>(proxy?.useDict('yes_no'));
+const { yes_no, pt_op_method } = toRefs<any>(proxy?.useDict('yes_no', 'pt_op_method'));
 const deawerData = ref();
 const infoStore = useInfoStore();
 // 表单数据
 const form = ref({
+    taskId: '',
+    //管理类型 1-农事管理 2-投料
+    activityType: '1',
     operationDate: {
-        startDate: null as string | null,
-        endDate: null as string | null,
+        activityStart: null as string | null,
+        activityEnd: null as string | null,
     },
-    operationType: null as string | null,
-    operationMethod: '',
-    recorder: infoStore.userInfo?.name,
-    useMaterial: '0' as '0' | '1',
+    //作用对象类型 1-地块 2-动物
+    targetType: '1',
+    opMethod: null as string | null,
+    cusOp: null as string | null,
+    //操作地块
+    landIds: [],
+    opRemark: '',
+    mgName: infoStore.userInfo?.name,
+    //是否使用物料
+    inputFlag: '0' as '0' | '1',
+    //物料列表
+    inputs: [],
     remark: '',
-    technicalFile: '',
+    imgs: null as string | null,
+    videos: null as string | null,
+    landFlag: '0' as '0' | '1',
 });
 const baseId = ref('');
-// 操作类型选项(示例,可以根据实际需求调整)
-const operationTypeOptions = ref([
-    { label: '浇水', value: '1' },
-    { label: '施肥', value: '2' },
-    { label: '除草', value: '3' },
-    { label: '病虫害防治', value: '4' },
-    { label: '修剪', value: '5' },
-    { label: '其他', value: '6' },
-]);
-
+const Material = ref();
+//判断是新增还是修改
+const isAdd = ref(true);
 // 自定义校验函数:操作日期校验
 const validateOperationDate = (rule: any, value: any, callback: any) => {
     if (!value) {
         callback(new Error('请选择操作日期'));
         return;
     }
-    const { startDate, endDate } = value;
-    if (!startDate) {
+    const { activityStart, activityEnd } = value;
+    if (!activityStart) {
         callback(new Error('请选择操作开始时间'));
         return;
     }
-    if (!endDate) {
+    if (!activityEnd) {
         callback(new Error('请选择操作结束时间'));
         return;
     }
-    const start = new Date(startDate);
-    const end = new Date(endDate);
+    const start = new Date(activityStart);
+    const end = new Date(activityEnd);
     if (end <= start) {
         callback(new Error('操作结束时间必须晚于开始时间'));
         return;
@@ -135,13 +159,23 @@ const validateOperationDate = (rule: any, value: any, callback: any) => {
     callback();
 };
 
+// 自定义校验函数:自填操作类型校验(当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' }],
-    operationType: [{ required: true, message: '请选择操作类型' }],
-    operationMethod: [{ required: true, message: '请输入操作方式' }],
-    recorder: [{ required: true, message: '请输入记录人' }],
-    useMaterial: [{ required: true, message: '请选择是否使用物料' }],
+    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: '请输入备注' }],
 });
 
@@ -170,14 +204,14 @@ const save = () => {
 
                 const params = {
                     ...form.value,
-                    startDate: form.value.operationDate.startDate,
-                    endDate: form.value.operationDate.endDate,
+                    ...form.value.operationDate,
+                    landFlag: deawerData?.value.aloneChecked ? '1' : '0',
                 };
 
                 console.log('提交参数:', params);
 
                 // 这里需要根据实际 API 进行调整
-                const res = await useClientRequest.post('/plt-api/app/managementRecord/save', params);
+                const res = await useClientRequest.post('/plt-api/app/plantationActivity/saveActivity', params);
                 if (res.code == 200) {
                     uni.showToast({
                         title: '提交成功',
@@ -185,7 +219,11 @@ const save = () => {
                         duration: 2000,
                     });
                     setTimeout(() => {
-                        uni.navigateBack();
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
                     }, 1000);
                 }
             } catch (error: any) {
@@ -202,34 +240,47 @@ const save = () => {
         true,
     );
 };
-
-// 暂存
-const saveDraft = () => {
+//修改提交表单
+const change = () => {
     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,
+                    ...form.value.operationDate,
+                    landFlag: deawerData?.value.aloneChecked ? '1' : '0',
                 };
 
-                console.log('暂存参数:', params);
+                console.log('提交参数:', params);
 
                 // 这里需要根据实际 API 进行调整
-                const res = await useClientRequest.post('/plt-api/app/managementRecord/draft', params);
+                const res = await useClientRequest.post('/plt-api/app/plantationActivity/updateActivity', params);
                 if (res.code == 200) {
                     uni.showToast({
-                        title: '暂存成功',
+                        title: '提交成功',
                         icon: 'success',
                         duration: 2000,
                     });
                     setTimeout(() => {
-                        uni.navigateBack();
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
                     }, 1000);
                 }
             } catch (error: any) {
-                console.log('暂存错误:', error);
+                console.log('表单验证错误:', error);
+                // 滚动到第一个错误字段
+                if (error && error[0]?.field) {
+                    const firstErrorField = error[0].field + 'pppp';
+                    paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+                }
+                return;
             }
         },
         1000,
@@ -240,11 +291,40 @@ const saveDraft = () => {
 const goSelectBase = () => {
     uni.$once('updatelands', function (data) {
         deawerData.value = data;
-        console.log(deawerData.value, 'deawerData.value');
+        console.log(deawerData.value);
+
+        form.value.landIds = deawerData.value.checkBox;
     });
     uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-plot/index', params: { baseId: baseId.value } });
 };
-onLoad((options: any) => {
+//去选择物料
+const goMaterial = () => {
+    if (!+isAdd.value) {
+        return;
+    }
+};
+onLoad(async (options: any) => {
     baseId.value = options?.baseId;
+    form.value.taskId = options?.taskId;
+    isAdd.value = 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;
+        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,
+        };
+    }
 });
 </script>

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

@@ -0,0 +1,84 @@
+<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 class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30">种植日期:</text>
+                <text class="c-#333 f-s-30">{{ data?.activityStart }}至{{ data?.activityEnd }}</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">{{ selectDictLabel(pt_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>
+                <text class="c-#333 f-s-30">{{ data?.cusOp }}</text>
+            </view>
+            <view class="pt-16 pb-16 info-border-bottom d-flex flex-cln">
+                <text class="c-#666 f-s-30 pb-10">操作地块:</text>
+                <Baseinfo :modeValue="deawerData" :baseType="'1'" :showClose="false" />
+            </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?.opRemark }}</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?.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">{{ selectDictLabel(yes_no, data?.inputFlag) }}</text>
+            </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>
+            <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">
+                <text class="c-#666 f-s-30">过程图片:</text>
+                <ut-album :urls="data?.imgs"></ut-album>
+            </view>
+            <view v-if="data?.videos" class="pt-16 pb-16 info-border-bottom">
+                <text class="c-#666 f-s-30">过程视频:</text>
+                <ut-album :urls="data?.videos"></ut-album>
+            </view>
+        </view>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import Baseinfo from '../models/baseinfo.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { yes_no, pt_op_method } = toRefs<any>(proxy?.useDict('yes_no', 'pt_op_method'));
+const list = ref<any>([]);
+const data = ref<any>();
+const paging = ref();
+const ID = ref('');
+const deawerData = 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,
+    };
+};
+onMounted(() => {
+    query();
+});
+onLoad((options: any) => {
+    ID.value = options?.id;
+});
+</script>

+ 45 - 33
src/tools/supervise-plot/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" safe-area-inset-bottom>
+    <z-paging ref="paging" v-model="list" paging-class="paging-btm-shadow" bgColor="#f7f7f7" safe-area-inset-bottom>
         <template #top>
             <ut-navbar title="选择操作地块" :fixed="false"></ut-navbar>
         </template>
@@ -27,43 +27,49 @@
         <view class="pd-24">
             <ut-search ref="searchRef" v-model="keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜索地块名称" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
             <view class="pd-20"></view>
-            <!-- 全选行 -->
-            <view class="b-radius bg-#fff mb-20 pd-24 d-flex a-c j-sb">
-                <view class="c-#333 f-s-34 f-w-5">全选</view>
-                <up-checkbox usedAlone activeColor="#37A954" :checked="isAllSelected" @change="handleSelectAll"></up-checkbox>
-            </view>
-            <view class="b-radius bg-#fff mb-20 pd-24" v-for="(item, index) in lands" :key="index">
-                <up-checkbox-group v-model="checkboxValue">
-                    <view class="d-flex w-100% j-sb">
-                        <view class="flex1 ov-hd">
-                            <view class="mb-20 ov-hd tx-ov d-flex a-c">
-                                <view class="c-primary f-s-24 f-w-5 mr-5 bg-#EBF6EE pd4-6-10-6-10 b-radius mr-6" style="font-style: italic">{{ Number(index) + 1 < 10 ? '0' + (Number(index) + 1) : Number(index) + 1 }}</view>
-                                <view class="c-#333 f-w-5 f-s-34 tx-ov ov-hd">{{ item?.landName }}</view>
+            <up-checkbox-group v-model="checkboxValue">
+                <view class="d-flex w-100% j-sb b-radius bg-#fff mb-20 pd-24" v-for="(item, index) in lands" :key="index" :name="item?.id">
+                    <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 mr-10 bg-#EBF6EE pd4-4-6-4-6 b-radius" style="font-style: italic">{{ Number(index) + 1 < 10 ? '0' + (Number(index) + 1) : Number(index) + 1 }}</view>
+                            <view class="c-#333 f-w-5 f-s-34 tx-ov ov-hd">{{ item?.landName }}</view>
+                        </view>
+                        <view class="d-flex a-c">
+                            <view class="w-50%">
+                                <text class="c-#666 f-s-28 mr-5">{{ item?.area }}</text>
+                                <text class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.areaUnit }}</text>
                             </view>
-                            <view class="d-flex a-c">
-                                <view class="w-50%">
-                                    <text class="c-#333 f-s-28 f-w-5 mr-5">{{ item?.area }}</text>
-                                    <text class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.areaUnit }}</text>
-                                </view>
-                                <view class="w-50%">
-                                    <text class="c-#333 f-s-28 f-w-5 mr-5">负责人:</text>
-                                    <text class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.contactName }}</text>
-                                </view>
+                            <view class="w-50%">
+                                <text class="c-#666 f-s-28 f-w-5 mr-5">负责人:</text>
+                                <text class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.contactName }}</text>
                             </view>
                         </view>
-                        <view class="d-flex j-c a-c">
-                            <view @click.stop class="">
-                                <up-checkbox activeColor="#37A954" label="" :name="item?.id" shape="circle"></up-checkbox>
-                            </view>
+                    </view>
+                    <view class="d-flex j-c a-c">
+                        <view class="">
+                            <up-checkbox activeColor="#37A954" label="" :name="item?.id" shape="circle"></up-checkbox>
                         </view>
                     </view>
-                </up-checkbox-group>
-            </view>
+                </view>
+            </up-checkbox-group>
         </view>
         <template #bottom>
-            <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
-                <up-button type="warning" @click="cancel()">取消</up-button>
-                <up-button type="primary" @click="save()">确认选择</up-button>
+            <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>{{ checkboxValue.length }}</text>
+                        <text>个地块</text>
+                    </view>
+                    <view class="d-flex a-c">
+                        <view class="c-#333 f-s-28 mr-10">全选</view>
+                        <up-checkbox usedAlone activeColor="#37A954" :checked="isAllSelected" @change="handleSelectAll"></up-checkbox>
+                    </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>
@@ -110,8 +116,13 @@ const cancel = () => {
 };
 // 确认选择
 const save = () => {
-    const checkedLands = lands.value.filter((item: any) => checkboxValue.value.includes(item.id));
-    console.log(checkedLands);
+    if (checkboxValue.value.length === 0) {
+        return uni.showToast({
+            title: '请选择地块',
+            icon: 'none',
+        });
+    }
+    const data = checkboxValue.value.map((id) => lands.value.find((item) => item.id === id));
     // 我希望这个能返回 data: { medicineName: string; swyqMedicineName: string; checkBox: any[]; data: any[]; aloneChecked: boolean; baseName: string; area?: string; gapFlag: number; swyqRes: number; areaUnit: string; adcodeName: string; address: string })
     uni.$emit('updatelands', {
         baseName: modeValue.value?.baseName,
@@ -125,6 +136,7 @@ const save = () => {
         swyqMedicineName: modeValue.value?.swyqMedicineName,
         medicineName: modeValue.value?.medicineName,
         checkBox: checkboxValue.value,
+        data: data,
     });
     uni.navigateBack({
         delta: 1,

+ 1 - 1
src/utils/dict.ts

@@ -16,7 +16,7 @@ export const useDict = (...args: string[]): { [key: string]: DictDataOption[] }
                 res.value[dictType] = dicts;
             } else {
                 const resp: any = await useClientRequest.get(`/system/dict/data/type/${dictType}`, null, false);
-                res.value[dictType] = resp?.data?.map((p): DictDataOption => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass }));
+                res.value[dictType] = resp?.data?.map((p): DictDataOption => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass, remark: p.remark }));
                 useDictStore().setDict(dictType, res.value[dictType]);
             }
         });