<template>
    <global-page :padding="24" title="布置工作闭环要求详情" auto :localData="details?.arrangeWorkList || []">
        <template #default="{ item, index }">
            <view class="mocp-cell">
                <up-cell-group>
                    <up-cell title="序号" :value="index + 1"></up-cell>
                    <up-cell title="责任单位" :value="getCompany(item.unit) || '-'"></up-cell>
                    <up-cell title="任务描述" :label="item.taskDescribe || '-'"></up-cell>
                    <up-cell title="完成日期" :value="timeStampFormat(item.endTime) || '-'"></up-cell>
                </up-cell-group>
            </view>
        </template>
    </global-page>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { timeStampFormat } from 'mocp/utils/tool'
import useQualityAnalysisStore from 'mocp/store/qualityAnalysis'

const qualityAnalysisStore = useQualityAnalysisStore()
const { details } = storeToRefs(qualityAnalysisStore)
const getCompany = (company) => {
    return company
        .split(',')
        .map((v) => {
            return qualityAnalysisStore.getEnetRepeatOrg(v) || qualityAnalysisStore.getEnetOrg(v)
        })
        .join('，')
}
</script>
<style lang="scss" scoped>
.mocp-cell {
    background: #fff;
    margin-bottom: 16rpx;
}
</style>
