<template>
    <div class="pd10">
        <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
            <el-tab-pane name="temUser" label="用户临时档案管理">
                <el-form :inline="true" class="demo-form-inline">

                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="运维单位:">
                                <Organization @click="queryNodeClick" ref="area" :valueTitle="editCheckName"
                                    :editCheckCode="editCheckCode"></Organization>
                            </el-form-item>

                            <el-button size="small" type="primary" icon="el-icon-search" @click="
                                pageNum = 1;
                            pageListInit()">
                                查询
                            </el-button>
                            <el-button style="float: right" type="primary" icon="el-icon-download" @click="exportEvent">
                                导出
                            </el-button>

                            <el-button style="float: right" size="small" class="ml10" type="primary"
                                icon="el-icon-s-promotion" @click="filePushDialog">
                                附件上送
                            </el-button>

                            <el-button style="float: right" type="primary" class="ml10" icon="el-icon-s-promotion"
                                @click="uploadGw()">上送网公司
                            </el-button>

                            <el-button type="primary" style="float: right" icon="el-icon-delete" @click="deleteFn">
                                删除
                            </el-button>

                            <el-button style="float: right" size="small" type="primary" icon="el-icon-plus"
                                @click="addTemUser()">新增
                            </el-button>


                        </el-col>


                    </el-row>

                </el-form>
                <el-row>
                    <el-col :span="24">
                        <vxe-table :data="pageData" :height="height" border size="mini" :highlight-current-row="true"
                            ref="workOrderTable" style="width: 100%" v-loading="isLoading"
                            header-cell-class-name="table_header" @checkbox-all="selectAllChangeEvent"
                            @checkbox-change="handleSelectionChange">
                            <vxe-table-column key="checkboxs" type="checkbox" align="center"
                                width="55"></vxe-table-column>
                            <template v-for="(item, index) in tableData">
                                <vxe-table-column align="center" :field="item.prop" :title="item.label" :key="index" :sortable="item.sortable"
                                    show-overflow :min-width="item.width" :formatter="tableDateFilter">
                                </vxe-table-column>
                            </template>


                            <vxe-table-column key="uploadStatus" field="uploadStatus"  title="状态" fixed="right"
                                align="center" width="100">
                                <template slot-scope="scope">
                                    <el-tag type="primary" size="small" style="color: #409eff; background: #ecf5ff"
                                        v-if="scope.row.uploadStatus == 0">
                                        未上送
                                    </el-tag>
                                    <el-tag type="primary" size="small" style="color: #67c23a; background: #f0f9eb"
                                        v-if="scope.row.uploadStatus == 1">
                                        已上送
                                    </el-tag>
                                    <el-tag type="primary" size="small" style="color: #909399; background: #f4f4f5"
                                        v-if="scope.row.uploadStatus == 2">
                                        取消上送
                                    </el-tag>
                                    <el-tag type="primary" size="small" style="color: orange; background: #f4f4f5"
                                        v-if="scope.row.uploadStatus == 3">
                                        待重新上送
                                    </el-tag>

                                </template>
                            </vxe-table-column>

                            <vxe-table-column key="operate" field="" show-overflow align="center" title="操作"
                                min-width="280px" fixed="right">
                                <template slot-scope="scope">
                                    <el-button type="primary" size="mini" @click="openUpdate(scope.row)">修改
                                    </el-button>
                                    <el-button type="primary" size="mini" @click="openProcess(scope.row)">全过程跟踪
                                    </el-button>

                                    <el-dropdown size="mini" style="margin-left: 10px;">
                                        <el-button type="primary">
                                            更多<i class="el-icon-arrow-down el-icon--right"></i>
                                        </el-button>
                                        <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item>
                                                <el-button style="margin-top: 10px" size="mini" type="primary"
                                                    @click="uploadFile(scope.row)">上传附件
                                                </el-button>
                                            </el-dropdown-item>
                                            <el-dropdown-item>
                                                <el-button style="margin-top: 10px" size="mini" type="primary"
                                                    @click="lookFn(scope.row)">查看附件
                                                </el-button>
                                            </el-dropdown-item>

                                        </el-dropdown-menu>
                                    </el-dropdown>
                                </template>
                            </vxe-table-column>
                        </vxe-table>
                        <el-pagination background align="right" @size-change="handleSizeChange"
                            @current-change="handleCurrentChange" :current-page="pageNum"
                            :page-sizes="[20, 30, 40, 50, 100]" :page-size="pageSize"
                            layout="total, sizes, prev, pager, next, jumper" :total="total"
                            class="mt10"></el-pagination>
                    </el-col>
                </el-row>
            </el-tab-pane>
            <el-tab-pane name="processTrack" label="用户全过程跟踪数据">
                <TrackIndex></TrackIndex>
            </el-tab-pane>
            <el-tab-pane name="processApproval" label="评估问题整改数据">
                <TrackApproval></TrackApproval>
            </el-tab-pane>
            <el-tab-pane name="processRun" label="用户试运行">
                <pilotRun></pilotRun>
            </el-tab-pane>
            <el-tab-pane name="processReport" label="全过程月报数据">
                <TrackReport></TrackReport>
            </el-tab-pane>
        </el-tabs>


        <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%" :before-close="handleClose">
            <el-form ref="form" :rules="userFormRules" :model="form" label-width="190px"
                style="padding: 0px 20px 0px 0px">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="运维单位:" prop="maintOrg">
                            <Organization @click="handleNodeClick" ref="Organization" :valueTitle="form.maintOrgName"
                                :editCheckCode="form.maintOrg"></Organization>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="用户/项目名称:" prop="consName">
                            <el-input style="width: 100%" v-model="form.consName" placeholder="请输入用户/项目名称"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="干扰源类型" prop="sourceType">
                            <el-select v-model="form.sourceType" placeholder="请选择干扰源类型" @change="sourceTypeChange">
                                <el-option v-for="item in sourceTypeList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="干扰源类别" prop="sourceCategory">
                            <el-select v-model="form.sourceCategory" placeholder="请选择干扰源类别">
                                <el-option v-for="item in sourceCategoryList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="场站属性" prop="sourceAttr">
                            <el-select v-model="form.sourceAttr" placeholder="请选择场站属性">
                                <el-option v-for="item in sourceAttrList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="并网/供电电压等级" prop="gcVoltageLevel">
                            <el-select v-model="form.gcVoltageLevel" filterable placeholder="请选择并网/供电电压等级">
                                <el-option v-for="item in gcVoltageLevelList" :key="item.algoDescribe"
                                    :label="item.name" :value="item.algoDescribe"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="并网/供电变电站名称:" prop="gcSubstationName">
                            <el-input style="width: 100%" v-model="form.gcSubstationName"
                                placeholder="请输入并网/供电变电站名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="并网/供电变电站电压等级" prop="gcSubstationVoltageLevel">
                            <el-select v-model="form.gcSubstationVoltageLevel" filterable placeholder="请选择并网/供电变电站电压等级">
                                <el-option v-for="item in gcVoltageLevelList" :key="item.algoDescribe"
                                    :label="item.name" :value="item.algoDescribe"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="并网/供电线路名称:" prop="gcFeederName">
                            <el-input style="width: 100%" v-model="form.gcFeederName"
                                placeholder="并网/供电线路名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="总装机容量（MVA）:" prop="ratedCapacity">
                            <el-input style="width: 100%" v-model="form.ratedCapacity"
                                placeholder="总装机容量（MVA）"></el-input>
                        </el-form-item>
                    </el-col>

                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="档案状态" prop="userDossierStatus">
                            <el-select v-model="form.userDossierStatus" placeholder="请选择档案状态">
                                <el-option v-for="item in userDossierStatusList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="所属电站类型" prop="gcSubstationType">
                            <el-select v-model="form.gcSubstationType" placeholder="请选择所属电站类型">
                                <el-option v-for="item in gcSubstationTypeList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="投运日期:" prop="operateTime">
                            <el-date-picker clearable v-model.trim="form.operateTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="投运日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="发布日期:" prop="releaseTime">
                            <el-date-picker clearable v-model.trim="form.releaseTime" type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss" placeholder="发布日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>

                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="营销用户编号:" prop="consNo">
                            <el-input v-model="form.consNo" placeholder="营销用户编号"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="mt10" label="发布人" prop="releaseUserName">
                            <el-input placeholder="发布人" v-model="form.releaseUserName"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">

                    </el-col>
                </el-row>

            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="submitForm('form')">确 定</el-button>
            </span>
        </el-dialog>

        <el-dialog :title="dialogTitleTrack" :visible.sync="dialogVisibleTrack" width="40%"
            :before-close="handleCloseTrack">
            <el-form ref="formTrack" :rules="rulesTrack" :model="formTrack" label-width="190px"
                style="padding: 0px 20px 0px 0px">
                <!--                <el-form-item label="运维单位:" class="mt10" prop="maintOrg">
                                    <Organization
                                        @click="handleNodeClick"
                                        ref="Organization"
                                        :valueTitle="editCheckName"
                                        :editCheckCode="editCheckCode"
                                    ></Organization>
                                </el-form-item>-->

                <el-row>

                    <el-col :span="12">
                        <el-form-item label="用户/项目名称" prop="tempUserDossierName">
                            <el-input v-model="formTrack.tempUserDossierName" readonly
                                placeholder="请选择用户/项目名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目阶段" prop="proStage">
                            <el-select v-model="formTrack.proStage" placeholder="请选择项目阶段">
                                <el-option v-for="item in proStageList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="规划可研-评估状态" prop="auditStatus">
                            <el-select v-model="formTrack.auditStatus" placeholder="请选择规划可研-评估状态">
                                <el-option v-for="item in auditStatusList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="规划可研-评估结论" prop="auditResult">
                            <el-select v-model="formTrack.auditResult" clearable placeholder="请选择规划可研-评估结论">
                                <el-option v-for="item in auditResultList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="规划可研-审查人" prop="auditUserName">
                            <!--                            <el-select v-model="formTrack.auditUserId" placeholder="请选择规划可研-审查人" clearable
                                                                   @change="userToForm">
                                                            <el-option
                                                                v-for="item in userList"
                                                                :key="item.id"
                                                                :label="item.name"
                                                                :value="item.id"
                                                            ></el-option>
                                                        </el-select>-->
                            <el-input style="width: 100%" v-model="formTrack.auditUserName"
                                placeholder="规划可研-审查人"></el-input>

                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="规划可研-审查时间:" prop="auditTime">
                            <el-date-picker clearable v-model.trim="formTrack.auditTime" type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss" placeholder="规划可研-审查时间">
                            </el-date-picker>
                        </el-form-item>


                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="竣工验收-验收状态" prop="approvalStatus">
                            <el-select v-model="formTrack.approvalStatus" clearable placeholder="请选择竣工验收-验收状态">
                                <el-option v-for="item in approvalStatusList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>

                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="竣工验收-验收结论" prop="approvalResult">
                            <el-select v-model="formTrack.approvalResult" clearable placeholder="请选择竣工验收-验收结论">
                                <el-option v-for="item in approvalResultList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>

                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="竣工验收-验收负责人" prop="approvalDutyUserName">
                            <!--                        @change="approvalUserToForm"     <el-select v-model="formTrack.approvalDutyUserId" clearable
                                                                   placeholder="请选择竣工验收-验收负责人">
                                                            <el-option
                                                                v-for="item in userList"
                                                                :key="item.id"
                                                                :label="item.name"
                                                                :value="item.id"
                                                            ></el-option>
                                                        </el-select>-->

                            <el-input clearable style="width: 100%" v-model="formTrack.approvalDutyUserName"
                                placeholder="竣工验收-验收负责人"></el-input>
                        </el-form-item>

                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="竣工验收-验收时间" prop="approvalTime">
                            <el-date-picker clearable v-model.trim="formTrack.approvalTime" type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss" placeholder="竣工验收-验收时间">
                            </el-date-picker>
                        </el-form-item>

                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="总超标天数" prop="allOvCountDay">
                            <el-input style="width: 100%" v-model="formTrack.allOvCountDay"
                                placeholder="总超标天数"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="监测天数" prop="monitorDay">
                            <el-input style="width: 100%" v-model="formTrack.monitorDay" placeholder="监测天数"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="试运行-是否超标" prop="testIsOv">
                            <el-select v-model="formTrack.testIsOv" clearable placeholder="请选择试运行-是否超标">
                                <el-option v-for="item in testIsOvList" :key="item.value" :label="item.name"
                                    :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="试运行出具单位名称" prop="testRunIssueOrgName">
                            <el-input style="width: 100%" v-model="formTrack.testRunIssueOrgName"
                                placeholder="试运行出具单位名称"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>


                <el-row>
                    <el-col :span="12">
                        <el-form-item label="开始监测日期:" prop="startMonitorDate">
                            <el-date-picker clearable v-model.trim="formTrack.startMonitorDate" type="date"
                                value-format="yyyy-MM-dd" placeholder="开始监测日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="投运日期:" prop="operateDate">
                            <el-date-picker clearable v-model.trim="formTrack.operateDate" type="date"
                                value-format="yyyy-MM-dd" placeholder="投运日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>


                <el-row>
                    <el-col :span="12">
                        <el-form-item label="运行天数" prop="testRunDay">
                            <el-input style="width: 100%" v-model="formTrack.testRunDay" placeholder="运行天数"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="审查完成时间" prop="auditFinalTime">
                            <el-date-picker clearable v-model.trim="formTrack.auditFinalTime" type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss" placeholder="审查完成时间">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="审查出具单位名称" prop="auditIssueOrgName">
                            <el-input style="width: 100%" v-model="formTrack.auditIssueOrgName"
                                placeholder="审查出具单位名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" style="margin-bottom: 20px">
                        <el-form-item label="电能质量专业审查意见" prop="professionalAuditOpinion">
                            <el-input style="width: 100%" type="textarea" v-model="formTrack.professionalAuditOpinion"
                                placeholder="电能质量专业审查意见"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="审查单位" prop="auditOrgName">
                            <el-input style="width: 100%" v-model="formTrack.auditOrgName"
                                placeholder="电能质量专业审查意见"></el-input>
                        </el-form-item>

                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="验收完成时间" prop="approvalFinalTime">
                            <el-date-picker clearable v-model.trim="formTrack.approvalFinalTime" type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss" placeholder="验收完成时间">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="遗留问题" prop="legacyProblem">
                            <el-input style="width: 100%" v-model="formTrack.legacyProblem"
                                placeholder="遗留问题"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="验收建议" prop="approvalAdvise">
                            <el-input style="width: 100%" v-model="formTrack.approvalAdvise"
                                placeholder="验收建议"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>


                <el-row>
                    <el-col :span="12">
                        <el-form-item label="验收参与人名称" prop="approvalJoinUserName">
                            <el-input style="width: 100%" v-model="formTrack.approvalJoinUserName"
                                placeholder="验收参与人名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="关联营销档案时间" prop="relConsTime">
                            <el-date-picker clearable v-model.trim="formTrack.relConsTime" type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss" placeholder="关联营销档案时间">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="操作人名称" prop="operateUserName">
                            <el-select v-model="formTrack.operateUserName" clearable placeholder="操作人名称">
                                <el-option v-for="item in userList" :key="item.id" :label="item.name"
                                    :value="item.id"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="测试结论" prop="testResult">
                            <el-select v-model="formTrack.testResult" clearable placeholder="测试结论">
                                <el-option v-for="item in testResultList" :key="item.value" :label="item.name"
                                    :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">

                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="越限指标" prop="ovIndexs">
                            <el-select v-model="formTrack.ovIndexs" clearable placeholder="越限指标">
                                <el-option v-for="item in ovIndexsList" :key="item.gvalue" :label="item.name"
                                    :value="item.gvalue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="handleCloseTrack">取 消</el-button>
                <el-button type="primary" @click="submitFormTrack('formTrack')">确 定</el-button>
            </span>
        </el-dialog>

        <!-- 上传文件 -->
        <el-dialog :close-on-click-modal="false" title="附件上传" :visible.sync="uploadInformation"
            :before-close="uploadClose" width="20%" class="dialog" height="280px">
            <el-form label-width="100px" :model="formLine" ref="fileForm" :rules="rules">
                <el-form-item label="附件分类:" class="mt10" prop="classification">
                    <el-select v-model="formLine.classification" clearable placeholder="请选择附件分类">
                        <el-option v-for="item in classificationData" :key="item.id" :label="item.name"
                            :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="报告时间:" class="mt20 timeBox" prop="uploadTime">
                    <el-date-picker v-model="formLine.uploadTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime"
                        placeholder="选择日期时间"></el-date-picker>
                </el-form-item>
                <el-form-item label="上送人:" class="mt20" prop="uploaderName">
                    <el-select v-model="formLine.uploaderId" clearable placeholder="请选择上送人"
                        @change="changeUploaderName">
                        <el-option v-for="item in ImplementationPeople" :key="item.id" :label="item.name"
                            :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="附件:" class="mt20">
                    <el-upload ref="upload" action="#" class="upload-files" accept="" :headers="headers" name="file"
                        multiple :auto-upload="false" :file-list="fileList" :on-change="handleChange" :limit="1"
                        :on-exceed="handleExceed" :before-remove="beforeRemove">
                        <el-button slot="trigger" size="mini" type="primary">选取文件</el-button>
                    </el-upload>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="uploadClose">取 消</el-button>
                <el-button type="primary" @click="uploadFn">确 定</el-button>
            </span>
        </el-dialog>

        <!-- 查看附件/附件上送 -->
        <el-dialog :close-on-click-modal="false" :title="uploadTitle" :visible.sync="lookUpload"
            :before-close="lookUploadClose" width="80%">
            <el-form ref="form" inline :model="formLine">
                <el-form-item label="附件分类:" class="mt10" prop="classification">
                    <el-select v-model="formLine.classification" clearable placeholder="请选择附件分类">
                        <el-option v-for="item in classificationData" :key="item.id" :label="item.name"
                            :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item class="mt10">
                    <el-button size="small" type="primary" icon="el-icon-search" @click="lookOnsubmit">查询</el-button>
                </el-form-item>
                <el-form-item class="mt10">
                    <el-button size="small" v-if="uploadType == 1" type="primary" icon="el-icon-search"
                        @click="delFile">删除附件</el-button>
                </el-form-item>


            </el-form>
            <vxe-table stripe size="mini" :row-config="{ isCurrent: true, isHover: true }" :data="uploadData"
                highlight-current-row border :height="vh1" header-cell-class-name="table_header"
                @checkbox-all="selectAllChangeEvent2" @checkbox-change="handleSelectionChange2">
                <vxe-table-column type="checkbox" align="center" width="55"></vxe-table-column>
                <vxe-table-column field="uploadTime" show-overflow align="center" title="上传时间"
                    min-width="120"></vxe-table-column>

                <vxe-table-column field="attachmentName" show-overflow align="center" title="附件名称" min-width="400">
                    <template slot-scope="scope">
                        <span style="color: blue; text-decoration: underline; cursor: pointer"
                            @click="downLoadFn(scope.row)">
                            {{ scope.row.attachmentName }}
                        </span>
                    </template>
                </vxe-table-column>
                <vxe-table-column field="attachmentType" show-overflow align="center" title="附件类型" min-width="100"
                    :formatter="formFilter2"></vxe-table-column>
                <vxe-table-column field="uploaderName" show-overflow align="center" title="上送人"
                    min-width="100"></vxe-table-column>
                <vxe-table-column field="isUploadHead" show-overflow align="center" title="是否上送网公司" min-width="100px">
                    <template slot-scope="scope">
                        <el-tag type="primary" size="mini" style="color: #409eff; background: #ecf5ff"
                            v-if="scope.row.isUploadHead == 0">
                            未上送
                        </el-tag>
                        <el-tag type="primary" size="mini" style="color: #67c23a; background: #f0f9eb"
                            v-if="scope.row.isUploadHead == 1">
                            已上送
                        </el-tag>
                        <el-tag type="primary" size="small" style="color: #909399; background: #f4f4f5"
                            v-if="scope.row.isUploadHead == 2">
                            取消上送
                        </el-tag>
                        <el-tag type="primary" size="small" style="color: orange; background: #f4f4f5"
                            v-if="scope.row.isUploadHead == 3">
                            待重新上送
                        </el-tag>
                    </template>
                </vxe-table-column>
            </vxe-table>


            <span slot="footer" class="dialog-footer" v-if="uploadType == 0">
                <el-button type="primary" @click="isUploadFn">确 定</el-button>
            </span>


        </el-dialog>

    </div>
