<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 v-if="+data?.inputFlag" class="pt-16 pb-16 info-border-bottom">
                <text class="c-#666 f-s-30 pb-10">投入物料名称：</text>
                <view v-for="(item, indexs) in data?.inputMaterialList" :key="indexs" class="bg-#FBFDFB border-#AFDDBB pd-24 b-radius mb-10">
                    <view class="d-flex a-c pb-10">
                        <view class="c-primary pd-4 bg-#E7F4EA radius-10" style="font-style: italic">{{ Number(indexs) + 1 < 10 ? '0' + (Number(indexs) + 1) : Number(indexs) + 1 }}</view>
                        <view class="c-#333 f-s-34 f-w-5 ml-10">{{ item?.materialName }}</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">{{ item?.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">{{ item?.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">{{ item?.warehouses }}</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">{{ item?.quantity }}{{ item?.unit }}</view>
                        </view>
                    </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">{{ 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">{{ data?.remark || '-' }}</text>
            </view>
            <view class="pt-16 pb-16 info-border-bottom">
                <text class="c-#666 f-s-30">过程图片：</text>
                <ut-album v-if="data?.imgs" :urls="data?.imgs"></ut-album>
                <view v-else>{{ '-' }}</view>
            </view>
            <view class="pt-16 pb-16 info-border-bottom">
                <text class="c-#666 f-s-30">过程视频：</text>
                <ut-album v-if="data?.videos" :urls="data?.videos"></ut-album>
                <view v-else>{{ '-' }}</view>
            </view>
        </view>
    </z-paging>
</template>
<script setup lang="ts">
import { useClientRequest } from '@/utils/request';
const list = ref<any>([]);
const data = ref<any>();
const paging = ref();
const ID = ref('');
const deawerData = ref<any>({});
const individualLandIds = 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,
    };
    individualLandIds.value = {
        checkBox: res.data.animalIds,
        variety: res.data.variety,
    };
};
onMounted(() => {
    query();
});
onLoad((options: any) => {
    ID.value = options?.id;
});
</script>
