瀏覽代碼

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

huangxw 1 月之前
父節點
當前提交
bd9475e229

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

@@ -18,8 +18,8 @@
                         <ut-row gap="16rpx">
                             <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 }}
+                                    <view @click="clickCol(item)" class="ut-custom-item-sheet p-rtv" :class="{ active: checkeds[item.value] }"
+                                        >{{ 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>
@@ -96,12 +96,11 @@ const clickCol = (item: any) => {
         // 单选
         checkeds.value = {
             [item.value]: true,
-        }
+        };
         emit('update:modelValue', item.value);
         emit('change', item.value);
         close();
     }
-    
 };
 // 未选择之前的
 const initialCheckeds = ref({});
@@ -113,7 +112,7 @@ const selectChange = (item: any) => {
 };
 watch(
     () => props.modelValue,
-    (newVal: any) => { 
+    (newVal: any) => {
         // 初始化已选择项
         let selected: any = {};
         if (props.multiple && Array.isArray(newVal)) {
@@ -127,7 +126,7 @@ watch(
         }
         checkeds.value = selected;
     },
-    { immediate: true }
+    { immediate: true },
 );
 onMounted(() => {
     // 初始化已选择项
@@ -137,17 +136,17 @@ onMounted(() => {
 <style lang="scss" scoped>
 .ut-custom-item-sheet {
     padding: 18rpx 6rpx;
-    border: 1rpx solid #F7F7F7;
-    background-color: #F7F7F7;
+    border: 1rpx solid #f7f7f7;
+    background-color: #f7f7f7;
     border-radius: 10rpx;
     text-align: center;
     font-size: 30rpx;
     color: #333;
 
     &.active {
-        border-color: #37A954;
-        background-color: #E6F4F0;
-        color: #37A954;
+        border-color: #37a954;
+        background-color: #e6f4f0;
+        color: #37a954;
     }
 }
 .checked-icon {

+ 9 - 2
src/pages.json

@@ -159,9 +159,9 @@
                     }
                 },
                 {
-                    "path": "supervise-create/index",
+                    "path": "supervise/supervise-plant-create/index",
                     "style": {
-                        "navigationBarTitleText": "添加管理记录"
+                        "navigationBarTitleText": "添加种植管理记录"
                     }
                 }
             ]
@@ -268,6 +268,13 @@
                     "style": {
                         "navigationBarTitleText": "选择动植物类型"
                     }
+                },
+                // 选择操作地块
+                {
+                    "path": "supervise-plot/index",
+                    "style": {
+                        "navigationBarTitleText": "选择操作地块"
+                    }
                 }
             ]
         },

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

@@ -7,7 +7,7 @@
             <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 } })">
+                <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="c-#fff f-s-22">添加管理记录</view>
                 </view>

+ 0 - 0
src/plant/port/supervise-create/models/baseinfo.vue → src/plant/port/supervise/models/baseinfo.vue


+ 27 - 20
src/plant/port/supervise-create/index.vue → src/plant/port/supervise/supervise-plant-create/index.vue

@@ -1,9 +1,7 @@
 <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>
+            <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">
@@ -25,9 +23,8 @@
                             </view>
                         </ut-datetime-picker>
                     </up-form-item>
-
                     <!-- 操作类型 -->
-                    <ut-action-sheet v-model="form.operationType" :tabs="operationTypeOptions" title="选择操作类型">
+                    <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>
                             <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择操作类型</view>
@@ -36,18 +33,19 @@
                             </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">
+                    <!-- 操作地块 -->
+                    <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="goSelectBase()">
                             <view class=""></view>
-                            <view class="f-s-34 c-primary">请选择种养殖所在的基地</view>
+                            <view class="f-s-34 c-primary">请选择操作地块</view>
                         </view>
                         <view class="w-100%" v-else>
-                            <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
+                            <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="'1'" />
                         </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-input v-model="form.operationMethod" placeholder="如:人工锄草、机械中耕、喷雾器叶面喷施等" border="none"></up-input>
                     </up-form-item>
 
                     <!-- 记录人 -->
@@ -63,8 +61,11 @@
                     </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 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>
                 </view>
             </up-form>
@@ -81,6 +82,7 @@
 import { ref, reactive, computed, getCurrentInstance, type ComponentInternalInstance } from 'vue';
 import { useClientRequest } from '@/utils/request';
 import { useInfoStore } from '@/store';
+import Baseinfo from '../models/baseinfo.vue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { yes_no } = toRefs<any>(proxy?.useDict('yes_no'));
 const deawerData = ref();
@@ -96,8 +98,9 @@ const form = ref({
     recorder: infoStore.userInfo?.name,
     useMaterial: '0' as '0' | '1',
     remark: '',
+    technicalFile: '',
 });
