<template>
  <div>
    <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
      <el-form-item :label="'BU'">
        <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in userBuList"
            :key = "i.buNo"
            :label = "i.buDesc"
            :value = "i.buDesc">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'项目编码'">
        <el-input v-model="searchData.projectNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'项目名称'">
        <el-input v-model="searchData.projectDesc" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'项目料号'">
        <el-input v-model="searchData.testPartNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'料号描述'">
        <el-input v-model="searchData.partDesc" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'客户编码'">
        <el-input v-model="searchData.customerNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'客户名称'">
        <el-input v-model="searchData.customerDesc" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'打样单号'">
        <el-input v-model="searchData.proofingNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'项目分类'">
        <el-select v-model="searchData.cProjectTypeDb" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in projectCategoryList"
            :key = "i.projectCategory"
            :label = "i.projectCategory"
            :value = "i.projectCategory">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'项目状态'">
        <el-select v-model="searchData.status" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in statusList"
            :key = "i.status"
            :label = "i.status"
            :value = "i.status">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'PM/Sales'">
        <el-select v-model="searchData.projectManager" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in projectManagersList"
            :key = "i.projectManagerId"
            :label = "i.projectManagerName"
            :value = "i.projectManager">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'PjM'">
        <el-select v-model="searchData.projectOwner" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in projectOwnersList"
            :key = "i.projectOwnerId"
            :label = "i.projectOwnerName"
            :value = "i.projectOwner">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'Engineer'">
        <el-select v-model="searchData.engineer" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in engineersList"
            :key = "i.engineerId"
            :label = "i.engineerName"
            :value = "i.engineer">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'立项日期：'">
        <el-date-picker
          style="width: 120px"
          v-model="searchData.startDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
        -
        <el-date-picker
          style="width: 120px"
          v-model="searchData.endDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <!--      <el-form-item :label="'在用'">-->
      <!--        <el-select filterable v-model="searchData.active" style="width: 130px">-->
      <!--          <el-option label="全部" value=""></el-option>-->
      <!--          <el-option label="是" value="Y"></el-option>-->
      <!--          <el-option label="否" value="N"></el-option>-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <el-form-item :label="' '">
        <el-button @click="getDataList()">查询</el-button>
        <download-excel
          :fields="fields()"
          :data="exportData"
          type="xls"
          :name="exportName"
          :header="exportHeader"
          :footer="exportFooter"
          :fetch="createExportData"
          :before-generate="startDownload"
          :before-finish="finishDownload"
          worksheet="导出信息"
          class="el-button el-button--primary el-button--medium">
          {{ "导出" }}
        </download-excel>
      </el-form-item>
    </el-form>

    <el-table
      @header-dragend="handleColumnResize"
      :data="dataList"
      border
      :height="height"
      style="width: 100%;margin-top: 0px;"
      ref="projectAllDocumentDocumentTable"
      @row-click="projectAllProofClickRow"
      :row-style="rowStyle"
      v-loading="dataListLoading">
      <el-table-column
        v-for="(item,index) in columnProjectAllProofList" :key="index"
        :sortable="item.columnSortable"
        :prop="item.columnProp"
        :header-align="item.headerAlign"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :align="item.align"
        :fixed="item.fixed==''?false:item.fixed"
        :min-width="item.columnWidth"
        :label="item.columnLabel">
        <template slot-scope="scope">
          <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
          <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                             style="width: 100px; height: 80px"/></span>
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        align="center"
        fixed="left"
        width="70">
        <template slot-scope="scope">
          <a type="text" size="small" @click="toMes(scope.row)">项目信息</a>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[20, 50, 100, 200, 500]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
  </div>
</template>

<script>

import {
  searchProjectUploadsDocumentList,
  searchProjectOverUploadsDocumentList,
  searchConfirmProgressList, searchOverConfirmProgressList, getProofDocument, searchAllProjectUploadsDocumentList,
  searchAllProofing, searchAllConfirmProgressList, queryAllProofing
} from "../../../api/eam/eamProofing";
import {searchConfirmProgressPusherList, warnSendMailHandle} from "../../../api/eam/eamProject";
import {getSiteAndBuByUserName} from "../../../api/qc/qc";
import {removeUserFavorite, saveUserFavorite, userFavoriteList} from "../../../api/userFavorite";
import {getTableDefaultListLanguage, getTableUserListLanguage, updateColumnSize} from "../../../api/table";
import {EventBus} from "../../../main";
import UploadFileList1 from "../common/uploadFileList1.vue";

