lisy 3 tuần trước cách đây
mục cha
commit
395df45327

+ 7 - 0
src/pages.json

@@ -498,6 +498,13 @@
                     "style": {
                         "navigationBarTitleText": "选择加工工艺信息"
                     }
+                },
+                //选择加工原料
+                {
+                    "path": "species-info-process/index",
+                    "style": {
+                        "navigationBarTitleText": "选择加工原料"
+                    }
                 }
             ]
         },

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

@@ -1,9 +1,5 @@
 <template>
-<<<<<<< HEAD
     <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom hide-no-more-inside>
-=======
-    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query">
->>>>>>> 84bf63a02fd3b1ba91f839dc1cba1e254e5d4b6c
         <template #top>
             <ut-navbar title="种养殖任务" :fixed="false">
                 <template #left><view class=""></view></template>

+ 8 - 23
src/pages/plant/processing/index.vue

@@ -5,11 +5,11 @@
         </template>
         <template>
             <view class="pd3-24-24-0">
-                <view class="mb-20">
+                <view class="">
                     <ut-tabs mode="subsection" v-model="form.restFlag" :tabs="tabs" @change="onRefresh"></ut-tabs>
                 </view>
             </view>
-            <view class="d-flex a-c pd-24 bg-#f7f7f7">
+            <view class="d-flex a-c pd-24 pb-0 bg-#f7f7f7">
                 <view class="min-w-170 flex1">
                     <ut-action-sheet v-model="form.taskType" :tabs="[{ label: '全部', value: '' }, ...pt_process_type]" @change="onRefresh" title="选择原料类型">
                         <view class="d-flex search-select-item a-c">
@@ -24,10 +24,10 @@
             </view>
             <view class="pd-24">
                 <template v-for="(item, index) in list" :key="index">
-                    <view class="bg-#fff b-radius pd-24 p-rtv">
-                        <view v-if="+item?.processType == 1 && +item?.stockType == 1" class="bg-#91C747 c-#fff f-w-5 pl-10 pr-10 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: relative; top: -24rpx; left: -24rpx">种子初加工</view>
-                        <view v-if="+item?.processType == 1 && +item?.stockType == 2" class="bg-#C7A262 c-#fff f-w-5 pl-10 pr-10 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: relative; top: -24rpx; left: -24rpx">药材初加工</view>
-                        <view v-if="+item?.processType == 2" class="bg-#37A954 c-#fff f-w-5 pl-10 pr-10 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: relative; top: -24rpx; left: -24rpx">趁鲜切制</view>
+                    <view class="bg-#fff b-radius pd-24 p-rtv mb-16">
+                        <view v-if="+item?.processType == 1 && +item?.processMedType == 1" class="bg-#91C747 c-#fff f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: relative; top: -24rpx; left: -24rpx">种子初加工</view>
+                        <view v-if="+item?.processType == 1 && +item?.processMedType == 2" class="bg-#C7A262 c-#fff f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: relative; top: -24rpx; left: -24rpx">药材初加工</view>
+                        <view v-if="+item?.processType == 2" class="bg-#37A954 c-#fff f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: relative; top: -24rpx; left: -24rpx">趁鲜切制</view>
                         <view class="mb-10">
                             <span class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.variety }}</span>
                             <span class="f-s-24 c-#666" v-if="+item?.stockType == 1">{{ selectDictLabel(pt_stock_type, item?.stockType) }}</span>
@@ -52,23 +52,7 @@
                             <span class="c-#666">加工负责人:</span>
                             <span class="c-#333 f-w-500">{{ item?.contactName }}</span>
                         </view>
-                        <view class="radius-10 bg-#f7f7f7 d-flex mb-10">
-                            <view class="bg-#EDF7F0 w-50 h-110 d-flex flex-cln a-c j-c c-primary f-w-5 f-s-24">
-                                <view class="">原</view>
-                                <view class="">料</view>
-                            </view>
-                            <view class="bg-#F5FBF7 flex1 d-flex a-c">
-                                <view class="d-flex flex1 f-s-26">
-                                    <view class="c-#999 ml-16"> 暂无关联原料信息 </view>
-                                    <view class="flex1"></view>
-                                    <view class="c-primary d-flex a-c">
-                                        <view>去关联</view>
-                                        <up-icon name="arrow-right" size="26rpx"></up-icon>
-                                    </view>
-                                </view>
-                            </view>
-                        </view>
-                        <Output />
+                        <Output :data="item" />
                     </view>
                 </template>
             </view>
