<!--  -->
<template>
    <div>
        <el-row>
            <el-col :span="leftWidth" style="padding: 0;border-right: 1px solid #dcdfe6;"
                :style="{'height': colHeight + 'px'}">
                <el-container>
                    <el-header style="height: 3vh;padding: 0 10px;line-height: 3vh;border-bottom:1px solid #dcdfe6;">
                        <strong>稽察任务</strong>
                    </el-header>
                    <el-main style="padding:10px 0;">
                        <el-row style="padding: 0 10px;">
                            <el-input clearable placeholder="点击下列选项或输入关键字搜索" v-model="filterText">
                            </el-input>
                        </el-row>
                        <el-row style="padding: 10px;">
                            <el-form :inline="true" size="small" class="demo-form-inline">
                                <el-row>
                                    <el-col :span="24">
                                        <el-form-item label="年度">
                                            <el-select v-model="year" clearable style="width:100px;">
                                                <el-option :lable="item.year" :value="item.year" :key="item.id"
                                                    v-for="item in yearList"></el-option>
                                            </el-select>
                                        </el-form-item>
                                        <el-form-item label="批次">
                                            <el-select v-model="batch" clearable style="width:100px;">
                                                <el-option :lable="item.batch" :value="item.batch" :key="item.id"
                                                    v-for="item in pcList"></el-option>
                                            </el-select>
                                        </el-form-item>
                                        <el-button type="primary" size="small" @click="treeSearch">查询</el-button>
                                    </el-col>
                                </el-row>
                            </el-form>
                        </el-row>
                        <el-row style="overflow-y:auto;padding: 0 10px;" :style="{'height': colHeight - 170 + 'px'}">
                            <el-tree :highlight-current="true" class="filter_tree" :data="treeDataLists"
                                :props="defaultProps" :default-expanded-keys="defaultExpanded"
                                :filter-node-method="filterNode" node-key="id" @node-click='treeNodeClickHandler'
                                ref="tree2">
                                <span class="custom-tree-node" #default="{ node }">
                                    <el-tooltip v-if="node.isLeaf" class="item" effect="dark" :content="node.label"
                                        placement="top-start">
                                        <span>{{ node.label }}</span>
                                    </el-tooltip>
                                    <span v-else>{{ node.label }}</span>
                                </span>
                            </el-tree>
                        </el-row>
                    </el-main>
                </el-container>
            </el-col>
            <el-col :span="rightWidth" style="border-right: 1px solid #dcdfe6;position:relative;"
                :style="{'height': colHeight + 'px'}">
                <el-container>
                    <el-row style="">
                        <Profession :reallMenuLists="reallMenuLists" :currentNodeId="currentNodeId"
                            :projectName="projectName + stateName"
                            @professionChildrenTableName="professionChildrenTableNameEvent">
                        </Profession>
                    </el-row>
                    <el-header v-if="tbsm"
                        style="background: #F5F9FC;height: 3.5vh;line-height:3.5vh;padding: 0;text-align:center;">
                        <strong>填报说明</strong>
                    </el-header>
                    <el-header v-if="jbxxAndWtqd || isbcqd"
                        style="background: #F5F9FC;font-size:large;height: 3.5vh;line-height:3.5vh;padding: 0;text-align:center;">
                        <strong>{{projectName + stateName + rightTableName}} </strong>
                    </el-header>

                    <el-header v-if="reportTable"
                        style="background: #F5F9FC;font-size:large;height: 3.5vh;line-height:3.5vh;padding: 0;text-align:center;">
                        <strong>{{projectName + stateName}} </strong>
                    </el-header>
                    <el-main style="padding:0;overflow:hidden">
                        <div style="position: absolute;top: 60px;right: 0;">
                            <el-button v-if="jbxxAndWtqd && showSubmitBtn && submitStatus < 4" type="danger"
                                style="float: right;margin-right: 20px;font-size: 14px" @click="submitProfession1">提
                                交（新）</el-button>
                            <el-button v-if="jbxxAndWtqd" type="success"
                                style="float: right;margin-right: 20px;font-size: 14px" @click="showDailyRecord">日 志
                            </el-button>
                        </div>
                        <div style="text-align: right;" v-if="isHb">
                            <el-select style="width:180px;" v-model="tbIf" clearable placeholder="请选择是否填报">
                                    <el-option v-for="(item,index) in tbIfList" :label="item.label" :value="item.value" :key="item.value"></el-option>
                            </el-select>
                            <el-button type="primary" @click="showBcqdFn1()">查询</el-button>
                            <el-button type="primary" style="margin-right: 20px;font-size: 14px" @click="showBcqdFn()">生成必查清单</el-button>
                        </div>
                        <!-- <div style="position: absolute;top: 60px;right: 0;">
                            <el-button v-if="isbcqd && isHb" type="primary"
                                style="float: right;margin-right: 20px;font-size: 14px" @click="showBcqdFn">生成必查清单</el-button>
                        </div> -->
                        <component :is="curComponent" :type="professionType" :pertype="pertype" :objId="objId"
                            :currentNodeId="currentNodeId" :projectName="projectName" :rightTableName="rightTableName"
                            :tableSrc="tableSrc" :backStatus="backStatus" :hasPriv="hasPriv"
                            :submitStatus="submitStatus" ref="componentRef" pageName="inspectionIndex"></component>
                        <div class="assistant_btn">
                            <!-- <el-button v-if="jbxxAndWtqd && rightTableName == '问题清单'" type="warning" style="float: right;margin-right: 20px;font-size: 14px" @click="showJobFile">生成工作底稿</el-button> -->
                        </div>
                    </el-main>
                </el-container>
                <div class="open_board">
                    <el-icon v-if="isOpen" @click="closeLeft"><ArrowLeft /></el-icon>
                    <el-icon v-else @click="openLeft"><ArrowRight /></el-icon>
                </div>
            </el-col>
        </el-row>
        <export-allinfo-word v-if="exportWordDialog" @dialogClose="dialogClose" :rgstrId="currentNodeId"
            :professionType="professionType" :rightTableName="rightTableName"></export-allinfo-word>
        <el-dialog title="操作日志" v-model="dailyRecordVisible" width="80%" :append-to-body="true">
            <daily-record :rgstrId="currentNodeId" :professionType="professionType"></daily-record>
        </el-dialog>
    </div>
