<template>
    <global-page title="反馈详情">
        <template v-if="getFeedBackDetails">
            <view class="mocp-cell">
                <up-cell-group>
                    <up-cell title="状态">
                        <template #value>
                            <global-text-status :value="getFeedBackDetails.state" dictkey="mco_feedBack"></global-text-status>
                        </template>
                    </up-cell>
                    <up-cell title="工作人" :value="getFeedBackDetails.staff || '-'"></up-cell>
                    <up-cell title="总实际工时" :value="getFeedBackDetails.actualWork || '-'"></up-cell>
                    <up-cell title="反馈内容" :label="getFeedBackDetails.content || '无'"></up-cell>
                    <up-cell title="附件">
                        <template #label>
                            <view style="margin-top: 16rpx">
                                <global-upload :fileList="contentFile" :showUpload="false"></global-upload>
                            </view>
                        </template>
                    </up-cell>
                </up-cell-group>
            </view>
        </template>
    </global-page>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import useMcoStore from 'mocp/store/mco'
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { getBackApi } from 'mocp/api/mco'

const mcoStore = useMcoStore()
const { getFeedBackDetails, feedBackType, details } = storeToRefs(mcoStore)
//获取文件
const contentFile = ref()
const getBack = async () => {
    const res = await getBackApi({ stepType: feedBackType.value, mcoNumber: details.value?.mcoNumber }, { loading: true })
    if (res.code == 200) {
        contentFile.value = res.data[0].contentFile
    } else {
        uni.$mocpMessage.error(res.message)
    }
}
onLoad(() => {
    getBack()
})
</script>
<style lang="scss" scoped>
.mocp-cell {
    background: #fff;
}
</style>