@@ -170,6 +154,7 @@ const query = async (pageNum: number, pageSize: number) => {
         paging.value.complete(rows);
     }
 };
+
 const onRefresh = () => {
     paging.value?.complete();
 };

+ 45 - 2
src/pages/plant/processing/models/output.vue

@@ -1,4 +1,38 @@
 <template>
+    <view class="radius-10 bg-#f7f7f7 d-flex mb-10 mt-10">
+        <view class="bg-#EDF7F0 w-50 h-110 d-flex flex-cln a-c j-c c-primary f-w-5 f-s-24">
+            <view class="">原</view>
+            <view class="">料</view>
+        </view>
+        <view class="bg-#F5FBF7 flex1 d-flex a-c" v-if="inputList?.length === 0">
+            <view class="d-flex flex1 f-s-26">
+                <view class="c-#999 ml-16"> 暂无关联原料信息 </view>
+                <view class="flex1"></view>
+                <view class="c-primary d-flex a-c" @click="goAssociate">
+                    <view>去关联</view>
+                    <up-icon name="arrow-right" size="26rpx"></up-icon>
+                </view>
+            </view>
+        </view>
+        <view class="bg-#F6FAFE flex1 f-s-22 d-flex a-c pd-16" v-else>
+            <ut-row gap="10rpx" class="w-100%">
+                <ut-col class="d-flex flex-cln j-c" :span="15">
+                    <view class="d-flex a-c">
+                        <span class="c-#666 f-s-26">{{ inputList?.materialName }}</span>
+                        <span class="c-#999 f-s-22 ml-10">{{ inputList?.storageInfo?.partName }}</span>
+                    </view>
+                    <view class="d-flex">
+                        <span class="c-#999 f-s-22">1mm极薄片</span>
+                    </view>
+                </ut-col>
+                <ut-col class="d-flex a-c c-#666" :span="10">{{ inputList?.quantity }}{{ inputList?.unit }}</ut-col>
+                <ut-col class="d-flex a-c j-ed" :span="5">
+                    <span class="c-#666">修改</span>
+                    <up-icon name="arrow-right" size="26rpx"></up-icon>
+                </ut-col>
+            </ut-row>
+        </view>
+    </view>
     <view class="radius-10 bg-#f7f7f7 d-flex">
         <view class="bg-#EBF4FD w-50 d-flex flex-cln a-c j-c c-#2289E0 f-w-5 f-s-24">
             <view class="">产</view>
@@ -14,7 +48,7 @@
                 </view>
             </view>
         </view>
-        <view class="bg-#F6FAFE flex1 f-s-22 pd-24" v-else>
+        <view class="bg-#F6FAFE flex1 f-s-22 pd-16" v-else>
             <ut-row gap="10rpx">
                 <ut-col class="d-flex a-c c-#666" :span="2">01</ut-col>
                 <ut-col class="d-flex flex-cln j-c" :span="8">
@@ -41,6 +75,15 @@
 </template>
 <script setup lang="ts">
 const props = defineProps<{
-    data: Array<any>;
+    data: any;
 }>();
+const inputList = ref<any>(props?.data?.inputList[0] || {});
+const goAssociate = () => {
+    console.log(props?.data?.id, 'processId');
+    uni.$u.route({
+        type: 'navigateTo',
+        url: '/tools/species-info-process/index',
+        params: { id: props?.data?.id, processMedType: props?.data?.processMedType },
+    });
+};
 </script>

+ 266 - 0
src/tools/species-info-process/index.vue