</template>

<script>
    //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
    //例如：import 《组件名称》 from '《组件路径》';
    import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'
    import inspectBaseinfo from './baseInfo.vue'
    import InstructionManual from './InstructionManual.vue'
    import inspectProblemList from './problemList.vue'
    import problemView from './problemView.vue'
    import Profession from './Profession';
    import ReportTable from './ReportTable';
    import exportAllinfoWord from './dialogCom/exportAllinfoWord';
    import dailyRecord from './dialogCom/dailyRecord';
    import request from '@/utils/gw_ajax_request'
    import pageOfficeBaseinfo from './pageofficeBaseinfo.vue'
    import axios from 'axios'
    import { hostUrl } from '@/utils/global_variable'

    import {
        getTree,
        getPerType,
        submitProfessionApi,
        submitProfessionTwoApi,
        backProfessionApi,
        passProfessionApi
    } from "@/api/InspectionReport.js";
    export default {
        //import引入的组件需要注入到对象中才能使用
        components: {
            ArrowLeft,
            ArrowRight,
            Profession,//专业折叠面板组件
            ReportTable,//右侧填报表格主体
            inspectBaseinfo,//基本信息
            inspectProblemList, //问题清单
            InstructionManual, //填报说明
            exportAllinfoWord, //生成工作底稿
            pageOfficeBaseinfo, //PageOffice版本基础信息
            dailyRecord, //稽察成果操作日志信息
            problemView,//必查清单
        },
        data() {
            //这里存放数据
            return {
                stateName: '', //状态名称
                leftWidth: 5,
                rightWidth: 19,
                isOpen: true,
                tbsm: true,
                jbxxAndWtqd: false,
                reportTable: false,
                isbcqd: false,
                defaultExpanded: [],//树默认展开节点数组
                curComponent: "InstructionManual",
                professionName: '前期与设计',
                professionType: '',//专业类型
                professionChildrenTableName: {},
                rightTableName: '填报说明',
                currentNodeId: '',//点击树的节点登记表ID
                inspGroupId: '',//点击树的节点组ID
                pertype: '',//稽察填报人员类型，用于控制表格上方菜单控制
                objId: '',//点击树节点的objId
                tableSrc: '',//报表的链接
                menuDisNum: 'all',//用于控制表格上方菜单项的显示隐藏的数组下标
                projectName: '',//点击树的工程名称
                colHeight: window.innerHeight - 90,
                filterText: '',
                year: "",
                batch: "",
                yearList: [],
                pcList: [],
                treeDataLists: [],
                defaultProps: {
                    children: 'children',
                    label: 'pnm'
                },
                showSubmitBtn: true,
                backStatus: false,
                exportWordDialog: false,
                reallMenuLists: [],//菜单实际用的数组
                menuList: [//配置菜单用的数组
                    {
                        type: '1',
                        index: '1',
                        title: '前期与设计',
                        menuDis: false,
                        children: [{
                            pType: '1',
                            index: '1-1',
                            title: '基本信息'
                        }, {
                            pType: '1',
                            index: '1-2',
                            title: '附件1 前期与设计基本情况',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_befor_design_basic1-1.sht&width=1526&height=592'
                        }, {
                            pType: '1',
                            index: '1-3',
                            title: '问题清单'
                        }, {
                            pType: '1',
                            index: '1-4',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '2',
                        index: '2',
                        title: '建设管理',
                        menuDis: false,
                        children: [{
                            pType: '2',
                            index: '2-1',
                            title: '基本信息'
                        }, {
                            pType: '2',
                            index: '2-2',
                            title: '附件2-1 项目法人责任制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_legal_person_duty2-1.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '2-3',
                            title: '附件2-2 招标投标制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc2_2.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '4',
                            title: '附件2-3 建设监理制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc2_3.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '2-5',
                            title: '附件2-4 合同管理制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_htglz2-4.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '2-6',
                            title: '问题清单'
                        }, {
                            pType: '2',
                            index: '2-7',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '3',
                        index: '3',
                        title: '计划下达与执行',
                        menuDis: false,
                        children: [{
                            pType: '3',
                            index: '3-1',
                            title: '基本信息'
                        }, {
                            pType: '3',
                            index: '3-2',
                            title: '附件3 计划下达与执行基本情况',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_plan_execute_basic3-1.sht&width=1526&height=592'
                        }, {
                            pType: '3',
                            index: '3-3',
                            title: '问题清单'
                        }, {
                            pType: '3',
                            index: '3-4',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '4',
                        index: '4',
                        title: '资金使用与管理',
                        menuDis: false,
                        children: [{
                            pType: '4',
                            index: '4-1',
                            title: '基本信息'
                        }, {
                            pType: '4',
                            index: '4-2',
                            title: '附件4 资金使用与管理基本情况',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_fund_manage_basic4-1.sht&width=1526&height=592'
                        }, {
                            pType: '4',
                            index: '4-3',
                            title: '问题清单'
                        }, {
                            pType: '4',
                            index: '4-4',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '5',
                        index: '5',
                        title: '工程质量',
                        menuDis: false,
                        children: [{
                            pType: '5',
                            index: '5-1',
                            title: '基本信息'
                        }, {
                            pType: '5',
                            index: '5-2',
                            title: '附件5-1 质量管理体制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_zlgltz5-1.sht&width=1526&height=592'
                        }, {
                            pType: '5',
                            index: '5-3',
                            title: '附件5-2 工程实体质量与验收',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_project_quality_check5-2.sht&width=1526&height=592'
                        }, {
                            pType: '5',
                            index: '5-4',
                            title: '问题清单'
                        }, {
                            pType: '5',
                            index: '5-5',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '6',
                        index: '6',
                        title: '工程安全',
                        menuDis: false,
                        children: [{
                            pType: '6',
                            index: '6-1',
                            title: '基本信息',

                        }, {
                            pType: '6',
                            index: '6-2',
                            title: '附件6-1 项目法人',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_project_safety_basic6-1.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-3',
                            title: '附件6-2 施工单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_project_safety_basic6-2.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-4',
                            title: '问题清单'
                        }, {
                            pType: '6',
                            index: '6-5',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '7',
                        index: '7',
                        title: '参建单位',
                        menuDis: false,
                        children: [{
                            pType: '7',
                            index: '7-1',
                            title: '施工单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_TAC_PAWP_UNIT_SCTN_1.sht&width=1526&height=592'

                        }, {
                            pType: '7',
                            index: '7-2',
                            title: '单位管理',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_TAC_PAWP_UNIT_SCTN_2.sht&width=1526&height=592'
                        },
                        // {
                        //     pType: '7',
                        //     index: '7-3',
                        //     title: '必查清单'
                        // }
                      ]
                    },
                    // {
                    //     type:'8',
                    //     index:'8',
                    //     title:'稽察报告',
                    //     menuDis:false,
                    //     reportSrc:'/demo/reportJsp/showReport.jsp?rpx=js_TAC_OUTLINE_WORD&width=800&height=592'
                    // },
                ],
                menuLists: [],
                menuListForFujian: [
                    {
                        type: '1',
                        index: '1',
                        title: '前期与设计',
                        menuDis: false,
                        children: [{
                            pType: '1',
                            index: '1-1',
                            title: '表二 基本情况'
                        }, {
                            pType: '1',
                            index: '1-3',
                            title: '表三 主要问题'
                        }]
                    },
                    {
                        type: '2',
                        index: '2',
                        title: '建设管理',
                        menuDis: false,
                        children: [{
                            pType: '2',
                            index: '2-1',
                            title: '表二 基本情况'
                        }, {
                            pType: '2',
                            index: '2-6',
                            title: '表三 主要问题'
                        }]
                    },
                    {
                        type: '3',
                        index: '3',
                        title: '计划下达与执行',
                        menuDis: false,
                        children: [{
                            pType: '3',
                            index: '3-1',
                            title: '表二 基本情况'
                        }, {
                            pType: '3',
                            index: '3-3',
                            title: '表三 主要问题'
                        }]
                    },
                    {
                        type: '4',
                        index: '4',
                        title: '资金使用与管理',
                        menuDis: false,
                        children: [{
                            pType: '4',
                            index: '4-1',
                            title: '表二 基本情况'
                        }, {
                            pType: '4',
                            index: '4-3',
                            title: '表三 主要问题'
                        }]
                    },
                    {
                        type: '5',
                        index: '5',
                        title: '工程质量',
                        menuDis: false,
                        children: [{
                            pType: '5',
                            index: '5-1',
                            title: '表二 基本情况'
                        }, {
                            pType: '5',
                            index: '5-4',
                            title: '表三 主要问题'
                        }]
                    },
                    {
                        type: '6',
                        index: '6',
                        title: '工程安全',
                        menuDis: false,
                        children: [{
                            pType: '6',
                            index: '6-1',
                            title: '表二 基本情况'

                        }, {
                            pType: '6',
                            index: '6-4',
                            title: '表三 主要问题'
                        }]
                    },
                    {
                        type: '7',
                        index: '7',
                        title: '参建单位',
                        menuDis: false,
                        children: [{
                            pType: '7',
                            index: '7-1',
                            title: '施工单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_TAC_PAWP_UNIT_SCTN_1.sht&width=1526&height=592'

                        }, {
                            pType: '7',
                            index: '7-2',
                            title: '单位管理',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=jc_TAC_PAWP_UNIT_SCTN_2.sht&width=1526&height=592'
                        }]
                    }
                ],
                // 青海专属菜单
                menuListForQinghai: [
                    {
                        type: '1',
                        index: '1',
                        title: '前期与设计',
                        menuDis: false,
                        children: [{
                            pType: '1',
                            index: '1-1',
                            title: '基本信息'
                        }, {
                            pType: '1',
                            index: '1-2',
                            title: '附件1 前期与设计基本情况',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_befor_design_basic1-1.sht&width=1526&height=592'
                        }, {
                            pType: '1',
                            index: '1-3',
                            title: '问题清单'
                        }, {
                            pType: '1',
                            index: '1-4',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '2',
                        index: '2',
                        title: '建设管理',
                        menuDis: false,
                        children: [{
                            pType: '2',
                            index: '2-1',
                            title: '基本信息'
                        }, {
                            pType: '2',
                            index: '2-2',
                            title: '附件2-1 项目法人责任制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_legal_person_duty2-1.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '2-3',
                            title: '附件2-2 招标投标制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc2_2.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '4',
                            title: '附件2-3 建设监理制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc2_3.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '2-5',
                            title: '附件2-4 合同管理制',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_htglz2-4.sht&width=1526&height=592'
                        }, {
                            pType: '2',
                            index: '2-6',
                            title: '问题清单'
                        }, {
                            pType: '2',
                            index: '2-7',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '3',
                        index: '3',
                        title: '计划下达与执行',
                        menuDis: false,
                        children: [{
                            pType: '3',
                            index: '3-1',
                            title: '基本信息'
                        }, {
                            pType: '3',
                            index: '3-2',
                            title: '附件3 计划下达与执行基本情况',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_plan_execute_basic3-1.sht&width=1526&height=592'
                        }, {
                            pType: '3',
                            index: '3-3',
                            title: '问题清单'
                        }, {
                            pType: '3',
                            index: '3-4',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '4',
                        index: '4',
                        title: '资金使用与管理',
                        menuDis: false,
                        children: [{
                            pType: '4',
                            index: '4-1',
                            title: '基本信息'
                        }, {
                            pType: '4',
                            index: '4-2',
                            title: '附件4-1 资金使用与管理基本情况',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_fund_manage_basic4-1.sht&width=1526&height=592'
                        }, {
                            pType: '4',
                            index: '4-3',
                            title: '附件4-2 资金使用明细表',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_fund_manage_basic4-2.sht&width=1526&height=592'
                        }, {
                            pType: '4',
                            index: '4-4',
                            title: '附件4-3 待摊投资明细表',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_fund_manage_basic4-3.sht&width=1526&height=592'
                        }, {
                            pType: '4',
                            index: '4-5',
                            title: '问题清单'
                        }, {
                            pType: '4',
                            index: '4-6',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '5',
                        index: '5',
                        title: '工程质量',
                        menuDis: false,
                        children: [{
                            pType: '5',
                            index: '5-1',
                            title: '基本信息'
                        },
                        // {
                        //     pType: '5',
                        //     index: '5-2',
                        //     title: '附件5-1 质量管理体制',
                        //     reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_zlgltz5-1.sht&width=1526&height=592'
                        // },
                            {
                                pType: '5',
                                index: '5-2',
                                title: '附件5-1-1工程质量基本情况表-质量管理体制-项目法人',
                                reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_zlgltz5-1-1.sht&width=1526&height=592'
                            },
                            {
                                pType: '5',
                                index: '5-3',
                                title: '附件5-1-2工程质量基本情况表-质量管理体制-质量监督单位',
                                reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_zlgltz5-1-2.sht&width=1526&height=592'
                            },
                            {
                                pType: '5',
                                index: '5-4',
                                title: '附件5-1-3工程质量基本情况表-质量管理体制-监理单位',
                                reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_zlgltz5-1-3.sht&width=1526&height=592'
                            },
                            {
                                pType: '5',
                                index: '5-5',
                                title: '附件5-1-4工程质量基本情况表-质量管理体制-监理单位施工单位',
                                reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_zlgltz5-1-4.sht&width=1526&height=592'
                            },
                            {
                            pType: '5',
                            index: '5-3',
                            title: '附件5-2 工程实体质量与验收',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_project_quality_check5-2.sht&width=1526&height=592'
                        }, {
                            pType: '5',
                            index: '5-4',
                            title: '问题清单'
                        }, {
                            pType: '5',
                            index: '5-5',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '6',
                        index: '6',
                        title: '工程安全',
                        menuDis: false,
                        children: [{
                            pType: '6',
                            index: '6-1',
                            title: '基本信息',

                        }, {
                            pType: '6',
                            index: '6-2',
                            title: '附件6-1 项目法人',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_project_safety_basic6-1.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-3',
                            title: '附件6-2 施工单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_project_safety_basic6-2.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-4',
                            title: '附件6-3 监理单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_project_safety_basic6-3.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-5',
                            title: '附件6-4 设计单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_project_safety_basic6-4.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-6',
                            title: '附件6-5 其他单位',
                            reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_project_safety_basic6-5.sht&width=1526&height=592'
                        }, {
                            pType: '6',
                            index: '6-7',
                            title: '问题清单'
                        }, {
                            pType: '6',
                            index: '6-8',
                            title: '必查清单'
                        }]
                    },
                    {
                        type: '7',
                        index: '7',
                        title: '参建单位',
                        menuDis: false,
                        children: [
                            // {
                            //     pType: '7',
                            //     index: '7-1',
                            //     title: '施工单位',
                            //     reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_TAC_PAWP_UNIT_SCTN_1.sht&width=1526&height=592'

                            // },
                            {
                                pType: '7',
                                index: '7-2',
                                title: '单位管理',
                                reportSrc: '/demo/reportJsp/showInput.jsp?sht=qinghai/jc_TAC_PAWP_UNIT_SCTN_2.sht&width=1526&height=592'
                            },
                            // {
                            //     pType: '7',
                            //     index: '7-3',
                            //     title: '必查清单'
                            // }
                          ]
                    }
                ],
                submitStatus: '',
                dailyRecordVisible: false,  //操作日志弹窗
                isClicked: false,
                tbIf:'',
                tbIfList:[
                  {label: '全部',value: ''},
                  {label: '未填报',value: '0'},
                  {label: '已填报',value: '1'}
                ]
            };
        },
        //监听属性 类似于data概念
        computed: {
            persId() {
                return localStorage.getItem("userid")
                    ? localStorage.getItem("userid")
                    : "1098101939614724096";
            },
            hasPriv() {
                return this.ownPriv('manage')
            },
            isHb(){
                if(localStorage.getItem('currentRlcode').substring(0,2)=="42"){
                    return true;
                }else{
                    return false;
                }
            }
        },
        //监控data中的数据变化
        watch: {
            filterText(val) {
                this.$refs.tree2.filter(val);
            },
            professionName(n, o) {
                this.professionName = n;
            },
            professionType(n, o) {
                this.professionType = n;
                // 在已选择工程的状态下,当专业切换的时候也要获取下各自专业的状态
                this.getSubmitStatus();
            },
        },
        //方法集合
        methods: {
            async getYearPc() {
                await request.post(`/tac/insp/year/list`, {}).then(res => {
                    if (res.success) {
                        this.$nextTick(() => {
                            this.yearList = res.data;
                        })
                    }
                })
                request.post(`/tac/insp/batch/list`, {}).then(res => {
                    if (res.success) {
                        this.pcList = res.data;
                    }
                })
            },
            filterNode(value, data) {
                if (!value) return true;
                return data.pnm.indexOf(value) !== -1;
            },
            //获取左侧树数据
            getTreeData: function () {
                let _self = this;
                //       getTree('008','1').then((res)=>{
                //           _self.treeDataLists = res.data[0].children;
                //           // 默认隐藏到批次
                //           _self.treeDataLists.forEach((element) => {
                //               _self.defaultExpanded.push(element.id);
                //           });
                //       });
                //           _self.defaultExpanded.unshift("008");
                //     request.post(`/tac/insp/year/batch/obj/getObjTreeList`,{"persId": "363f0a52df6943189af9bced98a875f6"}).then(res =>{
                request.post(`/tac/insp/year/batch/obj/getObjTreeListV2`, {
                    "persId": _self.persId,
                    "year": _self.year,
                    "batch": _self.batch
                }).then(res => {
                    _self.treeDataLists = res.data.children;
                })

            },
            //左侧树搜索
            treeSearch() {
                this.getTreeData();
            },
            // 固定阶段时阶段定义。已转至新阶段，注释此处
            //         getStateName(dataState){
            //             if(Number(dataState) > 2){
            //                 switch (dataState) {
            //             case "3":
            //               this.stateName = "(助理退回给专家)";
            //               break;
            //             case "4":
            //               this.stateName = "(专家提交到助理)";
            //               break;
            //             case "5":
            //               this.stateName = "(成果讨论阶段)";
            //               break;
            //             case "6":
            //               this.stateName = "(中心修改阶段)";
            //               break;
            //             case "7":
            //               this.stateName = "(司局修改阶段)";
            //               break;
            //             default:
            //               this.stateName = '';
            //               break;
            //           }
            //         }else{
            //         this.stateName = '';
            // }
            //         },
            //树节点点击事件
            treeNodeClickHandler: function (data, node, tree) {
                if (node.childNodes.length == 0) {
                    console.log(node.parent.data.pid)
                    let dataState = node.data.state;
                    // 其实这一步不用也行，因为这里返回的是总的状态，点击专业的时候会再调用一次获取状态的接口
                    // this.getStateName(dataState);
                    // this.stateName = node.data.stateName;
                    this.projectName = data.pnm;
                    this.currentNodeId = data.id;
                    this.objId = data.objId;
                    this.inspGroupId = node.parent.data.pid;
                    this.reallMenuLists = [];
                    this.getMenu(dataState);
                    // 在已选择专业的情况下 切换工程重新获取提交状态
                    if (this.professionType) {
                        this.getSubmitStatus()
                        this.$nextTick(()=>{
                          this.showBcqdFn1()
                        })
                    }
                } else {
                    return;
                }
            },
            getMenu: function (dataState) {
                let _self = this;
                let thisType = true;
                getPerType(_self.inspGroupId, _self.persId).then((res) => {
                    console.log(res);
                    _self.pertype = res.data.pertype;
                    res.data.forEach(ele => {
                        if (ele.pertype == '11' || ele.pertype == '12' || ele.pertype == '13' || ele.pertype == '14' || ele.pertype == '15' || ele.pertype == '16') {
                            _self.reallMenuLists.push(_self.menuLists[Number(ele.pertype) - 11]);
                            thisType = true;
                        } else {
                            _self.reallMenuLists = _self.menuLists;
                            // if(dataState > 2){
                            //     _self.currentNodeId += "_4";
                            // }
                            thisType = false;
                            return;
                        }
                    })
                    if (thisType) {
                        _self.reallMenuLists.push(_self.menuLists[6]);
                        if (_self.menuLists[7]) {
                            _self.reallMenuLists.push(_self.menuLists[7]);
                        }
                    }
                    console.log(_self.reallMenuLists);
                    // 11：前期专家；12：监管专家；13：计划专家；14：财务专家；15：质量专家；16：安全专家；
                    // if(_self.pertype == '11'){
                    //     _self.menuDisNum = '0';
                    // }else if(_self.pertype == '12'){
                    //     _self.menuDisNum = '1';
                    // }else if(_self.pertype == '13'){
                    //     _self.menuDisNum = '2';
                    // }else if(_self.pertype == '14'){
                    //     _self.menuDisNum = '3';
                    // }else if(_self.pertype == '15'){
                    //     _self.menuDisNum = '4';
                    // }else if(_self.pertype == '16'){
                    //     _self.menuDisNum = '5';
                    // }else{
                    //     _self.menuDisNum = '';
                    // }
                    // if(_self.pertype == '11' || _self.pertype == '12' || _self.pertype == '13' || _self.pertype == '14' || _self.pertype == '15' || _self.pertype == '16'){
                    //     this.showSubmitBtn = true
                    // }else{
                    //     this.showSubmitBtn = false
                    // }
                });
            },
            getSubmitStatus() {
                request.get(`/tac/pawp/rgstr/getState/${this.currentNodeId}/${this.professionType}`).then(res => {
                    ;
                    if (res.success) {
                        this.submitStatus = res.data.state;
                        // 获取下状态名称
                        this.stateName = res.data.stateName;

                        // this.getStateName(res.data.state)
                    } else {
                        this.$message.error(res.message)
                    }
                })
            },
            //中间专业导航后处理
            professionChildrenTableNameEvent(item) {
                this.professionChildrenTableName = item;
                if (this.professionChildrenTableName.hasOwnProperty('tableSrc')) {
                    this.tableSrc = this.professionChildrenTableName.tableSrc;
                }
                if (this.professionChildrenTableName.tableName == '基本信息' || this.professionChildrenTableName.tableName.indexOf('表二 基本情况') > -1) {
                    this.rightTableName = '基本情况'
                    this.professionType = item.type;//专业类型
                    // this.curComponent = inspectBaseinfo;
                    this.curComponent = pageOfficeBaseinfo;
                    this.tbsm = false;
                    this.jbxxAndWtqd = true;
                    this.reportTable = false;
                    this.isbcqd = false;
                } else if (this.professionChildrenTableName.tableName == '问题清单' || this.professionChildrenTableName.tableName.indexOf('问题') > -1) {
                    this.rightTableName = '问题清单'
                    this.professionType = item.type;//专业类型
                    this.curComponent = inspectProblemList;
                    this.tbsm = false;
                    this.jbxxAndWtqd = true;
                    this.reportTable = false;
                    this.isbcqd = false;
                } else if (this.professionChildrenTableName.tableName == '必查清单' ) {
                    this.rightTableName = '必查清单'
                    this.professionType = item.type;//专业类型
                    this.curComponent = problemView;
                    this.tbsm = false;
                    this.jbxxAndWtqd = false;
                    this.reportTable = false;
                    this.isbcqd = true;
                    this.$nextTick(()=>{
                      this.showBcqdFn1()
                    })
                }else {
                    this.rightTableName = ''
                    this.professionType = item.type;//专业类型
                    this.curComponent = ReportTable;
                    this.tbsm = false;
                    this.jbxxAndWtqd = false;
                    this.reportTable = true;
                    this.isbcqd = false;
                }
                this.getSubmitStatus()
            },
            // 专家提交工作底稿(测试)
            submitProfession1() {
                this.$confirm('提交后，您将无法操作问题清单，如需继续操作问题清单，请联系助理驳回。请问您是否确定提交？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    if (this.isClicked) {
                        return false
                    }
                    this.isClicked = true
                    submitProfessionTwoApi(this.currentNodeId, this.professionType).then(res => {
                        if (res.success) {
                            this.$message.success('提交成功')
                            this.getSubmitStatus()
                        } else {
                            this.$message.warning(res.message)
                        }
                        this.isClicked = false
                    }).catch(err => {
                        this.$message.success(err)
                        this.isClicked = false
                    })
                })
            },
            // 专家提交工作底稿
            submitProfession() {
                this.$confirm('提交后，您将无法操作问题清单，如需继续操作问题清单，请联系助理驳回。请问您是否确定提交？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    if (this.isClicked) {
                        return false
                    }
                    this.isClicked = true
                    submitProfessionApi(this.currentNodeId, this.professionType).then(res => {
                        if (res.success) {
                            this.$message.success('提交成功')
                            this.getSubmitStatus()
                        } else {
                            this.$message.warning(res.message)
                        }
                        this.isClicked = false
                    }).catch(err => {
                        this.$message.success(err)
                        this.isClicked = false
                    })
                })
            },
            // 助理退回工作底稿
            backProfession() {
                backProfessionApi(this.currentNodeId, this.professionType).then(res => {
                    if (res.success) {
                        this.$message.success('提交成功')
                        this.backStatus = true
                    } else {
                        this.$message.warning(res.message)
                    }
                }).catch(err => {
                    this.$message.success(err)
                })
            },
            // 助理通过工作底稿
            passProfession() {
                passProfessionApi(this.currentNodeId, this.professionType).then(res => {
                    if (res.success) {
                        this.$message.success('提交成功')
                    } else {
                        this.$message.warning(res.message)
                    }
                }).catch(err => {
                    this.$message.success(err)
                })
            },
            showJobFile() {
                // this.exportWordDialog = true
                this.isUsePo()
            },
            dialogClose() {
                this.exportWordDialog = false
            },
            isUsePo() {
                // 是否启用PageOffice
                let _this = this;
                axios.defaults.timeout = 2000;
                axios.get('/pageofficePath/pageoffice/getUsePo').then((res) => {
                    let data = res.data
                    if (data.isUse == 'true') {
                        _this.exportWordDialog = false
                        // 打开PageOffice
                        _this.openPageoffice()
                    } else {
                        _this.exportWordDialog = true
                    }
                }).catch(function (err) {
                    _this.exportWordDialog = true
                })
            },
            openPageoffice: function () {

                let host = hostUrl;
                let nginx = '/pageofficePath/';
                let rgstrId = this.currentNodeId;
                let type = "20" + this.professionType;
                let persId = this.persId;
                let href = 'pageoffice://|' + host + nginx + '/pageoffice/pblmlist/word/' + type + '/' + rgstrId + '?persId=' + persId + '|width=1100px;height=800px;ismodal=false;||91A4EE66EC1921F376873E85D6C74FFA|A890649B44577C32CE1930797E1299F9';
                let a = document.createElement('a'); // 创建a标签
                a.setAttribute('href', href);// href链接
                a.click();// 自执行点击事件
                console.log(href)
            },
            closeLeft() {
                this.isOpen = false
                this.leftWidth = 0
                this.rightWidth = 24
            },
            openLeft() {
                this.isOpen = true
                this.leftWidth = 5
                this.rightWidth = 19
            },
            // 展示操作日志
            showDailyRecord() {
                this.dailyRecordVisible = true
            },
            showBcqdFn(){
              if(!this.currentNodeId){
                this.$message.warning('请先在左侧选择工程！');
                return
              }
              if(!this.professionType){
                this.$message.warning('请选择专业类型');
                return
              }
              this.$refs.componentRef.getProblemList(this.tbIf)
            },
            showBcqdFn1(){
              if(!this.currentNodeId){
                this.$message.warning('请先在左侧选择工程！');
                return
              }
              if(!this.professionType){
                this.$message.warning('请选择专业类型');
                return
              }
              this.$refs.componentRef.getProblemList1(this.tbIf)
            }
        },
        //生命周期 - 创建完成（可以访问当前this实例）
        created() {

        },
        //生命周期 - 挂载完成（可以访问DOM元素）
        mounted() {
            this.getTreeData();
            //this.getMenu();
            let currentOrgId = localStorage.getItem("currentOrgId") || ''
            if (currentOrgId == '034') {
                // 福建专属菜单
                this.menuLists = this.menuListForFujian;
                this.reallMenuLists = this.menuListForFujian;
            } else if (currentOrgId == '063') {
                // 青海专属菜单
                this.menuLists = this.menuListForQinghai;
                this.reallMenuLists = this.menuListForQinghai;
            } else {
                if(!this.isHb){
                    this.menuList.forEach((item,index)=>{
                        let newArr = item.children.filter(function(item,index){
                            return item.title != '必查清单';
                        })
                        item.children = newArr
                    })
                }
                this.menuLists = this.menuList;
                this.reallMenuLists = this.menuLists;
            }
            this.getYearPc();

        },
        beforeCreate() { }, //生命周期 - 创建之前
        beforeMount() { }, //生命周期 - 挂载之前
        beforeUpdate() { }, //生命周期 - 更新之前
        updated() { }, //生命周期 - 更新之后
        beforeDestroy() { }, //生命周期 - 销毁之前
        destroyed() { }, //生命周期 - 销毁完成
        activated() { }, //如果页面有keep-alive缓存功能，这个函数会触发
    }
</script>
<style>
    .filter_tree {
        .el-tree-node__label {
            color: #666;
            font-size: large;
        }
    }

    .filter_tree.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
        background-color: #c7e9fe;
    }

    .assistant_btn {
        position: absolute;
        bottom: -10px;
        right: 20px;
        z-index: 999;
    }

    .open_board {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 24px;
        height: 30px;
        line-height: 30px;
        border: solid 1px #ddd;
        border-top-right-radius: 5px;
        border-bottom-right-radius: 5px;
        text-align: center;
        background-color: #bbebff;
        cursor: pointer;
    }
</style>
