<template>
    <div class="project-progress">
        <!--大屏背景-->
        <background-video></background-video>
        <!--大屏内容-->
        <div class="screen-content-max">
            <screen-header :nav="5"></screen-header>
            <div class="screen-content">
                <el-row>
                    <el-col :span="6">
                        <module-one-1-1 label="节点完成率">
                            <div style="    margin-top: 10px;max-height: 265px;overflow-y: auto;margin-right: 8px;" class="scroll">
                                <div class="completion-item" v-for="(it, idx) in completionData" :key="idx">
                                    <div class="row-1">
                                        <svg class="my-svg-icon-blue"
                                            style="position: relative;top:-1px; width:16px;margin-right: 4px;vertical-align: middle;fill: currentColor;overflow: hidden;"
                                            viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                                            p-id="11733">
                                            <path
                                                d="M510.0032 492.9536c-12.16 0-24.3456-2.3808-35.9424-7.1168L71.7824 300.5952c-11.3408-4.6336-18.816-15.5648-19.072-27.8016s6.784-23.4496 17.92-28.544l400.1536-183.296a100.1728 100.1728 0 0 1 82.7648-0.3072l398.1056 178.8416c11.1616 5.0176 18.2784 16.1792 18.1248 28.416s-7.5776 23.2192-18.8672 27.9296l-404.3264 189.7216a94.26944 94.26944 0 0 1-36.5824 7.3984zM160.64 270.592l336.7424 158.3872a33.0496 33.0496 0 0 0 25.5232-0.1024l338.9952-162.3808-333.5424-149.8112a38.6688 38.6688 0 0 0-32 0.128L160.64 270.592z"
                                                fill="#040000" p-id="11734"></path>
                                            <path
                                                d="M510.1568 722.7648c-14.4896 0-28.9536-3.3536-42.1632-10.0864L68.3264 509.0816c-8.576-4.3776-15.0784-12.2624-16.9472-21.6832a30.7072 30.7072 0 0 1 15.0272-32.8192l189.6704-106.9568c19.5584-11.0336 44.3136-4.1216 55.3472 15.4368l10.2144 18.1248-175.1808 98.7904L495.872 657.92a31.5392 31.5392 0 0 0 28.672-0.0512l354.0224-181.9136-175.9488-100.736 10.3424-18.0736c11.1616-19.4816 35.968-26.2144 55.4496-15.0784l189.7984 108.672c9.7792 5.6064 15.6928 16.1024 15.4368 27.3664s-6.656 21.4784-16.6656 26.624l-404.352 207.7696a92.53376 92.53376 0 0 1-42.4704 10.2656z"
                                                fill="#040000" p-id="11735"></path>
                                            <path
                                                d="M512.2048 975.9744c-4.7872 0-9.5744-1.1264-13.952-3.3536L70.2464 754.5856c-8.576-4.3776-15.0784-12.2624-16.9472-21.7088a30.72512 30.72512 0 0 1 15.0272-32.8192l192.1536-108.3648c18.176-10.24 41.2416-3.8144 51.4816 14.3616l11.6224 20.608-175.1808 98.7904 363.7504 185.2928 368.3584-189.2608-175.9488-100.736 11.7504-20.5312c10.368-18.1248 33.4592-24.3968 51.584-14.0288l192.2816 110.08c9.7792 5.6064 15.6928 16.1024 15.4368 27.3664a30.72 30.72 0 0 1-16.6656 26.624l-432.6656 222.3104a31.0272 31.0272 0 0 1-14.08 3.4048z"
                                                fill="#040000" p-id="11736"></path>
                                        </svg>
                                        <span class="sp-name">{{ it.projectName }}</span>
                                    </div>
                                    <div class="row-2">
                                        <span class="sp-lbl" style="position: relative;top: -2px;color: #aaa;">节点完成率:</span>
                                        <span class="sp-chart">
                                            <idle-list-chart :width="310" :prop="Number(it.percent)"
                                                :color="'#6ab9fe'"></idle-list-chart>
                                        </span>
                                    </div>
                                    <div class="row-2">
                                        <span class="sp-lbl" style="color: #aaa;">当 前 节 点:</span>
                                        <span class="sp-text" style="color: rgb(1, 169, 255);">{{ it.nodeText }}</span>
                                    </div>
                                </div>
                            </div>
                        </module-one-1-1>
                    </el-col>
                    <el-col :span="6">
                        <module-one-1-1 label="节点计划预警">
                            <div class="quality-table special-table scheduled-alerts-list">
                                <el-table :data="nodePLanData" style="width: 100%;background: transparent;" height="265"
                                    ref="fbsubordinateUnit">

                                    <el-table-column prop="projectName" label="项目名称" width="150" class-name="text-left">
                                    </el-table-column>
                                    <el-table-column prop="nodeText" label="节点名称" class-name="text-left">
                                        <template slot-scope="scope">
                                            <span style="color:#01A9FF;font-size: 12px;">{{ scope.row.nodeText }}</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="days" label="状态" width="80">
                                        <template slot-scope="scope">
                                            <span :class="'finish-' + scope.row.finishState">{{ scope.row.finish }}</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="planEndDate" label="计划完成时间" width="100">
                                        <template slot-scope="{row}">
                                            {{ row.planEndDate | formatDate() }}
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </module-one-1-1>
                    </el-col>
                    <el-col :span="12">
                        <module-one-1-2 label="项目季度考核目标">
                            <img src="images/icon2001.png" style="position: absolute;cursor: pointer;right: 12px;top: 12px;"
                                @click="doShowDlg1">
                            <div class="quality-table special-table">
                                <el-table :data="getAssessData()" style="width: 100%;background: transparent;" height="265"
                                    ref="fbsubordinateUnit">

                                    <el-table-column prop="prj" label="项目名称" class-name="text-left"
                                        :show-overflow-tooltip="true"> </el-table-column>
                                    <el-table-column prop="deptName" label="责任主体" class-name="text-left"
                                        :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="comp" label="季度计划目标" class-name="text-left"
                                        :show-overflow-tooltip="true">
                                    </el-table-column>

                                    <el-table-column prop="planDate" label="计划完成日期" width="200" v-if="1 == 2">
                                    </el-table-column>
                                    <el-table-column prop="finish" label="实际完成" width="200" v-if="1 == 2">
                                        <template slot-scope="scope">
                                            <span style="font-size: 12px;"
                                                :class="'finish-' + scope.row.finishState">{{ scope.row.finish }}</span>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </module-one-1-2>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <module-one-1-2 label="项目推进明细">
                            <el-row style="padding: 20px;" :key="elKey">
                                <el-col :span="12">
                                    <div class="warning-info-title my-warning-info-title">
                                        <div :class="pushNav == 0 ? 'active' : ''" @click="doPushNav(0, '在建项目')">在建项目({{
                                            getPrjCateCount(0) }})</div>
                                        <div :class="pushNav == 1 ? 'active' : ''" @click="doPushNav(1, '拟建项目')">拟建项目({{
                                            getPrjCateCount(1) }})</div>
                                        <div :class="pushNav == 3 ? 'active' : ''" @click="doPushNav(3, '完成项目')">完成项目({{
                                            getPrjCateCount(3) }})</div>
                                    </div>
                                    <el-row>
                                        <el-col :span="8">
                                            <div class="survey_content">
                                                <div class="survey_content_img">
                                                    <img :src="pushUrl">
                                                </div>
                                            </div>
                                            <div class="survey_content_number labour-survey_content_number">
                                                <div class="survey_content_value"><span>{{ pushCount }}</span> 个</div>
                                                <p>{{ pushText }}</p>
                                            </div>
                                        </el-col>
                                        <el-col :span="16">
                                            <staff-survey-chart :height="220" unit=" " :data="pushData"
                                                :width="140"></staff-survey-chart>
                                        </el-col>
                                    </el-row>
                                </el-col>
                                <el-col :span="12" style="position: relative;">
                                    <div class="glr-title" style="margin-top:10px;color:#4DDEDF">建设项目节点明细</div>
                                    <img src="images/icon2001.png"
                                        style="position: absolute;cursor: pointer;right: 12px;top: 12px;"
                                        @click="showBuildNodeDlg">
                                    <div class="build-item">
                                        <div class="build-text" style="flex-grow: 1;">
                                            <div class="div-prj" v-if="scheduleInfo">
                                                <i style="color:#389DE3" class="el-icon-office-building"></i>
                                                {{ scheduleInfo.projectName }}
                                            </div>
                                            <template v-if="buildNode && buildNode.current">
                                                <div style="margin-top:12px;"><img src="images/title_icon.png"><span
                                                        class="sp-lbl" style="position: relative;top: -7px;color:#B8C9EE;">
                                                        {{ buildNode.current.baseBuildNode.nodeText }}</span></div>
                                                <div class="div-text scroll"
                                                    style="max-height: 140px;overflow: auto;color:#B8C9EE;padding-right: 12px;">
                                                    <div>
                                                        <table class="build-node-list"
                                                            v-if="buildNode && buildNode.nodes && buildNode.nodes.length > 0">
                                                            <tr class="header">
                                                                <th style="border-radius: 4px 0px 0px 0px;">项目</th>
                                                                <th style="border-radius: 0px 4px 0px 0px;">状态</th>
                                                            </tr>
                                                            <tr v-for="(it, idx) in buildNode.nodes" :key="idx" class="data">
                                                                <td>{{ it.nodeText }}</td>
                                                                <td :class="'finish-' + it.finishState">{{ it.finish }}</td>
                                                            </tr>
                                                        </table>
                                                        <div v-else style="text-align: center;">
                                                            <img src="images/nodata.png" style="width: 140px;"
                                                                v-show="buildNodeLoad">
                                                            <div style="text-align: center;color:#ccc">暂无数据</div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </template>
                                            <div v-else style="text-align: center;">
                                                <img src="images/nodata.png" style="width: 140px;" v-show="buildNodeLoad">
                                                <div style="text-align: center;color:#ccc">暂无数据</div>
                                            </div>
                                        </div>
                                    </div>
                                </el-col>
                            </el-row>
                        </module-one-1-2>
                    </el-col>
                    <el-col :span="12">
                        <module-one-1-2 label="项目问题推进情况">
                            <problemProgress :scheduleInfo="scheduleInfo" :prjInfo="prjInfo"></problemProgress>
                        </module-one-1-2>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <module-one-1-2 label="项目形象进度" style="position: relative;">
                            <img src="images/icon2001.png" style="position: absolute;cursor: pointer;right: 12px;top: 12px;"
                                @click="doShowDlg3">
                            <div class="hj-moment-choice" style="margin:20px;height: 30px;" v-if="1 == 2">
                                <div class="hj-moment-select" style="width: 214px;">
                                    <screen-select :data="selectData" ref="sel1"></screen-select>
                                </div>
                            </div>
                            <div class="prj-info-list" v-if="scheduleInfo">
                                <div class="col-1" style="width:400px;padding-top:12px;">
                                    <el-carousel height="260px"
                                        v-if="scheduleInfo && scheduleInfo.images && scheduleInfo.images.length > 0">
                                        <el-carousel-item v-for="item in scheduleInfo.images" :key="item">
                                            <div
                                                style="width: 100%;display: flex;align-items: center;justify-content: center;height: 260px;">
                                                <el-image :src="$apiPath + item" style="width:100%"
                                                    :preview-src-list="[$apiPath + item]" />
                                            </div>
                                        </el-carousel-item>
                                    </el-carousel>
                                </div>
                                <div class="col-2 scroll"
                                    style="flex-grow: 1;max-height: 270px;overflow: auto;width: calc(100% - 4px);margin-top:8px;">                                   
                                    <template v-if="scheduleInfo.plannedNode">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">计划节点</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.plannedNode }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.actualNode">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">实际节点</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.actualNode }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.dataTemplate!=4">
                                    <template v-if="scheduleInfo.purchaseProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">融资、招采进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.purchaseProgress }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.designProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">报建、设计进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.designProgress }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.constructionProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">施工进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.constructionProgress }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.acceptanceProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">验收进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.acceptanceProgress }}</div>
                                        </div>
                                    </template>
                                    </template>
                                    <template v-if="scheduleInfo.dataTemplate==4">
                                    <template v-if="scheduleInfo.constructionProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">施工进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.constructionProgress }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.acceptanceProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">验收进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.acceptanceProgress }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.purchaseProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">结算进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.purchaseProgress }}</div>
                                        </div>
                                    </template>
                                    <template v-if="scheduleInfo.designProgress">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">运维进展</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.designProgress }}</div>
                                        </div>
                                    </template>

                                    </template>
                                    <template v-if="scheduleInfo.planForNextWeek">
                                        <div><img src="images/title_icon.png"><span class="sp-lbl">下周计划</span></div>
                                        <div class="div-text ">
                                            <div>{{ scheduleInfo.planForNextWeek }}</div>
                                        </div>
                                    </template>

                                </div>
                            </div>
                            <div v-else style="text-align: center;padding-top: 50px;">
                                <img src="images/nodata.png" style="width: 240px;">
                                <div style="text-align: center;">暂无数据</div>
                            </div>
                        </module-one-1-2>
                    </el-col>
                    <el-col :span="12">
                        <module-one-1-2 label="项目跟进计划">
                            <img src="images/icon2001.png" style="position: absolute;cursor: pointer;right: 12px;top: 12px;"
                                @click="doShowDlg2">
                            <div class="prj-pan-nav" style="padding:20px;">
                                <span class="prj-pan-nav-item" :class="panNav == 0 ? 'active' : ''"
                                    @click="panNav = 0">城建项目计划</span>
                                <span class="prj-pan-nav-item" style="margin-left: 20px;" :class="panNav == 1 ? 'active' : ''"
                                    @click="panNav = 1">重点项目计划</span>
                            </div>

                            <div class="modify-project-amount" @mouseout="planMouseout" @mouseover="planMouseover"
                                style="margin-top:0px;">
                                <div class="modify-btn" style="padding-top:100px">
                                    <svg class="my-svg-icon-aaa" @click="planLeftBtn"
                                        style="cursor:pointer; width: 3em;vertical-align: middle;fill: currentColor;overflow: hidden;"
                                        viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                                        p-id="4967">
                                        <path
                                            d="M729.6 931.2l-416-425.6 416-416c9.6-9.6 9.6-25.6 0-35.2-9.6-9.6-25.6-9.6-35.2 0l-432 435.2c-9.6 9.6-9.6 25.6 0 35.2l432 441.6c9.6 9.6 25.6 9.6 35.2 0C739.2 956.8 739.2 940.8 729.6 931.2z"
                                            p-id="4968"></path>
                                    </svg>
                                </div>
                                <div class="modify-content" id="planContent">
                                    <div class="modify-content-overflow" style="width: 2000px;">

                                        <div class="quality-table special-table" style="width: 800px;">
                                            <el-table :data="planData1" style="width: 100%;background: transparent;"
                                                height="265">

                                                <el-table-column prop="name" class-name="text-left" label="项目名称"
                                                    width="250px"> </el-table-column>
                                                <el-table-column prop="node" class-name="text-left" label="项目节点"
                                                    width="200px"> </el-table-column>
                                                <el-table-column prop="planDate" label="计划完成时间"> </el-table-column>
                                                <el-table-column prop="finishDate" label="实际完成时间"> </el-table-column>
                                                <el-table-column prop="isLate" label="是否逾期"> </el-table-column>
                                                <el-table-column prop="lateDays" label="逾期天数"> </el-table-column>
                                            </el-table>
                                        </div>

                                        <div class="quality-table special-table" style="width: 800px;">
                                            <el-table :data="planData2" style="width: 100%;background: transparent;"
                                                height="265">

                                                <el-table-column prop="name" class-name="text-left" label="项目名称"
                                                    width="200px"> </el-table-column>
                                                <el-table-column prop="node" label="项目节点"> </el-table-column>
                                                <el-table-column prop="planDate" label="计划完成时间"> </el-table-column>
                                                <el-table-column prop="finishDate" label="实际完成时间"> </el-table-column>
                                                <el-table-column prop="isLate" label="是否逾期"> </el-table-column>
                                                <el-table-column prop="lateDays" label="逾期天数"> </el-table-column>
                                            </el-table>
                                        </div>
                                    </div>
                                </div>
                                <div class="modify-btn" style="padding-top:100px">
                                    <svg class="my-svg-icon-aaa" @click="planRightBtn"
                                        style="cursor:pointer; width: 3em;vertical-align: middle;fill: currentColor;overflow: hidden;"
                                        viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                                        p-id="4997">
                                        <path
                                            d="M761.6 489.6l-432-435.2c-9.6-9.6-25.6-9.6-35.2 0-9.6 9.6-9.6 25.6 0 35.2l416 416-416 425.6c-9.6 9.6-9.6 25.6 0 35.2s25.6 9.6 35.2 0l432-441.6C771.2 515.2 771.2 499.2 761.6 489.6z"
                                            p-id="4998"></path>
                                    </svg>
                                </div>
                            </div>

                        </module-one-1-2>
                    </el-col>
                </el-row>
            </div>
        </div>
        <index-dlg1 ref="dlg1"></index-dlg1>
        <index-dlg2 ref="dlg2"></index-dlg2>
        <index-dlg3 ref="dlg3"></index-dlg3>
        <build-node-dlg ref="buildNodeDlg"></build-node-dlg>
    </div>