@@ -0,0 +1,266 @@
+<template>
+    <z-paging ref="paging" v-model="list" paging-class="paging-btm-shadow" bgColor="#f7f7f7" safe-area-inset-bottom @query="query">
+        <template #top>
+            <ut-navbar leftText="请选择任务所使用的种源信息" :fixed="false"></ut-navbar>
+        </template>
+        <view class="d-flex a-c pd-24 pb-0 bg-#f7f7f7">
+            <view class="min-w-170 flex1">
+                <ut-action-sheet v-model="form.instoreType" :tabs="[{ label: '全部', value: '' }, ...pt_fresh_instore_type]" @change="changeSeach" title="选择原料类型">
+                    <view class="d-flex search-select-item a-c">
+                        <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ selectDictLabel(pt_fresh_instore_type, form.instoreType) || '全部' }}</view>
+                        <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
+                    </view>
+                </ut-action-sheet>
+            </view>
+            <view class="h-86 pl-20 w-100%">
+                <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" @change="changeSeach" margin="0" :border="false" placeholder="搜批次号、品种名、基地名" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+            </view>
+        </view>
+        <template v-for="(item, index) in list" :key="index">
+            <info-card :item="item" :selected="selectedItems.has(item.id)" @click="toggleSelection(item)" />
+        </template>
+        <template #bottom>
+            <view v-if="formDate.inputs.length > 0" class="bg-#EBF6EE c-primary f-s-24 pd-10 pl-24">
+                已选择种源:
+                <template v-for="(item, index) in formDate.inputs" :key="index">
+                    <text v-if="index !== 0">、</text>
+                    {{ item.variety }}
+                </template>
+            </view>
+            <view class="pd-20 d-flex">
+                <up-button type="primary" @click="open">确认选择</up-button>
+            </view>
+        </template>
+    </z-paging>
+    <up-popup v-if="show" :show="show" :round="10" mode="bottom" @close="close" @open="open" closeable>
+        <view>
+            <view class="d-flex a-c pd-24">
+                <view class="f-s-34 f-w-5 c-#333">关联种源信息</view>
+                <view class="bg-#37A954 radius-10 pd4-10-20-10-20 d-flex a-c" style="width: max-content">
+                    <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
+                    <view class="c-#fff f-s-22">添加种源关联信息</view>
+                </view>
+            </view>
+            <view class="pd-24">
+                <up-form class="p-rtv" labelPosition="top" :model="formDate" :rules="rules" labelWidth="auto" ref="upFormRef">
+                    <up-form-item :borderBottom="false" prop="inputs" id="inputspppp">
+                        <view class="d-flex flex-cln" style="width: 100%">
+                            <template v-for="(item, index) in Array.from(selectedItems.values())" :key="index">
+                                <souceinfo showClose :data="item" :index="index" v-model:inputs="formDate.inputs[index]" @close="handleSourceClose" />
+                            </template>
+                        </view>
+                    </up-form-item>
+                </up-form>
+            </view>
+            <view class="pd-20 d-flex">
+                <up-button type="primary" @click="saveSeedInfo">确认添加</up-button>
+            </view>
+        </view>
+    </up-popup>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import InfoCard from './models/info-card.vue';
+import Souceinfo from './models/souceinfo.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_fresh_instore_type } = toRefs<any>(proxy?.useDict('pt_fresh_instore_type'));
+interface SeedItem {
+    id: number | string;
+    [key: string]: any;
+}
+
+const list = ref<SeedItem[]>([]);
+const paging = ref();
+const form = ref({
+    keyword: '',
+    instoreType: '',
+    part: '',
+    notIncludePart: '',
+});
+//表单
+const formDate = ref({
+    inputs: [] as any,
+});
+
+// 自定义inputs校验函数
+const validateInputs = (rule: any, value: any, callback: any) => {
+    // value 应该是 inputs 数组
+    if (!value || !Array.isArray(value) || value.length === 0) {
+        callback(new Error('请至少添加一个种源并填写用量'));
+        return;
+    }
+
+    // 检查每个物料
+    for (const item of value) {
+        if (!item || typeof item !== 'object') {
+            callback(new Error('种源数据格式错误'));
+            return;
+        }
+
+        const { storageId, inputAmount } = item;
+        console.log(item, 'item');
+
+        if (!storageId) {
+            callback(new Error('种源ID缺失'));
+            return;
+        }
+
+        if (inputAmount === undefined || inputAmount === null || inputAmount === '') {
+            callback(new Error('请填写种源用量'));
+            return;
+        }
+
+        const amounts = Number(inputAmount);
+        if (isNaN(amounts) || amounts <= 0) {
+            callback(new Error('种源用量必须大于0'));
+            return;
+        }
+    }
+
+    callback();
+};
+// 表单验证规则
+const rules = ref({
+    inputs: [{ validator: validateInputs, trigger: 'blur' }],
+});
+
+const selectedItems = ref(new Map<string | number, SeedItem>());
+const query = async (pageNo: number, pageSize: number) => {
+    const params = {
+        pageNo,
+        pageSize,
+        ...form.value,
+    };
+    const res = await useClientRequest.get('/plt-api/app/storage/list', params);
+    const { rows } = res;
+    paging.value.complete(rows);
+};
+const changeSeach = () => {
+    paging.value.reload();
+};
+
+const toggleSelection = (item: SeedItem) => {
+    const newMap = new Map(selectedItems.value);
+    if (newMap.has(item.id)) {
+        // 取消选择
+        newMap.delete(item.id);
+        formDate.value.inputs = formDate.value.inputs.filter((inputItem: any) => inputItem.storageId !== item.id);
+    } else {
+        // 防止重复添加
+        if (!formDate.value.inputs.some((inputItem: any) => inputItem.storageId === item.id)) {
+            formDate.value.inputs.push({
+                storageId: item.id,
+                inputAmount: '',
+                variety: item?.variety,
+            });
+        }
+        newMap.set(item.id, item);
+    }
+
+    selectedItems.value = newMap;
+    console.log('当前选中的种子:', Array.from(newMap.keys()));
+    console.log('表单数据:', formDate.value.inputs);
+};
+
+// 创建响应式数据
+const show = ref(false);
+// 定义方法
+const open = () => {
+    // 打开逻辑,比如设置 show 为 true
+    show.value = true;
+    // 获取所有选中的完整对象
+    const selectedArray = Array.from(selectedItems.value.values());
+    console.log('选中的完整项目:', selectedArray);
+    // 这里可以使用 selectedArray 进行后续处理
+};
+
+const close = () => {
+    // 关闭逻辑,设置 show 为 false
+    show.value = false;
+    // console.log('close');
+};
+
+// 处理种源信息关闭事件
+const handleSourceClose = (index: number) => {
+    // 根据索引找到对应的项目
+    const selectedArray = Array.from(selectedItems.value.values());
+    if (index >= 0 && index < selectedArray.length) {
+        const item = selectedArray[index];
+        console.log(item, 'item');
+
+        const newMap = new Map(selectedItems.value);
+
+        // 从 selectedItems 中删除对应的项目
+        newMap.delete(item.id);
+        selectedItems.value = newMap;
+
+        // 从 formDate.inputs 中删除对应的数据
+        // 注意:由于删除后数组索引会变化,我们需要根据 storageId 来过滤
+        formDate.value.inputs = formDate.value.inputs.filter((input: any) => input.storageId !== item.id);
+    }
+};
+const upFormRef = ref();
+//校验表单然后提交
+const saveSeedInfo = async () => {
+    uni.$u.debounce(
+        async () => {
+            try {
+                console.log('开始校验');
+                console.log(formDate.value, 'formDate.value');
+                await upFormRef.value?.validate();
+                console.log('校验完成');
+                const params = {
+                    processId: processId.value,
+                    inputList: formDate.value.inputs,
+                };
+                console.log('提交参数:', params);
+
+                // 这里需要根据实际 API 进行调整
+                const res = await useClientRequest.post('/plt-api/app/processInputMaterial/batchInput', params);
+                if (res.code == 200) {
+                    uni.showToast({
+                        title: '提交成功',
+                        icon: 'success',
+                        duration: 2000,
+                    });
+                    setTimeout(() => {
+                        //发送emit
+                        uni.$emit('updatesuperviselist');
+                        uni.navigateBack({
+                            delta: 1,
+                        });
+                    }, 1000);
+                }
+            } catch (error: any) {
+                console.log('表单验证错误:', error);
+                // 滚动到第一个错误字段
+                if (error && error[0]?.field) {
+                    const firstErrorField = error[0].field + 'pppp';
+                    paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+                }
+                return;
+            }
+        },
+        1000,
+        true,
+    );
+};
+const processId = ref('');
+onLoad((options: any) => {
+    processId.value = options?.id;
+    if (+options?.processMedType == 1) {
+        form.value.part = 'PL-FR-05';
+    } else if (+options?.processMedType == 2) {
+        form.value.notIncludePart = 'PL-FR-05';
+    }
+});
+</script>
+<style lang="scss" scoped>
+.search-select-item {
+    height: 86rpx;
+    background-color: #fff;
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding: 12rpx;
+}
+</style>

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

