<template>
    <global-page :padding="24" title="AOG施工列表" auto :localData="bbData">
        <template #default="{ item, index }">
            <global-card :title="`步骤${index + 1}`" titleSuffix="查看详情" @handleTitleClick="goTo(index)">
                <global-text-status :value="getStatus(item)" dictkey="bbDetails_status"></global-text-status>
            </global-card>
        </template>
    </global-page>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import useAogStore from 'mocp/store/aog'

const aogStore = useAogStore()
const { bbData } = storeToRefs(aogStore)
const goTo = (index) => {
    uni.$mocpJump.navigateTo('/panel/aog/construction-details').then(() => {
        aogStore.setState('bbIndex', index)
    })
}
const getStatus = (row) => {
    if (!row.startTime && !row.realityCompleteTime) {
        return '2'
    }
    return row.startTime && row.realityCompleteTime ? '1' : '0'
}
</script>
<style lang="scss" scoped></style>