</template>

<script>
import '../components/module/module-one-1-1'
import '../components/module/module-one-1-2'
import '../components/module/module-one-3-1'
import '../components/background_video'
import '../components/header'
import '../components/staff-survey-chart'
import '../components/idle-list-chart'
import '../components/screen-select'
import indexDlg1 from './progress/indexDlg1'
import indexDlg2 from './progress/indexDlg2'
import indexDlg3 from './progress/indexDlg3'
import problemProgress from './progress/problemProgress.vue'
import buildNodeDlg from './progress/buildNodeDlg.vue'
export default {
    components: {
        indexDlg1,
        indexDlg2,
        indexDlg3,
        problemProgress,
        buildNodeDlg
    },
    data() {
        return {
            elKey: 0,
            //节点完成率
            completionData: [],
            //节点计划预警
            nodePLanData: [],
            assessData: [],
            pushUrl: 'images/company_6.png',
            pushNav: 0,
            pushText: '在建项目',
            pushCount: 35,
            pushData: [
                { text: "正常推进项目", value: 0 },
                { text: "进度滞后项目", value: 1 },
            ],
            costIndex: 0,
            direction: 'right',
            costInterval: undefined,
            issueData: [
                {
                    title: '泾河新城荟锦坊二期',
                    detail: '项目存在约7万方土无外运点',
                    info: '积极协调开发建设部与环保部门。'
                },
                {
                    title: '瀛洲新苑（二期）幼儿园',
                    detail: '项目存在约3万方土无外运点',
                    info: '积极协调开发建设部与环保部门。'
                },
                {
                    title: '光伏公园',
                    detail: '项目存在约5万方土无外运点',
                    info: '积极协调开发建设部与环保部门。'
                },
            ],
            panNav: 0,
            planIndex: 0,
            planDirection: 'right',
            planInterval: undefined,
            planData1: [
                { name: '泾河新城崇文大桥两侧辅道工程', node: "完成设计招标", planDate: '2023-2', finishDate: '2023-2', isLate: '已完成', lateDays: '0天' },
                { name: '电力管沟项目', node: "完成电力管沟施工", planDate: '2023-12', finishDate: '2023-12', isLate: '未完成', lateDays: '0天' },
                { name: '瀛洲新苑（一期）幼儿园', node: "招标完成、施工进场", planDate: '2023-4', finishDate: '2023-4', isLate: '未逾期', lateDays: '0天' },
            ],
            planData2: [
                { name: '创维智能电子产业园', node: "施工进场", planDate: '2022-3', finishDate: '2023-12', isLate: '未逾期', lateDays: '0天' },
                { name: '云语间小区', node: "施工进场", planDate: '2022-7', finishDate: '2026-7', isLate: '未逾期', lateDays: '0天' },
                { name: '泊域人才中心', node: "施工进场", planDate: '2023-1', finishDate: '2024-12', isLate: '未逾期', lateDays: '0天' },
            ],
            selectData: [
                { text: '泾河新城荟锦坊二期', id: 1 },
            ],
            dept: null,
            prjInfos: [],
            prjInfo: {},
            scheduleInfo: null,
            projects: [],
            projectCategory: [],
            buildNodeLoad: false,
            buildNode: {
                current: null,
                nodes: []
            }
        }
    },
    created() {
        this.init()
    },
    mounted() {
        window.app = this;
        this.$bus.$on("projectChange", res => {
            this.prjInfo = res;
            this.loadProjectConstructionProgress();
            this.selectScheduledAlerts();
            this.selectCompletionRate();
        });
        this.$bus.$on("loadProjects", prjs => {
            this.projects = prjs;
        })
        this.$bus.$on("deptChange", dept => {
            this.dept = dept;
            this.groupByProjectCategory(dept.id);
            this.deptChange();
            this.selectScheduledAlerts();
            this.selectCompletionRate();
        })
    },
    methods: {
        selectCompletionRate(){
            let postData = {}
            if (this.prjInfo.id == 0) {
                postData.id = this.dept.id;
            } else {
                postData.projectId = this.prjInfo.id;
            }
            this.$api.buildNode.countCompletionRate(postData).then(d=>{
                this.completionData=d||[];                
            })
        },
        selectScheduledAlerts() {
            let postData = {}
            if (this.prjInfo.id == 0) {
                postData.id = this.dept.id;
            } else {
                postData.projectId = this.prjInfo.id;
            }
            this.$api.buildNode.selectScheduledAlerts(postData).then(d => {
                this.nodePLanData = d||[];

            })
        },
        showBuildNodeDlg() {
            this.$refs.buildNodeDlg.showDialog(this.projects, this.prjInfo);
        },
        getAssessData() {
            if (this.prjInfo.id == 0) {
                return this.assessData;
            } else {
                return this.assessData.filter(d => d.projectId == this.prjInfo.id);
            }
        },
        deptChange() {
            this.$api.quarterlyAssess.currentListByDept(this.dept.id).then(d => {
                this.assessData = (d.rows || []).map(it => {
                    it.prj = it.project?.projectName || '';
                    it.deptName = it.project?.paretProjectName || '';
                    it.comp = it.planTarget;
                    if (it.finishDate) {
                        it.finishState = 0;
                        it.finish = it.finishDate;
                    } else {
                        if (it.planDate) {
                            if (+this.$dt(it.planDate) < +new Date()) {
                                let dt1 = +this.$dt(it.planDate)
                                let dt2 = +this.$dt(this.$dt(new Date()).format("YYYY-MM-DD"));
                                let ts = (dt2 - dt1) / 3600 / 1000 / 24;
                                it.finish = "滞后" + ts + "天";
                                it.finishState = 1;

                            } else {
                                it.finish = "进行中";
                                it.finishState = 2;
                            }
                        } else {
                            it.finish = "进行中";
                            it.finishState = 2;
                        }
                    }
                    return it;
                })
            })
        },
        getProjectId(cb) {
            let func = () => {
                let prjId = this.prjInfo.id;
                if (prjId == 0) {
                    if (this.projects.length == 0) {
                        setTimeout(func, 100);
                    } else {
                        cb && cb(this.projects[1].id);
                    }
                } else {
                    cb && cb(prjId);
                }
            }
            func();
        },
        loadProjectConstructionProgress() {
            this.prjInfo = JSON.parse(localStorage.getItem("data2"));
            this.getProjectId(prjId => {
                this.$api.schedule.projectConstructionProgress(prjId).then(d => {
                    let obj = d?.data || {};
                    if (obj.image) {
                        obj.images = obj.image.split(",").filter(d => d);
                    }
                    this.scheduleInfo = obj;
                })
                this.$api.buildNode.selectCurrent({ projectId: prjId }).then(d => {
                    let tmps = this.$api.buildNode.covertData(d.data || []);
                    let objs = tmps.filter(d => d.lvl.length == 2)
                    this.buildNode.current = objs.length > 0 ? objs[0] : null;
                    this.buildNode.nodes = tmps.filter(d => d.lvl.length > 2)
                    this.buildNodeLoad = true;
                })
            })

        },
        doShowDlg1() {
            this.$refs.dlg1.showDialog(this.assessData)
        },
        doShowDlg2() {
            this.$refs.dlg2.showDialog(this.panNav)
        },
        doShowDlg3() {
            this.$refs.dlg3.showDialog(this.scheduleInfo, this.projects)
        },
        doPushNav(n, t) {
            this.pushNav = n;
            this.pushText = t;
            this.pushUrl = ['images/company_6.png', 'images/company_5.png', 'images/company_4.png'][n]
            this.pushCount = this.getPrjCateCount(n);
            let item = this.projectCategory.length > n ? this.projectCategory[n] : null;
            this.pushData[0].value = item && item.length > 0 ? item[0].cnt : 0;
            this.pushData[1].value = item && item.length > 1 ? item[1].cnt : 0;
            this.elKey++;
        },
        modifyLeftBtn() {
            this.direction = 'left'
            this.manufacturingCostRoll()
        },
        modifyRightBtn() {
            this.direction = 'right'
            this.manufacturingCostRoll()
        },
        manufacturingCostRoll() {
            var width = $(".project-amount").innerWidth()
            if (this.direction == 'right') {
                if (this.costIndex == 6) {
                    this.costIndex = 0
                } else {
                    this.costIndex = this.costIndex + 3
                }
            } else {
                if (this.costIndex == 0) {
                    this.costIndex = 6
                } else {
                    this.costIndex = this.costIndex - 3
                }
            }
            $("#modifyContent").animate({ scrollLeft: (width * this.costIndex) + 'px' })
            this.direction = 'right'
        },
        costMouseover() {
            clearInterval(this.costInterval);
        },
        costMouseout() {
            this.costInterval = setInterval(this.manufacturingCostRoll, 5000);
        },


        planLeftBtn() {
            this.planDirection = 'left'
            this.manufacturingPlanRoll()
        },
        planRightBtn() {
            this.planDirection = 'right'
            this.manufacturingPlanRoll()
        },
        manufacturingPlanRoll() {
            var width = 830
            if (this.planDirection == 'right') {
                if (this.planIndex == 1) {
                    this.planIndex = 0
                } else {
                    this.planIndex = this.planIndex + 1
                }
            } else {
                if (this.planIndex == 0) {
                    this.planIndex = 1
                } else {
                    this.planIndex = this.planIndex - 1
                }
            }
            this.panNav = this.planIndex;
            $("#planContent").animate({ scrollLeft: (width * this.planIndex) + 'px' })
            this.planDirection = 'right'
        },
        planMouseover() {
            clearInterval(this.planInterval);
        },
        planMouseout() {
            this.planInterval = setInterval(this.manufacturingPlanRoll, 5000);
        },
        getPrjCateCount(n) {
            if (this.projectCategory.length < n + 1) {
                return 0;
            }
            let tmps = this.projectCategory[n];
            if (tmps && tmps.length > 0) {
                let sum = 0;
                tmps.forEach(d => {
                    sum += d.cnt;
                })
                return sum;
            }
            return 0;
        },
        groupByProjectCategory(detpId){
            this.$api.project.groupByProjectCategory(detpId,datas => {                
                this.projectCategory = datas;
                this.pushCount = this.getPrjCateCount(0);
                let item = this.projectCategory.length > 0 ? this.projectCategory[0] : null;
                this.pushData[0].value = item && item.length > 0 ? item[0].cnt : 0;
                this.pushData[1].value = item && item.length > 1 ? item[1].cnt : 0;
                this.doPushNav(0, '在建项目');
                this.elKey++;
            });
        },
        init() {
            if (localStorage.length == 0) {
                var company = { text: '城投公司', id: 1, type: 1 }
                localStorage.setItem("company", JSON.stringify(company))
                this.localStorage1 = JSON.parse(localStorage.getItem("company"))

                var project = { text: '泾河新城荟锦坊二期', id: 1, type: 2 }
                localStorage.setItem("project", JSON.stringify(project))
                this.localStorage2 = JSON.parse(localStorage.getItem("project"))
            } else {
                this.localStorage1 = JSON.parse(localStorage.getItem("company"))
                this.localStorage2 = JSON.parse(localStorage.getItem("project"))
            }
            
            //设备概况点击事件定时器
            this.overviewInterval = setInterval(this.overviewClick, 5000);
            //重大节点预期预警
            this.majorInterval = setInterval(this.timer, 5000);
            //正在发生 定时器
            this.warningInterval = setInterval(this.automaticRoll, 5000);
            //预警类型 定时器
            this.warningTypeInterval = setInterval(this.automaticRollType, 5000);
        },

    },

};
</script>

