<template>
    <div class="container" style="padding: 30px !important">
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="云员工认证" name="first"></el-tab-pane>
            <el-tab-pane label="企业认证" name="second"></el-tab-pane>
        </el-tabs>

        <el-table v-if="activeName === 'first'" v-loading="loading" :data="ApplicationReviewList">
            <el-table-column label="用户编号" align="center" prop="userId" />
            <el-table-column label="姓名" align="center" prop="name" />
            <el-table-column label="身份证号" align="center" prop="idNumber" />
            <el-table-column label="所在城市" align="center" prop="city" />
            <el-table-column label="技能" align="center" prop="testSkills" />
            <el-table-column key="first" label="状态" align="center" prop="status" width="180">
                <template slot-scope="scope">
                    <span v-if="scope.row.status == 0" style="color: #e6a23c">未审核</span>
                    <span v-if="scope.row.status == 1" style="color: #0952c8">待审核</span>
                    <span v-if="scope.row.status == 2" style="color: #67c23a">审核通过</span>
                    <el-tooltip class="item" effect="dark" :content="scope.row.auditOpinion" placement="top-start">
                        <span v-if="scope.row.status == 3" style="color: #f56c6c; cursor: pointer">审核未通过</span>
                    </el-tooltip>
                </template>
            </el-table-column>
            <el-table-column key="first" label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <!-- <el-button size="mini" type="text" icon="el-icon-view" @click="handleUpdate('see',scope.row)" v-hasPermi="['system:ApplicationReview:edit']" >查看详情</el-button> -->
                    <el-button
                        v-if="scope.row.status == 1"
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        @click="handleUpdate('examine', scope.row)"
                        >审核</el-button
                    >
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleUpdate('del', scope.row)"
                        >删除</el-button
                    >
                    <el-button size="mini" type="text" icon="el-icon-view" @click="cloudUserDetail(scope.row)"
                        >查看详情</el-button
                    >
                </template>
            </el-table-column>
        </el-table>

        <el-table v-if="activeName === 'second'"  :data="companyApplyList">
            <el-table-column label="公司编号" align="center" prop="applyId" />
            <el-table-column label="姓名" align="center" prop="contactName" />
            <el-table-column label="公司名称" align="center" prop="name" />
            <el-table-column key="second" label="状态" align="center" prop="status" width="180">
                <template slot-scope="scope">
                    <span v-if="scope.row.status == 0" style="color: #e6a23c">待审核</span>
                    <span v-if="scope.row.status == 1" style="color: #67c23a">审核通过</span>
                    <span v-if="scope.row.status == 2" style="color: #f56c6c; cursor: pointer">审核未通过</span>
                    <!-- <el-tooltip class="item" effect="dark" :content="scope.row.auditOpinion" placement="top-start">
                        <span v-if="scope.row.status == 2" style="color: #f56c6c; cursor: pointer">审核未通过</span>
                    </el-tooltip> -->
                </template>
            </el-table-column>
            <el-table-column  key="second" label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button
                        v-if="scope.row.status != 1"
                        size="mini"
                        type="text"
                        icon="el-icon-delete"
                        @click="companyApplyFn(scope.row)"
                        >审核</el-button
                    >
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="companyDelete(scope.row.applyId)"
                        >删除</el-button
                    >
                    <el-button size="mini" type="text" icon="el-icon-view" @click="opencompanyDetail(scope.row.applyId)"
                        >查看详情</el-button
                    >
                </template>
            </el-table-column>
        </el-table>

        <pagination
            v-if="activeName == 'first'"
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
        />
        <pagination
            v-if="activeName == 'second'"
            v-show="total1 > 0"
            :total="total1"
            :page.sync="queryParams1.pageNum"
            :limit.sync="queryParams1.pageSize"
            @pagination="getCompanyList"
        />

        <!-- 申请审核对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false">
            <!-- 认证公司 -->
            <el-form v-if="companyApply" :model="companyApply" label-width="200px">
                <el-form-item label="公司名称" prop="name" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.name" type="textarea" placeholder="请输入内容" />
                </el-form-item>
                <el-form-item label="统一信用代码" prop="creditCode" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.creditCode" placeholder="请输入统一信用代码" />
                </el-form-item>
                <el-form-item label="通讯地址" prop="address" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.address" type="textarea" placeholder="请输入内容" />
                </el-form-item>
                <el-form-item label="网址" prop="webSite" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.webSite" placeholder="请输入网址" />
                </el-form-item>
                <el-form-item label="营业执照" prop="filePath" v-if="cA || tAcA">
                    <!-- <multifile-link
            v-if="allFileGetFlag"
            v-model="companyApply.businessLicenseUrl"
            :serverAddr="materialServerAddr"
            fileName="营业执照"
            :limit="1"
          /> -->
                    <AuthImg :authSrc="companyApply.businessLicenseUrl" alt=""></AuthImg>
                </el-form-item>
                <el-form-item label="认证公司补充材料" prop="filePath" v-if="cA || tAcA">
                    <multifile-link
                        v-if="allFileGetFlag"
                        v-model="companyApply.otherCQList"
                        :serverAddr="materialServerAddr"
                        fileName="认证公司补充材料"
                        :limit="10"
                    />
                </el-form-item>
                <el-form-item label="公司简介" prop="companyDesc" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.companyDesc" type="textarea" placeholder="请输入内容" />
                </el-form-item>
                <el-form-item label="联系人姓名" prop="contactName" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.contactName" placeholder="请输入联系人姓名" />
                </el-form-item>
                <el-form-item label="联系人职位" prop="contactPosition" v-if="cA || tAcA">
                    <el-input readonly v-model="companyApply.contactPosition" placeholder="请输入联系人职位" />
                </el-form-item>
            </el-form>
            <!-- 测试者 p2pt p2ct c2ct 三合一 -->
            <el-form v-if="testerApply" :model="testerApply" label-width="200px">
                <el-form-item label="真实姓名" prop="name" v-if="tA">
                    <el-input readonly v-model="testerApply.name" placeholder="请输入真实姓名" />
                </el-form-item>
                <el-form-item label="所在城市" prop="city" v-if="tA">
                    <el-input readonly v-model="testerApply.city" placeholder="请输入所在城市" />
                </el-form-item>
                <el-form-item label="身份证号码" prop="idNumber" v-if="tA">
                    <el-input readonly v-model="testerApply.idNumber" placeholder="请输入身份证号码" />
                </el-form-item>
                <el-form-item label="身份证正面" prop="filePath" v-if="tA">
                    <!-- <multifile-link
            v-if="allFileGetFlag"
            v-model="testerApply.idCardFrontUrl"
            :serverAddr="materialServerAddr"
            fileName="身份证正面"
            :limit="1"
          /> -->
                    <AuthImg :authSrc="testerApply.idCardFrontUrl" alt=""></AuthImg>
                </el-form-item>
                <el-form-item label="身份证反面" prop="filePath" v-if="tA">
                    <!-- <multifile-link
            v-if="allFileGetFlag"
            v-model="testerApply.idCardBackUrl"
            :serverAddr="materialServerAddr"
            fileName="身份证反面"
            :limit="1"
          /> -->
                    <AuthImg :authSrc="testerApply.idCardBackUrl" alt=""></AuthImg>
                </el-form-item>
                <el-form-item label="测试能力" prop="testSkills" v-if="tA">
                    <el-input readonly v-model="testerApply.testSkills" type="textarea" placeholder="请输入内容" />
                    <el-popover placement="top-start" title="示例：" width="400" trigger="hover">
                        <span>性能测试LoadRunner, Jmeter，自动化测试Selenium</span>
                        <el-link slot="reference" style="color: #46a6ff">查看示例</el-link>
                    </el-popover>
                </el-form-item>
                <el-form-item label="奖项和证书" prop="certificate" v-if="tA">
                    <el-input readonly v-model="testerApply.certificate" type="textarea" placeholder="请输入内容" />
                    <el-popover placement="top-start" title="示例：" width="570" trigger="hover">
                        <span
                            >STQB认证软件测试工程师<br />国家软考认证软件评测师<br />或国家等级考试软件测试工程师证书
                            <br />
                            2019年全国大学生软件测试大赛二等奖
                        </span>
                        <el-link slot="reference" style="color: #46a6ff">查看示例</el-link>
                    </el-popover>
                </el-form-item>
                <el-form-item label="工作经历" prop="workExperience" v-if="tA">
                    <el-input readonly v-model="testerApply.workExperience" type="textarea" placeholder="请输入内容" />
                    <el-popover placement="top-start" title="示例：" width="570" trigger="hover">
                        <span
                            >2017.5-2021.7 西安未央软件有限公司 软件测试工程师<br />
                            2013.9-2017.4. 西安大唐软件有限公司 软件测试工程师<br />
                            2009.9-2013.7 西安电子科技大学 软件工程专业 本科
                        </span>
                        <el-link slot="reference" style="color: #46a6ff">查看示例</el-link>
                    </el-popover>
                </el-form-item>

                <el-form-item label="测试项目案例" prop="testProjects" v-if="tA || tAcA || c2ct">
                    <el-input readonly v-model="testerApply.testProjects" type="textarea" placeholder="请输入内容" />
                    <el-popover placement="top-start" title="示例：" width="530" trigger="hover">
                        <span
                            >2021年 航空仿真软件单元测试<br />
                            2020年 企业供应链管理平台安全测试<br />
                            2020年 B2C的电商平台系统前后台会员管理、订单、支付及后台订单处理相关模块测试
                        </span>
                        <el-link slot="reference" style="color: #46a6ff">查看示例</el-link>
                    </el-popover>
                </el-form-item>
                <el-form-item label="其它补充材料" prop="filePath" v-if="tA || tAcA || c2ct">
                    <multifile-link
                        v-if="allFileGetFlag"
                        v-model="testerApply.otherTQList"
                        :serverAddr="materialServerAddr"
                        fileName="其它补充材料"
                        :limit="10"
                    />
                </el-form-item>
                <el-form-item label="补充说明" prop="otherInfo" v-if="tAcA || c2ct">
                    <el-input readonly v-model="testerApply.otherInfo" type="textarea" placeholder="请输入内容" />
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitPass">审核通过</el-button>
                <el-button type="primary" @click="submitUnpass">审核不通过</el-button>
            </div>
        </el-dialog>

        <!-- 添加或修改企业认证申请对话框 -->
        <el-dialog :title="title" :visible.sync="unpassOpen" width="500px" append-to-body class="certclas">
            <el-form ref="examform" :model="examform" :rules="rules" label-width="80px">
                <el-form-item label="姓名" prop="name">
                    <el-input v-model="examform.name" disabled placeholder="请输入内容" />
                </el-form-item>
                <el-form-item label="身份证号" prop="idNumber">
                    <el-input v-model="examform.idNumber" disabled placeholder="请输入内容" />
                </el-form-item>
                <el-form-item v-if="title != '查看认证信息'" label="审核结果" prop="status">
                    <el-select v-model="examform.status" style="width: 380px">
                        <el-option label="审核通过" value="2">审核通过</el-option>
                        <el-option label="审核不通过" value="3">审核不通过</el-option>
                    </el-select>
                </el-form-item>
                <el-form-item v-if="examform.status == 3" label="审核意见" prop="msg">
                    <el-input v-model="examform.msg" type="textarea" placeholder="请输入内容" />
                </el-form-item>
            </el-form>
            <div v-if="title != '查看认证信息'" slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
            <div v-else slot="footer" class="dialog-footer">
                <el-button type="primary" @click="cancel">关闭</el-button>
            </div>
        </el-dialog>

        <!-- 公司审核详情 -->
        <el-dialog
            :title="companyDetailInfo.name + '认证详情'"
            :visible.sync="companyOpen"
            width="1000px"
            append-to-body
        >
            <div style="color: #000; font-size: 18px; margin-bottom: 20px">
                法人姓名：{{ companyDetailInfo.contact_name }}
            </div>
            <img :src="baseTarget + companyDetailInfo.businessLicenseUrl" style="width: 100%; height: 500px" alt="" />
        </el-dialog>

        <!-- 公司审核 -->
        <el-dialog title="认证审核" :visible.sync="companyApplyOpen" width="500px" append-to-body>
            <el-form :rules="companyApplyFormRules" ref="companyApplyForm" label-width="80px" :model="companyApplyForm">
                <el-form-item label="状态" prop="status">
                    <el-select v-model="companyApplyForm.status" placeholder="请选择审核结果">
                        <el-option label="通过" value="1"></el-option>
                        <el-option label="不通过" value="2"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="意见" prop="auditOpinion">
                    <el-input v-model="companyApplyForm.auditOpinion" placeholder="请输入咨询内容"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button size="mini" type="primary" @click="companyApplySubmit">确 定</el-button>
                <el-button size="mini" @click="companyApplyCancel">取 消</el-button>
            </div>
        </el-dialog>

        <!-- 用户详情 -->
        <el-dialog title="详情" :visible.sync="cloudUserOpen" width="700px" append-to-body class="cloudi">
            <div class="sintitle">
                <div class="line"></div>
                个人信息</div>
            <div class="newfont">
                <div>姓名：{{ cloudUserOpenRow.name || '未填写' }}</div>
                <div>性别：{{ cloudUserOpenRow.sex || '未填写' }}</div>
                <div>手机号：{{ cloudUserOpenRow.phonenumber || '未填写' }}</div>
                <div>所在城市：{{ cloudUserOpenRow.city || '未填写' }}</div>
                <div>技能方向：{{ cloudUserOpenRow.testSkills || '未填写' }}</div>
                <div>个人优势：{{ cloudUserOpenRow.personalAdvantage || '未填写' }}</div>
            </div>
            <div class="sintitle"><div class="line"></div>工作经历</div>
            <div v-if="workList.length">
                <div class="newfont" v-for="it in workList" :key="it.caseId">
                    <div>公司名称：{{ it.name }}</div>
                    <div>在职时间：{{ it.startTime }} - {{ it.endTime }}</div>
                    <div>职位名称：{{ it.title }}</div>
                    <div>工作内容：{{ it.intro }}</div>
                </div>
            </div>
            <p v-else style="color: #333333; margin: 20px 30px; text-align: left">未填写</p>
            <div class="sintitle"><div class="line"></div>项目经历</div>
            <div v-if="proList.length">
                <div class="newfont" v-for="it in proList" :key="it.caseId">
                    <div>公司名称：{{ it.name }}</div>
                    <div>在职时间：{{ it.startTime }} - {{ it.endTime }}</div>
                    <div>担任角色：{{ it.title }}</div>
                    <div>应用技术：{{ it.applyTech }}</div>
                    <div>工作内容：{{ it.intro }}</div>
                </div>
            </div>
            <p v-else style="color: #333333; margin: 20px 30px; text-align: left">未填写</p>
            <div class="sintitle"><div class="line"></div>教育经历</div>
            <div v-if="eduList.length">
                <div class="newfont" v-for="it in eduList" :key="it.caseId">
                    <div>学校名称：{{ it.name }}</div>
                    <div>在校时间：{{ it.startTime }} - {{ it.endTime }}</div>
                    <div>学历：{{ it.education }}</div>
                    <div>专业：{{ it.major }}</div>
                </div>
            </div>
            <p v-else style="color: #333333; margin: 20px 30px; text-align: left">未填写</p>
            <div class="sintitle"><div class="line"></div>技能证书</div>
            <div v-if="bookList.length">
                <div class="newfont" v-for="it in bookList" :key="it.fileId">
                    <div>证书名称：{{ it.fileName }}</div>
                    <img :src="it.fileUrl" style="width: 360px; height: 150px" alt="" />
                </div>
            </div>
            <p v-else style="color: #333333; margin: 20px 30px; text-align: left">未填写</p>
        </el-dialog>
    </div>
