<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="Object.keys(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">{{ inputList?.storageInfo?.batchCode }}</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" @click.stop="withdraw">
                    <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>
            <view class="">出</view>
        </view>
        <view class="bg-#F6FAFE flex1 d-flex a-c" v-if="data?.length === 0">
            <view class="d-flex flex1 f-s-26">
                <view class="c-#999 ml-16"> 暂无产出信息 </view>
                <view class="flex1"></view>
                <view class="c-#2289E0 d-flex a-c">
                    <view>添加产出</view>
                    <up-icon name="arrow-right" size="26rpx"></up-icon>
                </view>
            </view>
        </view>
        <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">
                    <span class="c-#666">统货2</span>
                    <span class="c-#999">1mm极薄片</span>
                </ut-col>
                <ut-col class="d-flex a-c c-#666" :span="8">19999kg</ut-col>
                <ut-col class="d-flex a-c" :span="3">
                    <span class="c-#F74C30">未检</span>
                    <span class="c-primary">已检</span>
                </ut-col>
                <ut-col class="d-flex a-c j-ed" :span="9">
                    <span class="c-#666">已入药材库</span>
                    <span class="c-#666">未入库</span>
                    <up-icon name="arrow-right" size="26rpx"></up-icon>
                </ut-col>
            </ut-row>
            <view class="d-flex a-c j-c pd-16 radius-10" style="border: 1rpx dashed #2289e0">
                <up-icon name="plus" size="26rpx" color="#2289E0"></up-icon>
                <span class="c-#2289E0 f-s-26">添加产出物</span>
            </view>
        </view>
    </view>
</template>
<script setup lang="ts">
import { useClientRequest } from '@/utils/request';
const props = defineProps<{
    data: any;
}>();
watch(
    () => props.data,
    (val) => {
        inputList.value = val?.inputList[0] || {};
    },
);
const inputList = ref<any>(props?.data?.inputList[0] || {});
const goAssociate = () => {
    uni.$u.route({
        type: 'navigateTo',
        url: '/tools/species-info-process/index',
        params: { id: props?.data?.id, processMedType: props?.data?.processMedType },
    });
};
uni.$on(`updatesupervise-${props?.data?.id}`, function (data) {
    inputList.value = data;
});
const withdraw = async () => {
    // 删除
    const res = await uni.showModal({
        title: '撤回提示',
        content: '撤回后不可恢复，请谨慎操作！',
        confirmColor: '#F74C30',
    });
    console.log(res);
    if (res.confirm) {
        const delRes = await useClientRequest.get(`/plt-api/app/processInputMaterial/callbackInput/${inputList?.value?.id}`);
        if (delRes && delRes.code === 200) {
            uni.showToast({ title: '删除成功', icon: 'none' });
            inputList.value = {};
        }
    }
};
</script>
