<template>
    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" safe-area-inset-bottom>
        <template #top>
            <ut-navbar title="种养殖任务详情" :fixed="false"></ut-navbar>
        </template>
        <template>
            <!-- <up-alert :title="'备注' + form?.remark" type = "warning" ></up-alert> -->
            <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
            <view class="bg-#fff pd-24 mb-20">
                <view v-if="form?.remark" class="pd4-16-20-16-20 bg-#EBF6EE c-primary f-s-30 f-w-5 b-radius mb-24">备注：{{ form?.remark }}</view>
                <Baseinfo v-if="deawerData" :modeValue="deawerData" :baseType="form.taskType" :showClose="false" />
            </view>
            <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
            <view class="bg-#fff pd-24 mb-20 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 f-w-5">{{ selectDictLabel(pt_task_type, form.taskType) }}</text>
                </view>
                <!-- 种植字段显示（仅当 taskType == 1 时显示） -->
                <template v-if="form.taskType == 1">
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">符合要求：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.gapFlag ? selectDictLabel(pt_task_gap_flag, form.gapFlag) : '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">植物名称：</view>
                        <view class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="mb-20">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
                            </view>
                            <view class="mb-20">
                                <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">产出：</text>
                                <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
                            </view>
                        </view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">种植批号：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.plantationCode || '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">种植技术规程：</view>
                        <ut-album v-if="form.technicalFile?.length > 0" :urls="form.technicalFile"></ut-album>
                        <text v-else class="c-#333 f-s-30 f-w-5">{{ '--' }}</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 f-w-5">{{ form.plantationMethod ? selectDictLabel(pt_feeding_method, form.plantationMethod) : '--' }}</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 f-w-5">{{ `${form.plannedStartDate} 至 ${form.plannedEndDate}` }}</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 f-w-5">{{ form.plantingAmount ? `${form.plantingAmount}${form.plantingUnit || ''}` : '--' }}</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 f-w-5">{{ form.reproductionType ? selectDictLabel(pt_reproduction_type, form.reproductionType) : '--' }}</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 f-w-5">{{ form.plantationType ? selectDictLabel(pt_plantation_type, form.plantationType) : '--' }}</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 f-w-5">{{ form.sowingMethod ? selectDictLabel(pt_sowing_method, form.sowingMethod) : '--' }}</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 f-w-5">{{ form.transplantMethod ? selectDictLabel(pt_transplant_method, form.transplantMethod) : '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">前茬植物：</view>
                        <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="mb-20">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
                                <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
                            </view>
                            <view class="mb-20">
                                <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
                                <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">产出：</text>
                                <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
                            </view>
                        </view>
                        <view v-else class="">--</view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">备注：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.remark || '--' }}</text>
                    </view>
                </template>
                <!-- 养殖字段显示（仅当 taskType == 2 时显示） -->
                <template v-if="form.taskType == 2">
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">溯源级别：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.mgMethod ? selectDictLabel(pt_mg_method, form.mgMethod) : '--' }}</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 f-w-5">{{ form.gapFlag ? selectDictLabel(pt_task_gap_flag, form.gapFlag) : '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">动物名称：</view>
                        <view class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="mb-20">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
                            </view>
                            <view class="mb-20">
                                <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">产出：</text>
                                <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
                            </view>
                        </view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">养殖批号：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.plantationCode || '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">养殖技术规程：</view>
                        <ut-album v-if="form.technicalFile?.length > 0" :urls="form.technicalFile"></ut-album>
                        <text v-else class="c-#333 f-s-30 f-w-5">{{ '--' }}</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 f-w-5">{{ form.plantationMethod ? selectDictLabel(pt_feeding_method, form.plantationMethod) : '--' }}</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 f-w-5">{{ `${form.plannedStartDate} 至 ${form.plannedEndDate}` }}</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 f-w-5">{{ form.plantingAmount ? `${form.plantingAmount}${form.plantingUnit || ''}` : '--' }}</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 f-w-5">{{ form.breedScale ? `${form.breedScale}个` : '--' }}</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 f-w-5">{{ form?.plantingMgAmount ? `${form.plantingMgAmount}${form?.plantingMgUnit ? selectDictLabel(pt_planting_mg_unit, form.plantingMgUnit) : ''}` : '--' }}</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 f-w-5">{{ form.remark || '--' }}</text>
                    </view>
                </template>
                <!-- 种畜繁育字段显示（仅当 taskType == 21 时显示） -->
                <template v-if="form.taskType == 21">
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">是否代繁育：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.delegateFlag ? selectDictLabel(yes_no, form.delegateFlag) : '--' }}</text>
                    </view>
                    <view delegateFlag class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">委托企业：</view>
                        <view class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ form?.delegateInfo?.cusName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">{{ form?.delegateInfo?.cusCode }}</text>
                            </view>
                        </view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">溯源级别：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.mgMethod ? selectDictLabel(pt_mg_method, form.mgMethod) : '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">动物名称：</view>
                        <view class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="mb-20">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
                            </view>
                            <view class="mb-20">
                                <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">产出：</text>
                                <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
                            </view>
                        </view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">养殖批号：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.plantationCode || '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">养殖繁育技术规程：</view>
                        <ut-album v-if="form.technicalFile?.length > 0" :urls="form.technicalFile"></ut-album>
                        <text v-else class="c-#333 f-s-30 f-w-5">{{ '--' }}</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 f-w-5">{{ form.plantationMethod ? selectDictLabel(pt_feeding_method, form.plantationMethod) : '--' }}</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 f-w-5">{{ `${form.plannedStartDate} 至 ${form.plannedEndDate}` }}</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 f-w-5">{{ form.plantingAmount ? `${form.plantingAmount}${form.plantingUnit || ''}` : '--' }}</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 f-w-5">{{ form.breedScale ? `${form.breedScale}个` : '--' }}</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 f-w-5">{{ form?.plantingMgAmount ? `${form.plantingMgAmount}${form?.plantingMgUnit ? selectDictLabel(pt_planting_mg_unit, form.plantingMgUnit) : ''}` : '--' }}</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 f-w-5">{{ form.remark || '--' }}</text>
                    </view>
                </template>
                <!-- 种苗繁育字段显示（仅当 taskType == 11 时显示） -->
                <template v-if="form.taskType == 11">
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">是否代繁育：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.delegateFlag ? selectDictLabel(yes_no, form.delegateFlag) : '--' }}</text>
                    </view>
                    <view v-if="+form?.delegateFlag" class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">委托企业：</view>
                        <view class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ form?.delegateInfo?.cusName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">{{ form?.delegateInfo?.cusCode }}</text>
                            </view>
                        </view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">溯源级别：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.mgMethod ? selectDictLabel(pt_mg_method, form.mgMethod) : '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">植物名称：</view>
                        <view class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="mb-20">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
                            </view>
                            <view class="mb-20">
                                <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
                                <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">产出：</text>
                                <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
                            </view>
                        </view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">繁育批号：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.plantationCode || '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">繁育技术规程：</view>
                        <ut-album v-if="form.technicalFile?.length > 0" :urls="form.technicalFile"></ut-album>
                        <text v-else class="c-#333 f-s-30 f-w-5">{{ '--' }}</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 f-w-5">{{ form.plantationMethod ? selectDictLabel(pt_feeding_method, form.plantationMethod) : '--' }}</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 f-w-5">{{ `${form.plannedStartDate} 至 ${form.plannedEndDate}` }}</text>
                    </view>
                    <view v-if="+deawerData?.data[0]?.landType == 1" class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">种植面积：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.plantingAmount ? `${form.plantingAmount}${form.plantingUnit || ''}` : '--' }}</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 f-w-5">{{ form.inoculationAmount ? `${form.inoculationAmount}${form?.inoculationUnit}` : '--' }}</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 f-w-5">{{ form?.plantingMgAmount ? `${form.plantingMgAmount}${form?.plantingMgUnit ? selectDictLabel(pt_inoculation_dosage_unit, form?.plantingMgUnit) : ''}` : '--' }}</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 f-w-5">{{ form.reproductionType ? selectDictLabel(pt_reproduction_type, form.reproductionType) : '--' }}</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 f-w-5">{{ form.plantationType ? selectDictLabel(pt_plantation_type, form.plantationType) : '--' }}</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 f-w-5">{{ form.sowingMethod ? selectDictLabel(pt_sowing_method, form.sowingMethod) : '--' }}</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 f-w-5">{{ form.transplantMethod ? selectDictLabel(pt_transplant_method, form.transplantMethod) : '--' }}</text>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <view class="c-#666 f-s-30 mb-20">前茬植物：</view>
                        <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20">
                            <view class="mb-20">
                                <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
                                <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
                            </view>
                            <view class="mb-20">
                                <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
                                <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
                            </view>
                            <view class="">
                                <text class="c-#666 f-s-24">产出：</text>
                                <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
                            </view>
                        </view>
                        <view v-else class="">--</view>
                    </view>
                    <view class="pt-16 pb-16 info-border-bottom">
                        <text class="c-#666 f-s-30">备注：</text>
                        <text class="c-#333 f-s-30 f-w-5">{{ form.remark || '--' }}</text>
                    </view>
                </template>
            </view>
            <template v-if="animalIds?.length > 0">
                <view class="startline-title pl-24 ml-24 mb-16">个体标识信息</view>
                <view class="bg-#fff pd-24 mb-20">
                    <template v-for="(item, index) in animalIds" :key="index">
                        <view class="pd-34 border-#37A954 mb-20 d-flex flex-cln b-radius">
                            <text>{{ item }}</text>
                        </view>
                    </template>
                </view>
            </template>
            <view class="pd-24">
                <view class="d-flex j-c pd-10">
                    <view class="mr-10 c-#ccc f-s-24">
                        <text>最新操作人：</text>
                        <text>{{ form?.updateByName || form?.createByName }}</text>
                    </view>
                    <view class="c-#ccc f-s-24">
                        <text>最新操作时间：</text>
                        <text>{{ form?.updateTime || form?.createTime }}</text>
                    </view>
                </view>
                <view class="">
                    <up-button type="primary" class="b-radius" @click="handlechoseConfirm">修改</up-button>
                </view>
            </view>
        </template>
    </z-paging>
</template>
<script setup lang="ts">
import Baseinfo from '../port-create/models/baseinfo.vue';
import { useClientRequest } from '@/utils/request';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { pt_feed_amount_unit, pt_planting_mg_unit, pt_inoculation_unit, pt_inoculation_dosage_unit, pt_transplant_method, pt_plantation_type, pt_sowing_method, pt_area_unit, pt_plantation_method, pt_reproduction_type, pt_scale_unit, pt_feeding_method, pt_mg_method, pt_task_gap_flag, pt_task_type, pt_org_type, yes_no } = toRefs<any>(
    proxy?.useDict('pt_feed_amount_unit', 'pt_planting_mg_unit', 'pt_inoculation_unit', 'pt_inoculation_dosage_unit', 'pt_transplant_method', 'pt_plantation_type', 'pt_sowing_method', 'pt_area_unit', 'pt_plantation_method', 'pt_reproduction_type', 'pt_scale_unit', 'pt_feeding_method', 'pt_mg_method', 'pt_task_gap_flag', 'pt_task_type', 'pt_org_type', 'yes_no'),
);
const paging = ref();
const list = ref();
const form = ref<any>({
    deawerData: null,
    baseId: null,
    landIds: [],
    taskType: null,
    gapFlag: null,
    mgMethod: null,
    varietyId: null,
    plantationCode: null,
    plantationMethod: null,
    reproductionType: null,
    technicalFile: [],
    plantingUnit: null,
    breedScale: null,
    queryType6: {
        plannedStartDate: null,
        plannedEndDate: null,
    },
    plant: {
        plantingMgAmount: null,
        plantingMgUnit: null,
    },
    plantingAmount: '',
    remark: null,
    delegateFlag: '0',
    delegateInfo: {},
    plantationType: null,
    sowingMethod: null,
    transplantMethod: null,
    preCropId: null,
    inoculation: {
        inoculationAmount: null,
        inoculationUnit: null,
        inoculationDosage: null,
        inoculationDosageUnit: null,
    },
    cultureMediumFormula: null,
});
const deawerData = ref<any>(null);
const animalIds = ref();
// 所选动植物
const Biological = ref<any>(null);
const PreBiological = ref<any>(null);
const taskId = ref();
const getInfo = async () => {
    const res = await useClientRequest.get<any>(`/plt-api/app/plantationTask/getInfo/${taskId.value}`);
    if (!res.data) return;
    form.value = res.data;
    if (res.data.animalIds) {
        animalIds.value = res.data.animalIds;
    }
    if (res.data.preCropCode) {
        PreBiological.value = {};
        const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
        PreBiological.value = Bio.data;
    }
    if (res.data.varietyCode) {
        Biological.value = {};
        const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
        Biological.value = Bio.data;
    }
    // 判断有没有基地，然后去获取基地数据
    if (res.data.baseId) {
        deawerData.value = {};
        deawerData.value.baseName = res.data.baseRef.baseName;
        deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
        deawerData.value.area = res.data.baseRef.baseInfo.area;
        deawerData.value.address = res.data.baseRef.baseInfo.address;
        // adcodeName
        deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
        if (+res.data.landFlag) {
            deawerData.value.aloneChecked = true;
            const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
            deawerData.value.data = landIds.rows;
        } else {
            deawerData.value.aloneChecked = false;
            deawerData.value.data = [];
            const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
            //找到res.data.landIds和landIds.rows中的id相同的项
            landIds.rows.forEach((i: any) => {
                if (res.data.landIds.find((t: any) => t == i.id)) {
                    deawerData.value.data.push(i);
                }
            });
        }
    }
};
const handlechoseConfirm = () => {
    uni.$u.route({ type: 'navigateTo', url: '/plant/port/port-create/index', params: { taskId: taskId.value } });
};
onMounted(() => {
    getInfo();
});
onLoad((options: any) => {
    taskId.value = options?.id;
});
</script>