</template>

<script>


import { dicData } from '@/assets/commjs/dictypeData'
import {
    addPmsTemUser,
    updatePmsTemUser,
    pageList,
    delPmsTemUser,
    getById,
    addTemProcessTrack,
    updateTemProcessTrack,
    getAllUserList, upGwTemUser
} from '@/api/pmsUpload/processFollow'
import Organization from '@/views/Process-supervision/Supervisionmanage2/Area/Organization.vue'
import Area from '@/views/components/Area/Area.vue'
import TrackIndex from '@/views/gwPush/processFollow/track/track.vue'
import TrackReport from '@/views/gwPush/processFollow/track/trackReport.vue'
import TrackApproval from '@/views/gwPush/processFollow/track/trackApproval.vue'
import pilotRun from '@/views/gwPush/processFollow/track/pilotRun.vue'
import { delFile, detail, getUserListByDeptId, list, planUpload, pushFile } from '@/api/Supervisionmanage2/Workplan'

export default {
    components: { Organization, Area, TrackIndex, TrackReport, TrackApproval, pilotRun },
    data() {
        return {
            vh: '',
            vh1: '',
            height: null,
            activeName: 'temUser',
            isLoading: false,

            ImplementationPeople: [], //实施人员
            classificationData: [],
            uploadInformation: false,
            formLine: {
                classification: '',
                uploadTime: '',
                uploaderName: '',
                uploaderId: ''
            },
            headers: {
                Authorization: window.sessionStorage.getItem('cntoken')
            },
            fileList: [],
            uploadTitle: '',
            lookUpload: false,
            uploadData: [],
            multipleSelection2: [], //附件checkbox


            form: {
                maintOrg: '',
                maintOrgName: '',
                consName: '',
                sourceType: '',
                sourceCategory: '',
                sourceAttr: '',
                gcVoltageLevel: '',
                gcSubstationName: '',
                gcSubstationVoltageLevel: '',
                ratedCapacity: null,
                userDossierStatus: '',
                gcSubstationType: '',
                operateTime: '',
                releaseTime: '',
                consNo: '',
                releaseUserName: '',
                gcFeederName: ''
            },
            userFormRules: {
                maintOrg: [{ required: true, message: '不可为空', trigger: 'blur' }],
                consName: [{ required: true, message: '不可为空', trigger: 'blur' }],
                sourceType: [{ required: true, message: '不可为空', trigger: 'blur' }],
                sourceCategory: [{ required: true, message: '不可为空', trigger: 'blur' }],
                sourceAttr: [{ required: true, message: '不可为空', trigger: 'blur' }],
                gcVoltageLevel: [{ required: true, message: '不可为空', trigger: 'blur' }],
                gcSubstationName: [{ required: true, message: '不可为空', trigger: 'blur' }],
                gcSubstationVoltageLevel: [{ required: true, message: '不可为空', trigger: 'blur' }],
                ratedCapacity: [{ required: true, message: '不可为空', trigger: 'blur' }],
                userDossierStatus: [{ required: true, message: '不可为空', trigger: 'blur' }],
            },


            formTrack: {
                tempUserDossierName: '',
                proStage: '',
                auditStatus: '',
                auditResult: '',
                auditUserId: '',
                auditUserName: '',
                auditTime: '',
                approvalStatus: '',
                approvalResult: '',
                approvalDutyUserId: '',
                approvalDutyUserName: '',
                approvalTime: '',
                consNo: '',
                testIsOv: '',
                allOvCountDay: '',
                monitorDay: '',
                startMonitorDate: '',
                monitorIds: '',
                operateDate: '',
                testRunDay: '',
                auditFinalTime: '',
                auditIssueOrgName: '',
                professionalAuditOpinion: '',
                auditOrg: '',
                auditOrgName: '',
                approvalFinalTime: '',
                legacyProblem: '',
                approvalAdvise: '',
                approvalJoinUserName: '',
                relConsTime: '',
                operateUserName: '',
                testResult: '',
                testRunIssueOrgName: '',
                ovIndexs: ''

            },

            sourceTypeList: [],
            sourceTypeChildenList: [],
            sourceCategoryList: [],
            sourceAttrList: [],
            gcVoltageLevelList: [],
            userDossierStatusList: [],
            gcSubstationTypeList: [],
            testResultList: [{ value: '01', name: '合格' }, { value: '02', name: '越限' }],


            proStageList: [],
            auditStatusList: [],
            auditResultList: [],
            userList: [],
            approvalStatusList: [],
            approvalResultList: [],
            testIsOvList: [{ value: '0', name: '否' }, { value: '1', name: '是' }],
            ovIndexsList: [],

            dialogVisible: false,
            dialogTitle: '',

            dialogVisibleTrack: false,
            dialogTitleTrack: '',

            statisticalType: '03',
            searchBeginTime: '',
            searchEndTime: '',

            multipleSelection: [],


            tableData: [
                { prop: 'provinceOrgName', label: '所属省份', width: 150 },
                { prop: 'cityOrgName', label: '所属地市', width: 180 },
                { prop: 'maintOrgName', sortable:true, label: '运维单位', width: 180 },


                { prop: 'consName', label: '用户/项目名称', width: 320 },
                { prop: 'sourceType', label: '干扰源类型', width: 180 },

                { prop: 'sourceCategory', sortable:true, label: '干扰源类别', width: 160 },
                { prop: 'sourceAttr', sortable:true, label: '场站属性', width: 160 },
                { prop: 'gcVoltageLevel', sortable:true, label: '并网/供电电压等级', width: 170 },
                { prop: 'gcSubstationName', label: '并网/供电变电站名称', width: 180 },


                { prop: 'gcSubstationVoltageLevel', sortable:true, label: '并网/供电变电站电压等级', width: 180 },
                { prop: 'ratedCapacity', label: '总装机容量（MVA）', width: 170 },
                { prop: 'userDossierStatus', sortable:true, label: '档案状态', width: 120 },
                { prop: 'releaseUserName', label: '发布人', width: 120 },
                { prop: 'gcSubstationType', label: '所属电站类型', width: 120 },
                { prop: 'operateTime', sortable:true, label: '投运日期', width: 120 },

                { prop: 'releaseTime', sortable:true, label: '发布时间', width: 180 },
                { prop: 'consNo', label: '营销用户编号', width: 180 }

            ],
            pageData: [],

            objId: '',
            ids: [],
            uploadType: 0,// 附件dialog控制；0.上送 1.查看

            operateType: 0, //0.新增 1.修改

            editCheckCode: JSON.parse(window.sessionStorage.getItem('Info')).deptId,
            editCheckName: '',
            rules: {},

            rulesTrack: {},

            pageNum: 1,
            pageSize: 20,
            total: 0

        }
    },
    created() {

        let day = new Date()
        day.setDate(day.getDate() - 1)
        this.statisticalType = '03'
        this.searchBeginTime = this.$tools.formatDate(day, 'yyyy-MM-dd')

        this.sourceTypeList = dicData('pms_disturb_type', [])
        this.sourceTypeChildenList = dicData('pms_disturb_sort', [])
        this.sourceAttrList = dicData('pms_new_energy_obj', [])
        this.gcVoltageLevelList = dicData('Dev_Voltage', [])
        this.userDossierStatusList = dicData('File_status', [])
        this.gcSubstationTypeList = dicData('type_of_station', [])


        this.proStageList = dicData('project_phase', [])
        this.auditStatusList = dicData('pms_eval_status', [])
        this.auditResultList = dicData('pms_eval_review', [])
        this.approvalStatusList = dicData('pms_acceptance_phase', [])
        this.approvalResultList = dicData('pms_conclusion', [])

        //附件分类
        this.classificationData = dicData('file_type', [])

        getAllUserList().then(res => {
            this.userList = res.data
        })
        this.getUserId()
    },
    mounted() {
        this.pageListInit()
        this.setHeight()
        window.addEventListener('resize', this.setHeight)
    },
    beforeDestroy() {
        window.removeEventListener('resize', this.setHeight)
    },
    methods: {
        //f附件复选框
        handleSelectionChange2(val) {
            this.multipleSelection2 = val.records
        },
        selectAllChangeEvent2(val) {
            // console.log(val.records);
            this.multipleSelection2 = val.records
        },
        lookUploadClose() {
            this.lookUpload = false
        },

        //计划附件上送确认
        isUploadFn() {
            if (this.multipleSelection2.length == 0) {
                this.$message({
                    showClose: true,
                    message: '请选择一条数据上送!!!',
                    type: 'warning'
                })
                return
            }
            this.$confirm('是否确认上送?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    let busIds = []
                    this.multipleSelection2.forEach(item => {
                        busIds.push(item.uuid)
                    })

                    pushFile(busIds).then(res => {
                        if ((res.code == 'A0000')) {
                            this.$message({
                                dangerouslyUseHTMLString: true,
                                type: 'success',
                                message: res.data
                            })
                            this.lookOnsubmit()
                            this.multipleSelection2 = []
                        }
                        // this.lookUpload = false

                    })
                })
                .catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消上送'
                    })
                })
        },

        formFilter2(row, column) {
            if (row.column.property == 'attachmentType') {
                let title = ''
                this.classificationData.forEach(item => {
                    if (item.id == row.row.attachmentType) {
                        title = item.name
                    }
                })
                return title
            } else {
                return row.row[row.column.property]
            }
        },

        //附件下载
        downLoadFn(val, type) {
            this.$confirm('是否确认附件下载?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    let data = {
                        busId: val.busiId,
                        type: 2,
                        attachmentType: val.attachmentType
                    }
                    detail(data).then(res => {
                        let blob = new Blob([res], {
                            type: 'application/vnd.ms-excel'
                        })
                        const url = window.URL.createObjectURL(blob)
                        const link = document.createElement('a') // 创建a标签
                        link.href = url // link.download = "电压暂降事件分析报告"; // 设置下载的文件名
                        link.download = val.attachmentName // 设置下载的文件名
                        document.body.appendChild(link)
                        link.click() //执行下载
                        document.body.removeChild(link)
                    })
                })
                .catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消下载'
                    })
                })
        },

        getUserId() {
            let form = {
                deptId: JSON.parse(window.sessionStorage.getItem('Info')).deptId
            }
            getUserListByDeptId(form).then(res => {
                this.ImplementationPeople = res.data
            })
        },
        changeUploaderName(val) {
            // console.log(val);
            this.ImplementationPeople.forEach(item => {
                if (val == item.id) {
                    this.formLine.uploaderName = item.name
                }
            })
        },
        handleChange(file, fileList) {
            // console.log(file, fileList);
            this.fileList = fileList
        },
        handleExceed(files, fileList) {
            this.$message.warning(
                `当前限制选择 1个文件,本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length
                } 个文件`
            )
        },
        beforeRemove(file, fileList) {
            // console.log(file,fileList);
            this.fileList = []
        },

        uploadClose() {
            this.uploadInformation = false
            this.$refs.upload.clearFiles()
            this.fileList = []
            this.pageListInit()
        },

        uploadFile(val) {
            (this.formLine = {
                classification: '',
                uploadTime: '',
                uploaderName: '',
                uploaderId: ''
            })
            this.objId = val.objId
            this.uploadInformation = true
            this.$nextTick(() => {
                this.$refs['fileForm'].clearValidate()
            })
        },

        //查看附件
        lookFn(val) {
            this.ids = []
            this.uploadTitle = '查看附件'
            this.lookUpload = true
            this.formLine.classification = ''
            this.ids.push(val.objId)
            this.uploadType = 1
            this.lookOnsubmit()
        },
        lookOnsubmit() {
            let form = {
                attachmentType: this.formLine.classification,
                ids: this.ids,
                type: 2
            }
            list(form).then(res => {
                this.uploadData = res.data
            })
        },


        //计划附件上送
        filePushDialog() {
            this.uploadType = 0
            this.ids = []
            if (this.multipleSelection.length == 0) {
                this.$message({
                    showClose: true,
                    message: '请选择一条数据上送!!!',
                    type: 'warning'
                })
                return
            }
            this.uploadTitle = '附件上送'
            this.lookUpload = true
            this.formLine.classification = ''
            this.multipleSelection.forEach(item => {
                this.ids.push(item.objId)
            })
            this.lookOnsubmit()
        },


        delFile() {
            if (this.multipleSelection2.length == 0) {
                this.$message({
                    type: 'warning',
                    message: '请选择一个文件删除！！！'
                })
            } else {
                let uuid = this.multipleSelection2.map(item => item.uuid)
                this.$confirm('是否确认删除附件?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {

                    delFile(uuid).then(res => {
                        this.$message({
                            type: 'success',
                            message: '删除成功'
                        })
                        this.lookOnsubmit()
                    })
                })
                    .catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消删除'
                        })
                    })
            }
        },

        //上传附件确认
        uploadFn() {
            let fileName = this.fileList[0].name
            let pos = fileName.lastIndexOf('.')
            let includes = fileName.substring(pos, fileName.length)
            console.log(includes)
            let fileLastArr = ['.doc', '.docx', '.xls', '.xlsx', '.pdf', '.txt', '.zip', '.rar']
            if (!fileLastArr.includes(includes)) {
                this.$message.error('当前不支持该格式文件')
                return false
            }


            this.$refs.fileForm.validate(value => {
                if (value == true) {
                    this.$confirm('是否确认上传附件?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    })
                        .then(() => {
                            //console.log(this.fileList);
                            if (this.fileList.length == 0) {
                                this.$message({
                                    type: 'warning',
                                    message: '请选择一个文件上传！！！'
                                })
                            } else {
                                const formData = new FormData()
                                this.fileList.forEach(item => {
                                    // console.log(item);
                                    if (item.raw == '') {
                                    } else {
                                        formData.append('files', item.raw)
                                    }
                                })
                                formData.append('planId', this.objId)
                                formData.append('type', 2)
                                formData.append('attachmentType', this.formLine.classification)
                                formData.append('uploadTime', this.formLine.uploadTime)
                                formData.append('uploaderName', this.formLine.uploaderName)
                                formData.append('uploaderId', this.formLine.uploaderId)
                                planUpload(formData).then(res => {
                                    if (res.code == 'A0000') {
                                        this.$message({
                                            message: res.message,
                                            type: 'success'
                                        })
                                        this.uploadInformation = false
                                        this.$refs.upload.clearFiles()
                                        this.fileList = []
                                        if (this.tag == 1) {
                                            this.onSubmit()
                                        } else if (this.yag == 2) {
                                            this.problemOnSubmit()
                                        }
                                    }
                                })
                            }
                        })
                        .catch(() => {
                            this.$message({
                                type: 'info',
                                message: '已取消上传'
                            })
                        })
                }
            })
        },

        sourceTypeChange(val) {
            if (val === '01') {
                this.sourceCategoryList = this.sourceTypeChildenList.filter(item => {
                    return item.algoDescribe === 0
                })

            } else {
                this.sourceCategoryList = this.sourceTypeChildenList.filter(item => {
                    return item.algoDescribe === 1
                })
            }
        },
        submitForm(formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {

                    if (this.dialogTitle == '新增用户档案') {
                        addPmsTemUser(this.form).then(res => {
                            if (res.code == 'A0000') {
                                this.$message({
                                    message: '新增成功!',
                                    type: 'success'
                                })
                                this.handleClose()
                                this.pageListInit()
                            }

                        })
                    } else {
                        updatePmsTemUser(this.form).then(res => {
                            if (res.code == 'A0000') {
                                this.$message({
                                    message: '修改成功!',
                                    type: 'success'
                                })
                                this.handleClose()
                                this.pageListInit()
                            }

                        })
                    }

                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },

        submitFormTrack(formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {

                    if (this.operateType == 0) {
                        addTemProcessTrack(this.formTrack).then(res => {
                            if (res.code == 'A0000') {
                                this.$message({
                                    message: '新增成功!',
                                    type: 'success'
                                })
                                this.handleCloseTrack()
                                this.pageListInit()
                            }

                        })
                    } else {
                        updateTemProcessTrack(this.formTrack).then(res => {
                            if (res.code == 'A0000') {
                                this.$message({
                                    message: '修改成功!',
                                    type: 'success'
                                })
                                this.handleCloseTrack()
                                this.pageListInit()
                            }

                        })
                    }

                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },

        resetForm(formName) {
            this.$nextTick(() => {
                this.$refs[formName].resetFields()
            })
        },

        handleClick(tab, event) {

        },

        // 切换选项
        handleNodeClick(data) {
            // console.log(data);
            this.form.maintOrg = data.code
            this.form.maintOrgName = data.name
        },

        handleNodeClickAuditOrg(data) {
            // console.log(data);
            this.formTrack.auditOrg = data.code
            this.formTrack.auditOrgName = data.name
        },


        queryNodeClick(data) {
            this.editCheckCode = data.id
            this.editCheckName = data.name
        },

        setHeight() {
            this.height = window.sessionStorage.getItem('appheight') - 170
            this.vh1 = window.sessionStorage.getItem('appheight') - 610
        },
        //获取主网运行指标统计数据
        pageListInit() {
            this.isLoading = true
            let param = {
                pageNum: this.pageNum,
                pageSize: this.pageSize,
                maintOrg: this.editCheckCode,
                dataType: this.statisticalType,
                searchBeginTime: this.searchBeginTime
            }
            pageList(param).then(res => {
                if (res.code === 'A0000') {
                    this.total = res.data.total
                    this.pageData = res.data.records
                    this.isLoading = false
                }

            })
        },

        addTemUser() {
            this.dialogTitle = '新增用户档案'
            this.dialogVisible = true

            this.form = {
                maintOrg: '',
                maintOrgName: '',
                consName: '',
                sourceType: '',
                sourceCategory: '',
                sourceAttr: '',
                gcVoltageLevel: '',
                gcSubstationName: '',
                gcSubstationVoltageLevel: '',
                ratedCapacity: null,
                userDossierStatus: '',
                gcSubstationType: '',
                operateTime: '',
                releaseTime: '',
                consNo: '',
                releaseUserName: ''
            }
        },

        openUpdate(row) {
            this.dialogTitle = '修改用户档案'
            this.dialogVisible = true
            let data = JSON.parse(JSON.stringify(row))
            this.form = data

            this.form.gcVoltageLevel = Number(data.gcVoltageLevel)
            this.form.gcSubstationVoltageLevel = Number(data.gcSubstationVoltageLevel)

            if (data.sourceType === '01') {
                this.sourceCategoryList = this.sourceTypeChildenList.filter(item => {
                    return item.algoDescribe === 0
                })
            } else {
                this.sourceCategoryList = this.sourceTypeChildenList.filter(item => {
                    return item.algoDescribe === 1
                })
            }
        },


        openProcess(row) {
            this.dialogTitleTrack = '全过程管理'
            this.dialogVisibleTrack = true
            this.resetForm('formTrack')


            let data = {
                tempUserDossierId: row.objId
            }
            getById(data).then(res => {
                if (res.code === 'A0000') {
                    if (res.data == null) {
                        this.formTrack.tempUserDossierId = row.objId
                        this.formTrack.tempUserDossierName = row.consName
                        this.operateType = 0

                    } else {
                        this.operateType = 1
                        this.formTrack = res.data
                    }
                }

            })

        },

        userToForm(val) {
            if (val && val != null && val != '') {
                let obj = this.userList.find(item => item.id === val)
                this.formTrack.auditUserName = obj.name
            } else {
                this.formTrack.auditUserName = ''
            }
        },

        approvalUserToForm(val) {
            if (val && val != null && val != '') {
                let obj = this.userList.find(item => item.id === val)
                this.formTrack.approvalDutyUserName = obj.name
            }
        },

        // 删除
        deleteFn() {
            if (this.multipleSelection.length == 0) {
                this.$message({
                    showClose: true,
                    message: '至少选择一条!!!',
                    type: 'warning'
                })
                return
            }
            this.$confirm('是否确认删除?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    let ids = []
                    this.multipleSelection.forEach(item => {
                        ids.push(item.objId)
                    })

                    delPmsTemUser(ids).then(res => {
                        if ((res.code == 'A0000')) {
                            this.$message({
                                type: 'success',
                                message: res.message
                            })
                        }
                        this.pageListInit()
                    })
                })
                .catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    })
                })
        },

        //每页条数改变时触发 选择一页显示多少行
        handleSizeChange(val) {
            this.pageSize = val
            this.pageListInit()
        },
        //当前页改变时触发 跳转其他页
        handleCurrentChange(val) {
            this.pageNum = val
            this.pageListInit()
        },
        //重置
        Reset() {
            this.$refs.area.form.valueTitle = '全国'
            this.$refs.interval.intervald = 1
        },
        //导出
        exportEvent() {
            this.$refs.workOrderTable.exportData({
                filename: '用户临时档案' + new Date().getTime(), // 文件名字
                sheetName: 'Sheet1',
                type: 'xlsx', //导出文件类型 xlsx 和 csv
                useStyle: true,
                data: this.pageData,
                columnFilterMethod: function (column, $columnIndex) {
                    return !(column.$columnIndex === 0)
                }
            })
        },


        handleClose() {
            this.resetForm('form')
            setTimeout(() => {
                this.dialogVisible = false
            }, 0)
        },

        handleCloseTrack() {
            this.resetForm('formTrack')
            this.dialogVisibleTrack = false
        },


        //上报网公司按钮触发
        uploadGw() {
            if (this.multipleSelection.length === 0) {
                this.$message({
                    type: 'warning',
                    message: '请选择至少一条上送'
                })
                return
            }

            this.$confirm('是否确认上送?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                let objIds = []
                this.multipleSelection.forEach(item => {
                    objIds.push(item.objId)
                })
                upGwTemUser(objIds).then(res => {
                    console.log(res)
                    if ((res.code == 'A0000')) {
                        this.$message({
                            type: 'success',
                            message: res.message
                        })
                    }
                    this.pageListInit()
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消上送'
                })
            })

        },

        //附件上送
        annexPush() {
            this.ids = []
            if (this.multipleSelection2.length == 0) {
                this.$message({
                    showClose: true,
                    message: '请选择一条数据上送!!!',
                    type: 'warning'
                })
                return
            }
            this.lookUpload = true
            this.formLine.classification = ''
            this.multipleSelection2.forEach(item => {
                this.ids.push(item.uuid)
            })
            this.lookOnsubmit()
        },

        handleSelectionChange(val) {
            this.multipleSelection = val.records
        },
        selectAllChangeEvent(val) {
            this.multipleSelection = val.records
        },

        tableDateFilter(row, column) {
            if (row.column.property == 'sourceType') {
                let tem = this.sourceTypeList.find(item => item.gvalue === row.row.sourceType)
                if (tem) {
                    return tem.name
                }
            } else if (row.column.property == 'sourceCategory') {
                if (row.row.sourceType == '01') {
                    let tem = this.sourceTypeChildenList.filter(it => it.algoDescribe == 0).find(item => item.gvalue === row.row.sourceCategory)
                    if (tem) {
                        return tem.name
                    }
                } else if (row.row.sourceType == '02') {
                    let tem = this.sourceTypeChildenList.filter(it => it.algoDescribe == 1).find(item => item.gvalue === row.row.sourceCategory)
                    if (tem) {
                        return tem.name
                    }
                }


            } else if (row.column.property == 'sourceAttr') {
                let tem = this.sourceAttrList.find(item => item.gvalue === row.row.sourceAttr)
                if (tem) {
                    return tem.name
                }
            } else if (row.column.property == 'gcVoltageLevel') {
                let tem = this.gcVoltageLevelList.find(item => item.algoDescribe == row.row.gcVoltageLevel)
                if (tem) {
                    return tem.name
                }
            } else if (row.column.property == 'gcSubstationVoltageLevel') {
                let tem = this.gcVoltageLevelList.find(item => item.algoDescribe == row.row.gcSubstationVoltageLevel)
                if (tem) {
                    return tem.name
                }
            } else if (row.column.property == 'userDossierStatus') {
                let tem = this.userDossierStatusList.find(item => item.gvalue == row.row.userDossierStatus)
                if (tem) {
                    return tem.name
                }
            } else if (row.column.property == 'gcSubstationType') {
                let tem = this.gcSubstationTypeList.find(item => item.gvalue == row.row.gcSubstationType)
                if (tem) {
                    return tem.name
                }
            } else {
                return row.row[row.column.property]
            }
        },


        timeChange() {
            let day = new Date()
            day.setDate(day.getDate() - 1)
            if (this.statisticalType == '01') {
                this.searchBeginTime = this.$tools.formatDate(day, 'yyyy-MM-dd').substring(0, 5) + '01-01'
                this.searchEndTime = this.searchBeginTime.substring(0, 5) + '12-31'
            } else if (this.statisticalType == '02') {
                this.searchBeginTime = this.$tools.formatDate(day, 'yyyy-MM-dd').substring(0, 8) + '01'
                this.searchEndTime =
                    this.$tools.formatDate(day, 'yyyy-MM-dd').substring(0, 8) +
                    this.getDaysInMonth(
                        this.searchBeginTime.substring(5, 7) - 0,
                        this.searchBeginTime.substring(0, 4) - 0
                    )
            } else {
                this.searchBeginTime = this.$tools.formatDate(day, 'yyyy-MM-dd')
                this.searchEndTime = this.searchBeginTime
            }
        },

        dateChange(e) {
            this.searchEndTime = this.searchBeginTime
        },
        monthChange(e) {
            this.searchEndTime = this.searchBeginTime.substring(0, 8) + this.getDaysInMonth(e.substring(5, 7), e.substring(0, 4))
        },
        yearChange(e) {
            this.searchEndTime = this.searchBeginTime.substring(0, 5) + '12-31'
        },
        getDaysInMonth(month, year) {
            return new Date(year, month, 0).getDate()
        }

    }
}
</script>
<style lang="less" scoped>
@import url('../../../styles/comStyle.less');
</style>
<style lang="less" scoped>
.el-date-editor.el-input,
.el-date-editor.el-input__inner {
    width: 100%;
}
</style>