-
+const baseId = ref('');
 // 操作类型选项(示例,可以根据实际需求调整)
 const operationTypeOptions = ref([
     { label: '浇水', value: '1' },
@@ -142,13 +145,6 @@ const rules = reactive({
     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>();
@@ -240,4 +236,15 @@ const saveDraft = () => {
         true,
     );
 };
+//去操作地块页面选择地块
+const goSelectBase = () => {
+    uni.$once('updatelands', function (data) {
+        deawerData.value = data;
+        console.log(deawerData.value, 'deawerData.value');
+    });
+    uni.$u.route({ type: 'navigateTo', url: '/tools/supervise-plot/index', params: { baseId: baseId.value } });
+};
+onLoad((options: any) => {
+    baseId.value = options?.baseId;
+});
 </script>

+ 137 - 0
src/tools/supervise-plot/index.vue

@@ -0,0 +1,137 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="选择操作地块" :fixed="false"></ut-navbar>
+        </template>
+        <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
+        <view class="pd-26 bg-#fff mb-20">
+            <view class="border-#AFDDBB pd-26 pb-10 pt-10 bg-#FBFDFB p-rtv">
+                <!-- 标签显示: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="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地</view>
+                    <view v-if="+modeValue?.swyqRes && !+modeValue?.gapFlag" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.swyqMedicineName }}三无一全基地</view>
+                    <view v-if="+modeValue?.gapFlag && +modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地和{{ modeValue?.swyqMedicineName }}三无一全基地</view>
+                </view>
+                <view class="c-#333 f-s-34 f-w-5 pt-8 pb-8 pr-16">{{ modeValue?.baseName }}</view>
+                <view class="pt-8 pb-8">
+                    <text class="c-#666 f-s-28">基地面积:</text>
+                    <text class="c-#333 f-s-28 f-w-5">{{ modeValue?.gapInfo?.area }}{{ modeValue?.gapInfo?.areaUnit }}</text>
+                </view>
+                <view class="pt-8 pb-8">
+                    <text class="c-#666 f-s-28">基地地址:</text>
+                    <text class="c-#333 f-s-28 f-w-5">{{ modeValue?.gapInfo?.adcodeName }}{{ modeValue?.gapInfo?.address }}</text>
+                </view>
+            </view>
+        </view>
+        <view class="startline-title pl-24 ml-24 mb-16">请选择所操作的地块</view>
+        <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>
+                            </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>
+                        </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>
+                </up-checkbox-group>
+            </view>
+        </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>
+        </template>
+    </z-paging>
+</template>
+<script lang="ts" setup>
+import { ref, computed } from 'vue';
+import { useClientRequest } from '@/utils/request';
+const paging = ref();
+const list = ref([]);
+//基地信息
+const modeValue = ref();
+const keyword = ref('');
+//地块信息
+const lands = ref<any>([]);
+const changeSeach = async () => {
+    const res = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: modeValue.value?.id, keyword: keyword.value });
+    lands.value = res?.rows;
+    // 搜索时清空选中状态
+    checkboxValue.value = [];
+};
+const checkboxValue = ref<string[]>([]);
+const handleSelectAll = () => {
+    if (isAllSelected.value) {
+        checkboxValue.value = []; // 全选状态下点击 → 清空
+    } else {
+        checkboxValue.value = lands.value.map((item: any) => item.id); // 非全选状态下点击 → 全选
+    }
+};
+const isAllSelected = computed(() => {
+    console.log(checkboxValue.value.length === lands.value.length);
+    return lands.value.length > 0 && checkboxValue.value.length === lands.value.length;
+});
+onLoad(async (options: any) => {
+    const res = await useClientRequest.get(`/plt-api/app/base/getInfoAllById/${options?.baseId}`);
+    modeValue.value = res?.data?.baseInfo;
+    lands.value = res?.data?.landInfoList;
+    // 初始选中状态为空
+    checkboxValue.value = [];
+});
+const cancel = () => {
+    uni.navigateBack({
+        delta: 1,
+    });
+};
+// 确认选择
+const save = () => {
+    const checkedLands = lands.value.filter((item: any) => checkboxValue.value.includes(item.id));
+    console.log(checkedLands);
+    // 我希望这个能返回 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,
+        area: modeValue.value?.gapInfo?.area,
+        gapFlag: modeValue.value?.gapFlag,
+        swyqRes: modeValue.value?.swyqRes,
+        areaUnit: modeValue.value?.gapInfo?.areaUnit,
+        adcodeName: modeValue.value?.gapInfo?.adcodeName,
+        address: modeValue.value?.gapInfo?.address,
+        aloneChecked: isAllSelected.value,
+        swyqMedicineName: modeValue.value?.swyqMedicineName,
+        medicineName: modeValue.value?.medicineName,
+        checkBox: checkboxValue.value,
+    });
+    uni.navigateBack({
+        delta: 1,
+    });
+};
+
+onUnload(() => {
+    uni.$off('updatelands');
+});
+</script>