</template>

<script>
import {
    listApplicationReview,
    delApplicationReview,
    addApplicationReview,
    updateApplicationReview,
    exportApplicationReview,
    listtestercert,
    gettestercert,
    deltestercert,
    updatetestercert,
    companyList,
    companyDetail,
    companyDelete,
    companyApplyPost,
    getUserJL,
} from '@/api/system/ApplicationReview'
import { getUnauditInfo, changeAllStatusOnce, user_status, apple_type } from '@/api/system/user'
import { changeCAStatus } from '@/api/tester/CompanyApply'
import { changeTAStatus } from '@/api/tester/TesterApply'
import MultifileLink from '@/views/components/MultifileLink'
import AuthImg from '@/views/components/AuthImg'
import { getApplyList, getApplyById, applyPost } from '@/api/cloudUser'
export default {
    name: 'ApplicationReview',
    components: {
        MultifileLink,
        AuthImg,
    },
    data() {
        return {
            // 弹层
            companyOpen: false,
            companyApplyOpen: false,
            // newmodel
            activeName: 'first',
            companyApplyList: [],
            srcList: [],
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            total1: 0,

            // 申请审核表格数据
            ApplicationReviewList: [],
            // 弹出层标题
            title: '',
            // 是否显示弹出层
            open: false,
            unpassOpen: false,
            // 最后登录时间时间范围
            daterangeLoginDate: [],
            // 创建时间时间范围
            daterangeCreateTime: [],
            // 更新时间时间范围
            daterangeUpdateTime: [],
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                deptId: null,
                userName: null,
                nickName: null,
                userType: null,
                email: null,
                phonenumber: null,
                sex: null,
                avatar: null,
                password: null,
                status: null,
                loginIp: null,
                loginDate: null,
                companyStatus: null,
                testerStatus: null,
            },
            queryParams1: {
                pageNum: 1,
                pageSize: 10,
            },
            // 表单参数
            testerApply: {},
            companyApply: {},
            examform: {
                auditOpinion: '',
                auditorId: '',
                status: '',
                applyId: '',
                name: '',
                idNumber: '',
                city: '',
                certificateUrl: '',
                testSkills: '',
                workExperience: '',
            },
            // 表单校验
            rules: {
                // auditOpinion: [{ required: true, message: "审核意见不能为空", trigger: "blur" },],
                status: [{ required: true, message: '请选择审核结果', trigger: 'blur' }],
            },
            materialServerAddr: '',
            allFileGetFlag: false,
            cA: false,
            tA: false,
            tAcA: false,
            c2ct: false,
            companyDetailInfo: {},
            baseTarget: process.env.VUE_APP_BASE_API,
            companyApplyForm: {},
            companyApplyFormRules: {
                status: [{ required: true, message: '请选择审核结果', trigger: 'blur' }],
            },
            cloudUserOpen: false,
            cloudUserOpenRow: {},
            base: process.env.VUE_APP_BASE_API,
            // 工作经历
            workList: [],
            // 项目经历
            proList: [],
            // 教育经历
            eduList: [],
            // 证书
            bookList: [],
        }
    },
    created() {
        this.getList()
        this.getClientConfigKey('material.server').then((response) => {
            this.materialServerAddr = response.msg
        })
    },
    methods: {
        // 获取云员工详情
        cloudUserDetail(row) {
            this.cloudUserOpenRow = {}
            this.workList = []
            this.proList = []
            this.eduList = []
            this.bookList = []
            getUserJL(row.userId).then((res) => {
                this.cloudUserOpenRow = res.personalInfo
                if (res.experience && res.experience.length) {
                    this.workList = res.experience.filter((it) => it.type == 1)
                    this.proList = res.experience.filter((it) => it.type == 0)
                    this.eduList = res.experience.filter((it) => it.type == 2)
                }
                if (res.credentials && res.credentials.length) {
                    this.bookList = res.credentials
                }
                this.cloudUserOpen = true
            })
        },

        // 打开审核
        companyApplyFn(row) {
            this.companyApplyForm.applyId = row.applyId
            this.companyApplyForm.userId = row.userId
            this.companyApplyOpen = true
        },
        // 审核
        companyApplySubmit() {
            this.$refs['companyApplyForm'].validate((valid) => {
                if (valid) {
                    this.companyApplyForm.userId = companyApplyPost(this.companyApplyForm).then((res) => {
                        console.log(res)
                        if (res.code == 200) {
                            this.$message.success('审核成功')
                            this.companyApplyCancel()
                            this.getCompanyList()
                        }
                    })
                }
            })
        },
        companyApplyCancel() {
            this.companyApplyForm = {}
            this.companyApplyOpen = false
        },
        // 取消审核

        // 删除公司审核
        companyDelete(id) {
            this.$confirm('是否确认删除编号为"' + id + '"的数据项?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(function () {
                    return companyDelete(id)
                })
                .then(() => {
                    this.getCompanyList()
                    this.msgSuccess('删除成功')
                })
        },
        // 打开详情
        opencompanyDetail(id) {
            companyDetail(id).then((res) => {
                this.companyDetailInfo = res.data || {}
                this.companyOpen = true
            })
        },
        // tab切换
        handleClick(val) {
            this.activeName = val.name
            if (this.activeName == 'first') {
                this.getList()
            } else {
                this.getCompanyList()
            }
        },
        // 查询公司审核
        getCompanyList() {
            companyList(this.queryParams1)
                .then((res) => {
                    this.total1 = res.total
                    this.companyApplyList = res.rows
                })
                .catch((error) => {
                })
        },
        /** 查询个人申请审核列表 */
        getList() {
            this.loading = true
            getApplyList(this.queryParams)
                .then((res) => {
                    this.total = res.total
                    this.ApplicationReviewList = res.rows
                    this.loading = false
                })
                .catch((error) => {
                    this.loading = false
                })
        },

        // 取消按钮
        cancel() {
            this.unpassOpen = false
            this.reset()
        },
        // 表单重置
        reset() {
            this.examform = {
                // auditOpinion: null,
            }
            this.resetForm('examform')
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1
            this.getList()
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.daterangeLoginDate = []
            this.daterangeCreateTime = []
            this.daterangeUpdateTime = []
            this.resetForm('queryForm')
            this.handleQuery()
        },
        // // 多选框选中数据
        // handleSelectionChange(selection) {
        //   this.ids = selection.map((item) => item.userId);
        //   this.single = selection.length !== 1;
        //   this.multiple = !selection.length;
        // },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset()
            this.open = true
            this.title = '添加申请审核'
        },
        /** 审核按钮操作 */
        handleUpdate(type, row) {
            this.reset()
            if (type == 'see') {
                const userId = row.userId || this.ids
                this.allFileGetFlag = false
                this.open = false
                const userStatus = row.userStatus
                const appleType = row.appleType
                this.tAcA = false //p2ct
                this.tA = false //p2pt
                this.c2ct = false //c2ct
                this.cA = false //p2c
                getUnauditInfo(userId).then((response) => {
                    if (response.testerApply) {
                        if (response.companyApply) {
                            //公司测试者认证审核??? p2ct
                            this.tAcA = true
                        } else {
                            if (
                                userStatus &&
                                appleType &&
                                userStatus == user_status.c &&
                                appleType == apple_type.c2ct
                            ) {
                                //c2ct
                                this.c2ct = true
                            } else {
                                //p2pt
                                this.tA = true
                            }
                        }
                    } else {
                        if (response.companyApply) {
                            //公司认证审核??? p2c
                            this.cA = true
                        }
                    }

                    if (response.testerApply) {
                        this.testerApply = response.testerApply
                    } else {
                        this.testerApply = {
                            applyId: null,
                            name: null,
                            city: null,
                            idNumber: null,
                            testSkills: null,
                            testProjects: null,
                            workExperience: null,
                            certificate: null,
                            createTime: null,
                            updateTime: null,
                            idCardFrontUrl: [],
                            idCardBackUrl: [],
                            otherTQList: [],
                            otherInfo: null,
                        }
                    }
                    if (response.companyApply) {
                        this.companyApply = response.companyApply
                    } else {
                        this.companyApply = {
                            applyId: null,
                            name: null,
                            creditCode: null,
                            address: null,
                            webSite: null,
                            companyDesc: null,
                            contactName: null,
                            contactPosition: null,
                            createTime: null,
                            updateTime: null,
                            businessLicenseUrl: [],
                            otherCQList: [],
                        }
                    }
                    this.allFileGetFlag = true
                    this.open = true
                    this.title = '申请审核'
                })
            } else if (type == 'del') {
                this.$confirm('确定删除当前认证审核吗？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }).then(() => {
                    deltestercert(row.userId).then((res) => {
                        this.$message.success('删除成功')
                        this.getList()
                    })
                })
            } else if (type == 'senk') {
                this.title = '查看认证信息'
                this.unpassOpen = true
                let {
                    applyId,
                    name,
                    idNumber,
                    city,
                    certificateUrl,
                    testSkills,
                    workExperience,
                    status,
                    auditOpinion,
                } = row
                this.srcList.push(certificateUrl)

                this.examform = {
                    applyId,
                    name,
                    idNumber,
                    city,
                    certificateUrl,
                    testSkills,
                    workExperience,
                    status: status + '',
                    auditOpinion,
                }
            } else {
                console.log('row--', row)
                this.unpassOpen = true
                let {
                    applyId,
                    name,
                    idNumber,
                    city,
                    certificateUrl,
                    testSkills,
                    workExperience,
                    status,
                    auditOpinion,
                    msg
                } = row
                this.examform = {
                    applyId,
                    name,
                    idNumber,
                    city,
                    certificateUrl,
                    testSkills,
                    workExperience,
                    status: null,
                    auditOpinion,
                    msg
                }
                this.title = '云员工认证'
                this.srcList.push(certificateUrl)
                this.examform.userId = row.userId
            }
        },
        /** 审核通过 */
        submitPass() {
            if (this.tAcA) {
                this.testerApply.remark = '' + this.companyApply.applyId
                this.testerApply.status = 1
                this.doPostApplyMethod(changeAllStatusOnce, this.testerApply)
            }
            if (this.tA || this.c2ct) {
                this.testerApply.status = 1
                this.doPostApplyMethod(changeTAStatus, this.testerApply)
            }
            if (this.cA) {
                this.companyApply.status = 1
                this.doPostApplyMethod(changeCAStatus, this.companyApply)
            }
        },
        /** 审核不通过 */
        /** 审核的确定 */
        submitForm() {
            if (!this.examform.status) {
                this.$message.warning('请选择审核结果')
                return
            }
            applyPost(this.examform.userId, this.examform).then((res) => {
                this.$message.success('审核成功')
                this.getList()
                this.cancel()
            })
        },
        /** 审核不通过 */
        submitUnpass() {
            this.unpassOpen = true
        },
        doPostApplyMethod(methodPost, aData) {
            // if (this.unpassOpen) {
            //   aData.auditOpinion = this.form.auditOpinion;
            // }
            methodPost(aData).then((response) => {
                this.open = false
                this.unpassOpen = false
                this.getList()
            })
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const userIds = row.userId || this.ids
            this.$confirm('是否确认删除申请审核编号为"' + userIds + '"的数据项?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(function () {
                    return delApplicationReview(userIds)
                })
                .then(() => {
                    this.getList()
                    this.msgSuccess('删除成功')
                })
        },
        /** 导出按钮操作 */
        handleExport() {
            const queryParams = this.queryParams
            this.$confirm('是否确认导出所有申请审核数据项?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(function () {
                    return exportApplicationReview(queryParams)
                })
                .then((response) => {
                    this.download(response.msg)
                })
        },
    },
}
</script>
<style scoped>
.certclas >>> .el-textarea.is-disabled .el-textarea__inner,
.certclas >>> .el-input.is-disabled .el-input__inner {
    background-color: transparent;
    color: #606266;
}
.cloudi >>> .el-dialog__body {
    max-height: 700px;
    overflow: auto;
}
.sintitle {
    font-size: 16px;
    color: #000000;
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
.newfont {
    padding: 0 20px;
    box-sizing: border-box;
}
.newfont div {
    margin-bottom: 5px;
}
.line {
    width: 4px;
    height: 18px;
    background: #1890ff;
    margin-right: 5px;
    border-radius: 2px;
}
</style>
