<div class="bigbox">
    <div class="titlebox" *ngIf="pattern == 'edit'">
        <div class="titleitembox">
            <div class="item" *ngFor="let item of planTemplateData;let key = index" (click)="clickTitleItem(item)"
                [ngClass]="{'selectedItem': selectedItem == item.groupName}" [title]="item.groupName">
                {{key + 1}}.{{item.groupName}}
            </div>
        </div>
        <div class="btnbox">
            <button mat-stroked-button (click)="preview()">
                <mat-icon>visibility</mat-icon> 预览
            </button>
            <button mat-flat-button color="primary" (click)="submit()">
                <mat-icon>save</mat-icon> 提交
            </button>
        </div>
    </div>
    <button mat-stroked-button (click)="quitPreview()" class="quitPreview" *ngIf="blockyl">
        <mat-icon>visibility</mat-icon> 退出预览
    </button>
    <div class="contentbox" [ngClass]="{'noPadding': pattern == 'look'}">
        <div class="leftbox"
            *ngIf="pattern == 'edit' &&  (selectedItem == '重点图示' || selectedItem == '交通水源' || selectedItem == '预案附件' || selectedItem == '单位概况')">
            <div *ngIf="selectedItem == '重点图示'" class="leftKeyImg">
                <div class="keyImgTitle">
                    重点图示
                </div>
                <div class="planlist" id="planlist">
                    <!-- 总平面图 -->
                    <div style="margin: 10px 0;">
                        <mat-accordion>
                            <mat-expansion-panel expanded style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
                                <mat-expansion-panel-header collapsedHeight='33px' expandedHeight='33px'
                                    style="position: relative;padding-left:20px;background: #F2F9FF;">
                                    <mat-panel-title>
                                        总平面图
                                    </mat-panel-title>
                                </mat-expansion-panel-header>
                                <div class="content">
                                    <div class="contentitem" *ngFor="let item of sitePlanItems">
                                        <div>
                                            <img (click)="openPlan(item,-1,'平面图')"
                                                [src]="item.imageUrl && item.imageUrl != 'null'  ? item.imageUrl+'?x-oss-process=image/resize,m_fill,h_100,w_100' : '/assets/images/2D.jpg'"
                                                alt="">
                                        </div>
                                        <p>{{item.name}}</p>
                                    </div>
                                </div>
                            </mat-expansion-panel>
                        </mat-accordion>
                    </div>
                    <!-- 建筑平面图 -->
                    <div>
                        <div *ngFor="let item of allBuildings;let key=index" style="margin-bottom: 10px;">
                            <mat-accordion>
                                <mat-expansion-panel style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
                                    <mat-expansion-panel-header collapsedHeight='33px' expandedHeight='33px'
                                        style="position: relative;padding-left:20px;background: #F2F9FF;">
                                        <mat-panel-title>
                                            {{item.name}}
                                        </mat-panel-title>
                                    </mat-expansion-panel-header>
                                    <ng-template matExpansionPanelContent>
                                        <div class="content">
                                            <div class="contentitem" *ngFor="let i of item.plandata">
                                                <div>
                                                    <img (click)="openPlan(i,key,'平面图')"
                                                        [src]="i.imageUrl ? i.imageUrl+'?x-oss-process=image/resize,m_fill,h_100,w_100' : '../../../assets/images/noImg.png'"
                                                        alt="">
                                                </div>
                                                <p>{{i.name}}</p>
                                            </div>
                                        </div>
                                    </ng-template>
                                </mat-expansion-panel>
                            </mat-accordion>
                        </div>
                    </div>
                    <!-- 实景图 -->
                    <div style="margin: 10px 0;">
                        <mat-accordion>
                            <mat-expansion-panel style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
                                <mat-expansion-panel-header collapsedHeight='33px' expandedHeight='33px'
                                    style="position: relative;padding-left:20px;background: #F2F9FF;">
                                    <mat-panel-title>
                                        实景图
                                    </mat-panel-title>
                                </mat-expansion-panel-header>
                                <div class="content" id="viewer">
                                    <div class="realPictureItem" *ngFor="let item of allRealPicture;let key1 = index">
                                        <div class="realPictureTitle">{{item.name}}</div>
                                        <div class="contentitem" *ngFor="let i of item.realityImages;let key2 = index">
                                            <div class="realPictureImgItem">
                                                <img [src]="i.newImageUrl" alt=""
                                                    [attr.data-original]="'/api/Objects/PlanPlatform/' + i.imageUrl">
                                                <div class="realPictureImgItemBtn realPictureImgItemBtn1"
                                                    (click)="lookkeyImgItemLeft(key1,key2,i)">
                                                    查看图片
                                                </div>
                                                <div class="realPictureImgItemBtn realPictureImgItemBtn2"
                                                    (click)="addkeyImgItemLeft(item,i)">
                                                    增加分组
                                                </div>
                                            </div>
                                            <p>{{i.name}}</p>

                                        </div>
                                    </div>

                                </div>
                            </mat-expansion-panel>
                        </mat-accordion>
                    </div>
                </div>
            </div>
            <div *ngIf="selectedItem == '交通水源'" class="leftKeyImg">
                <div class="keyImgTitle">
                    交通水源
                </div>
                <div class="planlist" id="planlist">
                    <div style="margin: 10px 0;">
                        <mat-accordion>
                            <mat-expansion-panel expanded style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
                                <mat-expansion-panel-header collapsedHeight='33px' expandedHeight='33px'
                                    style="position: relative;padding-left:20px;background: #F2F9FF;">
                                    <mat-panel-title>
                                        水源
                                    </mat-panel-title>
                                </mat-expansion-panel-header>
                                <div class="content">
                                    <div class="contentitem">
                                        <div>
                                            <img (click)="openPlan(1,-1,'水源')" src='/assets/images/2D.jpg' alt="">
                                        </div>
                                        <p>交通水源</p>
                                    </div>
                                </div>
                            </mat-expansion-panel>
                        </mat-accordion>
                    </div>
                </div>
            </div>
            <div *ngIf="selectedItem == '预案附件'" class="leftKeyImg">
                <div class="keyImgTitle">
                    预案附件
                </div>
                <div class="planlist" id="planlist">
                    <div style="margin: 10px 0;">
                        <mat-accordion>
                            <mat-expansion-panel expanded style="box-shadow: 0 0 black;border: 1px solid #EEF1F5;">
                                <mat-expansion-panel-header collapsedHeight='33px' expandedHeight='33px'
                                    style="position: relative;padding-left:20px;background: #F2F9FF;">
                                    <mat-panel-title>
                                        二维预案列表
                                    </mat-panel-title>
                                </mat-expansion-panel-header>
                                <div class="content">
                                    <div class="contentitem" *ngFor="let TwoDPlan of TwoDPlanList">
                                        <div>
                                            <img (click)="openPlan(TwoDPlan,-1,'预案')" src='/assets/images/2Dplan.png'
                                                alt="">
                                        </div>
                                        <p>{{TwoDPlan.name}}</p>
                                    </div>
                                </div>
                            </mat-expansion-panel>
                        </mat-accordion>
                    </div>
                </div>
            </div>
            <div *ngIf="selectedItem == '单位概况'" class="leftBuilding">
                <div class="buildingHead">
                    <span>建筑列表</span>
                </div>
                <div class="buildingBody">
                    <div class="buildName" *ngFor="let item of planTemplateData[1].building;let i=index">
                        <mat-checkbox class="example-margin" color='primary' [(ngModel)]="item.completed"
                            (change)='clickBuilding(item,i)'></mat-checkbox>
                        <span>{{item.name}}</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="leftnew" *ngIf="pattern == 'edit' &&  ( selectedItem == '组织指挥'|| selectedItem == '社会联动'|| selectedItem == '勤务保障'|| selectedItem == '辅助决策')">
            <div class="newHead">
                <span>模板列表</span>
            </div>
            <div class="newBody">
                <div class="search">
                    <div class="searchChoose">
                          <select [(ngModel)]="searchType" (change)='clearSearch()'>
                            <option value="0">自定义</option>
                            <option value="1">按机构</option>
                          </select>
                    </div>
                    <div class="searchText">
                        <div class="queryField ordiv" *ngIf="searchType=='1'">
                            <input readonly placeholder="请输入组织"  autocomplete="off" [(ngModel)]="js" name="js"  (focus)="openorganizationbox()">
                            <!-- <mat-checkbox style="margin-left: 6px;" [(ngModel)]="jscheck" name="jscheck">包含下级</mat-checkbox> -->
                            <div class="organizationbox" *ngIf="isorganizationbox">
                                <div (click)="closediv()" class="closediv"><mat-icon>clear</mat-icon></div>
                                <mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
                                    <mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding  (click)='add(node)' class="organizationlist">
                                        <button type="button" mat-icon-button disabled ></button>
                                        <li>{{node.name}}</li>
                                    </mat-tree-node>
                                    <mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding  (click)='add(node)'  class="organizationlist">
                                        <button 
                                            type="button" 
                                            mat-icon-button 
                                            matTreeNodeToggle
                                            [attr.aria-label]="'toggle ' + node.name">
                                        <mat-icon class="mat-icon-rtl-mirror">
                                            {{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
                                        </mat-icon>
                                        </button>
                                        <li>{{node.name}}</li>
                                    </mat-tree-node>
                                </mat-tree>  
                            </div>
                        </div>
                        <div class="zdy" *ngIf="searchType=='0'">
                            <input type="text" placeholder="请输入关键字" [(ngModel)]="zdysearch">
                        </div>
                    </div>
                    <div class="searImg" (click)="searchYuan()">
                        <img src="../../../assets/images/search.png">
                    </div>
                </div>
                <div class="newBodycenter">
                    <div class="centerfen" *ngFor="let item of yinruData.items;let clicki=index">
                        <div class="tu" (click)='clickYinru(clicki)'>
                            <img src="../../../assets/images/yr.png">
                        </div>
                        <div class="org">
                            <span style="font-size: 15px;">{{item.organizationName}}</span>
                        </div>
                        <div class="lry">
                            <span style="color:#9EAAB4;font-size:14px">录入员:{{item.creatorName}}</span>
                        </div>
                    </div>
                    
                </div>
                <div class="fenye">
                    <mat-paginator pageEvent [length]="length"
                [pageSize]="pageSize"
                [pageSizeOptions]="pageSizeOptions"
                (page)="changePage($event)">
                
            </mat-paginator>
                </div>
            </div>
        </div>

        <div class="mainbox" id="mainbox">

            <!-- 模板页面 -->
            <div *ngFor="let item of planTemplateData;let key = index">
                <div *ngIf="selectedItem == item.groupName || pattern == 'look'">
                    <!-- 封面 -->
                    <div class="cover" *ngIf="item.groupName == '封面' && pattern == 'edit'" id="cover">
                        <p class="planNum">
                            预案编号: <input [(ngModel)]="item.attribute.planNumber" type="text" name="" id="">
                        </p>
                        <h1>{{item.attribute.planName}}</h1>
                        <ul>
                            <li>
                                <div>
                                    对象名称:
                                </div>
                                <div>
                                    {{item.attribute.objName}}
                                </div>
                            </li>
                            <li>
                                <div>
                                    单位性质:
                                </div>
                                <div>
                                    {{item.attribute.unitNature}}
                                </div>
                            </li>
                            <li>
                                <div>
                                    <span class="redspan">*</span>预案级别:
                                </div>
                                <div>
                                    <ng-container *ngIf="planLevel == '5'; else elseTemplate">
                                        Ⅴ级
                                    </ng-container>
                                    <ng-template #elseTemplate>
                                        Ⅲ级
                                    </ng-template>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <span class="redspan">*</span>灾害类型:
                                </div>
                                <div>
                                    <select [(ngModel)]="item.attribute.disasterType">
                                        <option value="火灾">火灾</option>
                                        <option value="抢险救援">抢险救援</option>
                                        <option value="其他">其他</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <div>
                                    防火级别:
                                </div>
                                <div>
                                    <input type="text" [(ngModel)]="item.attribute.fireproofingLevel">
                                </div>
                            </li>
                            <li>
                                <div>
                                    防火管辖:
                                </div>
                                <div>
                                    {{item.attribute.fireproofingAdminister}}
                                </div>
                            </li>
                            <li>
                                <div>
                                    灭火责任队站:
                                </div>
                                <div>
                                    <input type="text" [(ngModel)]="item.attribute.putOutFireAdminister">
                                </div>
                            </li>
                            <li>
                                <div>
                                    制作人职务/姓名:
                                </div>
                                <div>
                                    <input [(ngModel)]="item.attribute.producer.duty" type="text"
                                        style="margin-right: 10px;">
                                    <input [(ngModel)]="item.attribute.producer.name" type="text" style="width: 50px;">
                                </div>
                            </li>
                            <li>
                                <div>
                                    审核人职务/姓名:
                                </div>
                                <div>
                                    <input [(ngModel)]="item.attribute.verifier.duty" type="text"
                                        style="margin-right: 10px;">
                                    <input [(ngModel)]="item.attribute.verifier.name" type="text" style="width: 50px;">
                                </div>
                            </li>
                            <li>
                                <div>
                                    审核时间:
                                </div>
                                <div>
                                    <input type="text" [(ngModel)]="item.attribute.auditTime">
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div *ngIf="item.groupName == '封面' && pattern == 'look'" id="cover" style="margin-bottom: 100px;">
                        <p>
                            预案编号: {{item.attribute.planNumber}}
                        </p>
                        <h1 style="font-size: 46px;color: #2196f3;text-align: center;font-weight: 600;margin: 80px 0;">
                            {{item.attribute.planName}}</h1>
                        <div class="coverItem">
                            <div style="text-align: center;margin-bottom:12px;">
                                <span>对象名称:</span>
                                <span> {{item.attribute.objName}}</span>
                            </div>
                            <div style="text-align: center;margin-bottom:12px;">
                                <span>单位性质:</span>
                                <span> {{item.attribute.unitNature}}</span>
                            </div>
                            <div style="text-align: center;margin-bottom:12px;">
                                <span><span style="color: #ff0000;">*</span>预案级别:</span>
                                <span>
                                    <ng-container *ngIf="planLevel == '5'; else elseTemplate">
                                        Ⅴ级
                                    </ng-container>
                                    <ng-template #elseTemplate>
                                        Ⅲ级
                                    </ng-template>
                                </span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span><span style="color: #ff0000;">*</span>灾害类型:</span>
                                <span> {{item.attribute.disasterType}}</span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span>防火级别:</span>
                                <span> {{item.attribute.fireproofingLevel}}</span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span>防火管辖:</span>
                                <span> {{item.attribute.fireproofingAdminister}}</span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span>灭火责任队站:</span>
                                <span> {{item.attribute.putOutFireAdminister}}</span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span>制作人职务/姓名:</span>
                                <span> 
                                    <span style="margin-right:12px;">{{item.attribute.producer.duty}}</span>
                                    <span>{{item.attribute.producer.name}}</span>
                                </span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span>审核人职务/姓名:</span>
                                <span> 
                                    <span style="margin-right:12px;">{{item.attribute.verifier.duty}}</span>
                                    <span>{{item.attribute.verifier.name}}</span>
                                </span>
                            </div>
                            <div style="text-align: center;margin-bottom:20px;">
                                <span>审核时间:</span>
                                <span> {{item.attribute.auditTime}}</span>
                            </div>
                        </div>
                    </div>
                    <div class="centerBox"
                        *ngIf="item.groupName!='单位概况'&&item.groupName!='交通水源'&&item.groupName!='重点图示'&&item.groupName!='预案附件'&&item.groupName!='特别警示'&&item.groupName!='处置要点'&&item.groupName!='封面'">
                        <div class="titleItem" style="width: 100%;
                        background-color: #2196F3;
                        text-align: center;
                        color: white;">
                            <span>{{item.groupName}}</span>
                        </div>
                        <div class="boxBody" *ngFor="let element of item.attribute;let i=index" style="height: 100%;
                        width: 100%;
                        display: flex;
                        flex-direction: column;">
                            <div class="boxBodyHead" style="width: 100%;
                            height: 40pt;
                            background-color: #FFD91D;
                            text-align: center;">
                                <span style="font-size: 16px;
                                text-align: center;
                                height: 40pt;
                                line-height: 40pt;
                                color: #b99a00;">{{element.headName}}</span>
                                <img src="../../../assets/images/deleteblue.png" *ngIf="element.level==1&&pattern == 'edit'"
                                    (click)='delTd(key,i)'>
                                <img src="../../../assets/images/add.png" *ngIf="element.level==1&&pattern == 'edit'"
                                    (click)='addTd(key,i)'>
                            </div>
                            <div class="body">
                                <!--表格类型-->
                                <table *ngIf="element.level==1" style="width: 100%;border-collapse: collapse;">
                                    <thead *ngIf="pattern == 'edit'">
                                        <th *ngFor="let itemth of element.tableth;let tablethi=index;TrackBy:trackByFn" style="border: 1px solid #999;
                                        height: 40px;
                                        font-size: 16px;
                                        text-align: center;">
                                            <input type="text" placeholder="请输入内容"
                                                [(ngModel)]="element.tableth[tablethi]" >
                                        </th>
                                    </thead>
                                    <thead *ngIf="pattern == 'look'">
                                        <th *ngFor="let itemth of element.tableth;let tablethi=index;TrackBy:trackByFn" style="border: 1px solid #999;
                                        height: 40px;
                                        font-size: 16px;
                                        text-align: center;" >
                                         {{element.tableth[tablethi]}}
                                         <!-- <textarea [value]="element.tableth[tablethi]" disabled style="width: 100%;height: 100%;"></textarea> -->
                                        </th>
                                    </thead>
                                    <tbody *ngIf="pattern == 'edit'">
                                        <tr *ngFor="let itemtr of element.tabletr">
                                            <td
                                                *ngFor="let itemtd of itemtr.tabletd;let tabletdi=index;TrackBy:trackByFn">
                                                <input type="text" placeholder="请输入"
                                                    [(ngModel)]="itemtr.tabletd[tabletdi]">
                                                    
                                            </td>
                                        </tr>
                                    </tbody>
                                    <tbody *ngIf="pattern == 'look'">
                                        <tr *ngFor="let itemtr of element.tabletr">
                                            <td *ngFor="let itemtd of itemtr.tabletd;let tabletdi=index;TrackBy:trackByFn" style="border: 1px solid #999;
                                            height: 40px;
                                            font-size: 16px;
                                            text-align: center;">
                                                {{itemtr.tabletd[tabletdi]}}  
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <!--文本区域-->
                                <textarea style="width: 99%;height: 100px;" *ngIf="element.level==3&&pattern == 'edit'"
                                    [(ngModel)]="element.tableth"></textarea>
                                   <div style="height: 100px;width: 98%; border: 1px solid #000000;" *ngIf="element.level==3&&pattern == 'look'">{{element.tableth||''}}</div> 
                                <!--输入框-->
                                <div class="inputtext" *ngIf="element.level==2">
                                    <div class="inputj" style="height: 100%;width: 100%;"
                                        *ngFor="let itemth of element.tableth;let tablethi=index;TrackBy:trackByFn">
                                        <div style="height: 100%;width: 100%;"
                                            *ngFor="let itemthj of element.tableth[tablethi];let tablethj=index;TrackBy:trackByFn">
                                            <input type="text" placeholder="请输入内容"
                                                style="background-color: #E8E9E9;width: 40%;"
                                                [(ngModel)]="itemthj.head" *ngIf="pattern == 'edit'">
                                            <input type="text" placeholder="请输入内容" style="width: 60%;"
                                                [(ngModel)]="itemthj.body" *ngIf="pattern == 'edit'">
                                            
                                                <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                    <tr>
                                                        <th style="border: 1px solid #999;
                                                        height: 40px;
                                                        font-size: 16px;
                                                        text-align: center; white-space:pre-wrap; width: 185px;">
                                                        {{itemthj.head}}
                                                        </th>
                                                        <td style="border: 1px solid #999;
                                                        height: 40px;
                                                        font-size: 16px;
                                                        text-align: center;white-space:pre-wrap;width: 185px;">
                                                        {{itemthj.body}}
                                                        </td>
                                                      </tr>
                                                  </table>
                                        </div>
                                    </div>
                                </div>
                                
                                <!--树形图-->
                                <!-- <div style="height: 300px;width: 100%;" *ngIf="element.level==4">
                                    <tree-diagram [data]="element.tableth"></tree-diagram>
                                </div> -->
                                <div class="keyImg" *ngIf="element.level==4">
                                    
                            <div class="keyImgImg">
                                <div style="margin-top: 10px;
                                text-align: center;
                                position: relative;" class="imgbox" *ngFor="let imgUrl of element.tableth.json;let imgkey = index">
                                    <mat-icon *ngIf="pattern == 'edit'" class="deleteImg"
                                        (click)="deleteImgItem(element.tableth.json,imgkey)">delete
                                    </mat-icon>
                                    <img style="max-width: 100%;
                                    width: auto;
                                    height: auto;" [src]="imgUrl" alt="">
                                </div>
                                <div class="uploadBtn" *ngIf="pattern == 'edit'&&element.tableth.json.length<=0">
                                    <button mat-stroked-button>
                                        <mat-icon>add</mat-icon>上传图片
                                    </button>
                                    <input (change)="filechange($event,element)" type="file" name="" id="">
                                </div>
                            </div>
                                </div>
                                
                            </div>
                        </div>
                    </div>
                    <div class="keyImg"
                        *ngIf="item.groupName == '重点图示' || item.groupName == '交通水源' || item.groupName == '预案附件'">
                        <div class="titleItem" style="width: 100%;
                        background-color: #2196F3;
                        text-align: center;
                        color: white;">
                            <span>{{item.groupName}}</span>
                        </div>
                        <div style="border: 1px solid #e8e9e9;width: 100%;" class="keyImgItem"
                            *ngFor="let i of item.attribute;let key = index">
                            <div class="keyImgTitle" style="height: 30px;
                            position: relative;">
                                <input *ngIf="pattern == 'edit'" type="text" placeholder="请输入分组名称" [(ngModel)]="i.name">
                                <div *ngIf="pattern == 'look'" style="
                                width: 100%;
                                height: 30px;
                                background: #e8f4fe;
                                color: #2196f3;
                                border: 0;
                                box-sizing: border-box;
                                padding: 0 5px;"> {{ i.name }} </div>
                                <mat-icon class="deleteItem" *ngIf="key != 0 && pattern == 'edit'"
                                    (click)="deleteItem(item,key)">delete
                                </mat-icon>
                            </div>
                            <div class="keyImgImg">
                                <div style="margin-top: 10px;
                                text-align: center;
                                position: relative;" class="imgbox" *ngFor="let imgUrl of i.imgArr;let imgkey = index">
                                    <mat-icon *ngIf="pattern == 'edit'" class="deleteImg"
                                        (click)="deleteImgItem(i.imgArr,imgkey)">delete
                                    </mat-icon>
                                    <img style="max-width: 100%;
                                    width: auto;
                                    height: auto;" [src]="imgUrl" alt="">
                                </div>
                                <div class="uploadBtn" *ngIf="pattern == 'edit'">
                                    <button mat-stroked-button>
                                        <mat-icon>add</mat-icon>上传图片
                                    </button>
                                    <input (change)="filechange($event,i)" type="file" name="" id="">
                                </div>
                            </div>
                        </div>
                        <!-- 增加分组 -->
                        <div class="addkeyImgItem" *ngIf="pattern == 'edit'">
                            <button mat-flat-button color="primary" (click)="addkeyImgItem(item)">
                                增加分组
                            </button>
                        </div>
                    </div>
                    <div class="disposalPoint" *ngIf="item.groupName == '处置要点'">
                        <div class="titleItem" style="width: 100%;
                        background-color: #2196F3;
                        text-align: center;
                        color: white;">
                            <span>{{item.groupName}}</span>
                        </div>
                        <div class="disposalPointItem" *ngFor="let i of item.attribute;let key = index">
                            <div class="disposalPointTitle">
                                <input *ngIf="pattern == 'edit'" type="text" placeholder="请输入分组名称" [(ngModel)]="i.name">
                                <div *ngIf="pattern == 'look'" style="
                                width: 100%;
                                height: 30px;
                                background: #e8f4fe;
                                color: #2196f3;
                                border: 0;
                                box-sizing: border-box;
                                padding: 0 5px;"> {{ i.name }} </div>
                                <mat-icon class="deleteItem" *ngIf="key != 0 && pattern == 'edit'" (click)="deleteItem(item,key)">delete
                                </mat-icon>
                            </div>
                            <div class="disposalPointTextarea">
                                <textarea *ngIf="pattern == 'edit'" [(ngModel)]="i.cantent" style="resize: none;"
                                    placeholder="请填写自定义内容" name="" id="" cols="30" rows="10"></textarea>
                                <div style="width: 100%;height: auto;vertical-align: top;
                                box-sizing: border-box;
                                padding: 5px;" *ngIf="pattern == 'look'">
                                    {{i.cantent}}
                                </div>
                            </div>
                        </div>
                        <!-- 增加分组 -->
                        <div class="addDisposalPointItem" *ngIf="pattern == 'edit'">
                            <button mat-flat-button color="primary" (click)="addDisposalPointItem(item)">
                                增加分组
                            </button>
                        </div>
                    </div>
                    <div class="disposalPoint" *ngIf="item.groupName == '特别警示'">
                        <div class="titleItem" style="width: 100%;
                        background-color: #2196F3;
                        text-align: center;
                        color: white;">
                            <span>{{item.groupName}}</span>
                        </div>
                        <div class="disposalPointItem" *ngFor="let i of item.attribute;let key = index">
                            <div class="disposalPointTitle">
                                <input *ngIf="pattern == 'edit'" type="text" placeholder="请输入分组名称" [(ngModel)]="i.name">
                                <div *ngIf="pattern == 'look'" style="
                                width: 100%;
                                height: 30px;
                                background: #e8f4fe;
                                color: #2196f3;
                                border: 0;
                                box-sizing: border-box;
                                padding: 0 5px;"> {{ i.name }} </div>
                            </div>
                            <div class="disposalPointTextarea">
                                <textarea *ngIf="pattern == 'edit'" [(ngModel)]="i.cantent" style="resize: none;"
                                    placeholder="请填写自定义内容" name="" id="" cols="30" rows="10"></textarea>
                                <div style="width: 100%;height: auto;vertical-align: top;
                                box-sizing: border-box;
                                padding: 5px;" *ngIf="pattern == 'look'">
                                    {{i.cantent}}
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="unit" *ngIf="item.groupName == '单位概况'" style="width: 100%;
                    height: 100%;
                    display: flex;
                    flex-direction: column;
                    overflow-y: auto;">
                        <div *ngFor="let itemunit of planTemplateData[1].building;let uniti=index" style="border-bottom: 3px solid #999;">
                            <div *ngIf="itemunit.completed">
                                <div class="unithead" style=" height: 40px;
                                width: 100%;
                                background-color: #e8f4fe;">
                                    <span style=" margin-left: 20px;
                                    font-size: 16px;
                                    color: #2196f3;
                                    opacity: 1;
                                    height: 40px;
                                    line-height: 40px;">{{itemunit.name}}</span>
                                </div>
                                <div class="unitbody" *ngFor="let element of itemunit.body;let elei=index" style=" height: 100%;
                                width: 100%;
                                display: flex;
                                flex-direction: column;">
                                    <div *ngIf="element.completed">
                                        <div class="unitbodyHead" style="width: 100%;
                                        height: 40px;
                                        background-color: #2196f3;
                                        text-align: center;">
                                            <span style="font-size: 16px;
                                            text-align: center;
                                            height: 40px;
                                            line-height: 40px;
                                            color: #ffffff;">{{element.surveyName}}</span>
                                            <!-- <img src="../../../assets/images/deletered.png" > -->
                                            <img src="../../../assets/images/addbai.png"
                                                (click)='unitadd(element.surveyName,uniti,1)'
                                                *ngIf="pattern == 'edit'&&(element.surveyName=='功能分区'||element.surveyName=='重点部位')">
                                        </div>
                                        <div class="body">
                                            <!-- 进攻通道 -->
                                            <div class="attack" *ngIf="element.surveyName=='进攻通道'">
                                                <div *ngFor="let attack of element.attinf;let attacki=index">
                                                    <div class="attackhead" style=" width: 100%;
                                                    height: 40px;
                                                    background-color: #ffd91d;
                                                    text-align: center;">
                                                        <span style="font-size: 16px;
                                                        text-align: center;
                                                        height: 40px;
                                                        line-height: 40px;
                                                        color: #b99a00;">{{attack.head}}</span>
                                                        <img src="../../../assets/images/deleteblue.png" *ngIf="pattern == 'edit'"
                                                            (click)='unitDel(element.surveyName,uniti,attacki)'>
                                                        <img src="../../../assets/images/add.png"
                                                            *ngIf="pattern == 'edit'"
                                                            (click)='unitadd(element.surveyName,uniti,attacki)'>
                                                    </div>
                                                    <div class="attackbody">
                                                        <table style="width: 100%;border-collapse: collapse;">
                                                            <thead *ngIf="pattern == 'edit'">
                                                                <th
                                                                    *ngFor="let itemth of attack.tableth;let tablethi=index;TrackBy:trackByFn">
                                                                    <input type="text" placeholder="请输入内容"
                                                                        [(ngModel)]="attack.tableth[tablethi]">
                                                                </th>
                                                            </thead>
                                                            <thead *ngIf="pattern == 'look'">
                                                                <th style="border: 1px solid #999;
                                                                height: 40px;
                                                                font-size: 16px;
                                                                text-align: center;"
                                                                 *ngFor="let itemth of attack.tableth;let tablethi=index;TrackBy:trackByFn">{{attack.tableth[tablethi]}}</th>
                                                            </thead>
                                                            <tbody *ngIf="pattern == 'edit'">
                                                                <tr *ngFor="let itemtr of attack.tabletr">
                                                                    <td
                                                                        *ngFor="let itemtd of itemtr.tabletd;let tabletdi=index;TrackBy:trackByFn">
                                                                        <input type="text" placeholder="请输入"
                                                                            [(ngModel)]="itemtr.tabletd[tabletdi]">
                                                                    </td>
                                                                </tr>
                                                            </tbody>
                                                            <tbody *ngIf="pattern == 'look'">
                                                                <tr *ngFor="let itemtr of attack.tabletr">
                                                                    <td style="border: 1px solid #999;
                                                                    height: 40px;
                                                                    
                                                                    font-size: 16px;
                                                                    text-align: center;"
                                                                     *ngFor="let itemtd of itemtr.tabletd;let tabletdi=index;TrackBy:trackByFn">
                                                                        {{itemtr.tabletd[tabletdi]}}
                                                                    </td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>


                                            </div>
                                            <!-- 单位和建筑信息 -->
                                            <div class="building" *ngIf="element.surveyName=='单位基本信息'">
                                                <div *ngFor="let info of element.attinf">
                                                    <div *ngIf="info.completed" class="onetext">
                                                        <input type="text" placeholder="请输入内容" style="width: 30%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="info.propertyName" readonly *ngIf="pattern == 'edit'">
                                                        <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #FFFFFF;" [(ngModel)]="info.value" *ngIf="pattern == 'edit'">
                                                       <!--  <input type="text"  style="width: 30%;background-color: #FFFFFF;color: #999;" [(ngModel)]="info.olddata" *ngIf="pattern == 'edit'&&oldData" readonly> -->
                                                       <!-- <span style="width: 30%;background-color: #FFFFFF;color: #999;" *ngIf="pattern == 'edit'&&oldData">{{info.olddata||'无原数据'}}</span> -->
                                                       <input type="text" style="width: 30%;background-color: #FFFFFF;color: #999;" *ngIf="pattern == 'edit'&&oldData" readonly [value]="info.olddata||'无原数据'">
                                                        <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                            <tr>
                                                                <th style="border: 1px solid #999;
                                                                height: 40px;
                                                                width: 40%;
                                                                font-size: 16px;
                                                                text-align: center;">{{info.propertyName}}</th>
                                                                <td style="border: 1px solid #999;
                                                                height: 40px;
                                                                width: 60%;
                                                                font-size: 16px;
                                                                text-align: center;">{{info.value}}</td>
                                                              </tr>
                                                          </table>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="building" *ngIf="element.surveyName=='建筑信息'">
                                                <div *ngFor="let info of element.attinf">
                                                    <div *ngIf="info.completed" class="onetext">
                                                        <input type="text" placeholder="请输入内容" style="width: 30%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="info.propertyName" readonly *ngIf="pattern == 'edit'">
                                                        <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #FFFFFF;" [(ngModel)]="info.propertyValue" *ngIf="pattern == 'edit'">
                                                        <!-- <input type="text"  style="width: 30%;background-color: #FFFFFF;color: #999;" [(ngModel)]="info.olddata" *ngIf="pattern == 'edit'&&oldData" readonly> -->
                                                        <!-- <span style="width: 30%;background-color: #FFFFFF;color: #999;" *ngIf="pattern == 'edit'&&oldData">{{info.olddata||'无原数据'}}</span> -->
                                                        <input type="text" style="width: 30%;background-color: #FFFFFF;color: #999;" *ngIf="pattern == 'edit'&&oldData" readonly [value]="info.olddata||'无原数据'">
                                                        <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                            <tr>
                                                                <th style="border: 1px solid #999;
                                                                height: 40px;
                                                                width: 40%;
                                                                font-size: 16px;
                                                                text-align: center;">{{info.propertyName}}</th>
                                                                <td style="border: 1px solid #999;
                                                                height: 40px;
                                                                width: 60%;
                                                                font-size: 16px;
                                                                text-align: center;">{{info.propertyValue}}</td>
                                                              </tr>
                                                          </table>
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- 消防设施 -->
                                            <div class="file" *ngIf="element.surveyName=='消防设施'">
                                                <div *ngFor="let attack of element.attinf;let attacki=index">
                                                    <div *ngIf="attack.completed">
                                                        <div class="fileHead" style="height: 40px;
                                                        width: 100%;
                                                        background-color: #ffd91d;
                                                        text-align: center;">
                                                            <span style="font-size: 16px;
                                                            text-align: center;
                                                            height: 40px;
                                                            line-height: 40px;
                                                            color: #b99a00;">{{attack.name}}</span>
                                                        </div>
                                                        <div class="fileBody">
                                                            <div *ngFor="let info of attack.facilityItems">
                                                                <div *ngIf="info.completed" class="onetext">
                                                                    <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="info.name" readonly *ngIf="pattern == 'edit'">
                                                                    <input type="text" placeholder="请输入内容" style="width: 60%;background-color: #FFFFFF;" [(ngModel)]="info.value" *ngIf="pattern == 'edit'">
                                                                    <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                                        <tr>
                                                                            <th style="border: 1px solid #999;
                                                                            height: 40px;
                                                                            width: 40%;
                                                                            font-size: 16px;
                                                                            text-align: center;">{{info.name}}</th>
                                                                            <td style="border: 1px solid #999;
                                                                            height: 40px;
                                                                            width: 60%;
                                                                            font-size: 16px;
                                                                            text-align: center;">{{info.value}}</td>
                                                                          </tr>
                                                                      </table>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>

                                                </div>

                                            </div>
                                            <!-- 四周毗邻 -->
                                            <div class="fouradj" *ngIf="element.surveyName=='四周毗邻'">
                                                <div class="fourTexttwo" *ngFor="let info of element.attinf">
                                                    <input type="text" placeholder="请输入内容" style="width: 30%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="info.name" readonly *ngIf="pattern == 'edit'">
                                                    <input type="text" placeholder="请输入内容" style="width: 70%;background-color: #FFFFFF;" [(ngModel)]="info.value" *ngIf="pattern == 'edit'">
                                                    <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                        <tr>
                                                            <th style="border: 1px solid #999;
                                                            height: 40px;
                                                            width: 30%;
                                                            font-size: 16px;
                                                            text-align: center;">{{info.name}}</th>
                                                            <td style="border: 1px solid #999;
                                                            height: 40px;
                                                            width: 70%;
                                                            font-size: 16px;
                                                            text-align: center;">{{info.value}}</td>
                                                          </tr>
                                                      </table>
                                                </div>
                                            </div>
                                            <!-- 功能分区 -->
                                            <div class="fouradj" *ngIf="element.surveyName=='功能分区'">
                                                <div class="onetext" *ngFor="let info of element.attinf;let infoi=index">
                                                    <input type="text" placeholder="请输入内容" style="width: 30%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="info.name" *ngIf="pattern == 'edit'">
                                                    <input type="text" placeholder="请输入内容" style="width: 67%;background-color: #FFFFFF;" [(ngModel)]="info.value" *ngIf="pattern == 'edit'">
                                                    <img src="../../../assets/images/deletered.png" (click)='unitDel(element.surveyName,uniti,infoi)' *ngIf="pattern == 'edit'">
                                                    <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                        <tr>
                                                            <th style="border: 1px solid #999;
                                                            height: 40px;
                                                            width: 30%;
                                                            font-size: 16px;
                                                            text-align: center;">{{info.name}}</th>
                                                            <td style="border: 1px solid #999;
                                                            height: 40px;
                                                            width: 70%;
                                                            font-size: 16px;
                                                            text-align: center;">{{info.value}}</td>
                                                          </tr>
                                                      </table>
                                                </div>
                                            </div>
                                            <!-- 重点部位 -->
                                            <div class="parts" *ngIf="element.surveyName=='重点部位'">
                                                <div *ngFor="let parts of element.attinf;let infoi=index">
                                                    <div class="partsHead" style="width: 100%;
                                                    height: 40px;
                                                    background-color: #ffd91d;
                                                    text-align: center;">
                                                        <input type="text" placeholder="请输入内容" [(ngModel)]="parts.heafName" *ngIf="pattern == 'edit'">
                                                        <textarea [(ngModel)]="parts.heafName" *ngIf="pattern == 'look'" style="width: 100%;height: 100%;color: #b99a00;" disabled></textarea>
                                                        <!-- <span style="font-size: 16px;
                                                        text-align: center;
                                                        height: 40px;
                                                        line-height: 40px;
                                                        color: #b99a00;" *ngIf="pattern == 'look'">{{parts.heafName}}</span> -->
                                                        <img src="../../../assets/images/deletered.png" (click)='unitDel(element.surveyName,uniti,infoi)' *ngIf="pattern == 'edit'">
                                                    </div>
                                                    <div class="partsBody">
                                                        <div class="duohang">
                                                            <div class="duohangHalf">
                                                                <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="parts.body[0].name" *ngIf="pattern == 'edit'">
                                                                <input type="text" placeholder="请输入内容" style="width: 60%;background-color: #FFFFFF;" [(ngModel)]="parts.body[0].value" *ngIf="pattern == 'edit'">
                                                                <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                                    <tr>
                                                                        <th style="border: 1px solid #999;
                                                                        font-size: 16px;
                                                                        text-align: center;height: 40px;width: 185px;">
                                                                        {{parts.body[0].name}}
                                                                        <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[0].name" disabled></textarea> -->
                                                                        </th>
                                                                        <td style="border: 1px solid #999;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[0].value}}
                                                                        <!-- <textarea style="height: 30px;width: 180px;" [(ngModel)]="parts.body[0].value" disabled></textarea> -->
                                                                        </td>
                                                                      </tr>
                                                                  </table>
                                                            </div>
                                                            <div class="duohangHalf">
                                                                <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #e8e9e9;text-align: center;"[(ngModel)]="parts.body[1].name" *ngIf="pattern == 'edit'">
                                                                <input type="text" placeholder="请输入内容" style="width: 60%;background-color: #FFFFFF;" [(ngModel)]="parts.body[1].value" *ngIf="pattern == 'edit'">
                                                                <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                                    <tr>
                                                                        <th style="border: 1px solid #999;
                                                                        height: 40px;width: 185px;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[1].name}}
                                                                        <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[1].name" disabled></textarea> -->
                                                                        </th>
                                                                        <td style="border: 1px solid #999;
                                                                        height: 40px;
                                                                        width: 60%;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[1].value}}
                                                                        <!-- <textarea style="height: 100%;width:100%;" [(ngModel)]="parts.body[1].value" disabled></textarea> -->
                                                                        </td>
                                                                      </tr>
                                                                  </table>
                                                            </div>
                                                        </div>
                                                        <div class="duohang">
                                                            <div class="duohangHalf">
                                                                <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="parts.body[2].name" *ngIf="pattern == 'edit'">
                                                                <input type="text" placeholder="请输入内容" style="width: 60%;background-color: #FFFFFF;" [(ngModel)]="parts.body[2].value" *ngIf="pattern == 'edit'">
                                                                <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                                    <tr>
                                                                        <th style="border: 1px solid #999;
                                                                        height: 40px;width: 185px;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[2].name}}
                                                                        <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[2].name" disabled></textarea> -->
                                                                        </th>
                                                                        <td style="border: 1px solid #999;
                                                                        height: 40px;width: 185px;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[2].value}}
                                                                        <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[2].value" disabled></textarea> -->
                                                                        </td>
                                                                      </tr>
                                                                  </table>
                                                            </div>
                                                            <div class="duohangHalf">
                                                                <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="parts.body[3].name" *ngIf="pattern == 'edit'">
                                                                <input type="text" placeholder="请输入内容" style="width: 60%;background-color: #FFFFFF;" [(ngModel)]="parts.body[3].value" *ngIf="pattern == 'edit'">
                                                                <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                                    <tr>
                                                                        <th style="border: 1px solid #999;
                                                                        height: 40px;width: 185px;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[3].name}}
                                                                        <!-- <textarea style="height: 80%;width: 90%;" [(ngModel)]="parts.body[3].name" disabled></textarea> -->
                                                                        </th>
                                                                        <td style="border: 1px solid #999;
                                                                        height: 40px;width: 185px;
                                                                        font-size: 16px;
                                                                        text-align: center;">
                                                                        {{parts.body[3].value}}
                                                                        <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[3].value" disabled></textarea> -->
                                                                        </td>
                                                                      </tr>
                                                                  </table>
                                                            </div>
                                                        </div>
                                                        <div class="danhang">
                                                            <input type="text" placeholder="请输入内容" style="width: 40%;background-color: #e8e9e9;text-align: center;" [(ngModel)]="parts.body[4].name" *ngIf="pattern == 'edit'">
                                                            <input type="text" placeholder="请输入内容" style="width: 60%;background-color: #FFFFFF;" [(ngModel)]="parts.body[4].value" *ngIf="pattern == 'edit'">
                                                            <table *ngIf="pattern == 'look'" style="width: 100%;border-collapse: collapse;">
                                                                <tr>
                                                                    <th style="border: 1px solid #999;
                                                                    height: 40px;width: 185px;
                                                                    font-size: 16px;
                                                                    text-align: center;">
                                                                    {{parts.body[4].name}}
                                                                    <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[4].name" disabled></textarea> -->
                                                                    </th>
                                                                    <td style="border: 1px solid #999;
                                                                    height: 40px;width: 185px;
                                                                    font-size: 16px;
                                                                    text-align: center;">
                                                                    {{parts.body[4].value}}
                                                                    <!-- <textarea style="height: 100%;width: 100%;" [(ngModel)]="parts.body[4].value" disabled></textarea> -->
                                                                    </td>
                                                                  </tr>
                                                              </table>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </div>



                                </div>
                            </div>
                        </div>
                        <div class="oldData" *ngIf="pattern == 'edit'" (click)='clickoldData()'>
                            <img src="../../../assets/images/olddata.png">
                            <span>原数据</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        
        <div class="toolDiv" *ngIf="pattern == 'look'">
            <button title="下载文档" mat-mini-fab color="primary" (click)="generatingDoc()">
                <mat-icon>vertical_align_bottom</mat-icon>
            </button>
            <button title="返回顶部" mat-mini-fab color="primary" (click)="goBack()">
                <mat-icon>keyboard_capslock</mat-icon>
            </button>
        </div>

        <div class="rightbox">

        </div>
    </div>
</div>

<div id="viewerjs" style="display:none">

</div>