@@ -0,0 +1,108 @@
+<template>
+    <view class="pd-24 pb-10 select-item" @click="$emit('click')">
+        <view class="b-radius bg-#fff pd-20 p-rtv noactive" :class="{ active: selected }">
+            <view class="d-flex j-sb a-c li-item-head mb-16">
+                <view class="li-left-tag" :class="{ [`bg-instore-${item?.instoreType}`]: true }">{{ selectDictLabel(pt_fresh_instore_type, item?.instoreType) }}</view>
+                <view class="f-s-22 c-#666 pt-10">{{ item?.updateTime || item?.createTime }}</view>
+            </view>
+            <view class="d-flex flex1 mb-10">
+                <view class="flex1">
+                    <span class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.variety }}</span>
+                    <span class="f-s-24 c-#666">{{ item?.partName }}</span>
+                </view>
+                <view>
+                    <view v-if="item?.examinReport?.length" class="tag-span c-primary bg-#EBF6EE">已检验</view>
+                    <view v-else class="tag-span c-danger bg-#F9ECEA">未检验</view>
+                </view>
+            </view>
+            <view class="pd2-4-0 f-s-28">
+                <span class="c-#666 w-s-no">入库批号:</span>
+                <span class="c-#333 f-w-500">{{ item?.batchCode }}</span>
+            </view>
+            <!-- <view class="pd2-4-0 f-s-28">
+                            <span class="c-#666">溯源批号:</span>
+                            <span class="c-#333 f-w-500">暂无</span>
+                        </view> -->
+            <view v-if="['A3', 'A4'].includes(item?.seedType)" class="pd2-4-0 f-s-28">
+                <span class="c-#666 w-s-no">菌种/菌株编号:</span>
+                <span class="c-#333 f-w-500">{{ selectDictLabel(pt_fungus_code_type, item?.fungusCodeType) }}/{{ item?.fungusCode }}</span>
+            </view>
+            <view class="pd2-4-0 f-s-28">
+                <span class="c-#666 w-s-no">供应商:</span>
+                <span class="c-#333 f-w-500">{{ item?.supplierInfo?.cusName || '-' }}</span>
+            </view>
+            <view class="pd2-4-0 f-s-28">
+                <span class="c-#666 w-s-no">存放库房:</span>
+                <span class="c-#333 f-w-500">{{ getStorageRoomNames(item?.warehouses) || '-' }}</span>
+            </view>
+            <view class="pd2-4-0 f-s-28">
+                <span class="c-#666 w-s-no">入库量:</span>
+                <span class="c-#333 f-w-500">{{ item?.capacity }}{{ item?.unit }}</span>
+            </view>
+            <view class="d-flex">
+                <view v-if="item?.inputAmount" class="pd2-4-0 f-s-28 flex1">
+                    <span class="c-#666">出库量:</span>
+                    <span class="c-#333 f-w-500">{{ item?.inputAmount || '0' }}{{ item?.unit }}</span>
+                </view>
+                <view v-if="item?.restAmount" class="pd2-4-0 f-s-28 flex1">
+                    <span class="c-primary">剩余量:</span>
+                    <span class="c-primary f-w-500">{{ item?.restAmount || '0' }}{{ item?.unit }}</span>
+                </view>
+            </view>
+            <!-- 选中图标 -->
+            <image v-if="selected" class="w-40 h-40 checked-icon" src="/static/images/common/btn_checked_icon.png" mode="widthFix" />
+        </view>
+    </view>
+</template>
+<script setup lang="ts">
+import { selectDictListClass } from '@/utils/ruoyi';
+import { getStorageRoomNames } from '@/utils/common';
+const props = defineProps<{
+    item: any;
+    selected?: boolean;
+}>();
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_fresh_instore_type, pt_seed_type, pt_fungus_code_type } = toRefs<any>(proxy?.useDict('pt_fresh_instore_type', 'pt_seed_type', 'pt_fungus_code_type'));
+</script>
+<style lang="scss">
+.search-select-item {
+    height: 86rpx;
+    background-color: #fff;
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding: 12rpx;
+}
+.tag-span {
+    padding: 4rpx 12rpx;
+    font-size: 20rpx;
+    border-radius: 18rpx;
+}
+.li-item-head {
+    margin-left: -24rpx;
+    margin-top: -24rpx;
+}
+.li-left-tag {
+    padding: 6rpx 16rpx;
+    color: #fff;
+    border-radius: 16rpx 0 16rpx 0;
+    font-size: 20rpx;
+    font-weight: 500;
+}
+
+.select-item {
+    .noactive {
+        border: 1rpx solid transparent;
+    }
+    .active {
+        background-color: #ebf6ee;
+        position: relative;
+        border: 1rpx solid #37a954;
+    }
+
+    .checked-icon {
+        position: absolute;
+        right: 0rpx;
+        bottom: 0rpx;
+    }
+}
+</style>

