<template>
  <el-dialog  :close-on-click-modal="false" :title="$t('一人一档')" :visible.sync="visible" width="1200px" append-to-body>
    <el-card>
      <div slot="header" class="clearfix">
        <span>基本资料</span>
      </div>
      <div class="el-descriptions">
        <div class="el-descriptions__body">
          <table class="el-descriptions__table is-bordered el-descriptions--big" style="table-layout: fixed;border: 1px solid #e6ebf5;">
            <tr class="el-descriptions-row">
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "> 姓名</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"> {{staff.name}}</td>
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label ">部门</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content">{{unitFormat(staff)}}</td>
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label ">班组</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content">{{teamFormat(staff)}}</td>
              <td colspan="1" rowspan="3" >
                <img :src="photo"  style="width: 150px"/>
              </td>
            </tr>
            <tr class="el-descriptions-row">
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label ">工号</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content">{{staff.staffid}}</td>
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "> 性别</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content" > {{sexFormat(staff)}}</td>
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "> 年龄</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content">{{staff.birthday}}</td>
            </tr>
            <tr class="el-descriptions-row">
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label ">学历</th>
              <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content">{{educationFormat(staff)}}</td>
              <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label ">当前岗位</th>
              <td colspan="3" class="el-descriptions-item__cell el-descriptions-item__content">{{actualpostFormat(staff)}}</td>
            </tr>
          </table>
        </div>
      </div>
    </el-card>
    <el-row>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>裂解上岗证</span>
          </div>
          <el-table :data="doc.crackingfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>压缩上岗证</span>
          </div>
          <el-table :data="doc.hotareafileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>分离上岗证</span>
          </div>
          <el-table :data="doc.coldareafileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>芳烃上岗证</span>
          </div>
          <el-table :data="doc.aromaticfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>压力容器作业证书</span>
          </div>
          <el-table :data="doc.containerfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>压力管道作业证书</span>
          </div>
          <el-table :data="doc.pipefileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>锅炉证</span>
          </div>
          <el-table :data="doc.boileridfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>加氢工艺作业证书</span>
          </div>
          <el-table :data="doc.hydrogenationfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>裂化工艺作业证书</span>
          </div>
          <el-table :data="doc.crackingidfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>制冷与空调作业证书</span>
          </div>
          <el-table :data="doc.refrigerationfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>班组长安全生产合格证</span>
          </div>
          <el-table :data="doc.foremantrainfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>建筑消防作业证书</span>
          </div>
          <el-table :data="doc.fireProtectionfileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>锅炉水质处理作业证书</span>
          </div>
          <el-table :data="doc.waterdatefileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>锅炉能效作业证书</span>
          </div>
          <el-table :data="doc.energydatefileList" border>
            <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
              <template slot-scope="scope">
                <a  class="link-type"  @click="handleDownload(scope.row)">
                  <span>{{ scope.row.fileName }}</span>
                </a>
              </template>
            </el-table-column>
            <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.fileName.endsWith('pdf')"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                  @click="handleSee(scope.row)"
                >{{ $t('预览') }}</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-download"
                  @click="handleDownload(scope.row)"
                >{{ $t('下载') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
    <!-- pdf预览 -->
    <el-dialog  :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
      <div style="margin-top: -60px;float: right;margin-right: 40px;">
        <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
      <div style="margin-top: -30px">
        <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
      </div>
    </el-dialog>
  </el-dialog>
</template>

<script>
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  import {listPlan} from "@/api/training/spec/plan";
  import {listParticipants} from "@/api/training/participants";
  import {listDevice} from "@/api/training/device";
  import { getStaffmgrByStaffid } from "@/api/plant/staffmgr";
  import {getCommonfile,allFileList} from "@/api/common/commonfile";
  import { getToken } from "@/utils/auth";

  export default {
    name: "Resume",
    components: {Treeselect},
    data() {
      return {
        // 遮罩层
        loading: false,
        planLoading: false,
        visible: false,
        // 选中数组
        ids: [],
        staff: {},
        photo: '',
        dataListSelections: [],
        // 装置名称字典
        plantCodeOptions: [],
        // 性别字典
        sexOptions: [],
        // 部门字典
        unitOptions: [],
        // 班值字典
        teamOptions: [],
        // 实际岗位字典
        actualpostOptions: [],
        // 学历字典
        educationOptions: [],
        // 英语能力字典
        enAbilityOptions: [],
        // 特殊职能字典
        specialDutyOptions: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: false,
        // 总条数
        total: 0,
        // 培养计划表格数据
        planList: [],
        // 人员-公司级培训关系表格数据
        participantsList: [],
        // 人员-装置级培训关系表格数据
        devicceList: [],
        // 弹出层标题
        title: "",
        // 操作
        operation: "",
        // 部门树选项
        deptOptions: undefined,
        clientHeight: 300,
        // 是否显示弹出层
        open: false,
        // 学习状态字典
        studyStateOptions: [],
        // 学员列表
        successorOptions: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 20,
          staffId: null,
          plantName: null,
          startDate: null,
          endDate: null,
          classHour: null,
          studyState: null
        },
        queryCompanyParams: {
          staffId: null,
          companyId: null,
        },
        queryDeviceParams: {
          staffId: null,
          regularId: null,
          year: this.getNowTime(),
          trainingType: null
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {},
        doc: {
          file: "",
          // 是否显示弹出层（报告附件）
          open: false,
          // 弹出层标题（报告附件）
          title: "附件",
          // 是否禁用上传
          isUploading: false,
          // 是否更新已经存在的用户数据
          updateSupport: 0,
          // 报告附件上传位置编号
          ids: 0,
          // 设置上传的请求头部
          headers: { Authorization: "Bearer " + getToken() },
          // 上传的地址
          url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
          commonfileList: null,
          boilerfileList: [],
          crackingfileList: [],
          hotareafileList: [],
          coldareafileList: [],
          aromaticfileList: [],
          containerfileList: [],
          pipefileList: [],
          boileridfileList: [],
          hydrogenationfileList: [],
          crackingidfileList: [],
          refrigerationfileList: [],
          foremantrainfileList: [],
          fireProtectionfileList: [],
          waterdatefileList: [],
          energydatefileList: [],
          queryParams: {
            pId: null,
            pType: 'training'
          },
          pType: 'training',
          pId: null,
          form: {}
        },
        pdf : {
          title: '',
          pdfUrl: '',
          numPages: null,
          open: false,
          pageNum: 1,
          pageTotalNum: 1,
          loadedRatio: 0,
        },
      };
    },
    watch: {},
    created() {
      this.getDicts("PLANT_DIVIDE").then(response => {
        this.plantCodeOptions = response.data;
      });
      this.getDicts("sys_user_sex").then(response => {
        this.sexOptions = response.data;
      });
      this.getDicts("STAFF_UNIT").then(response => {
        this.unitOptions = response.data;
      });
      this.getDicts("TEAM_DIVIDE").then(response => {
        this.teamOptions = response.data;
      });
      this.getDicts("ACTUALPOST").then(response => {
        this.actualpostOptions = response.data;
      });
      this.getDicts("EDUCATION").then(response => {
        this.educationOptions = response.data;
      });
      this.getDicts("ENGLISHABILITY").then(response => {
        this.enAbilityOptions = response.data;
      });
      this.getDicts("SPECIAL_DUTY").then(response => {
        this.specialDutyOptions = response.data;
      });
    },
    methods: {
      init(row) {
        getStaffmgrByStaffid(row.employeeid).then(response => {
          if (response.data != null) {
            this.visible = true;
            this.staff = response.data
            this.photo = process.env.VUE_APP_BASE_API + response.data.photo
            this.queryParams.employeeid = row.employeeid
            this.getNowTime()

            this.doc.id = row.id;
            this.doc.queryParams.pId = row.id
            this.doc.pId = row.id
            this.getFileList();
          } else {
            this.msgError("该员工工号填写有误，请核对后再试。");
          }
        });
      },
      getFileList (){
        this.doc.queryParams.pType = "license-boiler"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.boilerfileList = response;
        });
        this.doc.queryParams.pType = "license-cracking"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.crackingfileList = response;
        });
        this.doc.queryParams.pType = "license-hotarea"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.hotareafileList = response;
        });
        this.doc.queryParams.pType = "license-coldarea"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.coldareafileList = response;
        });
        this.doc.queryParams.pType = "license-aromatic"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.aromaticfileList = response;
        });
        this.doc.queryParams.pType = "certificate-container"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.containerfileList = response;
        });
        this.doc.queryParams.pType = "certificate-pipe"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.pipefileList = response;
        });
        this.doc.queryParams.pType = "certificate-boilerid"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.boileridfileList = response;
        });
        this.doc.queryParams.pType = "certificate-hydrogenation"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.hydrogenationfileList = response;
        });
        this.doc.queryParams.pType = "certificate-crackingid"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.crackingidfileList = response;
        });
        this.doc.queryParams.pType = "certificate-refrigeration"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.refrigerationfileList = response;
        });
        this.doc.queryParams.pType = "certificate-foremantrain"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.foremantrainfileList = response;
        });
        this.doc.queryParams.pType = "certificate-fireProtection"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.fireProtectionfileList = response;
        });
        this.doc.queryParams.pType = "certificate-waterdate"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.waterdatefileList = response;
        });
        this.doc.queryParams.pType = "certificate-energydate"
        allFileList(this.doc.queryParams).then(response => {
          this.doc.energydatefileList = response;
        });
      },
      openPdf(){
        window.open(this.pdf.pdfUrl);//path是文件的全路径地址
      },
      handleSee (row){
        // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
        this.pdf.open =true
        this.pdf.title = row.fileName
        this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
      },
      // 上一页
      prePage() {
        let page = this.pdf.pageNum
        page = page > 1 ? page - 1 : this.pdf.pageTotalNum
        this.pdf.pageNum = page
      },
      // 下一页
      nextPage() {
        let page = this.pdf.pageNum
        page = page < this.pdf.pageTotalNum ? page + 1 : 1
        this.pdf.pageNum = page
      },
      //附件上传中处理
      handleFileDocProgress(event, file, fileList) {
        this.doc.file = file;
        this.doc.isUploading = true;
      },
      //附件上传成功处理
      handleFileDocSuccess(response, file, fileList) {
        this.doc.isUploading = false;
        this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
        this.getFileList()
      },
      // 文件下载处理
      handleDownload(row) {
        var name = row.fileName;
        var url = row.fileUrl;
        var suffix = url.substring(url.lastIndexOf("."), url.length);
        const a = document.createElement('a')
        a.setAttribute('download', name)
        a.setAttribute('target', '_blank')
        a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
        a.click()
      },
      /** 获取当前年份 */
      getNowTime() {
        var now = new Date();
        var year = now.getFullYear(); //得到年份
        var defaultDate = `${year}`;
        defaultDate = `${year}`
        return defaultDate;
      },
      /** 查询培养计划列表 */
      getPlanList() {
        this.planLoading = true;
        this.queryParams.year = this.queryDeviceParams.year
        listPlan(this.queryParams).then(response => {
          this.planList = response.rows;
          this.total = response.total;
          this.planLoading = false;
        });
      },
      getParticipants() {
        this.queryCompanyParams.staffId = this.staff.staffid
        // this.queryCompanyParams.year = this.queryDeviceParams.year
        listParticipants(this.queryCompanyParams).then(response => {
          this.participantsList = response.rows;
        });
      },
      getDevice() {
        this.queryDeviceParams.staffId = this.staff.staffid
        listDevice(this.queryDeviceParams).then(response => {
          this.devicceList = response.rows;
        });
      },
      staffPlanQuery (){
        this.getPlanList()
      },
      // 装置名称字典翻译
      plantCodeFormat(row, column) {
        return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
      },
      // 性别字典翻译
      sexFormat(row, column) {
        return this.selectDictLabel(this.sexOptions, row.sex);
      },
      // 部门字典翻译
      unitFormat(row, column) {
        return this.selectDictLabel(this.unitOptions, row.unit);
      },
      // 班值字典翻译
      teamFormat(row, column) {
        return this.selectDictLabel(this.teamOptions, row.team);
      },
      // 实际岗位字典翻译
      actualpostFormat(row, column) {
        return this.selectDictLabel(this.actualpostOptions, row.actualpost);
      },
      // 学历字典翻译
      educationFormat(row, column) {
        return this.selectDictLabel(this.educationOptions, row.education);
      },
      // 英语能力字典翻译
      enAbilityFormat(row, column) {
        return this.selectDictLabel(this.enAbilityOptions, row.enAbility);
      },
      // 特殊职能字典翻译
      specialDutyFormat(row, column) {
        return this.selectDictLabel(this.specialDutyOptions, row.specialDuty);
      },
    }
  };
</script>
