<div class="list-template">
    <div class="list-template__content">
      <div class="list-template__top" nz-row>
        <div nz-col nzXl='18' class="list-template__searchBox"></div>
        <div nz-col nzLg="6" class="list-template__btns">
          <button nz-button *ngIf="coopBtns.add" class="btn default" (click)="addModal()">新增</button>
        </div>
      </div>
      <div class="list-template__bottom">
        <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
          [nzLoading]="loading1">
          <thead>
            <tr class="thead">
              <th nzWidth="50px">序号</th>
              <th nzWidth="15%">问卷标题</th>
              <th nzWidth="15%">调查目标</th>
              <th nzWidth="15%">创建时间</th>
              <th nzWidth="15%">状态</th>
              <th nzWidth="15%">答题数量</th>
              <th nzWidth="15%">操作</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let data of listOfData;let i = index">
							<td>{{i+(pageIndex-1) * pageSize + 1}}</td>
              <td>{{data.title}}</td>
              <td>{{data.surveyTarget?data.surveyTarget.name:'无'}}</td>
              <td>{{data.createTime|date:'yyyy-MM-dd HH:mm'}}</td>
              <td>{{data.state?data.state.name:'无'}}</td>
              <td>{{data.answerNum}}</td>
              <td>
                <div class="coop">
                  <span *ngIf="coopBtns.look" (click)="detail(data.id)">查看</span>
                  <span *ngIf="coopBtns.edit&&data.state&&(data.state.value == 1 || data.state.value == 2)" (click)="edit(data)">编辑</span>
                  <span *ngIf="coopBtns.del&&!data.status" (click)="showDelModal(data,'您确认要删除此问卷吗？','删除','del')">删除</span>
                  <span *ngIf="coopBtns.look&&data.state&&(data.state.value == 2 || data.state.value == 3)" (click)="recovery(data)">回收数据</span>
                  <span *ngIf="coopBtns.look&&data.state&&data.state.value == 1" (click)="publish(data)">发布</span>
                  <span *ngIf="coopBtns.look&&data.state&&data.state.value == 2" (click)="generateLink(data)">链接生成</span>
                  <span *ngIf="coopBtns.look&&data.state&&data.state.value == 2" (click)="researchCompleted(data)">调研完成</span>
                  <!-- <span *ngIf="coopBtns.copy" (click)="copy(data)">复制</span> -->
                </div>
              </td>
            </tr>
          </tbody>
        </nz-table>
        <div class="list-template__pagination">
          <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize"
            (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
          </nz-pagination>
        </div>
      </div>
    </div>
  
    <!-- 新增/编辑/复制模态框 -->
    <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
      <div class="modalBody">
        <div class="title">{{modelName}}<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i></div>
        <div class="content">
          <form nz-form [formGroup]="validateForm" class="addForm">
            <nz-form-item>
              <nz-form-label [nzSpan]="24" nzRequired nzFor="title">问卷标题</nz-form-label>
              <nz-form-control nzErrorTip="请输入问卷标题!">
                <nz-input-group>
                  <input nz-input formControlName="title" placeholder="请输入问卷标题" />
                </nz-input-group>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="surveyDescribe">问卷描述</nz-form-label>
              <nz-form-control nzErrorTip="请输入问卷描述!">
                <nz-input-group>
                  <textarea class="surveyDescribe" formControlName="surveyDescribe" nz-input
                    placeholder="请输入问卷描述"></textarea>
                </nz-input-group>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label [nzSpan]="6" [nzXs]="24" nzRequired nzFor="surveyTarget">调查目标</nz-form-label>
              <nz-form-control nzErrorTip="请选择调查目标!">
                <nz-select [nzDisabled]="!add" [nzDropdownMatchSelectWidth]="false" formControlName="surveyTarget" nzShowSearch nzPlaceHolder="请选择调研目标">
                  <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of surveyTargets"></nz-option>
                </nz-select>
              </nz-form-control>
            </nz-form-item>
          </form>
        </div>
        <div class=" display_flex justify-content_flex-center">
          <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">配置问题</button>
          <button class="btn" nzGhost nzType="primary" nz-button (click)="submitForm(true)" [nzLoading]="btnLoading1"
            *ngIf="!add">保存</button>
          <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
        </div>
      </div>
    </div>
    <!-- 显示生成链接模态框 -->
    <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="linkModal">
      <div class="modalBody" style="width: 640px;">
        <div class="title">提示<i class="icon_transport transport-guanbi" (click)="hideLinkModal()"></i>
        </div>
        <div class="content" style="display: flex;">
          <div style="flex: 1;border-right: 2px solid #e5e9ed;">
            <div>内网链接：<a [href]="coopId.innerLink" target="_blank">{{coopId.innerLink}}</a></div>
            <div><img style="width: 70%;" [src]="coopId.innerQrcode"></div>
            <button nz-button nzType="default" (click)="downLoadQrCode(coopId.innerQrcode)">下载二维码</button>
          </div>
          <div style="flex: 1;">
            <div>外网链接：<a [href]="coopId.outLink" target="_blank">{{coopId.outLink}}</a></div>
            <div><img style="width: 70%;" [src]="coopId.outQrcode"></div>
            <button nz-button nzType="default" (click)="downLoadQrCode(coopId.innerQrcode)">下载二维码</button>
          </div>
        </div>
        <div class=" display_flex justify-content_flex-center">
          <button class="btn cancel" nz-button nzType="default" (click)="hideLinkModal()">知道了</button>
        </div>
      </div>
    </div>
    <!-- 删除模态框 -->
    <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
      (confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
  </div>
  <!-- 操作成功/失败提示框 -->
  <app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
    [info]="promptInfo">
  </app-prompt-modal>
  <!-- 查看详情 -->
  <router-outlet></router-outlet>
  