<template>
    <global-page :padding="24" title="品质跟踪闭环要求详情" auto :localData="details?.qualityTraceList || []">
        <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="事件类型" :value="item.eventType || '-'"></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>