+ 92 - 0
src/tools/species-info-process/models/souceinfo.vue

@@ -0,0 +1,92 @@
+<template>
+    <view class="bg-#FBFDFB border-#AFDDBB pd-24 b-radius mb-10">
+        <view v-if="showClose" class="c-#F81242 f-s-36 ab2-10-10 pl-20 pr-10" style="position: absolute; right: 10rpx; top: 0rpx" @click="() => handleClose(index)"> × </view>
+        <view class="d-flex a-c pb-10">
+            <view class="c-primary pd-4 bg-#E7F4EA radius-10" style="font-style: italic">{{ index + 1 < 10 ? '0' + (index + 1) : index + 1 }}</view>
+            <view class="c-#333 f-s-34 f-w-5 ml-10 mr-10">{{ data?.variety }}</view>
+            <span class="f-s-24 c-#666">{{ selectDictLabel(pt_seed_type, data?.seedType) }}</span>
+        </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">{{ data?.batchCode }}</view>
+        </view>
+        <view class="pt-6 pb-6 d-flex a-c">
+            <view class="c-#666 f-s-28"> 供应商:</view>
+            <view class="c-#333 f-s-28 f-w-5">{{ data?.supplier }}</view>
+        </view>
+        <view class="pt-6 pb-6 d-flex a-c">
+            <view class="c-#666 f-s-28 w-s-no"> 所在库房:</view>
+            <view class="c-#333 f-s-28 f-w-5">{{ data?.warehouses }}</view>
+        </view>
+        <view class="pt-6 pb-6 d-flex mb-12" v-if="showClose">
+            <view class="w-50% d-flex a-c">
+                <view class="c-#666 f-s-28"> 入库量:</view>
+                <view class="c-#333 f-s-28 f-w-5">{{ data?.capacity }}{{ data?.unit }}</view>
+            </view>
+            <view class="w-50% d-flex a-c">
+                <view class="c-#666 f-s-28"> 剩余量:</view>
+                <view class="c-primary f-s-28 f-w-5">{{ data?.restAmount }}{{ data?.unit }}</view>
+            </view>
+        </view>
+        <up-line color="#AFDDBB" style="margin-left: -24rpx; margin-right: -24rpx; width: auto"></up-line>
+        <view class="f-s-28 c-#666 pt-16">本次使用量:</view>
+        <view class="pt-6 pb-6 d-flex a-c">
+            <view class="flex1 mr-10">
+                <up-input v-model="inputsModel.inputAmount" placeholder="请输入本次使用量" border="bottom" style="padding-left: 0" type="number">
+                    <template #suffix>
+                        <view class="c-#333 f-s-28 f-w-5">{{ data?.unit }}</view>
+                    </template>
+                </up-input>
+            </view>
+            <view class="">
+                <up-checkbox label="全部使用" usedAlone v-model:checked="hasChecked" @change="handleUseAllChange"></up-checkbox>
+            </view>
+        </view>
+    </view>
+</template>
+<script setup lang="ts">
+import { ref, watch, computed, nextTick } from 'vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_seed_instore_type, pt_seed_type, pt_fungus_code_type } = toRefs<any>(proxy?.useDict('pt_seed_instore_type', 'pt_seed_type', 'pt_fungus_code_type'));
+// 从外部获取数据
+const props = defineProps<{
+    showClose?: boolean;
+    index: number;
+    data: any;
+}>();
+
+const emit = defineEmits<{
+    close: [index: number];
+}>();
+
+const inputsModel = defineModel<any>('inputs', { default: () => {} });
+
+// 处理关闭事件
+const handleClose = (index: number) => {
+    emit('close', index);
+};
+// 建立一个计算属性 如果props.data.restAmount 等于或者大于inputsModel.inputAmount 那么就为true
+const hasChecked = computed(() => {
+    return +inputsModel?.value.inputAmount >= +props.data.restAmount;
+});
+const handleUseAllChange = () => {
+    if (!hasChecked.value) {
+        inputsModel.value.inputAmount = props.data.restAmount;
+    }
+};
+watch(
+    () => inputsModel.value?.inputAmount,
+    (val) => {
+        if (val === undefined || val === null) return;
+
+        const numVal = Number(val);
+        if (!isNaN(numVal) && numVal > props.data.restAmount) {
+            // 使用 nextTick 确保 UI 更新
+            nextTick(() => {
+                inputsModel.value.inputAmount = props.data.restAmount;
+            });
+        }
+    },
+    { flush: 'post' },
+);
+</script>