<style lang="less" >
.project-progress {

    .my-svg-icon-aaa * {
        fill: #aaa;
    }

    .my-svg-icon-blue * {
        fill: #389DE3;
    }

    .completion-item {
        padding: 5px 20px;
        font-size: 12px;
    }

    .completion-item .row-2 {
        margin-left: 30px;
        margin-bottom: 5px;
    }

    .completion-item .sp-chart {
        display: inline-block;
        height: 28px;
        overflow: hidden;
    }

    .special-table th .cell {
        color: aquamarine;
        font-size: 12px;
    }

    .text-left {
        text-align: left !important;
    }

    .my-warning-info-title .active {
        background-size: 10px 10px;
    }

    .build-item {
        display: flex;
        margin-top: 15px;
    }

    .build-item .build-text {
        margin-left: 10px;
        line-height: 24px;
    }

    .build-item .div-prj {
        color: #B1C2DD;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 400px;
    }

    .build-item .div-lbl {
        font-size: 12px;
        color: #aaa;
    }

    .build-item .div-detail {
        font-size: 12px;
        color: #3E80BA;
    }

    .project-issue {
        width: 400px;
    }

    .project-issue .issue-title {
        height: 30px;
        background-position: unset;
        background-size: unset;
        padding-left: 10px;
    }

    .project-issue .row-1 {
        margin-top: 30px;
    }

    .project-issue .sp-lbl {
        display: inline-block;
        width: 70px;
        vertical-align: top;

        color: #aaa;
    }

    .project-issue .sp-detail {
        display: inline-block;
        width: calc(100% - 75px);
        line-height: 24px;
        color: #EB8308;

    }

    .project-issue .sp-detail.sp-info {
        color: #3E80BA;
    }

    .prj-pan-nav-item {
        cursor: pointer;
    }

    .prj-pan-nav-item.active {
        color: aquamarine;
        font-weight: bold;
    }

    .prj-info-list {
        display: flex;
        padding: 0px 20px;

    }

    .prj-info-list .info-img {
        height: 90px;
        width: 90px;
        margin-top: 10px;
        overflow: hidden;
    }

    .prj-info-list .info-img img {
        height: 90px;
    }

    .prj-info-list .col-2 {
        margin-left: 20px;
    }

    .prj-info-list .col-2 img {
        width: 12px;
        height: 12px;
    }

    .prj-info-list .col-2 .sp-lbl {
        color: rgb(1, 169, 255);
    }

    .prj-info-list .col-2 .div-text {
        color: #B8C9EE;
        line-height: 30px;
        padding-left: 20px;
    }

    .build-node-list {
        border-collapse: separate;
        border-spacing: 0;

        tr {
            &.data {
                td {
                    &:first-child {
                        border-bottom: solid 1px #2D5280;
                        border-left: solid 1px #2D5280;

                    }

                    &:last-child {
                        border-bottom: solid 1px #2D5280;
                        border-right: solid 1px #2D5280;
                    }
                }
            }

            &.header {
                background-color: #2D5280;
            }
        }

        td {

            line-height: 32px;
            padding: 0px 4px;
        }
    }
    .scheduled-alerts-list{
        .el-table__body-wrapper {
            &::-webkit-scrollbar {
                width: 8px;
                height: 8px;
            }

            &::-webkit-scrollbar-thumb {
                background-color: rgb(1, 169, 255);
                border-radius: 4px;
            }
            tr{
                cursor: pointer;
            }
        }
    }
}
</style>