<template>
    <view class="container py2">
        <view class="mx3 p3 bg-color-white" style="border-radius: 16rpx">
            <!-- <view class="f-size-32 f-weight-6 py2 mb-2 title">任务信息</view> -->
            <equipment-line title="计划名称" :content="infoData.planName" />
            <equipment-line title="盘点仓库" :content="infoData.storeName" />
            <equipment-line title="盘点备件" :content="infoData.spareName" />
            <equipment-line title="任务开始时间" :content="infoData.startTime" />
            <equipment-line title="任务结束时间" :content="infoData.endTime" />
            <equipment-line title="任务状态" :content="statusMap[infoData.status]" />
            <equipment-line title="待盘数量" :content="infoData.checkNum + ''" />
            <equipment-line title="实际数量" :content="infoData.realNum + ''" />
            <equipment-line title="备注" :content="infoData.remark" />
        </view>
        <view class="p-fixed d-flex j-around a-center footer">
            <view class="main-color-bg text-color-white common" @tap="handleUpdate"
            >执行</view
            >
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            infoData: {},
            detailId: "",
            statusMap: null,
            imagesList: []
        };
    },
    onLoad(options) {
        this.detailId = options.detailId;
        this.statusMap = this.$DictCache.getLabelByValueMapByType(
            this.$DictCache.TYPE.STORE_CHECK_JOB_STATUS
        );
    },
    onShow() {
        this.initData();
    },

    methods: {
        handleUpdate() {
            this.$Http.executeStoreCheckJob(this.infoData).then((res) => {
                uni.navigateTo({
                    url: "/pages/store-check/store-check-add?detailId=" + this.detailId,
                });
            });
        },
        handlePre(index) {
            uni.previewImage({
                urls: this.imagesList,
                current:this.imagesList[index],
                success() {

                }
            });
        },
        initData() {
            this.$Http
                .fetchStoreCheckJob({
                    id: this.detailId,
                })
                .then((res) => {
                    this.infoData = res.data;
                    if(res.data.fileList != null && res.data.fileList.length >0){
                        this.imagesList = res.data.fileList.map(item => {
                            return this.$BaseTool.UserUtil.getFileUrl(item.url);
                        })
                    }
                });
        },
    },
};
</script>

<style lang="less">
page {
    background-color: #f4f4f4;
}

.container {
    padding-bottom: 100rpx;

    .footer {
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        z-index: 10000;
    }

    .title {
        border-bottom: 1rpx solid #f4f4f4;
    }

    .img {
        width: 100rpx;
        height: 100rpx;
    }

    .p-fixed {
        border-top: 1rpx solid #f4f4f4;
        height: 100rpx;

        .common {
            padding: 15rpx 200rpx;
            border-radius: 30rpx;
            background-color: #0082ff;
            color: #fff;
        }
    }
}
</style>
