<template>
    <el-collapse v-model="activeNames">
        <el-collapse-item
            title="核查办理"
            name="verify"
            v-if="negative.checkStatus"
        >
            <div class="row">
                <div class="col col-6">
                    <label>核查情况</label>
                    <span>{{ negative.checkStatusName }}</span>
                </div>
                <div class="col col-6" v-if="negative.isRectifyName">
                    <label>是否整改</label>
                    <span>{{ negative.isRectifyName }}</span>
                </div>
                <div class="col col-6" v-if="negative.accountabilityTarget">
                    <label>追责对象</label>
                    <span>{{
                        getDictLable(
                            dict.accountabilityTarget,
                            negative.accountabilityTarget
                        )
                    }}</span>
                </div>
                <div class="col col-6" v-if="negative.rectifyRestrictionDays">
                    <label>整改限制</label>
                    <span>{{ `${negative.rectifyRestrictionDays}天` }}</span>
                </div>
            </div>
            <div class="row" v-if="negative.checkStatusDesc">
                <div class="col col-24">
                    <label>问题核查情况</label>
                    <span>{{ negative.checkStatusDesc }}</span>
                </div>
            </div>
        </el-collapse-item>
        <el-collapse-item
            v-for="(blame, index) in negative.blames.filter(
                (item) => item.type === BlameType.PERSONAL
            )"
            :key="index"
            :title="`涉及人员${index + 1}`"
            :name="`involved${index}`"
        >
            <div class="row">
                <div class="col col-6">
                    <label>涉及人员姓名</label>
                    <span>{{ blame.blameName }} {{ blame.blameEmpNo }}</span>
                </div>
                <div class="col col-6">
                    <label>身份证</label>
                    <span>{{ blame.blameIdCode }}</span>
                </div>
                <div class="col col-6">
                    <label>人员属性</label>
                    <span>{{
                        getDictLable(dict.personType, blame.ivPersonTypeCode)
                    }}</span>
                </div>
            </div>
            <div
                class="row"
                v-for="(problem, index) in blame.problems"
                :key="index"
            >
                <div class="col col-24">
                    <label>问题类型{{ index + 1 }}</label>
                    <span
                        >{{ problem.oneLevelContent }} /
                        {{ problem.twoLevelContent }} /
                        {{ problem.threeLevelContent }}</span
                    >
                </div>
            </div>
            <div class="row">
                <div class="col col-6" v-if="blame.responsibilityTypeName">
                    <label>责任类别</label>
                    <span>{{ blame.responsibilityTypeName }}</span>
                </div>
                <div class="col col-6" v-if="blame.subjectiveAspectCode">
                    <label>主观方面</label>
                    <span>{{ blame.subjectiveAspectName }}</span>
                </div>
                <div class="col col-6" v-if="blame.handleResultCode">
                    <label>处置结果</label>
                    <span>{{ blame.handleResultName }}</span>
                </div>
                <div class="col col-6" v-if="blame.superviseMeasuresCode">
                    <label>督察措施</label>
                    <span>{{ blame.superviseMeasuresName }}</span>
                </div>
                <div class="col col-6" v-if="blame.protectRightsName">
                    <label>维权容错</label>
                    <span>{{ blame.protectRightsName }}</span>
                </div>
            </div>
            <div v-perms="['negative:score']">
                <div
                    class="row"
                    v-for="item in negative.scorePolices.filter(
                        (item) => blame.blameIdCode === item.idCode
                    )"
                    :key="item"
                    
                >
                    <div class="col col-6">
                        <label>问题分值</label>
                        <span
                            style="color: var(--danger-color)"
                            class="text-bold"
                            >{{ item.score }}</span
                        >
                    </div>
                    <div class="col col-6">
                        <label>公式</label>
                        <span>{{ item.expression }}</span>
                    </div>
                </div>
            </div>
            <div class="row" style="background: #f5f5f5">
                <div class="col col-6">
                    <label>涉及领导姓名</label>
                    <span>{{ blame.leadName }} {{ blame.leadEmpNo }}</span>
                </div>
                <div class="col col-6">
                    <label>身份证</label>
                    <span>{{ blame.leadIdCode }}</span>
                </div>

                <div class="col col-6" v-if="blame.leadResponsibilityTypeName">
                    <label>责任类别</label>
                    <span>{{ blame.leadResponsibilityTypeName }}</span>
                </div>
                <div class="col col-6" v-if="blame.leadMeasuresCode">
                    <label>督察措施</label>
                    <span>{{ blame.leadMeasuresName }}</span>
                </div>
                <div class="col col-6" v-if="blame.leadHandleResultCode">
                    <label>处置结果</label>
                    <span>{{ blame.leadHandleResultName }}</span>
                </div>
                <div class="col col-6" v-if="blame.leadProtectRightsName">
                    <label>维权容错</label>
                    <span>{{ blame.leadProtectRightsName }}</span>
                </div>
            </div>
        </el-collapse-item>
        <el-collapse-item
            v-for="(blame, index) in negative.blames.filter(
                (item) => item.type === BlameType.DEPARTMENT
            )"
            :key="index"
            :title="`涉及单位`"
            :name="`involved_department`"
        >
            <div class="row">
                <div class="col col-6">
                    <label>班子成员姓名</label>
                    <span>{{ blame.blameName }}</span>
                </div>
                <div class="col col-6">
                    <label>身份证号码</label>
                    <span>{{ blame.blameIdCode }}</span>
                </div>
                <div class="col col-6">
                    <label>人员属性</label>
                    <span>{{
                        getDictLable(dict.personType, blame.ivPersonTypeCode)
                    }}</span>
                </div>
            </div>
            <div class="row" v-for="problem in blame.problems" :key="problem">
                <div class="col col-6">
                    <label>问题类型</label>
                    <span>{{ problem.oneLevelContent }}</span>
                </div>
                <div class="col col-6">
                    <label>问题类别</label>
                    <span>{{ problem.twoLevelContent }}</span>
                </div>
            </div>
            <div class="row">
                <div class="col col-6" v-if="blame.subjectiveAspectCode">
                    <label>主观方面</label>
                    <span>{{ blame.subjectiveAspectName }}</span>
                </div>
                <div class="col col-6">
                    <label>责任类别</label>
                    <span>{{ blame.responsibilityTypeName }}</span>
                </div>
                <div class="col col-6" v-if="blame.handleResultCode">
                    <label>处置结果</label>
                    <span>{{ blame.handleResultName }}</span>
                </div>
            </div>
        </el-collapse-item>
        <el-collapse-item
            title="办结佐证材料"
            name="completionAttachment"
            v-if="negative.files.length"
        >
            <file-list :files="negative.files" />
        </el-collapse-item>
        <el-collapse-item
            title="认定办结"
            name="completed"
            v-if="negative.processingStatus === ProcessingStatus.COMPLETED"
        >
            <div class="row">
                <div class="col col-6">
                    <label>核查办理情况</label>
                    <span>{{
                        getDictLable(
                            dict.verifySituation,
                            negative.verifySituation
                        ) || '/'
                    }}</span>
                </div>
                <div class="col col-6">
                    <label>佐证材料情况</label>
                    <span>{{
                        getDictLable(
                            dict.verifyFileSituation,
                            negative.verifyFileSituation
                        ) || '/'
                    }}</span>
                </div>
            </div>
        </el-collapse-item>
    </el-collapse>
</template>
<script setup>
import { BlameType } from "@/enums/dictEnums";
import { ProcessingStatus } from "@/enums/flowEnums";
import { getDictLable } from "@/utils/util";
import useCatchStore from "@/stores/modules/catch";

const dict = useCatchStore().getDicts([
    "accountabilityTarget",
    "personType",
    "verifySituation",
    "verifyFileSituation",
]);

const activeNames = ref([
    "verify",
    "involved_department",
    "completionAttachment",
    "completed",
]);
const negative = inject("negative");

for (
    let i = 0;
    i <
    negative.value.blames.filter((item) => item.type === BlameType.PERSONAL)
        .length;
    i++
) {
    activeNames.value.push("involved" + i);
}
</script>
<style lang="scss" scoped>
.el-collapse {
    --el-collapse-header-text-color: var(--primary-color);
}
</style>