<template>
    <global-page :showNavbar="false">
        <template #top>
            <global-navbar :title="showData(details.appraisee)">
                <template #left>
                    <uni-icons type="left" size="16" @tap="goBack"></uni-icons>
                </template>
                <template #right>
                    <global-button type="text" @tap="goTo">编辑</global-button>
                </template>
            </global-navbar>
        </template>
        <view class="content" v-if="details">
            <view class="details">
                <view class="details-header">
                    <view class="details-header-top">
                        <view class="txt">{{ details.status == 1 ? 'OPEN' : 'ClOSE' }}</view>
                        <score-details v-if="details.score > 0" :type="details.eventType == 1 ? 'success' : 'warning'">
                            {{ details.score }}
                        </score-details>
                    </view>
                    <view class="details-header-bottom">
                        <view class="left">
                            <global-icon class="left-icon" icon="Vector" size="24" color="#DD4012"></global-icon>
                            <view class="txt">{{ details.ac }} {{ details.acType }}</view>
                        </view>
                        <view class="right"><uni-dateformat :date="details.eventTime" format="yyyy-MM-dd"></uni-dateformat></view>
                    </view>
                </view>
                <view class="details-body">
                    <view class="details-body-top">
                        <view class="left">
                            <global-icon icon="mind-mapping"></global-icon>
                            <text>来源编号:{{ details.dmUid }}</text>
                        </view>
                        <view class="right">
                            {{ details.department }}
                            <text>{{ details.appraisee }}</text>
                        </view>
                    </view>
                    <view class="details-body-bottom">
                        {{ details.eventMsg || '暂无内容~' }}
                    </view>
                </view>
                <view class="details-footer">
                    <view class="details-footer-top">
                        <global-icon icon="subscribed" color="#1D2129"></global-icon>
                        <text>{{ details.examineType }}</text>
                    </view>
                    <view class="details-footer-center">{{ details.examineBasis }}</view>
                    <view class="details-footer-bottom">
                        <view class="person-info">
                            <global-icon icon="idcard"></global-icon>
                            <text>当班人员：{{ details.onDutyUser }}</text>
                        </view>
                        <view class="person-info">
                            <global-icon icon="idcard"></global-icon>
                            <text>值班人员：{{ details.dmName }}</text>
                        </view>
                    </view>
                </view>
            </view>
            <card-details type="company"></card-details>
            <card-details type="quality"></card-details>
            <card-details type="appeal"></card-details>
        </view>
    </global-page>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app'
import CardDetails from './components/card-details.vue'
import { ref } from 'vue'
import { showData } from '@/utils/tool'

const details = ref({
    id: '1771004152946348034',
    eventSource: '测试',
    department: '西北基地',
    appraisee: '执管MCC',
    ac: 'B1012',
    acOwn: 'DRJ',
    acType: 'A32',
    eventTime: 1711036800000,
    eventMsg: '测试',
    eventType: 1,
    examineType: '信息管理',
    examineBasis: '测试',
    score: 1.0,
    onDutyUser: '测试',
    dmUid: '10653',
    opinionType: 0,
    optionSaveTime: -1,
    optionSaveUid: '-1',
    appealInfo: -1,
    qmUid: '-1',
    qualityOpinionType: -1,
    qualitySaveTime: -1,
    qualitySaveUid: '-1',
    dmName: '唐恒山',
    qmName: null,
    dmSaveName: null,
    qmSaveName: null,
    status: 1,
    dmMsg: '',
    qmMsg: '',
    file: '[]',
    emailSendTime: 0
})
onLoad(() => {
    uni.$once('appraisalRecordDetials', (data) => {
        console.log(data)
    })
})
//跳转
const goTo = () => {
    uni.navigateTo({ url: 'edit' })
}
//返回
const goBack = () => {
    uni.navigateBack()
}
</script>
<style lang="scss" scoped>
@import './constants/details.scss';
</style>
