<template>
    <el-dialog draggable v-model="dialogVisible" title="历史审核记录" width="1000px">
        <vxe-table v-bind="defaultAttribute" height="500" ref="xTable1Ref" :data="list">
            <vxe-column field="reportProcess" title="审核节点" :formatter="formatter"></vxe-column>
            <vxe-column field="type" title="审核结果" :formatter="formatter"></vxe-column>
            <vxe-column field="checker" title="审核人"></vxe-column>
            <vxe-column field="orgName" title="审核人单位"></vxe-column>
            <vxe-column field="dataDate" title="审核时间" min-width="100px"></vxe-column>
            <vxe-column field="description" title="审核意见"  min-width="180px"></vxe-column>
        </vxe-table>
    </el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { queryCheckTrack } from '@/api/process-boot/electricitymanagement'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const problemData = dictData.getBasicData('Fill_Progress')
const auditStatus = dictData.getBasicData('Audit_Status')
const list = ref([])
const dialogVisible = ref(false)

const formatter = (row: any) => {
    if (row.column.field == 'reportProcess') {
        return problemData.filter((item: any) => item.code == row.cellValue)[0]?.name
    } else if (row.column.field == 'type') {
        return auditStatus.filter((item: any) => item.code == row.cellValue)[0]?.name
    } else {
        return row.cellValue
    }
}

const open = (row: any) => {
    dialogVisible.value = true
    queryCheckTrack(row.powerQualityProblemNo).then((res: any) => {
        list.value = res.data
    })
}

defineExpose({ open })
</script>
<style lang="scss" scoped></style>