export default {
  components: {UploadFileList1},

  computed: {
    projectOwnersList() {
      return this.allPersonnelInfoList.filter(item => item.projectOwnerId !== undefined);
    },
    projectManagersList() {
      return this.allPersonnelInfoList.filter(item => item.projectManagerId !== undefined);
    },
    engineersList() {
      return this.allPersonnelInfoList.filter(item => item.engineerId !== undefined);
    }
  },

  data() {
    return {
      // 导出
      exportData: [],
      exportName: '项目打样记录' + this.dayjs().format('YYYYMMDDHHmmss'),
      exportHeader: ['项目打样记录'],
      exportFooter: [],
      folder: '',
      dataList: [],
      allDataList: [],
      allPersonnelInfoList: [],
      fileList: [],
      height: 200,
      pageIndex: 1,
      pageSize: 20,
      totalPage: 0,
      dataListLoading: false,
      uploadDialog:false,
      isEditable: true,
      isMassProductionStage: true,
      warnFlag: false,
      projectAllProofClickRow: {},
      selectTypeFlag: [],
      searchData: {
        site: this.$store.state.user.site,
        userId: this.$store.state.user.id,
        projectId: '',
        projectNo: '',
        projectDesc: '',
        projectPartId: '',
        testPartNo: '',
        partDesc: '',
        customerNo: '',
        customerDesc: '',
        buDesc: '',
        projectCategory: '',
        status: '',
        startDate:'',
        endDate:'',
        projectCreationDate: new Date(),
        projectCloseDate:'',
        needDate:'',
        projectManager: '',
        projectOwner: '',
        engineer: '',
        page: 1,
        limit: 10,
      },
      columnProjectAllProofList: [
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1BuDesc',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'buDesc',
          headerAlign: "center",
          align: "center",
          columnLabel: 'BU',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1ProjectNo',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'projectNo',
          headerAlign: "center",
          align: "center",
          columnLabel: '项目编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1ProjectDesc',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'projectDesc',
          headerAlign: "center",
          align: "center",
          columnLabel: '项目名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1TestPartNo',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'testPartNo',
          headerAlign: "center",
          align: "center",
          columnLabel: '项目料号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1PartDesc',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'partDesc',
          headerAlign: "center",
          align: "center",
          columnLabel: '料号描述',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1customerNo',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: "customerNo",
          headerAlign: "center",
          align: "left",
          columnLabel: "客户编码",
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1customerDesc',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: "customerDesc",
          headerAlign: "center",
          align: "left",
          columnLabel: "客户名称",
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 150
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1ProjectCreationDate',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: "buildDate",
          headerAlign: "center",
          align: "center",
          columnLabel: "立项日期",
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1Priority',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'priority',
          headerAlign: "center",
          align: "left",
          columnLabel: '优先级',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CProjectRegion',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cProjectRegion',
          headerAlign: "center",
          align: "left",
          columnLabel: '区域',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1ProjectManager',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'projectManagerName',
          headerAlign: "center",
          align: "left",
          columnLabel: 'PM/Sales',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1ProjectOwner',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'projectOwnerName',
          headerAlign: "center",
          align: "left",
          columnLabel: 'PjM',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1Engineer',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'engineerName',
          headerAlign: "center",
          align: "left",
          columnLabel: 'Engineer',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer1',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer1Name',
          headerAlign: "center",
          align: "left",
          columnLabel: 'IPQC-Lam/Pri/Etch/Slit',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 170,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer2',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer2Name',
          headerAlign: "center",
          align: "left",
          columnLabel: 'IPQC-Converting',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 150,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer3',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer3Name',
          headerAlign: "center",
          align: "left",
          columnLabel: 'FQC1',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer5',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer5Name',
          headerAlign: "center",
          align: "left",
          columnLabel: 'FQC2',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer6',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer6Name',
          headerAlign: "center",
          align: "left",
          columnLabel: 'IQC',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CManufactureEngineer',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cManufactureEngineerName',
          headerAlign: "center",
          align: "left",
          columnLabel: 'MFG',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer4',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer4Name',
          headerAlign: "center",
          align: "left",
          columnLabel: 'SQE',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1DocEngineer',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'docEngineerName',
          headerAlign: "center",
          align: "left",
          columnLabel: '文档工程师',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1IpqcHardTag',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'ipqcHardTagName',
          headerAlign: "center",
          align: "left",
          columnLabel: 'IPQC-Hardtag',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CQualityEngineer7',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cQualityEngineer7Name',
          headerAlign: "center",
          align: "left",
          columnLabel: '前道工程师',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1Status',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'status',
          headerAlign: "center",
          align: "left",
          columnLabel: '物料状态' ,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1ProofingStatus',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'proofingStatus',
          headerAlign: "center",
          align: "left",
          columnLabel: '打样状态' ,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1NeedDate',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'needDate',
          headerAlign: "center",
          align: "center",
          columnLabel: '项目物料预计完成日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 130,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CloseDate',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'closeDate',
          headerAlign: "center",
          align: "center",
          columnLabel: '转量产日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1FinalPartNo',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'finalPartNo',
          headerAlign: "center",
          align: "left",
          columnLabel: 'ERP正式料号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1RequiredDeliveryDate',
          tableId: '103001Table1',
          tableName: '打样记录表',
          columnProp: 'planStartDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '打样开始日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 90
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1ProofingNo',
          tableId: '103001Table1',
          tableName: '打样记录表',
          columnProp: 'proofingNo',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '打样单号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1ProofingNumber',
          tableId: '103001Table1',
          tableName: '打样记录表',
          columnProp: 'proofingNumber',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '数量',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80
        },
        {
          userId: this.$store.state.user.name,
          functionId: 401008,
          serialNumber: '401008Table1CProjectTypeDb',
          tableId: "401008Table1",
          tableName: "项目打样记录表",
          columnProp: 'cProjectTypeDb',
          headerAlign: "center",
          align: "left",
          columnLabel: '项目分类',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1RequiredDeliveryDate',
          tableId: '103001Table1',
          tableName: '打样记录表',
          columnProp: 'requiredDeliveryDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '打样预计完成日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1ActualityDeliveryDate',
          tableId: '103001Table1',
          tableName: '打样记录表',
          columnProp: 'actualityDeliveryDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '实际完成日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1CreateDate',
          tableId: '103001Table1',
          tableName: '打样文档表',
          columnProp: 'createDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '打样单创建时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 130
        },
        {
          userId: this.$store.state.user.name,
          functionId: 103001,
          serialNumber: '103001Table1CreateBy',
          tableId: '103001Table1',
          tableName: '打样文档表',
          columnProp: 'createBy',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '打样单创建人',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 90
        }
      ],
      userBuList: [],
      projectCategoryList: [
        {
          projectCategory: 'Low Risk',
        },
        {
          projectCategory: 'High Risk',
        },
        {
          projectCategory: 'Sustaining',
        }
      ],
      statusList: [
        {
          status: '草稿',
        },
        {
          status: '进行中',
        },
        {
          status: '已量产',
        },
        {
          status: '正式量产',
        }
      ],
    };
  },
  created() {
    // 获取用户的 site 和 bu
    this.getSiteAndBuByUserName()
    // 校验用户是否收藏
    this.favoriteIsOk()
    // 动态列
    this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
    this.getDataList()
  },
  activated() {
    if (this.$route.query.flag) {
      this.getDataList()
    }
    this.$store.commit("sift/commitSearchFunction",this.queryAllProofing)
  },
  mounted () {
    this.$nextTick(() => {
      this.height = window.innerHeight - 200
    })
    EventBus.$on('updateAllProof', () => {
      this.getDataList();
    });
  },
  methods: {
    handleColumnResize(newWidth, oldWidth, column, event){
      let inData= this.columnList.filter(item => item.columnProp === column.property)[0]
      inData.columnWidth=newWidth
      updateColumnSize(inData).then(({data}) => {
        if (data.code === 0) {
          console.log("栏位宽度保存成功！")
        }
      })
    },
    // 获取用户的bu
    getSiteAndBuByUserName () {
      let tempData = {
        username: this.$store.state.user.name,
      }
      getSiteAndBuByUserName(tempData).then(({data}) => {
        if (data.code === 0) {
          this.userBuList = data.rows
        }
      })
    },

    //导出excel
    async createExportData() {
      this.searchData.limit = -1
      this.searchData.page = 1
      await searchAllProofing(this.searchData).then(({data}) => {
        this.exportList = data.page.list
        this.exportList.forEach((item) => {
          item.projectManagerName = item.projectManager.split('-')[1];
          item.projectOwnerName = item.projectOwner.split('-')[1];
          item.engineerName = item.engineer.split('-')[1];
          item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1];
          item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1];
          item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1];
          item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1];
          if (item.cQualityEngineer4 !== null && item.cQualityEngineer4 !== ''){
            item.cQualityEngineer4Name = item.cQualityEngineer4.split('-')[1];
          }
          if (item.cQualityEngineer5 !== null && item.cQualityEngineer5 !== ''){
            item.cQualityEngineer5Name = item.cQualityEngineer5.split('-')[1];
          }
          if (item.cQualityEngineer6 !== null && item.cQualityEngineer6 !== ''){
            item.cQualityEngineer6Name = item.cQualityEngineer6.split('-')[1];
          }
          if (item.docEngineer !== null && item.docEngineer !== ''){
            item.docEngineerName = item.docEngineer.split('-')[1];
          }
          if (item.ipqcHardTag !== null && item.ipqcHardTag !== ''){
            item.ipqcHardTagName = item.ipqcHardTag.split('-')[1];
          }
          if (item.cQualityEngineer7 !== null && item.cQualityEngineer7 !== ''){
            item.cQualityEngineer7Name = item.cQualityEngineer7.split('-')[1];
          }
        });

        for (let i = 0; i < this.exportList.length; i++) {
          if (this.exportList[i].responsibleDepartment === 'R001') {
            this.exportList[i].projectLeader = this.exportList[i].projectManager.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R002') {
            this.exportList[i].projectLeader = this.exportList[i].projectOwner.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R004') {
            this.exportList[i].projectLeader = this.exportList[i].engineer.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R005') {
            this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer1.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R007') {
            this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer2.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R008') {
            this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer3.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R009') {
            this.exportList[i].projectLeader = this.exportList[i].cManufactureEngineer.split("-")[1];
          } else if (this.exportList[i].responsibleDepartment === 'R011') {
            if (this.exportList[i].cQualityEngineer4 !== null && this.exportList[i].cQualityEngineer4 !== '') {
              this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer4.split("-")[1];
            }
          } else if (this.exportList[i].responsibleDepartment === 'R012') {
            if (this.exportList[i].docEngineer !== null && this.exportList[i].docEngineer !== '') {
              this.exportList[i].projectLeader = this.exportList[i].docEngineer.split("-")[1];
            }
          } else if (this.exportList[i].responsibleDepartment === 'R013') {
            if (this.exportList[i].cQualityEngineer5 !== null && this.exportList[i].cQualityEngineer5 !== '') {
              this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer5.split("-")[1];
            }
          } else if (this.exportList[i].responsibleDepartment === 'R014') {
            if (this.exportList[i].cQualityEngineer6 !== null && this.exportList[i].cQualityEngineer6 !== '') {
              this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer6.split("-")[1];
            }
          } else if (this.exportList[i].responsibleDepartment === 'R015') {
            if (this.exportList[i].ipqcHardTag !== null && this.exportList[i].ipqcHardTag !== '') {
              this.exportList[i].projectLeader = this.exportList[i].ipqcHardTag.split("-")[1];
            }
          } else if (this.exportList[i].responsibleDepartment === 'R016') {
            if (this.exportList[i].cQualityEngineer7 !== null && this.exportList[i].cQualityEngineer7 !== '') {
              this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer7.split("-")[1];
            }
          }
        }
      })
      return this.exportList
    },

    startDownload() {
    },

    finishDownload() {
    },

    fields () {
      let json = "{"
      this.columnProjectAllProofList.forEach((item, index) => {
        if (index == this.columnProjectAllProofList.length - 1) {
          json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
        } else {
          json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
        }
      })
      json += "}"
      let s = eval("(" + json + ")")
      return s
    },

    // 获取数据列表
    getDataList(params) {
      this.selectTypeFlag = params
        this.searchData.limit = this.pageSize;
        this.searchData.page = this.pageIndex;
        searchAllProofing(this.searchData).then(({ data }) => {
          if (data.code === 0) {
            this.dataList = data.page.list;
            this.allPersonnelInfoList = data.rows;
            this.pageIndex = data.page.currPage;
            this.pageSize = data.page.pageSize;
            this.totalPage = data.page.totalCount;

            this.dataList.forEach((item) => {
              item.projectManagerName = item.projectManager.split('-')[1];
              item.projectOwnerName = item.projectOwner.split('-')[1];
              item.engineerName = item.engineer.split('-')[1];
              item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1];
              item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1];
              item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1];
              item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1];
              if (item.cQualityEngineer4 !== null && item.cQualityEngineer4 !== ''){
                item.cQualityEngineer4Name = item.cQualityEngineer4.split('-')[1];
              }
              if (item.cQualityEngineer5 !== null && item.cQualityEngineer5 !== ''){
                item.cQualityEngineer5Name = item.cQualityEngineer5.split('-')[1];
              }
              if (item.cQualityEngineer6 !== null && item.cQualityEngineer6 !== ''){
                item.cQualityEngineer6Name = item.cQualityEngineer6.split('-')[1];
              }
              if (item.docEngineer !== null && item.docEngineer !== ''){
                item.docEngineerName = item.docEngineer.split('-')[1];
              }
              if (item.ipqcHardTag !== null && item.ipqcHardTag !== ''){
                item.ipqcHardTagName = item.ipqcHardTag.split('-')[1];
              }
              if (item.cQualityEngineer7 !== null && item.cQualityEngineer7 !== ''){
                item.cQualityEngineer7Name = item.cQualityEngineer7.split('-')[1];
              }
            });

            for (let i = 0; i < this.dataList.length; i++) {
              if (this.dataList[i].responsibleDepartment === 'R001') {
                this.dataList[i].projectLeader = this.dataList[i].projectManager.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R002') {
                this.dataList[i].projectLeader = this.dataList[i].projectOwner.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R004') {
                this.dataList[i].projectLeader = this.dataList[i].engineer.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R005') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer1.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R007') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer2.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R008') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer3.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R009') {
                this.dataList[i].projectLeader = this.dataList[i].cManufactureEngineer.split("-")[1];
              } else if (this.dataList[i].responsibleDepartment === 'R011') {
                if (this.dataList[i].cQualityEngineer4 !== null && this.dataList[i].cQualityEngineer4 !== '') {
                  this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer4.split("-")[1];
                }
              } else if (this.dataList[i].responsibleDepartment === 'R012') {
                if (this.dataList[i].docEngineer !== null && this.dataList[i].docEngineer !== '') {
                  this.dataList[i].projectLeader = this.dataList[i].docEngineer.split("-")[1];
                }
              } else if (this.dataList[i].responsibleDepartment === 'R013') {
                if (this.dataList[i].cQualityEngineer5 !== null && this.dataList[i].cQualityEngineer5 !== '') {
                  this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer5.split("-")[1];
                }
              } else if (this.dataList[i].responsibleDepartment === 'R014') {
                if (this.dataList[i].cQualityEngineer6 !== null && this.dataList[i].cQualityEngineer6 !== '') {
                  this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer6.split("-")[1];
                }
              } else if (this.dataList[i].responsibleDepartment === 'R015') {
                if (this.dataList[i].ipqcHardTag !== null && this.dataList[i].ipqcHardTag !== '') {
                  this.dataList[i].projectLeader = this.dataList[i].ipqcHardTag.split("-")[1];
                }
              } else if (this.dataList[i].responsibleDepartment === 'R016') {
                if (this.dataList[i].cQualityEngineer7 !== null && this.dataList[i].cQualityEngineer7 !== '') {
                  this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer7.split("-")[1];
                }
              }
            }

            this.getAllPersonnelList();

          } else {
            this.$alert(data.msg, '提示', {
              confirmButtonText: '确定',
              callback: action => {
              }
            });
          }
        })
        // else if(this.$route.query.flag === '1') {
      //   searchProjectUploadsDocumentList(this.searchData).then(({data}) => {
      //     if (data.code === 0) {
      //       this.dataList = data.page.list
      //       this.pageIndex = data.page.currPage
      //       this.pageSize = data.page.pageSize
      //       this.totalPage = data.page.totalCount
      //       this.dataList.forEach((item) => {
      //         item.projectManagerName = item.projectManager.split('-')[1]
      //         item.projectOwnerName = item.projectOwner.split('-')[1]
      //         item.engineerName = item.engineer.split('-')[1]
      //         item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1]
      //         item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1]
      //         item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1]
      //         item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
      //       })
      //       for (let i = 0; i < this.dataList.length; i++) {
      //         if (this.dataList[i].responsibleDepartment === 'R001'){
      //           this.dataList[i].projectLeader = this.dataList[i].projectManager.split("-")[1]
      //         } else if(this.dataList[i].responsibleDepartment === 'R002'){
      //           this.dataList[i].projectLeader = this.dataList[i].projectOwner.split("-")[1]
      //         } else if(this.dataList[i].responsibleDepartment === 'R004'){
      //           this.dataList[i].projectLeader = this.dataList[i].engineer.split("-")[1]
      //         } else if(this.dataList[i].responsibleDepartment === 'R005'){
      //           this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer1.split("-")[1]
      //         } else if(this.dataList[i].responsibleDepartment === 'R007'){
      //           this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer2.split("-")[1]
      //         } else if(this.dataList[i].responsibleDepartment === 'R008'){
      //           this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer3.split("-")[1]
      //         } else if(this.dataList[i].responsibleDepartment === 'R009'){
      //           this.dataList[i].projectLeader = this.dataList[i].cManufactureEngineer.split("-")[1]
      //         }
      //       }
      //     }
      //   })
      // }else {
      //   searchAllProjectUploadsDocumentList(this.searchData).then(({data}) => {
      //       if (data.code === 0) {
      //         this.allDataList = data.list
      //         let pjmList = []
      //         // 遍历data.page.list
      //         data.list.forEach((item) => {
      //           if (!pjmList.includes(item.projectOwner.split('-')[0])) {
      //             pjmList.push(item.projectOwner.split('-')[0])
      //           }
      //         })
      //         if (pjmList.includes(this.$store.state.user.name)){
      //           this.warnFlag = true
      //           this.dataList = data.page.list
      //           this.pageIndex = data.page.currPage
      //           this.pageSize = data.page.pageSize
      //           this.totalPage = data.page.totalCount
      //           this.dataList.forEach((item) => {
      //             item.projectManagerName = item.projectManager.split('-')[1]
      //             item.projectOwnerName = item.projectOwner.split('-')[1]
      //             item.engineerName = item.engineer.split('-')[1]
      //             item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1]
      //             item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1]
      //             item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1]
      //             item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
      //           })
      //           for (let i = 0; i < this.dataList.length; i++) {
      //             if (this.dataList[i].responsibleDepartment === 'R001') {
      //               this.dataList[i].projectLeader = this.dataList[i].projectManager.split("-")[1]
      //             } else if (this.dataList[i].responsibleDepartment === 'R002') {
      //               this.dataList[i].projectLeader = this.dataList[i].projectOwner.split("-")[1]
      //             } else if (this.dataList[i].responsibleDepartment === 'R004') {
      //               this.dataList[i].projectLeader = this.dataList[i].engineer.split("-")[1]
      //             } else if (this.dataList[i].responsibleDepartment === 'R005') {
      //               this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer1.split("-")[1]
      //             } else if (this.dataList[i].responsibleDepartment === 'R007') {
      //               this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer2.split("-")[1]
      //             } else if (this.dataList[i].responsibleDepartment === 'R008') {
      //               this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer3.split("-")[1]
      //             } else if (this.dataList[i].responsibleDepartment === 'R009') {
      //               this.dataList[i].projectLeader = this.dataList[i].cManufactureEngineer.split("-")[1]
      //             }
      //           }
      //         } else {
      //           this.$route.query.flag = '1'
      //         }
      //       }
      //     })
      // }
    },

    queryAllProofing(params) {
      this.selectTypeFlag = params
      this.searchData.limit = this.pageSize
      this.searchData.page = this.pageIndex
      if (params !== null && params !== undefined) {
        params.limit = this.pageSize
        params.page = this.pageIndex
        params.site = this.$store.state.user.site
        params.userName = this.$store.state.user.name
      } else {
        params = this.searchData
      }
      queryAllProofing(params).then(({data}) => {
        if (data.code === 0) {
          this.dataList = data.page.list;
          this.pageIndex = data.page.currPage;
          this.pageSize = data.page.pageSize;
          this.totalPage = data.page.totalCount;

          this.dataList.forEach((item) => {
            item.projectManagerName = item.projectManager.split('-')[1];
            item.projectOwnerName = item.projectOwner.split('-')[1];
            item.engineerName = item.engineer.split('-')[1];
            item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1];
            item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1];
            item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1];
            item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1];
            if (item.cQualityEngineer4 !== null && item.cQualityEngineer4 !== '') {
              item.cQualityEngineer4Name = item.cQualityEngineer4.split('-')[1];
            }
            if (item.cQualityEngineer5 !== null && item.cQualityEngineer5 !== '') {
              item.cQualityEngineer5Name = item.cQualityEngineer5.split('-')[1];
            }
            if (item.cQualityEngineer6 !== null && item.cQualityEngineer6 !== '') {
              item.cQualityEngineer6Name = item.cQualityEngineer6.split('-')[1];
            }
            if (item.docEngineer !== null && item.docEngineer !== '') {
              item.docEngineerName = item.docEngineer.split('-')[1];
            }
            if (item.ipqcHardTag !== null && item.ipqcHardTag !== '') {
              item.ipqcHardTagName = item.ipqcHardTag.split('-')[1];
            }
            if (item.cQualityEngineer7 !== null && item.cQualityEngineer7 !== '') {
              item.cQualityEngineer7Name = item.cQualityEngineer7.split('-')[1];
            }
          });

          for (let i = 0; i < this.dataList.length; i++) {
            if (this.dataList[i].responsibleDepartment === 'R001') {
              this.dataList[i].projectLeader = this.dataList[i].projectManager.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R002') {
              this.dataList[i].projectLeader = this.dataList[i].projectOwner.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R004') {
              this.dataList[i].projectLeader = this.dataList[i].engineer.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R005') {
              this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer1.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R007') {
              this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer2.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R008') {
              this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer3.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R009') {
              this.dataList[i].projectLeader = this.dataList[i].cManufactureEngineer.split("-")[1];
            } else if (this.dataList[i].responsibleDepartment === 'R011') {
              if (this.dataList[i].cQualityEngineer4 !== null && this.dataList[i].cQualityEngineer4 !== '') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer4.split("-")[1];
              }
            } else if (this.dataList[i].responsibleDepartment === 'R012') {
              if (this.dataList[i].docEngineer !== null && this.dataList[i].docEngineer !== '') {
                this.dataList[i].projectLeader = this.dataList[i].docEngineer.split("-")[1];
              }
            } else if (this.dataList[i].responsibleDepartment === 'R013') {
              if (this.dataList[i].cQualityEngineer5 !== null && this.dataList[i].cQualityEngineer5 !== '') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer5.split("-")[1];
              }
            } else if (this.dataList[i].responsibleDepartment === 'R014') {
              if (this.dataList[i].cQualityEngineer6 !== null && this.dataList[i].cQualityEngineer6 !== '') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer6.split("-")[1];
              }
            } else if (this.dataList[i].responsibleDepartment === 'R015') {
              if (this.dataList[i].ipqcHardTag !== null && this.dataList[i].ipqcHardTag !== '') {
                this.dataList[i].projectLeader = this.dataList[i].ipqcHardTag.split("-")[1];
              }
            } else if (this.dataList[i].responsibleDepartment === 'R016') {
              if (this.dataList[i].cQualityEngineer7 !== null && this.dataList[i].cQualityEngineer7 !== '') {
                this.dataList[i].projectLeader = this.dataList[i].cQualityEngineer7.split("-")[1];
              }
            }
          }

          this.getAllPersonnelList();

        } else {
          this.$alert(data.msg, '提示', {
            confirmButtonText: '确定',
            callback: action => {
            }
          });
        }
      })
    },

    getAllPersonnelList() {

      let allPersonnelInfoDataList = JSON.parse(JSON.stringify(this.allPersonnelInfoList))

      // 找出所有的同时过滤出唯一的 project owners, managers, and engineers
      const allPersonnelList = [];
      const projectOwnersMap = new Map();
      const projectManagersMap = new Map();
      const engineersMap = new Map();

      allPersonnelInfoDataList.forEach((item) => {
        // Handle project owners
        if (!projectOwnersMap.has(item.projectOwner)) {
          const projectOwnerId = projectOwnersMap.size + 1;  // Incrementing by +1
          projectOwnersMap.set(item.projectOwner, {
            projectOwnerId,
            projectOwner: item.projectOwner,
            projectOwnerName: item.projectOwner.split('-')[1]
          });
          allPersonnelList.push(projectOwnersMap.get(item.projectOwner));
        }

        // Handle project managers
        if (!projectManagersMap.has(item.projectManager)) {
          const projectManagerId = projectManagersMap.size + 1;
          projectManagersMap.set(item.projectManager, {
            projectManagerId,
            projectManager: item.projectManager,
            projectManagerName: item.projectManager.split('-')[1]
          });
          allPersonnelList.push(projectManagersMap.get(item.projectManager));
        }

        // Handle engineers
        if (!engineersMap.has(item.engineer)) {
          const engineerId = engineersMap.size + 1;
          engineersMap.set(item.engineer, {
            engineerId,
            engineer: item.engineer,
            engineerName: item.engineer.split('-')[1]
          });
          allPersonnelList.push(engineersMap.get(item.engineer));
        }
      });

      this.allPersonnelInfoList = allPersonnelList;
    },
    warnSendMail(row) {
      this.$confirm('确认发送提醒?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        warnSendMailHandle(row).then(({data}) => {
          if (data && data.code === 0) {
            this.$message({
              message: '发送成功',
              type: 'success'
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消发送'
        });
      });
    },

    // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val
      this.pageIndex = 1
      if (this.selectTypeFlag !== null && this.selectTypeFlag !== undefined) {
        this.queryAllProofing(this.selectTypeFlag)
      } else {
        this.getDataList()
      }
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val
      if (this.selectTypeFlag !== null && this.selectTypeFlag !== undefined) {
        this.queryAllProofing(this.selectTypeFlag)
      } else {
        this.getDataList()
      }
    },

    projectAllProofClickRow (row) {
      this.projectAllProofCurrentRow = JSON.parse(JSON.stringify(row))
    },

    toMes (row) {
      this.$router.push({ path: 'eam-eamProjectPartInfo', query: { projectNo: row.projectNo , testPartNo:row.testPartNo}})
    },

    /**
     * 上传文件
     */
    uploadFile (row) {
      this.isEditable = false;
      this.fileList = []
      if (row.documentId === null || row.documentId === undefined || row.documentId === '') {
        this.projectAllProofClickRow.proofingId= -1
        this.projectAllProofClickRow.proofingNo = '*'
        this.isMassProductionStage = true
        this.folder = 'projectPMPDocumentFiles'
      } else {
        this.isMassProductionStage = false
        this.folder = 'projectPPDocumentFiles'
      }
      this.getProofDocument(row)
      this.uploadDialog = true
      //打开组件 去做新增业务
      // this.$nextTick(() => {
      //   this.$refs.partUploadFile.init(currentData);
      // })
    },

    getProofDocument (row) {
      let tempData = {
        site: this.$store.state.user.site,
        buNo: row.buNo,
        projectId: row.projectId,
        projectPartId: row.projectPartId,
        proofingId: row.proofingId,
        userId: this.$store.state.user.id,
        languageCode: this.$i18n.locale
      }
      getProofDocument(tempData).then(({data}) => {
        if (data && data.code === 0) {
          this.projectPartDocumentList = data.page.list
          for (let i = 0; i < this.projectPartDocumentList.length; i++) {
            this.projectPartDocumentList[i].buNo = this.tempData.buNo
          }
        }
      })
    },

    formatDate(row, column) {
      // row 是当前行的数据对象
      // column 是当前列的属性信息对象
      const date = row[column.property];
      if (date) {
        const s = new Date(date).toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' });
        return s.replace(/\//g, '-')
      } else {
        return '';
      }
    },
    rowStyle ({row}) {
    },
    getCombinedDocumentType(row) {
      // 根据您的需求，组合或拼接需要显示的字段
      if (row.documentType === null || row.documentType === undefined) {
        return row.documentDesc
      }else {
        return row.documentType
      }
    },
    // 校验用户是否收藏
    favoriteIsOk () {
      let userFavorite = {
        userId: this.$store.state.user.id,
        languageCode: this.$i18n.locale
      }
      userFavoriteList(userFavorite).then(({data}) => {
        for (let i = 0; i < data.list.length; i++) {
          if (this.$route.meta.menuId === data.list[i].menuId) {
            this.favorite = true
          }
        }
      })
    },

    // 收藏 OR 取消收藏
    favoriteFunction () {
      let userFavorite = {
        userId: this.$store.state.user.id,
        functionId: this.$route.meta.menuId,
      }
      if (this.favorite) {
        removeUserFavorite(userFavorite).then(({data}) => {
          this.$message.success(data.msg)
          this.favorite = false
        })
      } else {
        // 收藏
        saveUserFavorite(userFavorite).then(({data}) => {
          this.$message.success(data.msg)
          this.favorite = true
        })
      }
    },

    // 动态列开始 获取 用户保存的 格式列
    async getTableUserColumn(tableId, columnId) {
      let queryTableUser = {
        userId: this.$store.state.user.name,
        functionId: this.$route.meta.menuId,
        tableId: tableId,
        status: true,
        languageCode: this.$i18n.locale
      }
      await getTableUserListLanguage(queryTableUser).then(({data}) => {
        if (data.rows.length > 0) {
          //this.columnList1 = []
          switch (columnId) {
            case 1:
              this.columnProjectAllProofList = data.rows
              break;
            // case 2:
            //   this.detailColumnList = data.rows
            //   break;
            // case 3:
            //   this.columnList2 = data.rows
            //   break;
            // case 4:
            //   this.columnList3 = data.rows
            //   break;
          }
        } else {
          this.getColumnList(tableId, columnId)
        }
      })
    },

    // 获取 tableDefault 列
    async getColumnList (tableId, columnId) {
      let queryTable= {
        functionId: this.$route.meta.menuId,
        tableId: tableId,
        languageCode: this.$i18n.locale
      }
      await getTableDefaultListLanguage(queryTable).then(({data}) => {
        if (!data.rows.length == 0) {
          switch (columnId) {
            case 1:
              this.columnProjectAllProofList = data.rows
              break;
            // case 2:
            //   this.detailColumnList = data.rows
            //   break;
            // case 3:
            //   this.columnList2 = data.rows
            //   break;
            // case 4:
            //   this.columnList3 = data.rows
            //   break;
          }
        } else {
          // this.showDefault = true.
        }
      })
    },
    //获取按钮的权限数据
    getButtonAuthData () {
      let searchFlag = this.isAuth(this.menuId+":search")
      let saveFlag = this.isAuth(this.menuId+":save")
      let updateFlag = this.isAuth(this.menuId+":update")
      let deleteFlag = this.isAuth(this.menuId+":delete")
      //处理页面的权限数据
      this.authSearch = !searchFlag
      this.authSave = !saveFlag
      this.authUpdate = !updateFlag
      this.authDelete = !deleteFlag
    },
  },
};
</script>

<style scoped>
.card-item {
  cursor: pointer;
  margin-bottom: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
  overflow: hidden;
  //padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 208px;
  width: 230px;
  margin-left: 40px;
  margin-top: 10px;
}

.card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  margin-top: 20px;
}

.card-count {
  font-size: 55px;
  color: #17B3A3;
  text-align: center;
  font-weight: bold;
  margin-top: 50px;
}

.project-list {
  font-size: 12px;
  color: #333;
  line-height: 1.5;
  margin-bottom: 5px;
}

.el-divider {
  margin: 10px 0;
}
</style>

<style lang="scss" scoped>
.el-table /deep/ .cell{
  height: auto;
  line-height: 1.5;
}
</style>
```
